Skip to main content

How to Migrate to the New Token and NFT RPC API V2 Bundle

Updated on
Nov 1, 2024

3 min read

Overview

We recently released v2 of our Token and NFT API add-ons. The upgrade gives you the same great, streamlined API with:

  • more accurate data,
  • support for more chains, and
  • faster indexing

In this guide, we will show you how to migrate from the default Token API and NFT Fetch Tool add-ons to the Token and NFT API v2 bundle marketplace add-on.

This guide assumes you have already interacted with the methods within our Token and NFT APIs and installed them on your QuickNode endpoint. If you are new to these APIs, check out our docs.

What We Will Do

  • Review the changes in the Token and NFT API v2 bundle
  • Add the Token and NFT API v2 bundle to an endpoint
  • Review the changes in the Token and NFT API v2 bundle

What You Will Need

  • A QuickNode account
  • An endpoint with the Token API and NFT Fetch Tool v1 default add-ons installed
  • A project using the Token API and NFT Fetch Tool v1 that will be migrated to the Token and NFT API v2 bundle

Add the Token and NFT API v2 Bundle

First, let's add the Token and NFT API v2 bundle add-on to an existing endpoint.

Note: this will override the methods from the Token API and NFT Fetch Tool v1 add-ons, so you may want to coordinate this step with the deployment of the code changes for production code.

  1. Log in to your Quicknode account and navigate to the endpoints page.
  2. Select the endpoint you would like to update.
  3. Select the add-ons tab
  4. Find the Token and NFT API v2 bundle add-on and select Explore.
  5. Select the Install button to add the add-on to your endpoint.

You will know that your update is successful if you go to your endpoint's add-on page (https://www.quicknode.com/endpoints/YOUR_ENDPOINT_ID/add_ons) you should see Token and NFT API v2 Bundle in the list of Installed Third-Party Add-Ons. Nice job.

Summary of Key Changes in V2

All v2 methods can be found in the QuickNode documentation in the sidebar for the associated chain. The v2 methods are suffixed with (v2). Update your code according to the following changes:

  • x-qn-api-version header is no longer needed or relevant. The v2 methods are used by default when the add-on is installed.
  • params are now an object wrapped in an Array. For example:
"params": [{
"contracts": [
"0x60E4d786628Fea6478F785A6d7e704777c86a7c6",
"0x7Bd29408f11D2bFC23c34f18275bBf23bB716Bc7"
]
}]
  • qn_fetchNFTs no longer returns provenance.
  • qn_fetchNFTs no longer returns currentOwner.
  • qn_getWalletTokenBalance no longer returns owner.
  • qn_getWalletTokenBalance no longer returns logoURL, chain, and network for the objects returned in the assets array.
  • qn_getWalletTokenBalance returns totalBalance instead of amount for the objects returned in the assets array.
  • qn_getWalletTokenTransactions returns totalBalance instead of amount for the objects returned in the transfers array.
  • qn_verifyNFTsOwner parameters uses an object with named properties inside of an array instead of an array with positional properties.

We're here to help

If you have any questions, please reach out to support or ask in the Quicknode Discord.

Wrap Up

Congratulations! You’ve learned how to migrate to the Token and NFT API v2 bundle. To learn more, check out some of our other tutorials here.

If you have any feedback on this guide, please let us know.

Share this guide