typescript-sdk

Home > @3rdweb/sdk > uploadToIPFS

uploadToIPFS() function

A helper function to upload arbitrary data to IPFS and return the resulting IPFS uri.

Signature:

export declare function uploadToIPFS(data: string | File | FileOrBuffer, contractAddress?: string, signerAddress?: string): Promise<string>;

Parameters

Parameter Type Description
data string | File | FileOrBuffer stringified JSON || File
contractAddress string (Optional) the contract address to associate the data with
signerAddress string (Optional) the wallet address of the actor that is uploading the file

Returns:

Promise<string>

The ipfs://<hash> uri of the uploaded file