@imtbl/dex-sdk 2.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/LICENSE.md +176 -0
  2. package/README.md +3 -0
  3. package/dist/browser/index.js +2 -0
  4. package/dist/node/index.cjs +2 -0
  5. package/dist/node/index.js +2 -0
  6. package/dist/types/config/config.test.d.ts +1 -0
  7. package/dist/types/config/index.d.ts +18 -0
  8. package/dist/types/constants/chains/immutable-mainnet.d.ts +2 -0
  9. package/dist/types/constants/chains/immutable-testnet.d.ts +2 -0
  10. package/dist/types/constants/chains/index.d.ts +2 -0
  11. package/dist/types/constants/index.d.ts +3 -0
  12. package/dist/types/constants/router.d.ts +8 -0
  13. package/dist/types/constants/tokens/immutable-mainnet.d.ts +5 -0
  14. package/dist/types/constants/tokens/immutable-testnet.d.ts +4 -0
  15. package/dist/types/constants/tokens/index.d.ts +2 -0
  16. package/dist/types/constants/wrapping.d.ts +2 -0
  17. package/dist/types/contracts/types/ERC20.d.ts +141 -0
  18. package/dist/types/contracts/types/ImmutableSwapProxy.d.ts +469 -0
  19. package/dist/types/contracts/types/Multicall.d.ts +83 -0
  20. package/dist/types/contracts/types/QuoterV2.d.ts +219 -0
  21. package/dist/types/contracts/types/UniswapV3Pool.d.ts +732 -0
  22. package/dist/types/contracts/types/WIMX.d.ts +179 -0
  23. package/dist/types/contracts/types/common.d.ts +50 -0
  24. package/dist/types/contracts/types/factories/ERC20__factory.d.ts +174 -0
  25. package/dist/types/contracts/types/factories/ImmutableSwapProxy__factory.d.ts +612 -0
  26. package/dist/types/contracts/types/factories/Multicall__factory.d.ts +90 -0
  27. package/dist/types/contracts/types/factories/QuoterV2__factory.d.ts +226 -0
  28. package/dist/types/contracts/types/factories/UniswapV3Pool__factory.d.ts +795 -0
  29. package/dist/types/contracts/types/factories/WIMX__factory.d.ts +219 -0
  30. package/dist/types/contracts/types/factories/index.d.ts +6 -0
  31. package/dist/types/contracts/types/index.d.ts +13 -0
  32. package/dist/types/errors/exchangeError.d.ts +61 -0
  33. package/dist/types/errors/index.d.ts +1 -0
  34. package/dist/types/exchange.d.ts +50 -0
  35. package/dist/types/exchange.getUnsignedSwapTxFromAmountIn.test.d.ts +1 -0
  36. package/dist/types/exchange.getUnsignedSwapTxFromAmountOut.test.d.ts +1 -0
  37. package/dist/types/exchange.test.d.ts +1 -0
  38. package/dist/types/index.d.ts +4 -0
  39. package/dist/types/lib/fees.d.ts +16 -0
  40. package/dist/types/lib/fees.test.d.ts +1 -0
  41. package/dist/types/lib/getQuotesForRoutes.d.ts +14 -0
  42. package/dist/types/lib/getQuotesForRoutes.test.d.ts +1 -0
  43. package/dist/types/lib/index.d.ts +3 -0
  44. package/dist/types/lib/multicall.d.ts +12 -0
  45. package/dist/types/lib/multicall.test.d.ts +1 -0
  46. package/dist/types/lib/nativeTokenService.d.ts +13 -0
  47. package/dist/types/lib/nativeTokenService.test.d.ts +1 -0
  48. package/dist/types/lib/poolUtils/computePoolAddress.d.ts +9 -0
  49. package/dist/types/lib/poolUtils/ensureCorrectERC20AddressOrder.test.d.ts +1 -0
  50. package/dist/types/lib/poolUtils/fetchValidPools.d.ts +14 -0
  51. package/dist/types/lib/poolUtils/fetchValidPools.test.d.ts +1 -0
  52. package/dist/types/lib/poolUtils/generateAllAcyclicPaths.test.d.ts +1 -0
  53. package/dist/types/lib/poolUtils/generateERC20Pairs.d.ts +7 -0
  54. package/dist/types/lib/poolUtils/generateERC20Pairs.test.d.ts +1 -0
  55. package/dist/types/lib/poolUtils/generatePossiblePoolsFromERC20Pairs.d.ts +11 -0
  56. package/dist/types/lib/poolUtils/generatePossiblePoolsFromERC20Pairs.test.d.ts +1 -0
  57. package/dist/types/lib/router.d.ts +24 -0
  58. package/dist/types/lib/router.test.d.ts +1 -0
  59. package/dist/types/lib/transactionUtils/approval.d.ts +25 -0
  60. package/dist/types/lib/transactionUtils/approval.test.d.ts +1 -0
  61. package/dist/types/lib/transactionUtils/gas.d.ts +18 -0
  62. package/dist/types/lib/transactionUtils/gas.test.d.ts +1 -0
  63. package/dist/types/lib/transactionUtils/getQuote.d.ts +13 -0
  64. package/dist/types/lib/transactionUtils/getQuote.test.d.ts +1 -0
  65. package/dist/types/lib/transactionUtils/slippage.d.ts +2 -0
  66. package/dist/types/lib/transactionUtils/slippage.test.d.ts +1 -0
  67. package/dist/types/lib/transactionUtils/swap.d.ts +16 -0
  68. package/dist/types/lib/transactionUtils/swap.test.d.ts +1 -0
  69. package/dist/types/lib/utils.d.ts +60 -0
  70. package/dist/types/lib/utils.test.d.ts +1 -0
  71. package/dist/types/test/utils.d.ts +134 -0
  72. package/dist/types/test/utils.test.d.ts +1 -0
  73. package/dist/types/types/index.d.ts +174 -0
  74. package/package.json +74 -0
