For Feria Nounish Artists: This documentation is inspired by Gabriel Lago from Cali, Colombia, who is building a Feria Nounish MiniApp for the artists participating in this year’s fair. The clientUploadToArweave function enables artists to upload their artwork and metadata to decentralized storage, creating permanent, onchain records of their contributions to the collective timeline.
Upload files to Arweave decentralized storage for use in your NFT collections and moments. This function is perfect for artists participating in events like Feria Nounish who need to store metadata and assets onchain.
Note: This function uploads files to Arweave and returns a URI that can be used in collection creation or moment creation.
Installation
First, install the required Arweave package:Function Implementation
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| file | File | Yes | The file to upload to Arweave |
| getProgress | (progress: number) => void | No | Optional callback function to track upload progress (0-100) |
Return Value
Returns a Promise that resolves to a string containing the Arweave URI in the format:ar://{transaction_id}
Environment Setup
You’ll need to set up your Arweave wallet key as an environment variable:Usage Examples
Basic Upload
Upload with Progress Tracking
Upload for Collection Metadata
Upload for Moment Content
React Hook Example
For React applications, here’s a custom hook for file uploads:File Types Supported
The function supports any file type that can be stored on Arweave:- Images: PNG, JPEG, GIF, SVG, WebP
- Documents: PDF, TXT, MD
- Data: JSON, CSV, XML
- Media: MP4, MP3, WebM
- Archives: ZIP, TAR
Best Practices
- File Size: Arweave has no strict size limits, but larger files take longer to upload and cost more AR tokens.
- Content-Type Tagging: The function automatically tags files with their MIME type for proper handling.
- Progress Tracking: Always implement progress tracking for better user experience, especially for larger files.
- Error Handling: Wrap upload calls in try-catch blocks to handle network issues or insufficient AR tokens.
- Metadata Structure: When uploading JSON metadata, follow standard NFT metadata schemas for compatibility with marketplaces.
Integration with Collection Creation
After uploading your metadata to Arweave, use the returned URI in your collection creation:Error Handling
Common errors and solutions:- Insufficient AR tokens: Ensure your Arweave wallet has enough AR tokens for the upload
- Invalid wallet key: Verify your
NEXT_PUBLIC_ARWEAVE_KEYis correctly base64 encoded - Network timeout: Increase the timeout value in the Arweave configuration
- File too large: Consider compressing or optimizing your files before upload
Next Steps
After uploading files to Arweave:- Create a collection using your uploaded metadata URI
- Create moments with your uploaded content
- Browse the timeline to see your contributions

