Skip to content

Commit

Permalink
non-existent token catch fetch balance error
Browse files Browse the repository at this point in the history
  • Loading branch information
kev1n-peters committed Jan 27, 2025
1 parent 17cf582 commit 63c1964
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion platforms/evm/src/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,14 @@ export class EvmPlatform<N extends Network>
rpc,
new EvmAddress(token).toString(),
);
return tokenImpl.balanceOf(walletAddr);
try {
return await tokenImpl.balanceOf(walletAddr);
} catch (e: any) {
if (e?.code === 'BAD_DATA') {
return null;
}
throw e;
}
}

static async getBalances(
Expand Down

0 comments on commit 63c1964

Please sign in to comment.