Register and show off your project at Ethereum QuickPitch and win $10,000. Apply now

Contents

qn_getWalletTokenTransactions RPC method

The API credit value for this method is 4 . To learn more about API credits and each method's value, visit the API Credits page.

Supports ERC-20 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:

    address — (String) The wallet address we want to check for transfers.

    contract — (String) The ERC-20 contract we want to check for transfers.

    fromBlock — (String - optional) First block number to check for transfers (inclusive). If omitted, will default to the genesis block for the provided token contract address.

    toBlock — (String - optional) Last block number to check for transfers (inclusive). If omitted, will default to the latest block.

    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 assets 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 transfers to return on each page. You can request up to 100 transfers per page. If omitted, defaults to 40 transfers per page.

Returns:

  1. Object — Custom Response Object containing token details and array of transfers, or an empty array if no transfers are found:

    token — An object containing information about the token with the following shape:

    address — The contract address of the token.

    decimals — The number of decimals this token supports.

    genesisBlock — The block number in which this contract was deployed.

    genesisTransaction — The hash of the transaction in which this contract was deployed.

    name — The name of this token.

    symbol — The symbol for this token.

    transfers — An array of objects representing token transfers with the following shape:

    amount — The raw amount of token transferred.

    blockNumber — The block number within which this transfer occurred.

    date - The date that this transfer occurred.

    from — The address for the sender of this transfer.

    logIndex — The log index of this transfer within the transaction in which it occurred.

    to — The address for the receiver of this transfer.

    txHash — The token transfer transaction hash.

    valueSent — The amount of Ethereum send within the underlying transaction.

    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_getWalletTokenTransactions",
    "params":{
      "address": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
      "contract": "0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE",
      "page": 1,
      "perPage": 10
    }
 }

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