@@ -0,0 +1,60 @@
1
+ import { Pool } from '@uniswap/v3-sdk';
2
+ import * as Uniswap from '@uniswap/sdk-core';
3
+ import { JsonRpcProvider } from 'ethers';
4
+ import { Amount, Coin, CoinAmount, ERC20, Native, Token } from '../types';
5
+ export declare const quoteReturnMapping: {
6
+ [signature: string]: string[];
7
+ };
8
+ /**
9
+ * Returns true if poolA is equivalent to poolB
10
+ * @param poolA one of the two pools
11
+ * @param poolB the other pool
12
+ */
13
+ export declare function poolEquals(poolA: Pool, poolB: Pool): boolean;
14
+ export declare const decimalsFunctionSig: string;
15
+ export declare function getTokenDecimals(tokenAddress: string, provider: JsonRpcProvider, nativeToken: Coin): Promise<number>;
16
+ /**
17
+ * Based on https://github.com/ethers-io/ethers.js/blob/main/src.ts/address/checks.ts#L51
18
+ */
19
+ export declare function isValidNonZeroAddress(address: string): boolean;
20
+ export declare const isValidTokenLiteral: (address: string) => boolean;
21
+ export declare const erc20ToUniswapToken: (token: ERC20) => Uniswap.Token;
22
+ export declare const uniswapTokenToERC20: (token: Uniswap.Token) => ERC20;
23
+ export declare const toBigNumber: (amount: Uniswap.CurrencyAmount<Uniswap.Token>) => bigint;
24
+ export declare const toAmount: (amount: Uniswap.CurrencyAmount<Uniswap.Token>) => CoinAmount<ERC20>;
25
+ export declare const toCurrencyAmount: (amount: CoinAmount<ERC20>) => Uniswap.CurrencyAmount<Uniswap.Token>;
26
+ export declare const newAmount: <T extends Coin>(amount: bigint, token: T) => CoinAmount<T>;
27
+ export declare const isERC20Amount: (amount: CoinAmount<Coin>) => amount is CoinAmount<ERC20>;
28
+ export declare const isNativeAmount: (amount: CoinAmount<Coin>) => amount is CoinAmount<Native>;
29
+ export declare const isNative: (token: Coin) => token is Native;
30
+ export declare const addERC20Amount: (a: CoinAmount<ERC20>, b: CoinAmount<ERC20>) => {
31
+ value: bigint;
32
+ token: ERC20;
33
+ };
34
+ export declare const addAmount: <T extends Coin>(a: CoinAmount<T>, b: CoinAmount<T>) => {
35
+ value: bigint;
36
+ token: ERC20;
37
+ } | {
38
+ value: bigint;
39
+ token: Native;
40
+ };
41
+ export declare const subtractERC20Amount: (a: CoinAmount<ERC20>, b: CoinAmount<ERC20>) => {
42
+ value: bigint;
43
+ token: ERC20;
44
+ };
45
+ export declare const subtractAmount: <T extends Coin>(a: CoinAmount<T>, b: CoinAmount<T>) => {
46
+ value: bigint;
47
+ token: ERC20;
48
+ } | {
49
+ value: bigint;
50
+ token: Native;
51
+ };
52
+ /**
53
+ * Converts our internal token type which could be ERC20 or Native
54
+ * into a format consumable by Checkout. They require an address to be
55
+ * present. We populate the address with the string 'native' if it's Native.
56
+ * If it's ERC20, we don't need to change it.
57
+ */
58
+ export declare const toPublicTokenType: (token: Coin) => Token;
59
+ export declare const toPublicAmount: (amount: CoinAmount<Coin>) => Amount;
60
+ export declare const getDefaultDeadlineSeconds: () => number;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,134 @@
1
+ import { TradeType } from '@uniswap/sdk-core';
2
+ import { Pool } from '@uniswap/v3-sdk';
3
+ import { ImmutableConfiguration } from '@imtbl/config';
4
+ import { BigNumberish, BytesLike, Result } from 'ethers';
5
+ import { QuoteResult } from '../lib/getQuotesForRoutes';
6
+ import { NativeTokenService } from '../lib/nativeTokenService';
7
+ import { ExchangeModuleConfiguration, SecondaryFee, CoinAmount, Coin, ERC20, Native, Amount } from '../types';
8
+ import { IV3SwapRouter } from '../contracts/types/ImmutableSwapProxy';
9
+ import { RoutingContracts } from '../lib';
10
+ export declare const TEST_BASE_FEE: bigint;
11
+ export declare const TEST_MAX_PRIORITY_FEE_PER_GAS: bigint;
12
+ export declare const TEST_GAS_PRICE: bigint;
13
+ export declare const TEST_TRANSACTION_GAS_USAGE: bigint;
14
+ export declare const TEST_CHAIN_ID = 999;
15
+ export declare const TEST_RPC_URL = "https://0.net";
16
+ export declare const TEST_FROM_ADDRESS = "0x94fC2BcA2E71e26D874d7E937d89ce2c9113af6e";
17
+ export declare const TEST_FEE_RECIPIENT = "0xe3ece548F1DD4B1536Eb6eE188fE35350bc1dd16";
18
+ export declare const TEST_MAX_FEE_BASIS_POINTS = 1000;
19
+ export declare const TEST_MULTICALL_ADDRESS = "0x66d0aB680ACEe44308edA2062b910405CC51A190";
20
+ export declare const TEST_V3_CORE_FACTORY_ADDRESS = "0x23490b262829ACDAD3EF40e555F23d77D1B69e4e";
21
+ export declare const TEST_QUOTER_ADDRESS = "0x9B323E56215aAdcD4f45a6Be660f287DE154AFC5";
22
+ export declare const TEST_ROUTER_ADDRESS = "0x615FFbea2af24C55d737dD4264895A56624Da072";
23
+ export declare const TEST_V3_MIGRATOR_ADDRESSES = "0x0Df0d2d5Cf4739C0b579C33Fdb3d8B04Bee85729";
24
+ export declare const TEST_NONFUNGIBLE_POSITION_MANAGER_ADDRESSES = "0x446c78D97b1E78bC35864FC49AcE1f7404F163F6";
25
+ export declare const TEST_TICK_LENS_ADDRESSES = "0x3aC4F8094b21A6c5945453007d9c52B7e15340c0";
26
+ export declare const TEST_SWAP_PROXY_ADDRESS = "0x8dBE1f0900C5e92ad87A54521902a33ba1598C51";
27
+ export declare const TEST_ROUTING_CONTRACTS: RoutingContracts;
28
+ export declare const IMX_TEST_TOKEN: ERC20;
29
+ export declare const WIMX_TEST_TOKEN: ERC20;
30
+ export declare const WETH_TEST_TOKEN: ERC20;
31
+ export declare const USDC_TEST_TOKEN: ERC20;
32
+ export declare const FUN_TEST_TOKEN: ERC20;
33
+ export declare const NATIVE_TEST_TOKEN: Native;
34
+ export declare const nativeTokenService: NativeTokenService;
35
+ export declare const TEST_IMMUTABLE_CONFIGURATION: ImmutableConfiguration;
36
+ export declare const TEST_DEX_CONFIGURATION: ExchangeModuleConfiguration;
37
+ export declare const refundETHFunctionSignature = "0x12210e8a";
38
+ export type PromiseOrValue<T> = T | Promise<T>;
39
+ export type SwapTest = {
40
+ fromAddress: string;
41
+ pools: Pool[];
42
+ inputToken: string;
43
+ outputToken: string;
44
+ intermediaryToken: string | undefined;
45
+ };
46
+ export declare function uniqBy<K, T extends string | number>(array: K[], comparator: (arg: K) => T): K[];
47
+ export declare function decodePathForExactInput(path: string): {
48
+ inputToken: string;
49
+ firstPoolFee: bigint;
50
+ intermediaryToken: string;
51
+ secondPoolFee: bigint;
52
+ outputToken: string;
53
+ };
54
+ export declare function decodePathForExactOutput(path: string): {
55
+ outputToken: string;
56
+ firstPoolFee: bigint;
57
+ intermediaryToken: string;
58
+ secondPoolFee: bigint;
59
+ inputToken: string;
60
+ };
61
+ export declare function decodeMulticallExactInputWithFees(data: BytesLike): {
62
+ secondaryFeeParams: SecondaryFee[];
63
+ swapParams: IV3SwapRouter.ExactInputParamsStruct;
64
+ unwrapTokenParams: Result;
65
+ deadline: bigint;
66
+ };
67
+ export declare function decodeMulticallExactInputWithoutFees(data: BytesLike): {
68
+ swapParams: IV3SwapRouter.ExactInputParamsStruct;
69
+ };
70
+ export declare function decodeMulticallExactOutputWithFees(data: BytesLike): {
71
+ secondaryFeeParams: SecondaryFee[];
72
+ swapParams: IV3SwapRouter.ExactOutputParamsStruct;
73
+ unwrapTokenParams: Result;
74
+ deadline: bigint;
75
+ };
76
+ export declare function decodeMulticallExactInputSingleWithFees(data: BytesLike): {
77
+ secondaryFeeParams: SecondaryFee[];
78
+ swapParams: IV3SwapRouter.ExactInputSingleParamsStruct;
79
+ unwrapTokenParams: Result;
80
+ deadline: bigint;
81
+ };
82
+ export declare function decodeMulticallExactOutputSingleWithFees(data: BytesLike): {
83
+ secondaryFeeParams: SecondaryFee[];
84
+ swapParams: IV3SwapRouter.ExactOutputSingleParamsStruct;
85
+ unwrapTokenParams: Result;
86
+ deadline: bigint;
87
+ };
88
+ export declare function decodeMulticallExactInputSingleWithoutFees(data: BytesLike): {
89
+ swapParams: IV3SwapRouter.ExactInputSingleParamsStruct;
90
+ };
91
+ export declare function decodeMulticallExactOutputSingleWithoutFees(data: BytesLike): {
92
+ swapParams: IV3SwapRouter.ExactOutputSingleParamsStruct;
93
+ };
94
+ export declare function createPool(tokenIn: ERC20, tokenOut: ERC20): Pool;
95
+ export declare function setupSwapTxTest(params?: {
96
+ multiPoolSwap?: boolean;
97
+ }): SwapTest;
98
+ type MockParams = {
99
+ pools: Pool[];
100
+ exchangeRate?: number;
101
+ };
102
+ export declare const amountOutFromAmountIn: (amountIn: CoinAmount<ERC20>, tokenOut: ERC20, exchangeRate: number) => CoinAmount<ERC20>;
103
+ export declare const amountInFromAmountOut: (amountOut: CoinAmount<ERC20>, tokenIn: ERC20, exchangeRate: number) => CoinAmount<ERC20>;
104
+ export declare function mockRouterImplementation(params: MockParams): jest.Mock<QuoteResult, [amountSpecified: CoinAmount<ERC20>, otherToken: ERC20, tradeType: TradeType, secondaryFees: SecondaryFee[], maxHops: number], any>;
105
+ export declare function expectToBeDefined<T>(x: T): asserts x is NonNullable<T>;
106
+ export declare function expectToBeString(x: unknown): asserts x is string;
107
+ export declare function expectERC20(token: Coin, expectedAddress?: string): asserts token is ERC20;
108
+ export declare function expectNative(token: Coin): asserts token is Native;
109
+ /**
110
+ * Takes an arbitrary string and turns it into a valid ethereum address
111
+ * @param str Arbitrary string to create the address from
112
+ */
113
+ export declare function makeAddr(str: string): string;
114
+ export declare function formatAmount(amount: CoinAmount<Coin> | Amount): string;
115
+ export declare function formatTokenAmount(amount: BigNumberish, token: ERC20): string;
116
+ export declare function formatEther(bn: PromiseOrValue<BigNumberish>): string;
117
+ export declare function newAmountFromString<T extends Coin>(amount: string, token: T): CoinAmount<T>;
118
+ export declare const buildBlock: ({ baseFeePerGas }: {
119
+ baseFeePerGas: bigint | null;
120
+ }) => {
121
+ baseFeePerGas: bigint | null;
122
+ difficulty: bigint;
123
+ extraData: string;
124
+ gasLimit: bigint;
125
+ gasUsed: bigint;
126
+ hash: string;
127
+ miner: string;
128
+ nonce: string;
129
+ number: number;
130
+ parentHash: string;
131
+ timestamp: number;
132
+ transactions: never[];
133
+ };
134
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,174 @@
1
+ import { TransactionRequest } from 'ethers';
2
+ import { ModuleConfiguration } from '@imtbl/config';
3
+ export type ExchangeContracts = {
4
+ multicall: string;
5
+ coreFactory: string;
6
+ quoter: string;
7
+ swapRouter: string;
8
+ immutableSwapProxy: string;
9
+ };
10
+ /**
11
+ * Type representing a Chain
12
+ * @property {number} chainId - The chain ID
13
+ * @property {string} rpcUrl - The RPC URL for the chain
14
+ * @property {@link ExchangeContracts} contracts - The DEX contract addresses
15
+ * @property {@link ERC20[]} commonRoutingTokens - The tokens used to find available pools for a swap
16
+ * @property {@link Native} nativeToken - The native token of the chain
17
+ * @property {@link ERC20} wrappedNativeToken - The wrapped native token of the chain
18
+ */
19
+ export type Chain = {
20
+ chainId: number;
21
+ rpcUrl: string;
22
+ contracts: ExchangeContracts;
23
+ commonRoutingTokens: ERC20[];
24
+ nativeToken: Native;
25
+ wrappedNativeToken: ERC20;
26
+ };
27
+ /**
28
+ * Type representing the secondary fees for a swap
29
+ * @property {string} recipient - The fee recipient address
30
+ * @property {number} basisPoints - The fee percentage in basis points
31
+ * @example 100 basis points = 1%
32
+ */
33
+ export type SecondaryFee = {
34
+ recipient: string;
35
+ basisPoints: number;
36
+ };
37
+ /**
38
+ * Type representing the fees returned in the quote
39
+ * @property {string} recipient - The fee recipient address
40
+ * @property {number} basisPoints - The fee percentage in basis points
41
+ * @property {@link Amount} amount - The amount of the fee
42
+ * @example 100 basis points = 1% = 1 IMX
43
+ */
44
+ export type Fee = {
45
+ recipient: string;
46
+ basisPoints: number;
47
+ amount: Amount;
48
+ };
49
+ /**
50
+ * Type representing an amount with the token information
51
+ * @property {@link Coin} token - The coin for the amount, either a {@link Native} or {@link ERC20}
52
+ * @property {BigInt} value - The value of the amount in the token's smallest unit
53
+ */
54
+ export type CoinAmount<T extends Coin> = {
55
+ token: T;
56
+ value: bigint;
57
+ };
58
+ /**
59
+ * Type representing a quote for a swap
60
+ * @property {@link Amount} amount - The quoted amount with fees applied
61
+ * @property {@link Amount} amountWithMaxSlippage - The quoted amount with the max slippage and fees applied
62
+ * @property {number} slippage - The slippage percentage used to calculate the quote
63
+ * @property {@link Fee[]} fees - The secondary fees applied to the swap
64
+ */
65
+ export type Quote = {
66
+ amount: Amount;
67
+ amountWithMaxSlippage: Amount;
68
+ slippage: number;
69
+ fees: Fee[];
70
+ };
71
+ /**
72
+ * Type representing the details of a transaction
73
+ * @property {@link TransactionRequest} transaction - The unsigned transaction
74
+ * @property {@link Amount | null} gasFeeEstimate - The gas fee estimate or null if it is not available
75
+ */
76
+ export type TransactionDetails = {
77
+ transaction: TransactionRequest;
78
+ gasFeeEstimate: Amount | null;
79
+ };
80
+ /**
81
+ * Type representing the results of {@link Exchange.getUnsignedSwapTxFromAmountIn} {@link Exchange.getUnsignedSwapTxFromAmountOut}
82
+ * @property {@link TransactionDetails | null} approval - The approval transaction or null if it is not required
83
+ * @property {@link TransactionDetails} swap - The swap transaction
84
+ * @property {@link Quote} quote - The quote details for the swap
85
+ */
86
+ export type TransactionResponse = {
87
+ approval: TransactionDetails | null;
88
+ swap: TransactionDetails;
89
+ quote: Quote;
90
+ };
91
+ /**
92
+ * Type representing an ERC20 token
93
+ * @property {string} type - The token type, used to discriminate between {@link ERC20} and {@link Native}
94
+ * @property {number} chainId - The chain ID
95
+ * @property {string} address - The token address
96
+ * @property {number} decimals - The token decimals
97
+ * @property {string | undefined} symbol - The token symbol or undefined if it is not available
98
+ * @property {string | undefined} name - The token name or undefined if it is not available
99
+ */
100
+ export type ERC20 = {
101
+ type: 'erc20';
102
+ chainId: number;
103
+ address: string;
104
+ decimals: number;
105
+ symbol?: string;
106
+ name?: string;
107
+ };
108
+ /**
109
+ * Type representing a native token
110
+ * @property {string} type - The token type, used to discriminate between {@link ERC20} and {@link Native}
111
+ * @property {number} chainId - The chain ID
112
+ * @property {number} decimals - The token decimals
113
+ * @property {string | undefined} symbol - The token symbol or undefined if it is not available
114
+ * @property {string | undefined} name - The token name or undefined if it is not available
115
+ */
116
+ export type Native = {
117
+ type: 'native';
118
+ chainId: number;
119
+ decimals: number;
120
+ symbol?: string;
121
+ name?: string;
122
+ };
123
+ /**
124
+ * Type representing a token, either an {@link ERC20} or {@link Native}
125
+ */
126
+ export type Coin = ERC20 | Native;
127
+ /**
128
+ * Type representing a token
129
+ * @property {number} chainId - The chain ID
130
+ * @property {string} address - The token address, or the empty string for the native token
131
+ * @property {number} decimals - The token decimals
132
+ * @property {string | undefined} symbol - The token symbol or undefined if it is not available
133
+ * @property {string | undefined} name - The token name or undefined if it is not available
134
+ */
135
+ export type Token = {
136
+ chainId: number;
137
+ address: string;
138
+ decimals: number;
139
+ symbol?: string;
140
+ name?: string;
141
+ };
142
+ /**
143
+ * Interface representing a token amount
144
+ * @property {@link Token} token - The token
145
+ * @property {@link BigInt} value - The amount
146
+ */
147
+ export type Amount = {
148
+ token: Token;
149
+ value: bigint;
150
+ };
151
+ /**
152
+ * Type representing the overrides for the {@link Exchange} module
153
+ * @property {string} rpcURL - The RPC URL for the chain
154
+ * @property {ExchangeContracts} exchangeContracts - The DEX contract addresses
155
+ * @property {ERC20[]} commonRoutingTokens - The tokens used to find available pools for a swap
156
+ * @property {Native} nativeToken - The native token of the chain
157
+ * @property {ERC20} wrappedNativeToken - The wrapped native token of the chain
158
+ */
159
+ export type ExchangeOverrides = {
160
+ rpcURL: string;
161
+ exchangeContracts: ExchangeContracts;
162
+ commonRoutingTokens: ERC20[];
163
+ nativeToken: Native;
164
+ wrappedNativeToken: ERC20;
165
+ };
166
+ /**
167
+ * Interface representing the configuration for the {@link Exchange} module
168
+ * @property {number} chainId - The chain ID
169
+ * @property {@link SecondaryFee[]} secondaryFees - The secondary fees for a swap
170
+ */
171
+ export interface ExchangeModuleConfiguration extends ModuleConfiguration<ExchangeOverrides> {
172
+ chainId: number;
173
+ secondaryFees?: SecondaryFee[];
174
+ }
package/package.json ADDED
@@ -0,0 +1,74 @@
1
+ {
2
+ "name": "@imtbl/dex-sdk",
3
+ "description": "DEX Provider package for the Immutable SDK",
4
+ "version": "2.0.0-alpha.0",
5
+ "author": "Immutable",
6
+ "bugs": "https://github.com/immutable/ts-immutable-sdk/issues",
7
+ "dependencies": {
8
+ "@imtbl/config": "2.0.0-alpha.0",
9
+ "@uniswap/sdk-core": "^3.0.1",
10
+ "@uniswap/swap-router-contracts": "^1.3.1",
11
+ "@uniswap/v3-sdk": "^3.9.0",
12
+ "ethers": "^6.13.4"
13
+ },
14
+ "devDependencies": {
15
+ "@swc/core": "^1.3.36",
16
+ "@swc/jest": "^0.2.24",
17
+ "@typechain/ethers-v6": "^0.5.1",
18
+ "@types/jest": "^29.4.3",
19
+ "@types/node": "^18.14.2",
20
+ "eslint": "^8.40.0",
21
+ "jest": "^29.4.3",
22
+ "jest-environment-jsdom": "^29.4.3",
23
+ "ts-node": "^10.9.1",
24
+ "tsup": "^8.3.5",
25
+ "typechain": "^8.1.1",
26
+ "typescript": "^5.6.2"
27
+ },
28
+ "engines": {
29
+ "node": ">=20.11.0"
30
+ },
31
+ "exports": {
32
+ "development": {
33
+ "types": "./src/index.ts",
34
+ "browser": "./dist/browser/index.js",
35
+ "require": "./dist/node/index.cjs",
36
+ "default": "./dist/node/index.js"
37
+ },
38
+ "default": {
39
+ "types": "./dist/types/index.d.ts",
40
+ "browser": "./dist/browser/index.js",
41
+ "require": "./dist/node/index.cjs",
42
+ "default": "./dist/node/index.js"
43
+ }
44
+ },
45
+ "files": [
46
+ "dist"
47
+ ],
48
+ "homepage": "https://github.com/immutable/ts-immutable-sdk#readme",
49
+ "keywords": [
50
+ "immutablex"
51
+ ],
52
+ "license": "Apache-2.0",
53
+ "main": "dist/node/index.cjs",
54
+ "module": "dist/node/index.js",
55
+ "browser": "dist/browser/index.js",
56
+ "publishConfig": {
57
+ "access": "public"
58
+ },
59
+ "repository": "immutable/ts-immutable-sdk.git",
60
+ "source": "src/index.ts",
61
+ "type": "module",
62
+ "types": "./dist/types/index.d.ts",
63
+ "scripts": {
64
+ "build": "pnpm transpile && pnpm typegen",
65
+ "transpile": "tsup src/index.ts --config ../../../../tsup.config.js",
66
+ "typegen": "tsc --customConditions default --emitDeclarationOnly --outDir dist/types",
67
+ "generate-types": "typechain --target ethers-v6 --out-dir ./src/contracts/types ./src/contracts/ABIs/*.json",
68
+ "lint": "eslint ./src --ext .ts --max-warnings=0",
69
+ "lint:fix": "cd ../../../.. && pnpm wsrun -p @imtbl/dex-sdk -c lint --fix",
70
+ "test": "jest test",
71
+ "test:watch": "jest --watch",
72
+ "typecheck": "tsc --customConditions default --noEmit"
73
+ }
74
+ }