Skip to content

Commit

Permalink
Use constant for eth token symbol
Browse files Browse the repository at this point in the history
  • Loading branch information
imx-mikhala committed Jul 20, 2023
1 parent f9324c6 commit e6cb3e2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/checkout/widgets-lib/src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export const DEFAULT_TOKEN_DECIMALS = 18;
export const DEFAULT_TOKEN_FORMATTING_DECIMALS = 6;
export const DEFAULT_GT_ONE_TOKEN_FORMATTING_DECIMALS = 2;
export const IMX_TOKEN_SYMBOL = 'IMX';
export const ETH_TOKEN_SYMBOL = 'ETH';

/**
* Checkout Widget default env
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import {
import { fetchTokenSymbols } from '../../../lib/fetchTokenSymbols';
import { NotEnoughGas } from '../../../components/NotEnoughGas/NotEnoughGas';
import { isNativeToken } from '../../../lib/utils';
import { DEFAULT_TOKEN_DECIMALS } from '../../../lib';
import { DEFAULT_TOKEN_DECIMALS, ETH_TOKEN_SYMBOL } from '../../../lib';
import { orchestrationEvents } from '../../../lib/orchestrationEvents';

export function WalletBalances() {
Expand Down Expand Up @@ -100,7 +100,7 @@ export function WalletBalances() {
if (network.chainId !== getL1ChainId(checkout.config)) return;

const ethBalance = tokenBalances
.find((balance) => isNativeToken(balance.address) && balance.symbol === 'ETH');
.find((balance) => isNativeToken(balance.address) && balance.symbol === ETH_TOKEN_SYMBOL);
if (!ethBalance) return;

if (ethBalance.balance === '0.0') {
Expand Down

0 comments on commit e6cb3e2

Please sign in to comment.