Skip to content

Commit 92c7c91

Browse files
committed
Refactor getTokenBalance to return bigint zero using 0n and optimize address comparison
1 parent 6840fc8 commit 92c7c91

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/gator-permissions-snap/src/clients/accountApiClient.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,12 +170,13 @@ export class AccountApiClient {
170170
logger.info(
171171
`No balance found for token ${tokenAddress} on account ${account}`,
172172
);
173-
return BigInt(0);
173+
return 0n;
174174
}
175175

176176
// Find the token in the balances array
177+
const tokenAddressLowerCase = tokenAddress.toLowerCase();
177178
const tokenData = balances.find(
178-
(token) => token.address.toLowerCase() === tokenAddress.toLowerCase(),
179+
(token) => token.address.toLowerCase() === tokenAddressLowerCase,
179180
);
180181

181182
if (!tokenData) {

0 commit comments

Comments
 (0)