Time Delay in Token Balance query

Iโ€™m trying to use moralis API to get the token balance for a specific bsc token in a specific wallet and it is working but it seems like there is at least a 30 second+ time delay between the completed transaction and when Moralis reports the updated balance. Is this delay normal? What is the normal time delay? and is there any way to make it faster?

It gets updated as soon as the transaction is processed.
On which chain are you testing?

1 Like

If you are only looking for a balance of one particular token, you can read the balacne using the smart contract call.

1 Like

there is a delay until the transaction is considered as confirmed

1 Like

Thatโ€™s brilliant , I was thinking something like that would be ideal. Whatโ€™s that called with moralis?

I was noticing a delay beyond when the transaction was confirmed on bscscan

BInance smart chain , only one token balance

You can do it using runcontractfunction

You need to use abi of balanceOf function from contract and pass the required parameters.

1 Like

Would I be able to get the success code of a transaction with getContractEvents ? If so would i use the Transaction hash for the address and what should i put for the topic of the event? My goal is to verify that a transaction has successfully bought or sold a token, so i was initially trying to verfiy this by seeing if any of that token was in the given wallet, but seeing the success code of the transaction seems like it could also work.
Screen Shot 2022-09-06 at 9.12.15 PM

Since the event is emitted only after the successful transaction you can use it to verify the transaction.

You can find the event topic from the etherscan.