getTokenMetadata()

Gets the metadata for a token from the metadata URL configured. Uses getTokenMetadataUrl() under the hood.

Parameters

NameTypeRequiredDescription
tokenIdNumberYThe tokenId to fetch.

Response

{
    "name": "string",
    "image": "string | undefined",
    "attributes": "array | undefined",
    "description": "string | undefined",
    "external_url": "string | undefined",
    "animation_url": "string | undefined",
}

📘

IPFS urls are automatically converted from ipfs:// to https:// urls for ease of use.

Example Usage

const tokenId = 0;

const data = await contract.getTokenMetadata(tokenId);

Possible Errors

Errors in the connect() function

Feedback

Something not quite right, unclear or can't find what you are looking for? Please let us know at support.moonpay.com and we will get back to you as soon as we can.