@imtbl/dex-sdk 2.23.0 → 2.24.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 (29) hide show
  1. package/dist/browser/index.js +1 -9
  2. package/dist/node/index.cjs +1 -56
  3. package/dist/node/index.js +1 -9
  4. package/dist/types/lib/fees.d.ts +1 -1
  5. package/dist/types/lib/router.d.ts +7 -1
  6. package/package.json +17 -18
  7. package/dist/types/config/config.test.d.ts +0 -1
  8. package/dist/types/exchange.getUnsignedSwapTxFromAmountIn.test.d.ts +0 -1
  9. package/dist/types/exchange.getUnsignedSwapTxFromAmountOut.test.d.ts +0 -1
  10. package/dist/types/exchange.test.d.ts +0 -1
  11. package/dist/types/lib/fees.test.d.ts +0 -1
  12. package/dist/types/lib/getQuotesForRoutes.test.d.ts +0 -1
  13. package/dist/types/lib/multicall.test.d.ts +0 -1
  14. package/dist/types/lib/nativeTokenService.test.d.ts +0 -1
  15. package/dist/types/lib/poolUtils/ensureCorrectERC20AddressOrder.test.d.ts +0 -1
  16. package/dist/types/lib/poolUtils/fetchValidPools.test.d.ts +0 -1
  17. package/dist/types/lib/poolUtils/generateAllAcyclicPaths.test.d.ts +0 -1
  18. package/dist/types/lib/poolUtils/generateERC20Pairs.test.d.ts +0 -1
  19. package/dist/types/lib/poolUtils/generatePossiblePoolsFromERC20Pairs.test.d.ts +0 -1
  20. package/dist/types/lib/router.spec.d.ts +0 -1
  21. package/dist/types/lib/router.test.d.ts +0 -1
  22. package/dist/types/lib/transactionUtils/approval.test.d.ts +0 -1
  23. package/dist/types/lib/transactionUtils/gas.test.d.ts +0 -1
  24. package/dist/types/lib/transactionUtils/getQuote.test.d.ts +0 -1
  25. package/dist/types/lib/transactionUtils/slippage.test.d.ts +0 -1
  26. package/dist/types/lib/transactionUtils/swap.test.d.ts +0 -1
  27. package/dist/types/lib/utils.test.d.ts +0 -1
  28. package/dist/types/test/utils.d.ts +0 -135
  29. package/dist/types/test/utils.test.d.ts +0 -1
@@ -8,9 +8,9 @@ export declare class Fees {
8
8
  amountWithFeesApplied(): CoinAmount<Coin>;
9
9
  amountLessFees(): CoinAmount<Coin>;
10
10
  withAmounts(): {
11
- amount: CoinAmount<Coin>;
12
11
  recipient: string;
13
12
  basisPoints: number;
13
+ amount: CoinAmount<Coin>;
14
14
  }[];
15
15
  private total;
16
16
  }
@@ -22,4 +22,10 @@ export declare class Router {
22
22
  private bestQuoteForAmountOut;
23
23
  private determineERC20InAndERC20Out;
24
24
  }
