Upload to decentrized storage

@solana-suite/storage

We upload content to decentralized file storage systems such as Arweave and nft.storage.

example

Full example code

upload content file(e.g: image, movie,,,)

nst.storage

import { Storage } from "@solana-suite/storage";

await Storage.uploadFile(
    "file path",  // upload content file path in local path  
    "nftStorage"  // set storage type
);

Arweave

import { Storage } from "@solana-suite/storage";

await Storage.uploadFile(
    "./animals.jpeg",                     // upload content file path in local path  
    "arweave",                            // set storage type
    {feePayer: "HTpCqDfm7NwxKrwaQww..."}  // fee payer,s secret
);

upload nft metadata(json)

nft.storage

import { Storage } from "@solana-suite/storage";

const meta = {
    name: "Tiger",                    // NFT's name in offchain   
    symbol: "TIGER",                  // NFT's symbol in offchain 
    description: "tiger description", // optional field 
    image: "https://......",          // Uploaded image url 
};

const res = await Storage.uploadData(meta, "nftStorage");

arweave

import { Storage } from "@solana-suite/storage";

const meta = {
    name: "Tiger",    // NFT's name in offchain   
    symbol: "TIGER",  // NFT's symbol in offchain 
    description: "This nft is tiger content", // optional field 
    image: "https://......", // Uploaded image url 
};

const res = await Storage.uploadData(
    meta, 
    "arweave", 
    {feePayer: "HTpCqDfm7NwxKrwaQww..."} // fee payer,s secret 
);

Arweave is a paid service, so specifying the fee payer is always necessary.


Last updated