omnia_getTokenPrice
Return the price of an ERC-20 token.
Parameters
DATA
, 20 Bytes - tokenAddress. ERC-20 token address for which the price is requested. REQUIREDDATA
, positive number - pricingDecimals. Number of decimals used for the returned price. Default value: 5. OPTIONAL
Returns
tokenAddress: address of the ERC-20 token
tokenSymbol: ERC-20 symbol as stored in the token smart contract
tokenDecimals: ERC-20 decimals as stored in the token smart contract
usdPrice: Positive number representing token price denominated in U.S. dollars. (0 if the price of the token cannot be determined)
Example
{
"id": 1,
"jsonrpc": "2.0",
"method": "omnia_getTokenPrice",
"params": [{
"tokenAddress": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"pricingDecimals": 5
}]
}
Response
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"tokenAddress": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"tokenSymbol": "WETH",
"tokenDecimals": 18,
"usdPrice": 2022.86554
}
}
Last updated