@1inch/swap-vm-sdk 0.1.1 → 0.1.2-rc.2
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.
- package/README.md +26 -25
- package/dist/abi/SwapVM.abi.d.mts +76 -0
- package/dist/abi/SwapVM.abi.d.ts +76 -0
- package/dist/index.js +614 -339
- package/dist/index.mjs +615 -342
- package/dist/swap-vm/instructions/concentrate/bigint-sqrt.d.mts +1 -0
- package/dist/swap-vm/instructions/concentrate/bigint-sqrt.d.ts +1 -0
- package/dist/swap-vm/instructions/concentrate/concentrate-grow-liquidity-2d-args.d.mts +16 -7
- package/dist/swap-vm/instructions/concentrate/concentrate-grow-liquidity-2d-args.d.ts +16 -7
- package/dist/swap-vm/instructions/concentrate/concentrate-liquidity-calculator/types.d.mts +39 -0
- package/dist/swap-vm/instructions/concentrate/concentrate-liquidity-calculator/types.d.ts +39 -0
- package/dist/swap-vm/instructions/concentrate/concentrate-liquidity-math/concentrate-liquidity-math.d.mts +51 -0
- package/dist/swap-vm/instructions/concentrate/concentrate-liquidity-math/concentrate-liquidity-math.d.ts +51 -0
- package/dist/swap-vm/instructions/concentrate/index.d.mts +4 -4
- package/dist/swap-vm/instructions/concentrate/index.d.ts +4 -4
- package/dist/swap-vm/instructions/concentrate/opcodes.d.mts +0 -5
- package/dist/swap-vm/instructions/concentrate/opcodes.d.ts +0 -5
- package/dist/swap-vm/instructions/dutch-auction/dutch-auction-args.d.mts +1 -2
- package/dist/swap-vm/instructions/dutch-auction/dutch-auction-args.d.ts +1 -2
- package/dist/swap-vm/instructions/fee/dynamic-protocol-fee/dynamic-protocol-fee-args-coder.d.mts +7 -0
- package/dist/swap-vm/instructions/fee/dynamic-protocol-fee/dynamic-protocol-fee-args-coder.d.ts +7 -0
- package/dist/swap-vm/instructions/fee/dynamic-protocol-fee/dynamic-protocol-fee-args.d.mts +13 -0
- package/dist/swap-vm/instructions/fee/dynamic-protocol-fee/dynamic-protocol-fee-args.d.ts +13 -0
- package/dist/swap-vm/instructions/fee/{flat-fee-args-coder.d.mts → flat-fee/flat-fee-args-coder.d.mts} +1 -1
- package/dist/swap-vm/instructions/fee/{flat-fee-args-coder.d.ts → flat-fee/flat-fee-args-coder.d.ts} +1 -1
- package/dist/swap-vm/instructions/fee/{flat-fee-args.d.mts → flat-fee/flat-fee-args.d.mts} +2 -2
- package/dist/swap-vm/instructions/fee/{flat-fee-args.d.ts → flat-fee/flat-fee-args.d.ts} +2 -2
- package/dist/swap-vm/instructions/fee/index.d.mts +3 -2
- package/dist/swap-vm/instructions/fee/index.d.ts +3 -2
- package/dist/swap-vm/instructions/fee/opcodes.d.mts +28 -8
- package/dist/swap-vm/instructions/fee/opcodes.d.ts +28 -8
- package/dist/swap-vm/instructions/fee/{protocol-fee-args-coder.d.mts → protocol-fee/protocol-fee-args-coder.d.mts} +1 -1
- package/dist/swap-vm/instructions/fee/{protocol-fee-args-coder.d.ts → protocol-fee/protocol-fee-args-coder.d.ts} +1 -1
- package/dist/swap-vm/instructions/fee/{protocol-fee-args.d.mts → protocol-fee/protocol-fee-args.d.mts} +3 -3
- package/dist/swap-vm/instructions/fee/{protocol-fee-args.d.ts → protocol-fee/protocol-fee-args.d.ts} +3 -3
- package/dist/swap-vm/instructions/index.d.mts +2 -1
- package/dist/swap-vm/instructions/index.d.ts +2 -1
- package/dist/swap-vm/instructions/pegged-swap/index.d.mts +3 -0
- package/dist/swap-vm/instructions/pegged-swap/index.d.ts +3 -0
- package/dist/swap-vm/instructions/pegged-swap/opcodes.d.mts +5 -0
- package/dist/swap-vm/instructions/pegged-swap/opcodes.d.ts +5 -0
- package/dist/swap-vm/instructions/pegged-swap/pegged-swap-args-coder.d.mts +7 -0
- package/dist/swap-vm/instructions/pegged-swap/pegged-swap-args-coder.d.ts +7 -0
- package/dist/swap-vm/instructions/pegged-swap/pegged-swap-args.d.mts +29 -0
- package/dist/swap-vm/instructions/pegged-swap/pegged-swap-args.d.ts +29 -0
- package/dist/swap-vm/instructions/pegged-swap/rate-resolver.d.mts +1 -0
- package/dist/swap-vm/instructions/pegged-swap/rate-resolver.d.ts +1 -0
- package/dist/swap-vm/instructions/pegged-swap/types.d.mts +6 -0
- package/dist/swap-vm/instructions/pegged-swap/types.d.ts +6 -0
- package/dist/swap-vm/programs/aqua-program-builder.d.mts +13 -16
- package/dist/swap-vm/programs/aqua-program-builder.d.ts +13 -16
- package/dist/swap-vm/programs/regular-program-builder.d.mts +21 -9
- package/dist/swap-vm/programs/regular-program-builder.d.ts +21 -9
- package/dist/swap-vm/strategies/aqua-amm-strategy.d.mts +2 -19
- package/dist/swap-vm/strategies/aqua-amm-strategy.d.ts +2 -19
- package/dist/swap-vm/strategies/aqua-pegged-amm-strategy.d.mts +11 -0
- package/dist/swap-vm/strategies/aqua-pegged-amm-strategy.d.ts +11 -0
- package/dist/swap-vm/strategies/aqua-xyc-amm-strategy.d.mts +11 -0
- package/dist/swap-vm/strategies/aqua-xyc-amm-strategy.d.ts +11 -0
- package/dist/swap-vm/strategies/index.d.mts +3 -0
- package/dist/swap-vm/strategies/index.d.ts +3 -0
- package/dist/swap-vm/strategies/types.d.mts +19 -0
- package/dist/swap-vm/strategies/types.d.ts +19 -0
- package/dist/swap-vm/taker-traits.d.mts +12 -2
- package/dist/swap-vm/taker-traits.d.ts +12 -2
- package/package.json +18 -18
- package/dist/swap-vm/instructions/concentrate/concentrate-grow-liquidity-xd-args-coder.d.mts +0 -7
- package/dist/swap-vm/instructions/concentrate/concentrate-grow-liquidity-xd-args-coder.d.ts +0 -7
- package/dist/swap-vm/instructions/concentrate/concentrate-grow-liquidity-xd-args.d.mts +0 -17
- package/dist/swap-vm/instructions/concentrate/concentrate-grow-liquidity-xd-args.d.ts +0 -17
- package/dist/swap-vm/instructions/concentrate/types.d.mts +0 -5
- package/dist/swap-vm/instructions/concentrate/types.d.ts +0 -5
- package/dist/swap-vm/instructions/concentrate/utils.d.mts +0 -4
- package/dist/swap-vm/instructions/concentrate/utils.d.ts +0 -4
- package/dist/swap-vm/instructions/stable-swap/index.d.mts +0 -2
- package/dist/swap-vm/instructions/stable-swap/index.d.ts +0 -2
- package/dist/swap-vm/instructions/stable-swap/opcodes.d.mts +0 -4
- package/dist/swap-vm/instructions/stable-swap/opcodes.d.ts +0 -4
- package/dist/swap-vm/instructions/stable-swap/stable-swap-2d-args-coder.d.mts +0 -7
- package/dist/swap-vm/instructions/stable-swap/stable-swap-2d-args-coder.d.ts +0 -7
- package/dist/swap-vm/instructions/stable-swap/stable-swap-2d-args.d.mts +0 -25
- package/dist/swap-vm/instructions/stable-swap/stable-swap-2d-args.d.ts +0 -25
|
@@ -51,6 +51,11 @@ export declare class TakerTraits {
|
|
|
51
51
|
* Defaults to zero address (meaning taker receives funds).
|
|
52
52
|
*/
|
|
53
53
|
readonly customReceiver: Address;
|
|
54
|
+
/**
|
|
55
|
+
* Optional expiration timestamp (uint40, Unix seconds). 0 = no deadline.
|
|
56
|
+
* When non-zero, contract validates block.timestamp <= deadline (TakerTraitsDeadlineExpired otherwise).
|
|
57
|
+
*/
|
|
58
|
+
readonly deadline: bigint;
|
|
54
59
|
/**
|
|
55
60
|
* Optional data passed to the maker's pre-transfer-in hook.
|
|
56
61
|
*/
|
|
@@ -137,6 +142,11 @@ export declare class TakerTraits {
|
|
|
137
142
|
* Defaults to zero address (meaning taker receives funds).
|
|
138
143
|
*/
|
|
139
144
|
customReceiver?: Address,
|
|
145
|
+
/**
|
|
146
|
+
* Optional expiration timestamp (uint40, Unix seconds). 0 = no deadline.
|
|
147
|
+
* When non-zero, contract validates block.timestamp <= deadline (TakerTraitsDeadlineExpired otherwise).
|
|
148
|
+
*/
|
|
149
|
+
deadline?: bigint,
|
|
140
150
|
/**
|
|
141
151
|
* Optional data passed to the maker's pre-transfer-in hook.
|
|
142
152
|
*/
|
|
@@ -187,9 +197,9 @@ export declare class TakerTraits {
|
|
|
187
197
|
/**
|
|
188
198
|
* Decodes a packed TakerTraits from a hex string.
|
|
189
199
|
* The packed format consists of:
|
|
190
|
-
* -
|
|
200
|
+
* - 20 bytes: 10 uint16 offsets for data sections
|
|
191
201
|
* - 2 bytes: uint16 flags
|
|
192
|
-
* - Variable: data sections (threshold, to, hook data, callback data, etc.)
|
|
202
|
+
* - Variable: data sections (threshold, to, deadline, hook data, callback data, etc.)
|
|
193
203
|
* - Variable: signature
|
|
194
204
|
*/
|
|
195
205
|
static decode(packed: HexString): TakerTraits;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@1inch/swap-vm-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2-rc.2",
|
|
4
4
|
"description": "1inch Swap VM SDK",
|
|
5
5
|
"author": "@1inch",
|
|
6
6
|
"license": "LicenseRef-Degensoft-SwapVM-1.1",
|
|
@@ -25,20 +25,6 @@
|
|
|
25
25
|
"README.md",
|
|
26
26
|
"package.json"
|
|
27
27
|
],
|
|
28
|
-
"scripts": {
|
|
29
|
-
"build": "rm -rf dist && tsdown",
|
|
30
|
-
"test": "vitest run",
|
|
31
|
-
"test:e2e": "vitest run --config vitest.e2e.config.mts",
|
|
32
|
-
"test:watch": "vitest watch",
|
|
33
|
-
"test:coverage": "vitest run --coverage",
|
|
34
|
-
"lint": "eslint .",
|
|
35
|
-
"lint:fix": "eslint . --fix",
|
|
36
|
-
"format": "prettier --write \"src/**/*.ts\"",
|
|
37
|
-
"format:check": "prettier --check \"src/**/*.ts\"",
|
|
38
|
-
"type-check": "tsc --noEmit",
|
|
39
|
-
"clean": "rimraf dist node_modules",
|
|
40
|
-
"changelog:generate": "changelog generate -a"
|
|
41
|
-
},
|
|
42
28
|
"keywords": [
|
|
43
29
|
"1inch",
|
|
44
30
|
"swap-vm",
|
|
@@ -52,8 +38,8 @@
|
|
|
52
38
|
},
|
|
53
39
|
"dependencies": {
|
|
54
40
|
"@1inch/byte-utils": "^3.1.7",
|
|
55
|
-
"
|
|
56
|
-
"
|
|
41
|
+
"tslib": "^2.8.1",
|
|
42
|
+
"@1inch/sdk-core": "0.1.1"
|
|
57
43
|
},
|
|
58
44
|
"devDependencies": {
|
|
59
45
|
"@types/node": "^22.13.0",
|
|
@@ -68,5 +54,19 @@
|
|
|
68
54
|
},
|
|
69
55
|
"publishConfig": {
|
|
70
56
|
"access": "public"
|
|
57
|
+
},
|
|
58
|
+
"scripts": {
|
|
59
|
+
"build": "rm -rf dist && tsdown",
|
|
60
|
+
"test": "vitest run",
|
|
61
|
+
"test:e2e": "vitest run --config vitest.e2e.config.mts",
|
|
62
|
+
"test:watch": "vitest watch",
|
|
63
|
+
"test:coverage": "vitest run --coverage",
|
|
64
|
+
"lint": "eslint .",
|
|
65
|
+
"lint:fix": "eslint . --fix",
|
|
66
|
+
"format": "prettier --write \"src/**/*.ts\"",
|
|
67
|
+
"format:check": "prettier --check \"src/**/*.ts\"",
|
|
68
|
+
"type-check": "tsc --noEmit",
|
|
69
|
+
"clean": "rimraf dist node_modules",
|
|
70
|
+
"changelog:generate": "changelog generate -a"
|
|
71
71
|
}
|
|
72
|
-
}
|
|
72
|
+
}
|
package/dist/swap-vm/instructions/concentrate/concentrate-grow-liquidity-xd-args-coder.d.mts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { HexString } from '@1inch/sdk-core';
|
|
2
|
-
import { ConcentrateGrowLiquidityXDArgs } from './concentrate-grow-liquidity-xd-args';
|
|
3
|
-
import type { IArgsCoder } from '../types';
|
|
4
|
-
export declare class ConcentrateGrowLiquidityXDArgsCoder implements IArgsCoder<ConcentrateGrowLiquidityXDArgs> {
|
|
5
|
-
encode(args: ConcentrateGrowLiquidityXDArgs): HexString;
|
|
6
|
-
decode(data: HexString): ConcentrateGrowLiquidityXDArgs;
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { HexString } from '@1inch/sdk-core';
|
|
2
|
-
import { ConcentrateGrowLiquidityXDArgs } from './concentrate-grow-liquidity-xd-args';
|
|
3
|
-
import type { IArgsCoder } from '../types';
|
|
4
|
-
export declare class ConcentrateGrowLiquidityXDArgsCoder implements IArgsCoder<ConcentrateGrowLiquidityXDArgs> {
|
|
5
|
-
encode(args: ConcentrateGrowLiquidityXDArgs): HexString;
|
|
6
|
-
decode(data: HexString): ConcentrateGrowLiquidityXDArgs;
|
|
7
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { HexString } from '@1inch/sdk-core';
|
|
2
|
-
import type { TokenDelta } from './types';
|
|
3
|
-
import type { IArgsData } from '../types';
|
|
4
|
-
/**
|
|
5
|
-
* Arguments for concentrateGrowLiquidityXD instruction with multiple token deltas
|
|
6
|
-
* @see https://github.com/1inch/swap-vm/blob/main/src/instructions/XYCConcentrate.sol#L139
|
|
7
|
-
**/
|
|
8
|
-
export declare class ConcentrateGrowLiquidityXDArgs implements IArgsData {
|
|
9
|
-
readonly tokenDeltas: TokenDelta[];
|
|
10
|
-
static readonly CODER: any;
|
|
11
|
-
constructor(tokenDeltas: TokenDelta[]);
|
|
12
|
-
/**
|
|
13
|
-
* Decodes hex data into ConcentrateGrowLiquidityXDArgs instance
|
|
14
|
-
**/
|
|
15
|
-
static decode(data: HexString): ConcentrateGrowLiquidityXDArgs;
|
|
16
|
-
toJSON(): Record<string, unknown>;
|
|
17
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { HexString } from '@1inch/sdk-core';
|
|
2
|
-
import type { TokenDelta } from './types';
|
|
3
|
-
import type { IArgsData } from '../types';
|
|
4
|
-
/**
|
|
5
|
-
* Arguments for concentrateGrowLiquidityXD instruction with multiple token deltas
|
|
6
|
-
* @see https://github.com/1inch/swap-vm/blob/main/src/instructions/XYCConcentrate.sol#L139
|
|
7
|
-
**/
|
|
8
|
-
export declare class ConcentrateGrowLiquidityXDArgs implements IArgsData {
|
|
9
|
-
readonly tokenDeltas: TokenDelta[];
|
|
10
|
-
static readonly CODER: any;
|
|
11
|
-
constructor(tokenDeltas: TokenDelta[]);
|
|
12
|
-
/**
|
|
13
|
-
* Decodes hex data into ConcentrateGrowLiquidityXDArgs instance
|
|
14
|
-
**/
|
|
15
|
-
static decode(data: HexString): ConcentrateGrowLiquidityXDArgs;
|
|
16
|
-
toJSON(): Record<string, unknown>;
|
|
17
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { HexString } from '@1inch/sdk-core';
|
|
2
|
-
import { StableSwap2DArgs } from './stable-swap-2d-args';
|
|
3
|
-
import type { IArgsCoder } from '../types';
|
|
4
|
-
export declare class StableSwap2DArgsCoder implements IArgsCoder<StableSwap2DArgs> {
|
|
5
|
-
encode(args: StableSwap2DArgs): HexString;
|
|
6
|
-
decode(data: HexString): StableSwap2DArgs;
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { HexString } from '@1inch/sdk-core';
|
|
2
|
-
import { StableSwap2DArgs } from './stable-swap-2d-args';
|
|
3
|
-
import type { IArgsCoder } from '../types';
|
|
4
|
-
export declare class StableSwap2DArgsCoder implements IArgsCoder<StableSwap2DArgs> {
|
|
5
|
-
encode(args: StableSwap2DArgs): HexString;
|
|
6
|
-
decode(data: HexString): StableSwap2DArgs;
|
|
7
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { Address, HexString } from '@1inch/sdk-core';
|
|
2
|
-
import type { IArgsData } from '../types';
|
|
3
|
-
/**
|
|
4
|
-
* Arguments for stableSwap2D instruction for stablecoin optimized swaps
|
|
5
|
-
**/
|
|
6
|
-
export declare class StableSwap2DArgs implements IArgsData {
|
|
7
|
-
readonly fee: bigint;
|
|
8
|
-
readonly A: bigint;
|
|
9
|
-
readonly rateLt: bigint;
|
|
10
|
-
readonly rateGt: bigint;
|
|
11
|
-
static readonly CODER: any;
|
|
12
|
-
/**
|
|
13
|
-
* fee - swap fee in 1e10 (uint32)
|
|
14
|
-
* A - amplification coefficient (uint32)
|
|
15
|
-
* rateLt - rate for token with lower address (uint256)
|
|
16
|
-
* rateGt - rate for token with higher address (uint256)
|
|
17
|
-
**/
|
|
18
|
-
constructor(fee: bigint, A: bigint, rateLt: bigint, rateGt: bigint);
|
|
19
|
-
static fromTokens(fee: bigint, a: bigint, tokenA: Address, tokenB: Address, rateA: bigint, rateB: bigint): StableSwap2DArgs;
|
|
20
|
-
/**
|
|
21
|
-
* Decodes hex data into StableSwap2DArgs instance
|
|
22
|
-
**/
|
|
23
|
-
static decode(data: HexString): StableSwap2DArgs;
|
|
24
|
-
toJSON(): Record<string, unknown>;
|
|
25
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { Address, HexString } from '@1inch/sdk-core';
|
|
2
|
-
import type { IArgsData } from '../types';
|
|
3
|
-
/**
|
|
4
|
-
* Arguments for stableSwap2D instruction for stablecoin optimized swaps
|
|
5
|
-
**/
|
|
6
|
-
export declare class StableSwap2DArgs implements IArgsData {
|
|
7
|
-
readonly fee: bigint;
|
|
8
|
-
readonly A: bigint;
|
|
9
|
-
readonly rateLt: bigint;
|
|
10
|
-
readonly rateGt: bigint;
|
|
11
|
-
static readonly CODER: any;
|
|
12
|
-
/**
|
|
13
|
-
* fee - swap fee in 1e10 (uint32)
|
|
14
|
-
* A - amplification coefficient (uint32)
|
|
15
|
-
* rateLt - rate for token with lower address (uint256)
|
|
16
|
-
* rateGt - rate for token with higher address (uint256)
|
|
17
|
-
**/
|
|
18
|
-
constructor(fee: bigint, A: bigint, rateLt: bigint, rateGt: bigint);
|
|
19
|
-
static fromTokens(fee: bigint, a: bigint, tokenA: Address, tokenB: Address, rateA: bigint, rateB: bigint): StableSwap2DArgs;
|
|
20
|
-
/**
|
|
21
|
-
* Decodes hex data into StableSwap2DArgs instance
|
|
22
|
-
**/
|
|
23
|
-
static decode(data: HexString): StableSwap2DArgs;
|
|
24
|
-
toJSON(): Record<string, unknown>;
|
|
25
|
-
}
|