Marketplace has launched, further enabling blockchain developers! Learn more

Contents

qn_getTransfersByNFT RPC method

Currently supports ERC-721 compliant contracts (on Ethereum mainnet).

Headers:

  1. x-qn-api-version — (Integer - optional) Provide an optional request header specifying the QuickNode API version you're targeting. Using this header is recommended as it will become mandatory (required) in the future. Current API version is 1.

Parameters:

  1. Object — Custom Object with the following fields:

    collection — (String) The contract address of the NFT Collection.

    collectionTokenId — (String) The Token ID of this NFT under this collection.

    page — (Integer - optional) The page number you would like returned. Page numbers start at 1 and end at "totalPages". If omitted, defaults to the first page (page 1). If the page number requested is higher than "totalPages", an empty transfers array will be returned. If the page number requested is less than 1, an invalid params response will be returned.

    perPage — (Integer - optional) The maximum amount of NFT tokens to return on each page. You can request up to 100 items per page. If omitted, defaults to 40 items per page.

Returns:

  1. Object — Custom Response Object, or null if no NFTs are found:

    collection — The contract address we checked for NFTs.

    transfers — An array of transfers representing NFTs with the following shape:

    blockNumber — The block number this transaction was included in.

    date — The date when this transaction was mined.

    from — The address for the sender of this transaction.

    to — The address for the receiver of this transaction.

    txHash — The token transfer transaction hash.

    totalItems — The total number of results.

    totalPages — The total number of results pages available.

    pageNumber — The page number of results that was returned with this response.

Code Examples:

# The eth.rb library does not support including additional request headers, so you won't be able to add the x-qn-api-version header.

require 'eth'

client = Eth::Client.create 'http://sample-endpoint-name.network.quiknode.pro/token-goes-here/'

payload = {
    "id":67,
    "jsonrpc":"2.0",
    "method":"qn_getTransfersByNFT",
    "params":{
      "collection": "0x60E4d786628Fea6478F785A6d7e704777c86a7c6",
      "collectionTokenId": "1",
      "page": 1,
      "perPage": 10
    }
 }

response = client.send(payload.to_json)
puts response
Ready to get started? Create a free account