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.
- Log in to your Quicknode account and navigate to the endpoints page.
- Select the endpoint you would like to update.
- Select the add-ons tab
- Find the
Token and NFT API v2 bundle
add-on and selectExplore
. - 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 returnsprovenance
.- Transfer data can be fetched in a separate call to qn_getTransfersByNFT.
qn_fetchNFTs
no longer returnscurrentOwner
.qn_getWalletTokenBalance
no longer returnsowner
.qn_getWalletTokenBalance
no longer returnslogoURL
,chain
, andnetwork
for the objects returned in theassets
array.qn_getWalletTokenBalance
returnstotalBalance
instead ofamount
for the objects returned in theassets
array.qn_getWalletTokenTransactions
returnstotalBalance
instead ofamount
for the objects returned in thetransfers
array.qn_verifyNFTsOwner
parameters uses an object with named properties inside of an array instead of an array with positional properties.- Code examples can be found in the RPC API documentation.
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.