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

Contents

qn_getTokenMetadataByContractAddress 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:

    contract — (String) The ERC-20 contract address you'd like to get token details for.

Returns:

  1. Object — Custom Response Object, or null if no Token details found:

    name — The name of this token.

    symbol — The symbol for this token.

    address — The contract address we checked.

    decimals — The number of decimals this token utilizes.

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

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

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_getTokenMetadataByContractAddress",
     "params":{
       "contract": "0x4d224452801ACEd8B2F0aebE155379bb5D594381"
     }
  }

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