Decent Documentation
  • Welcome to the DecentSDK
  • Core Modules
    • DCNTSDK
  • NFT Release & Utility Mechanisms
    • Edition
    • ZKEdition
    • Rentable
    • Crescendo
    • Vault
    • Staking
    • VaultBackedNFT
  • Marketplace Modules
    • RentalMarket
  • Infrastructure Modules
    • Registry
    • MetadataRenderer
    • IPFS
Powered by GitBook
On this page
  • Getting Started
  • Module Methods
  • getContract
  • Smart Contract Methods
  • bulkUpdate
  • tokenURITarget
  1. Infrastructure Modules

MetadataRenderer

PreviousRegistryNextIPFS

Last updated 2 years ago

A shared on-chain metadata renderer adhering to the which stores and renders metadata as base64 encoded URLs.

Getting Started

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);

Module Methods

Get an ethers contract instance of the MetadataRenderer contract.

getContract

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.

Smart Contract Methods

bulkUpdate

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.

tokenURITarget

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.

Initialized or updates the edition data for a specific target contract.

Returns the base64 encoded metadata for a specific target contract.

music metadata standard
Getting Started
Module Methods
Smart Contract Methods
getContract
bulkUpdate
tokenURITarget