Skip to content

Commit

Permalink
fix: Checkout types after DEX amount change (#1013)
Browse files Browse the repository at this point in the history
  • Loading branch information
keithbro-imx authored Oct 18, 2023
1 parent 581a0be commit f4b0610
Show file tree
Hide file tree
Showing 14 changed files with 116 additions and 83 deletions.
2 changes: 2 additions & 0 deletions packages/checkout/sdk/src/gasEstimate/gasEstimator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ describe('gasServiceEstimator', () => {
name: 'TEST',
decimals: 18,
chainId: 1,
type: 'erc20',
},
},
},
Expand Down Expand Up @@ -150,6 +151,7 @@ describe('gasServiceEstimator', () => {
name: 'TEST',
decimals: 18,
chainId: 1,
type: 'erc20',
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ describe('bridgeAndSwapRoute', () => {
},
],
} as Quote,
approval: undefined,
approval: null,
swap: null,
};
const dexQuoteETH: DexQuote = {
Expand Down Expand Up @@ -194,7 +194,7 @@ describe('bridgeAndSwapRoute', () => {
},
],
} as Quote,
approval: undefined,
approval: null,
swap: null,
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { BigNumber } from 'ethers';
import { TokenInfo as DexTokenInfo } from '@imtbl/dex-sdk';
import { ERC20 as DexTokenInfo } from '@imtbl/dex-sdk';
import { DexQuote } from '../types';
import {
ChainId,
Expand All @@ -26,7 +26,7 @@ describe('constructBridgeRequirements', () => {
approval?: number,
) => {
const dexQuote: DexQuote = {
approval: undefined,
approval: null,
swap: null,
quote: {
amount: {
Expand Down Expand Up @@ -75,6 +75,7 @@ describe('constructBridgeRequirements', () => {
decimals: 18,
symbol: 'ERC20',
name: 'ERC20',
type: 'erc20',
};

const swapTokenInfoB: DexTokenInfo = {
Expand All @@ -83,6 +84,7 @@ describe('constructBridgeRequirements', () => {
decimals: 18,
symbol: 'ERC20',
name: 'ERC20',
type: 'erc20',
};

const feesTokenInfo: DexTokenInfo = {
Expand All @@ -91,6 +93,7 @@ describe('constructBridgeRequirements', () => {
decimals: 18,
symbol: 'ERC20',
name: 'ERC20',
type: 'erc20',
};

const dexQuoteA = constructDexQuote(
Expand Down Expand Up @@ -195,6 +198,7 @@ describe('constructBridgeRequirements', () => {
decimals: 18,
symbol: 'ETH',
name: 'ETH',
type: 'erc20',
};

const feesTokenInfo: DexTokenInfo = {
Expand All @@ -203,6 +207,7 @@ describe('constructBridgeRequirements', () => {
decimals: 18,
symbol: 'IMX',
name: 'IMX',
type: 'erc20',
};

const ethDexQuote = constructDexQuote(
Expand Down Expand Up @@ -278,6 +283,7 @@ describe('constructBridgeRequirements', () => {
decimals: 18,
symbol: 'ERC20',
name: 'ERC20',
type: 'erc20',
};

const swapTokenInfoB: DexTokenInfo = {
Expand All @@ -286,6 +292,7 @@ describe('constructBridgeRequirements', () => {
decimals: 18,
symbol: 'ERC20',
name: 'ERC20',
type: 'erc20',
};

const feesTokenInfo: DexTokenInfo = {
Expand All @@ -294,6 +301,7 @@ describe('constructBridgeRequirements', () => {
decimals: 18,
symbol: 'ERC20',
name: 'ERC20',
type: 'erc20',
};

const dexQuoteA = constructDexQuote(
Expand Down Expand Up @@ -394,6 +402,7 @@ describe('constructBridgeRequirements', () => {
decimals: 18,
symbol: '0xIMX',
name: '0xIMX',
type: 'erc20',
};

const feesTokenInfo: DexTokenInfo = {
Expand All @@ -402,6 +411,7 @@ describe('constructBridgeRequirements', () => {
decimals: 18,
symbol: '0xIMX',
name: '0xIMX',
type: 'erc20',
};

const dexQuote = constructDexQuote(
Expand Down Expand Up @@ -487,6 +497,7 @@ describe('constructBridgeRequirements', () => {
decimals: 18,
symbol: '0xL2',
name: '0xL2',
type: 'erc20',
};

const feesTokenInfo: DexTokenInfo = {
Expand All @@ -495,6 +506,7 @@ describe('constructBridgeRequirements', () => {
decimals: 18,
symbol: '0xIMX',
name: '0xIMX',
type: 'erc20',
};

const dexQuote = constructDexQuote(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { BigNumber, utils } from 'ethers';
import { Environment } from '@imtbl/config';
import { JsonRpcProvider } from '@ethersproject/providers';
import { TokenInfo } from '@imtbl/dex-sdk';
import { ERC20 } from '@imtbl/dex-sdk';
import {
getBridgeAndSwapFundingSteps,
getSwapFundingSteps,
Expand Down Expand Up @@ -67,11 +67,11 @@ describe('routingCalculator', () => {
symbol: 'ERC20_2',
decimals: 18,
address: '0xERC20_2',
} as TokenInfo,
} as ERC20,
},
amountWithMaxSlippage: {
value: BigNumber.from(1),
token: {} as TokenInfo,
token: {} as ERC20,
},
slippage: 0,
fees: [
Expand All @@ -84,7 +84,7 @@ describe('routingCalculator', () => {
symbol: 'IMX',
decimals: 18,
address: IMX_ADDRESS_ZKEVM,
} as TokenInfo,
} as ERC20,
},
recipient: '',
basisPoints: 0,
Expand All @@ -99,11 +99,11 @@ describe('routingCalculator', () => {
symbol: 'IMX',
decimals: 18,
address: IMX_ADDRESS_ZKEVM,
} as TokenInfo,
} as ERC20,
},
swap: {
value: BigNumber.from(1),
token: {} as TokenInfo,
token: {} as ERC20,
},
},
],
Expand All @@ -123,11 +123,11 @@ describe('routingCalculator', () => {
symbol: 'ERC20_1',
decimals: 18,
address: '0xERC20_1',
} as TokenInfo,
} as ERC20,
},
amountWithMaxSlippage: {
value: BigNumber.from(2),
token: {} as TokenInfo,
token: {} as ERC20,
},
slippage: 0,
fees: [
Expand All @@ -140,7 +140,7 @@ describe('routingCalculator', () => {
symbol: 'IMX',
decimals: 18,
address: IMX_ADDRESS_ZKEVM,
} as TokenInfo,
} as ERC20,
},
recipient: '',
basisPoints: 0,
Expand All @@ -155,11 +155,11 @@ describe('routingCalculator', () => {
symbol: 'IMX',
decimals: 18,
address: IMX_ADDRESS_ZKEVM,
} as TokenInfo,
} as ERC20,
},
swap: {
value: BigNumber.from(2),
token: {} as TokenInfo,
token: {} as ERC20,
},
},
],
Expand Down
Loading

0 comments on commit f4b0610

Please sign in to comment.