25
- export declare const generateAllAcyclicPaths: (tokenIn: ERC20, tokenOut: ERC20, pools: Pool[], maxHops: number, currentRoute?: Pool[], routes?: Route<Token, Token>[], startTokenIn?: ERC20) => Route<Token, Token>[];
25
+ export declare const generateAllAcyclicPaths: (tokenIn: ERC20, // the currency we start with
26
+ tokenOut: ERC20, // the currency we want to end up with
27
+ pools: Pool[], // list of all available pools
28
+ maxHops: number, // the maximum number of pools that can be traversed
29
+ currentRoute?: Pool[], // list of pools already traversed
30
+ routes?: Route<Token, Token>[], // list of all routes found so far
31
+ startTokenIn?: ERC20) => Route<Token, Token>[];
package/package.json CHANGED
@@ -1,32 +1,31 @@
1
1
  {
2
2
  "name": "@imtbl/dex-sdk",
3
3
  "description": "DEX Provider package for the Immutable SDK",
4
- "version": "2.23.0",
4
+ "version": "2.24.0",
5
5
  "author": "Immutable",
6
+ "browser": "dist/browser/index.js",
6
7
  "bugs": "https://github.com/immutable/ts-immutable-sdk/issues",
7
8
  "dependencies": {
8
- "@imtbl/config": "2.23.0",
9
9
  "@uniswap/sdk-core": "^3.0.1",
10
10
  "@uniswap/swap-router-contracts": "^1.3.1",
11
11
  "@uniswap/v3-sdk": "~3.10.0",
12
- "ethers": "^6.13.4"
12
+ "ethers": "^6.17.0",
13
+ "@imtbl/config": "2.24.0"
13
14
  },
14
15
  "devDependencies": {
15
- "@swc/core": "^1.4.2",
16
+ "@swc/core": "^1.15.46",
16
17
  "@swc/jest": "^0.2.37",
17
18
  "@typechain/ethers-v6": "^0.5.1",
18
19
  "@types/jest": "^29.5.12",
19
20
  "@types/node": "^22.10.7",
20
- "eslint": "^8.56.0",
21
+ "@typescript/native": "npm:typescript@^7.0.2",
21
22
  "jest": "^29.7.0",
22
- "jest-environment-jsdom": "^29.4.3",
23
- "ts-node": "^10.9.1",
24
- "tsup": "^8.3.0",
23
+ "jest-environment-jsdom": "^29.7.0",
25
24
  "typechain": "^8.1.1",
26
- "typescript": "^5.6.2"
25
+ "typescript": "npm:@typescript/typescript6@^6.0.2"
27
26
  },
28
27
  "engines": {
29
- "node": ">=20.11.0"
28
+ "node": ">=24"
30
29
  },
31
30
  "exports": {
32
31
  "development": {
@@ -52,24 +51,24 @@
52
51
  "license": "Apache-2.0",
53
52
  "main": "dist/node/index.cjs",
54
53
  "module": "dist/node/index.js",
55
- "browser": "dist/browser/index.js",
56
54
  "publishConfig": {
57
55
  "access": "public"
58
56
  },
59
- "repository": "immutable/ts-immutable-sdk.git",
57
+ "repository": {
58
+ "type": "git",
59
+ "url": "immutable/ts-immutable-sdk.git"
60
+ },
60
61
  "source": "src/index.ts",
61
62
  "type": "module",
62
63
  "types": "./dist/types/index.d.ts",
63
64
  "scripts": {
64
65
  "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
- "pack:root": "pnpm pack --pack-destination $(dirname $(pnpm root -w))",
68
66
  "generate-types": "typechain --target ethers-v6 --out-dir ./src/contracts/types ./src/contracts/ABIs/*.json",
69
- "lint": "eslint ./src --ext .ts --max-warnings=0",
70
- "lint:fix": "cd ../../../.. && pnpm wsrun -p @imtbl/dex-sdk -c lint --fix",
67
+ "pack:root": "pnpm pack --pack-destination $(dirname $(pnpm root -w))",
71
68
  "test": "jest test",
72
69
  "test:watch": "jest --watch",
73
- "typecheck": "tsc --customConditions default --noEmit"
70
+ "transpile": "tsdown",
71
+ "typecheck": "tsc --customConditions default --noEmit",
72
+ "typegen": "tsc --customConditions default --emitDeclarationOnly --outDir dist/types"
74
73
  }
75
74
  }
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,135 +0,0 @@
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 USDT_TEST_TOKEN: ERC20;
33
- export declare const FUN_TEST_TOKEN: ERC20;
34
- export declare const NATIVE_TEST_TOKEN: Native;
35
- export declare const nativeTokenService: NativeTokenService;
36
- export declare const TEST_IMMUTABLE_CONFIGURATION: ImmutableConfiguration;
37
- export declare const TEST_DEX_CONFIGURATION: ExchangeModuleConfiguration;
38
- export declare const refundETHFunctionSignature = "0x12210e8a";
39
- export type PromiseOrValue<T> = T | Promise<T>;
40
- export type SwapTest = {
41
- fromAddress: string;
42
- pools: Pool[];
43
- inputToken: string;
44
- outputToken: string;
45
- intermediaryToken: string | undefined;
46
- };
47
- export declare function uniqBy<K, T extends string | number>(array: K[], comparator: (arg: K) => T): K[];
48
- export declare function decodePathForExactInput(path: string): {
49
- inputToken: string;
50
- firstPoolFee: bigint;
51
- intermediaryToken: string;
52
- secondPoolFee: bigint;
53
- outputToken: string;
54
- };
55
- export declare function decodePathForExactOutput(path: string): {
56
- outputToken: string;
57
- firstPoolFee: bigint;
58
- intermediaryToken: string;
59
- secondPoolFee: bigint;
60
- inputToken: string;
61
- };
62
- export declare function decodeMulticallExactInputWithFees(data: BytesLike): {
63
- secondaryFeeParams: SecondaryFee[];
64
- swapParams: IV3SwapRouter.ExactInputParamsStruct;
65
- unwrapTokenParams: Result;
66
- deadline: bigint;
67
- };
68
- export declare function decodeMulticallExactInputWithoutFees(data: BytesLike): {
69
- swapParams: IV3SwapRouter.ExactInputParamsStruct;
70
- };
71
- export declare function decodeMulticallExactOutputWithFees(data: BytesLike): {
72
- secondaryFeeParams: SecondaryFee[];
73
- swapParams: IV3SwapRouter.ExactOutputParamsStruct;
74
- unwrapTokenParams: Result;
75
- deadline: bigint;
76
- };
77
- export declare function decodeMulticallExactInputSingleWithFees(data: BytesLike): {
78
- secondaryFeeParams: SecondaryFee[];
79
- swapParams: IV3SwapRouter.ExactInputSingleParamsStruct;
80
- unwrapTokenParams: Result;
81
- deadline: bigint;
82
- };
83
- export declare function decodeMulticallExactOutputSingleWithFees(data: BytesLike): {
84
- secondaryFeeParams: SecondaryFee[];
85
- swapParams: IV3SwapRouter.ExactOutputSingleParamsStruct;
86
- unwrapTokenParams: Result;
87
- deadline: bigint;
88
- };
89
- export declare function decodeMulticallExactInputSingleWithoutFees(data: BytesLike): {
90
- swapParams: IV3SwapRouter.ExactInputSingleParamsStruct;
91
- };
92
- export declare function decodeMulticallExactOutputSingleWithoutFees(data: BytesLike): {
93
- swapParams: IV3SwapRouter.ExactOutputSingleParamsStruct;
94
- };
95
- export declare function createPool(tokenIn: ERC20, tokenOut: ERC20): Pool;
96
- export declare function setupSwapTxTest(params?: {
97
- multiPoolSwap?: boolean;
98
- }): SwapTest;
99
- type MockParams = {
100
- pools: Pool[];
101
- exchangeRate?: number;
102
- };
103
- export declare const amountOutFromAmountIn: (amountIn: CoinAmount<ERC20>, tokenOut: ERC20, exchangeRate: number) => CoinAmount<ERC20>;
104
- export declare const amountInFromAmountOut: (amountOut: CoinAmount<ERC20>, tokenIn: ERC20, exchangeRate: number) => CoinAmount<ERC20>;
105
- export declare function mockRouterImplementation(params: MockParams): jest.Mock<QuoteResult, [amountSpecified: CoinAmount<ERC20>, otherToken: ERC20, tradeType: TradeType, secondaryFees: SecondaryFee[], maxHops: number], any>;
106
- export declare function expectToBeDefined<T>(x: T): asserts x is NonNullable<T>;
107
- export declare function expectToBeString(x: unknown): asserts x is string;
108
- export declare function expectERC20(token: Coin, expectedAddress?: string): asserts token is ERC20;
109
- export declare function expectNative(token: Coin): asserts token is Native;
110
- /**
111
- * Takes an arbitrary string and turns it into a valid ethereum address
112
- * @param str Arbitrary string to create the address from
113
- */
114
- export declare function makeAddr(str: string): string;
115
- export declare function formatAmount(amount: CoinAmount<Coin> | Amount): string;
116
- export declare function formatTokenAmount(amount: BigNumberish, token: ERC20): string;
117
- export declare function formatEther(bn: PromiseOrValue<BigNumberish>): string;
118
- export declare function newAmountFromString<T extends Coin>(amount: string, token: T): CoinAmount<T>;
119
- export declare const buildBlock: ({ baseFeePerGas }: {
120
- baseFeePerGas: bigint | null;
121
- }) => {
122
- baseFeePerGas: bigint | null;
123
- difficulty: bigint;
124
- extraData: string;
125
- gasLimit: bigint;
126
- gasUsed: bigint;
127
- hash: string;
128
- miner: string;
129
- nonce: string;
130
- number: number;
131
- parentHash: string;
132
- timestamp: number;
133
- transactions: never[];
134
- };
135
- export {};
@@ -1 +0,0 @@
1
- export {};