Fetch and Transfer NFTs

You started creating wallets. Now it's time to build the frontend for your users to interact with them.

Visualizing the NFTs

The following API retrieves the NFTs stored in a wallet so you can display them in your frontend:

const fetch = require('node-fetch');

const url = 'https://staging.crossmint.com/api/v1-alpha1/wallets/chain:wallet/nfts?page=xx&perPage=xx';
const options = {
  method: 'GET',
  headers: {
    accept: 'application/json',
    'X-CLIENT-SECRET': '<YOUR_CLIENT_SECRET>',
    'X-PROJECT-ID': '<YOUR_PROJECT_ID>'
  }
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error('error:' + err));
ParameterTypeDescription
chainstringarbitrum, arbitrumnova, base, bsc, cardano ,ethereum, optimism, polygon, solana, and zora
walletAddressstringWallet address whose content you want to fetch
pageintPage index, starting with 1
perPage (optional)intNumber of items to display per page. Default: 20

Transferring NFTs

This API allows you to transfer an NFT from a wallet you control to any other wallet (whether it's powered by Crossmint or not), in a gas-less and seamless experience for your users. This API scope is open in staging but gated in production. Contact us to get access.

const fetch = require('node-fetch');

const url = 'https://staging.crossmint.com/api/v1-alpha1/transfer';
const options = {
  method: 'POST',
  headers: {
    accept: 'application/json',
    'content-type': 'application/json',
    'X-CLIENT-SECRET': '',
    'X-PROJECT-ID': ''
  },
   body: JSON.stringify({
    chain:'',
    tokenId:'',
    toAddress: '',
    tokenMintAddress: '',
    fromAddress: ''
  })

};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error('error:' + err));
ParameterTypeDescription
chainstringBlockchain of the NFT you want to transfer: [arbitrum, arbitrumnova, base, bsc, cardano ,ethereum, optimism, polygon, solana, and zora]
tokenIdstringThe identifier of the NFT
toAddressstringThe wallet address where you want to send the NFT
tokenMintAddressstringContract address
fromAddressstringThe wallet address for the current owner