A shared on-chain metadata renderer adhering to the music metadata standard which stores and renders metadata as base64 encoded URLs.
Getting Started
Module Methods
Smart Contract Methods
To begin we'll import the DecentSDK, chain configurations, and the MetadataRenderer module.
Then we'll setup our signer (via wagmi/ethers) and create a new instance of the DecentSDK.
// Import SDK, chain configurations, and the MetadataRenderer module
import { DecentSDK, chain, metadataRenderer } from "@decent.xyz/sdk";
// Get the signer via wagmi or configure using ethers
// Setup the SDK with the desired chain and signer
const sdk = new DecentSDK(chain.goerli, signer);
getContract
Get an ethers contract instance of the MetadataRenderer contract.
Get an ethers contract instance of the MetadataRenderer contract.
const renderer = await metadataRenderer.getContract(sdk);
sdk (SDK)
An instance of the DecentSDK, configured with a chain and signer.
bulkUpdate
Initialized or updates the edition data for a specific target contract.
tokenURITarget
Returns the base64 encoded metadata for a specific target contract.
Returns the balance of the ERC20 token held by the vault.
const renderer = await metadataRenderer.getContract(sdk);
await renderer.bulkUpdate(
target,
songMetadata,
projectMetadata,
tags,
credits
);
target (address)
The address of the NFT collection for which to initialize or update metadata.
_songMetadata (SongMetadata)
A struct containing the song metadata.
_projectMetadata (ProjectMetadata)
A struct containing the project metadata.
_tags (string[])
An array of tags.
_credits (Credit[])
An array of structs containing credits.
Returns the base64 encoded metadata for a specific target contract.
const renderer = await metadataRenderer.getContract(sdk);
const tokenId = 0;
const target = '0x1234567890123456789012345678901234567890';
const metadata = await renderer.tokenURITarget(tokenId, target);
tokenId (uint256)
The id of the token to retrieve metadata for.
target (address)
The address of the NFT collection to retrieve metadata for.