Skip to content

Commit

Permalink
Perform lower case comparision for native currency (#1493)
Browse files Browse the repository at this point in the history
Ignores the checksummed state of the provided addresses – one address is provided by a 3rd party, and we should be able to correctly perform this comparison regardless of the representation of the respective address.
  • Loading branch information
fmrsabino authored Apr 30, 2024
1 parent d06fbdd commit 93f6a75
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/routes/transactions/helpers/swap-order.helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,12 @@ export class SwapOrderHelper {
chainId: string;
address: `0x${string}`;
}): Promise<Token> {
if (args.address === SwapOrderHelper.NATIVE_CURRENCY_ADDRESS) {
// We perform lower case comparison because the provided address (3rd party service)
// might not be checksummed.
if (
args.address.toLowerCase() ===
SwapOrderHelper.NATIVE_CURRENCY_ADDRESS.toLowerCase()
) {
const { nativeCurrency } = await this.chainsRepository.getChain(
args.chainId,
);
Expand Down

0 comments on commit 93f6a75

Please sign in to comment.