Skip to content

Commit

Permalink
fix parsing history error in BNB
Browse files Browse the repository at this point in the history
  • Loading branch information
koko37 committed Dec 3, 2024
1 parent 4a9cf50 commit 804a718
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/contexts/Store.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,10 @@ const StoreProvider = ({ children }) => {
return;
}
account
.queryTokenHistory(token.native ? "" : selectedTokenAddress)
.queryTokenHistory(
token.native ? "" : selectedTokenAddress,
token.decimals
)
.then((result) => {
setTransfers(result);
});
Expand Down
7 changes: 5 additions & 2 deletions src/lib/account/evm.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class EvmAccount {
*/
}

async queryTokenHistory(tokenAddress, maxCount = 5) {
async queryTokenHistory(tokenAddress, decimals, maxCount = 5) {
const { transfers: rxTransfers } =
await this.alchemyClient.core.getAssetTransfers({
category: [tokenAddress ? "erc20" : "external"],
Expand Down Expand Up @@ -186,11 +186,14 @@ class EvmAccount {
hash,
blockNum,
metadata: { blockTimestamp },
rawContract,
}) => ({
hash,
from,
to,
value,
value:
value ||
parseFloat(ethers.formatUnits(rawContract.value, decimals)),
blockNum,
blockTimestamp,
})
Expand Down

0 comments on commit 804a718

Please sign in to comment.