Skip to content

Commit

Permalink
Fix bug in balanceOf ERC-20
Browse files Browse the repository at this point in the history
  • Loading branch information
tuler committed Oct 19, 2023
1 parent 7c4fa53 commit 26efd8d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/fresh-zebras-worry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@deroll/wallet": patch
---

fix bug in balanceOf ERC-20
4 changes: 2 additions & 2 deletions packages/wallet/src/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ export class WalletAppImpl implements WalletApp {
}

// erc-20 balance
const erc20: Record<Address, bigint> = this.wallets[address] ?? {};
return erc20[tokenOrAddress as Address] ?? 0n;
const wallet = this.wallets[address] ?? { ether: 0n, erc20: {} };
return wallet.erc20[tokenOrAddress as Address] ?? 0n;
} else {
// if is address, normalize it
if (isAddress(tokenOrAddress)) {
Expand Down

0 comments on commit 26efd8d

Please sign in to comment.