uploadMetadata
Upload a ERC-1155 Metadata to IPFS.
Usage
example.ts
import { mintclub } from 'mint.club-v2-sdk'
await mintclub.ipfs.uploadMetadata({
filebaseApiKey: 'YOUR API KEY',
image: 'ipfs://...',
name: 'My NFT',
description: 'My NFT description',
external_url: 'https://mint.club',
attributes: [{ trait_type: 'rarity', value: 'legendary' }],
video: 'ipfs://...'
})
Return Value
Promise<'ipfs://{string}'>
Returns a promise that resolves to a string containing the IPFS hash of the uploaded file.
Parameters
- Type:
MetadataUploadParams
type MetadataUploadParams = {
filebaseApiKey: string;
image: IpfsHashUrl | HttpUrl;
name: string;
description?: string;
external_url?: string;
attributes?: { trait_type: string; value: string }[];
video?: IpfsHashUrl | HttpUrl;
};
filebaseApiKey
- Type:
string
Filebase API key.
await mintclub.ipfs.uploadMetadata({
filebaseApiKey: 'YOUR API KEY',
image: 'ipfs://...',
name: 'My NFT',
description: 'My NFT description',
external_url: 'https://mint.club',
attributes: [{ trait_type: 'rarity', value: 'legendary' }],
video: 'ipfs://...'
})
image
- Type:
IpfsHashUrl
|HttpUrl
A url to the image file.
await mintclub.ipfs.uploadMetadata({
filebaseApiKey: 'YOUR API KEY',
image: 'ipfs://...',
name: 'My NFT',
description: 'My NFT description',
external_url: 'https://mint.club',
attributes: [{ trait_type: 'rarity', value: 'legendary' }],
video: 'ipfs://...'
})
name
- Type:
string
A collection name for the NFT.
await mintclub.ipfs.uploadMetadata({
filebaseApiKey: 'YOUR API KEY',
image: 'ipfs://...',
name: 'My NFT',
description: 'My NFT description',
external_url: 'https://mint.club',
attributes: [{ trait_type: 'rarity', value: 'legendary' }],
video: 'ipfs://...'
})
description
- Type:
string
A description for the NFT.
await mintclub.ipfs.uploadMetadata({
filebaseApiKey: 'YOUR API KEY',
image: 'ipfs://...',
name: 'My NFT',
description: 'My NFT description',
external_url: 'https://mint.club',
attributes: [{ trait_type: 'rarity', value: 'legendary' }],
video: 'ipfs://...'
})
external_url (optional)
- Type:
string
- Default:
https://mint.club
A external url for the NFT.
await mintclub.ipfs.uploadMetadata({
filebaseApiKey: 'YOUR API KEY',
image: 'ipfs://...',
name: 'My NFT',
description: 'My NFT description',
external_url: 'https://mint.club',
attributes: [{ trait_type: 'rarity', value: 'legendary' }],
video: 'ipfs://...'
})
attributes (optional)
- Type:
{ trait_type: string; value: string }[]
- Default:
[]
A external url for the NFT.
await mintclub.ipfs.uploadMetadata({
filebaseApiKey: 'YOUR API KEY',
image: 'ipfs://...',
name: 'My NFT',
description: 'My NFT description',
external_url: 'https://mint.club',
attributes: [{ trait_type: 'rarity', value: 'legendary' }],
video: 'ipfs://...'
})
video (optional)
- Type:
IpfsHashUrl
|HttpUrl
- Default:
undefined
A url to the video file if needed.
await mintclub.ipfs.uploadMetadata({
filebaseApiKey: 'YOUR API KEY',
image: 'ipfs://...',
name: 'My NFT',
description: 'My NFT description',
external_url: 'https://mint.club',
attributes: [{ trait_type: 'rarity', value: 'legendary' }],
video: 'ipfs://...'
})