getTokenTransfers returns incorrect address & add option to return token symbol when querying ERC20 transfers

When using the getTokenTransfers API in react-moralis, the “to_address” returned for a specific ERC20 tx is in all lowercase letters. For example,

import { useMoralisWeb3Api } from "react-moralis";
const { account } = useMoralisWeb3Api();

let result = await account
        .getTokenTransfers({ address: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", chain: "0x1", from_block: 0 })
        .then((result) => result.result);
console.log(result)

This returns:

[
  {
    "transaction_hash": "0x528c89a6c39353b0766a88992557bc069ffc5e76fabe8101693ef4d51f3ee511",
    "address": "0x6ba7b05a714f70d2d84373a7cd01a63706acd8b3",
    "block_timestamp": "2022-07-28T14:11:15.000Z",
    "block_number": "15231458",
    "block_hash": "0xeb69fb8c8995abb4cc0e7d250df7e96cc565e86689d2f6d3cced514524a1c6f1",
    "to_address": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
    "from_address": "0x3edf79a7116c278710f57b5d65868ddc1b05e961",
    "value": "14675989163770494325"
  }
]

Notice the “to_address” is 0xd8da6bf26964af9d7eed9e03e53415d37aa96045 where the correctly formatted version is actually 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045
The other suggestion I have is to return the token symbol in the getTokenTransfers API. Right now if you want to get the token being transferred in a ERC20 TX you queried, you have to make another API request with the contract address.

We return lowercase for now. All the formats are equivalent: lowercase, uppercase, the other format.

1 Like