'address/erc20/transfers' Web3 API response is token balance in GWei format?

Most of the API responses I got, the ‘value’ was in Wei but I noticed this one may be in ‘GWei’ style
Here is the CURL

curl -X 'GET' \
  'https://deep-index.moralis.io/api/v2/0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045/erc20/transfers?chain=eth&from_block=15184782&to_block=15184782' \
  -H 'accept: application/json' \
  -H 'X-API-Key: redacted'

and response is

{
  "total": 1,
  "page": 0,
  "page_size": 100,
  "cursor": null,
  "result": [
    {
      "transaction_hash": "0x09dc9a7aefcaf757769e3415ca943e5329e8f837f76b4ff91ba7c35b201c84c0",
      "address": "0x53fd2342b43ecd24aef1535bc3797f509616ce8c",
      "block_timestamp": "2022-07-21T08:11:14.000Z",
      "block_number": "15184782",
      "block_hash": "0xfcb7f648c0e685cf3c327142a9ccd63d12ebf07f0716a8eb49f9ffd4387228c1",
      "to_address": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
      "from_address": "0x925e26da09dc91c27ca4f7dcc6b91549ac19672c",
      "value": "666000000000"
    }
  ]
}

When you turn that value in “eth” style it is only 0.000000666 but on etherscan it shows as 666. I’m not sure if this is a Moralis problem or not. Here’s the link to the tx as shown on etherscan

Different contracts may use different decimals. For that transaction which is interacting with this contract, it’s using decimals of 9 meaning 666000000000 becomes 666, so this seems fine.

1 Like