Skip to content

Commit

Permalink
fix ts
Browse files Browse the repository at this point in the history
  • Loading branch information
jscriptcoder committed Jul 24, 2023
1 parent 31cafce commit 8bbf73d
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions packages/bridge-ui-v2/src/components/Bridge/Actions.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import { Button } from '$components/Button';
import { Icon } from '$components/Icon';
import { isERC20 } from '$libs/token';
import { account, network } from '$stores';
import {
Expand All @@ -17,6 +16,7 @@
selectedToken,
tokenBalance,
} from './state';
import { TokenType } from '$libs/token';
export let approve: () => Promise<void>;
export let bridge: () => Promise<void>;
Expand Down Expand Up @@ -48,7 +48,7 @@
$: canDoNothing = !hasAddress || !hasNetworks || !hasBalance || !$selectedToken || !$enteredAmount;
// Conditions for approve/bridge steps
$: isSelectedERC20 = $selectedToken && isERC20($selectedToken);
$: isSelectedERC20 = $selectedToken && $selectedToken.type === TokenType.ERC20;
$: isTokenApproved = isSelectedERC20 && $enteredAmount && !$insufficientAllowance;
// Conditions to disable/enable buttons
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { type Address, zeroAddress } from 'viem';

import { chainContractsMap } from '$libs/chain';
import { InsufficientAllowanceError, InsufficientBalanceError, RevertedWithFailedError } from '$libs/error';
import { getAddress, type Token,TokenType } from '$libs/token';
import { getAddress, type Token, TokenType } from '$libs/token';
import { isDeployedCrossChain } from '$libs/token/isDeployedCrossChain';
import { getConnectedWallet } from '$libs/util/getConnectedWallet';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Address } from 'viem';

import { chainContractsMap } from '$libs/chain';
import { type Token,TokenType } from '$libs/token';
import { type Token, TokenType } from '$libs/token';
import { getConnectedWallet } from '$libs/util/getConnectedWallet';
import { getLogger } from '$libs/util/logger';

Expand Down
4 changes: 2 additions & 2 deletions packages/bridge-ui-v2/src/libs/fee/recommendProcessingFee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { getPublicClient } from '@wagmi/core';
import { zeroAddress } from 'viem';

import { recommentProcessingFee } from '$config';
import { getAddress, isERC20, type Token } from '$libs/token';
import { getAddress, type Token,TokenType } from '$libs/token';

type RecommendProcessingFeeArgs = {
token: Token;
Expand All @@ -20,7 +20,7 @@ export async function recommendProcessingFee({ token, destChainId, srcChainId }:
// To make it enticing, we say 900k
let gasLimit = ethGasLimit;

if (isERC20(token)) {
if (token.type === TokenType.ERC20) {
if (!srcChainId) {
throw Error('missing required source chain for ERC20 token');
}
Expand Down
2 changes: 1 addition & 1 deletion packages/bridge-ui-v2/src/libs/token/getAddress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { NoTokenAddressError } from '$libs/error';
import { getLogger } from '$libs/util/logger';

import { getCrossChainAddress } from './getCrossChainAddress';
import { type Token,TokenType } from './types';
import { type Token, TokenType } from './types';

type GetAddressArgs = {
token: Token;
Expand Down
2 changes: 1 addition & 1 deletion packages/bridge-ui-v2/src/libs/token/getBalance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { type Address, zeroAddress } from 'viem';
import { getLogger } from '$libs/util/logger';

import { getAddress } from './getAddress';
import { type Token,TokenType } from './types';
import { type Token, TokenType } from './types';

type GetBalanceArgs = {
userAddress: Address;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { getContract } from '@wagmi/core';
import { tokenVaultABI } from '$abi';
import { chainContractsMap } from '$libs/chain';

import { type Token,TokenType } from './types';
import { type Token, TokenType } from './types';

type GetCrossChainAddressArgs = {
token: Token;
Expand Down

0 comments on commit 8bbf73d

Please sign in to comment.