Skip to content

Commit

Permalink
fix: catch error getting token symbol
Browse files Browse the repository at this point in the history
  • Loading branch information
genaroibc committed Oct 23, 2024
1 parent efd26a7 commit bc8a374
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/handlers/evm/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,17 @@ export class Utils {
throw new Error(`Insufficient funds for account: ${sender} on chain ${fromChain.chainId}`);
}

let tokenSymbol;

try {
tokenSymbol = await (fromTokenContract as Contract).symbol();
} catch (error) {
console.error("failed to get token symbol");
}

return {
isApproved: true,
message: `User has the expected balance ${amount} of ${await (
fromTokenContract as Contract
).symbol()}`,
message: `User has the expected balance ${amount} of ${tokenSymbol}`,
};
}

Expand Down

0 comments on commit bc8a374

Please sign in to comment.