AptosAptos Network's breakthrough technology and seamless user experience are now available on QuickNode.
Start building today!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.
Parameters:
symbol - string - The ERC-20 token symbol you'd like to get details for
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 tokens 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 tokens to return on each page. You can request up to 100 items per page. If omitted, defaults to 40 items per page
Returns:
pageNumber - The page number of results that was returned with this response
totalPages - The total number of results pages available
totalItems - The total number of tokens matching the supplied symbol
tokens - An array of objects representing tokens matching the supplied symbol
name - The name of this token
symbol - The symbol of this token
address - The contract address of this token
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:
const ethers = require("ethers"); (async () => { const provider = new ethers.providers.JsonRpcProvider("http://sample-endpoint-name.network.quiknode.pro/token-goes-here/"); provider.connection.headers = { "x-qn-api-version": 1 }; const heads = await provider.send("qn_getTokenMetadataBySymbol", { symbol: "USDC", }); console.log(heads); })();
require "uri" require "json" require "net/http" url = URI("http://sample-endpoint-name.network.quiknode.pro/token-goes-here/") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true request = Net::HTTP::Post.new(url) request["Content-Type"] = "application/json" request["x-qn-api-version"] = "1" request.body = JSON.dump({ "id": 67, "jsonrpc": "2.0", "method": "qn_getTokenMetadataBySymbol", "params": { "symbol": "USDC" } }) response = https.request(request) puts response.read_body
curl http://sample-endpoint-name.network.quiknode.pro/token-goes-here/ \ -X POST \ -H "Content-Type: application/json" \ -H "x-qn-api-version: 1" \ --data '{ "id":67, "jsonrpc":"2.0", "method":"qn_getTokenMetadataBySymbol", "params":{ "symbol": "USDC" } }'
from web3 import Web3, HTTPProvider OPTIONS = { 'headers': { 'x-qn-api-version': '1' } } w3 = Web3(HTTPProvider('http://sample-endpoint-name.network.quiknode.pro/token-goes-here/', request_kwargs=OPTIONS)) resp = w3.provider.make_request('qn_getTokenMetadataBySymbol', { "symbol": "USDC" }) print(resp)
var myHeaders = new Headers(); myHeaders.append("Content-Type", "application/json"); myHeaders.append("x-qn-api-version", "1"); var raw = JSON.stringify({ "id": 67, "jsonrpc": "2.0", "method": "qn_getTokenMetadataBySymbol", "params": { "symbol": "USDC" } }); var requestOptions = { method: 'POST', headers: myHeaders, body: raw, redirect: 'follow' }; fetch("http://sample-endpoint-name.network.quiknode.pro/token-goes-here/", requestOptions) .then(response => response.text()) .then(result => console.log(result)) .catch(error => console.log('error', error));
# 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_getTokenMetadataBySymbol", "params":{ "symbol": "USDC" } } response = client.send(payload.to_json) puts response
import requests import json url = "http://sample-endpoint-name.network.quiknode.pro/token-goes-here/" payload = json.dumps({ "id": 67, "jsonrpc": "2.0", "method": "qn_getTokenMetadataBySymbol", "params": { "symbol": "USDC" } }) headers = { 'Content-Type': 'application/json', 'x-qn-api-version': '1' } response = requests.request("POST", url, headers=headers, data=payload) print(response.text)