API Error: Missing timestamp in Get Wallet Transaction History API

I was expecting the return value of field blockTimestamp in triggered ERC20 transaction field named erc20_transfer of each transaction return but the data return nothing.
I have checked the sample data return on the API doc page has this value but I cannot retrieve it
Should that value important, i assume that triggered transactions should not be too far from the original transaction

Hi @DoanPhu, you should normally get a value in the blockTimestamp field, can you please share an example of missing data? (including the request URL with params)

i do get the blockTimestamp in the outer transaction, but blockTimestamp inside native_transfers field below is missing

Here is the code i run:

import Moralis from 'moralis';
const moralisAPI = getRandomMoralisAPI();
Moralis.start({
  apiKey: moralisAPI,
});

async function fetchWalletTransactionHistory(
  address: string,
  chainID: string,
) {
  const params = {
    address: '0xD1C24f50d05946B3FABeFBAe3cd0A7e9938C63F2',
    chain: '0x1',
    include_internal_transactions: false,
    nft_metadata: true,
    order: "ASC" as "ASC" | "DESC" | undefined,
  }
  const pageResult = await Moralis.EvmApi.wallets.getWalletHistory(params);
  return pageResult
}

Here is the first result from the code

{
    "cursor": null,
    "page_size": 94,
    "limit": "100",
    "result": [
        {
            "hash": "0xca8891ce2a6397cdf3479f4306c93556188ae859b9c201b89a38f52660bbd18f",
            "nonce": "0",
            "transaction_index": "131",
            "from_address_entity": null,
            "from_address_entity_logo": null,
            "from_address": "0xf82dce9bb688d15095e4072271bf3161876cba47",
            "from_address_label": null,
            "to_address_entity": null,
            "to_address_entity_logo": null,
            "to_address": "0xd1c24f50d05946b3fabefbae3cd0a7e9938c63f2",
            "to_address_label": null,
            "value": "1000000000000",
            "gas": "21000",
            "gas_price": "8000000000",
            "receipt_cumulative_gas_used": "6626632",
            "receipt_gas_used": "21000",
            "receipt_contract_address": null,
            "receipt_status": "1",
            "block_timestamp": "2018-11-02T05:01:04.000Z",
            "block_number": "6627774",
            "block_hash": "0x3e24fe4617af8037a03fefe8243a32e494bbbd30913523c41456d793ce7e62d8",
            "transaction_fee": "0.000168",
            "method_label": null,
            "nft_transfers": [],
            "erc20_transfers": [],
            "native_transfers": [
                {
                    "from_address_entity": null,
                    "from_address_entity_logo": null,
                    "from_address": "0xf82dce9bb688d15095e4072271bf3161876cba47",
                    "from_address_label": null,
                    "to_address_entity": null,
                    "to_address_entity_logo": null,
                    "to_address": "0xd1c24f50d05946b3fabefbae3cd0a7e9938c63f2",
                    "to_address_label": null,
                    "value": "1000000000000",
                    "value_formatted": "0.000001",
                    "direction": "receive",
                    "internal_transaction": false,
                    "token_symbol": "ETH",
                    "token_logo": "https://cdn.moralis.io/eth/0x.png"
                }
            ],
            "summary": "Received 0.000001 ETH from 0xf8...ba47",
            "possible_spam": false,
            "category": "receive"
        },
}

The blockTimestamp returned on the main transaction details is the timestamp of the transaction, which includes the native transfer (can also be another event such as swap, approval etcโ€ฆ) that occurred in that specific transaction. Therefore the same block timestamp applies to the native transfer in this case

2 Likes

Wow thanks for the explanation, should i expect triggered erc20 and nft transfer timestamp should be the same as main transaction block timestamp?
Otherwise, can you give me an example where triggered transaction timestamp doesnโ€™t match with the original one?

All the transactions on a same block number will always have the same block timestamp. Timestamp varies between blocks