How to get token uri?

  • getTokenUri

This function is used to get the uri of an NFT token by its ID.

import { L1XProvider, NFTTokenUriOfArg } from "@l1x/l1x-wallet-sdk";

let l1xProvider = new L1XProvider({
  clusterType: "mainnet",
  endpoint: "https://v2-mainnet-rpc.l1x.foundation",
});

let params: NFTTokenUriOfArg = {
    contract_address: "3ea1eed6d04b5453e25f1bf73b303d8a84fff121",
    token_id: 1
};

l1xProvider.tokens.NFT.getTokenUri(params)
  .then((response) => console.log(response)) // log response
  .catch((err) => console.error(err)); // log error

Parameters:

The attribute for getting the token uri.

{
    contract_address: "3ea1eed6d04b5453e25f1bf73b303d8a84fff121",
    token_id: 1
}

Returns:

The response contains the token uri.

{
    token_uri: "ipfs://sauydgahsbd/1.json"
}

Last updated