@1inch/swap-vm-sdk 0.1.0 → 0.1.2-rc.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 (84) hide show
  1. package/README.md +26 -25
  2. package/dist/abi/SwapVM.abi.d.mts +76 -0
  3. package/dist/abi/SwapVM.abi.d.ts +76 -0
  4. package/dist/index.js +641 -367
  5. package/dist/index.mjs +642 -370
  6. package/dist/swap-vm/instructions/concentrate/bigint-sqrt.d.mts +1 -0
  7. package/dist/swap-vm/instructions/concentrate/bigint-sqrt.d.ts +1 -0
  8. package/dist/swap-vm/instructions/concentrate/concentrate-grow-liquidity-2d-args.d.mts +16 -7
  9. package/dist/swap-vm/instructions/concentrate/concentrate-grow-liquidity-2d-args.d.ts +16 -7
  10. package/dist/swap-vm/instructions/concentrate/concentrate-liquidity-calculator/types.d.mts +39 -0
  11. package/dist/swap-vm/instructions/concentrate/concentrate-liquidity-calculator/types.d.ts +39 -0
  12. package/dist/swap-vm/instructions/concentrate/concentrate-liquidity-math/concentrate-liquidity-math.d.mts +51 -0
  13. package/dist/swap-vm/instructions/concentrate/concentrate-liquidity-math/concentrate-liquidity-math.d.ts +51 -0
  14. package/dist/swap-vm/instructions/concentrate/index.d.mts +4 -4
  15. package/dist/swap-vm/instructions/concentrate/index.d.ts +4 -4
  16. package/dist/swap-vm/instructions/concentrate/opcodes.d.mts +0 -5
  17. package/dist/swap-vm/instructions/concentrate/opcodes.d.ts +0 -5
  18. package/dist/swap-vm/instructions/dutch-auction/dutch-auction-args.d.mts +1 -2
  19. package/dist/swap-vm/instructions/dutch-auction/dutch-auction-args.d.ts +1 -2
  20. package/dist/swap-vm/instructions/fee/dynamic-protocol-fee/dynamic-protocol-fee-args-coder.d.mts +7 -0
  21. package/dist/swap-vm/instructions/fee/dynamic-protocol-fee/dynamic-protocol-fee-args-coder.d.ts +7 -0
  22. package/dist/swap-vm/instructions/fee/dynamic-protocol-fee/dynamic-protocol-fee-args.d.mts +13 -0
  23. package/dist/swap-vm/instructions/fee/dynamic-protocol-fee/dynamic-protocol-fee-args.d.ts +13 -0
  24. package/dist/swap-vm/instructions/fee/{flat-fee-args-coder.d.mts → flat-fee/flat-fee-args-coder.d.mts} +1 -1
  25. package/dist/swap-vm/instructions/fee/{flat-fee-args-coder.d.ts → flat-fee/flat-fee-args-coder.d.ts} +1 -1
  26. package/dist/swap-vm/instructions/fee/{flat-fee-args.d.mts → flat-fee/flat-fee-args.d.mts} +2 -2
  27. package/dist/swap-vm/instructions/fee/{flat-fee-args.d.ts → flat-fee/flat-fee-args.d.ts} +2 -2
  28. package/dist/swap-vm/instructions/fee/index.d.mts +3 -2
  29. package/dist/swap-vm/instructions/fee/index.d.ts +3 -2
  30. package/dist/swap-vm/instructions/fee/opcodes.d.mts +28 -8
  31. package/dist/swap-vm/instructions/fee/opcodes.d.ts +28 -8
  32. package/dist/swap-vm/instructions/fee/{protocol-fee-args-coder.d.mts → protocol-fee/protocol-fee-args-coder.d.mts} +1 -1
  33. package/dist/swap-vm/instructions/fee/{protocol-fee-args-coder.d.ts → protocol-fee/protocol-fee-args-coder.d.ts} +1 -1
  34. package/dist/swap-vm/instructions/fee/{protocol-fee-args.d.mts → protocol-fee/protocol-fee-args.d.mts} +3 -3
  35. package/dist/swap-vm/instructions/fee/{protocol-fee-args.d.ts → protocol-fee/protocol-fee-args.d.ts} +3 -3
  36. package/dist/swap-vm/instructions/index.d.mts +2 -1
  37. package/dist/swap-vm/instructions/index.d.ts +2 -1
  38. package/dist/swap-vm/instructions/pegged-swap/index.d.mts +3 -0
  39. package/dist/swap-vm/instructions/pegged-swap/index.d.ts +3 -0
  40. package/dist/swap-vm/instructions/pegged-swap/opcodes.d.mts +5 -0
  41. package/dist/swap-vm/instructions/pegged-swap/opcodes.d.ts +5 -0
  42. package/dist/swap-vm/instructions/pegged-swap/pegged-swap-args-coder.d.mts +7 -0
  43. package/dist/swap-vm/instructions/pegged-swap/pegged-swap-args-coder.d.ts +7 -0
  44. package/dist/swap-vm/instructions/pegged-swap/pegged-swap-args.d.mts +29 -0
  45. package/dist/swap-vm/instructions/pegged-swap/pegged-swap-args.d.ts +29 -0
  46. package/dist/swap-vm/instructions/pegged-swap/rate-resolver.d.mts +1 -0
  47. package/dist/swap-vm/instructions/pegged-swap/rate-resolver.d.ts +1 -0
  48. package/dist/swap-vm/instructions/pegged-swap/types.d.mts +6 -0
  49. package/dist/swap-vm/instructions/pegged-swap/types.d.ts +6 -0
  50. package/dist/swap-vm/programs/aqua-program-builder.d.mts +13 -16
  51. package/dist/swap-vm/programs/aqua-program-builder.d.ts +13 -16
  52. package/dist/swap-vm/programs/regular-program-builder.d.mts +21 -9
  53. package/dist/swap-vm/programs/regular-program-builder.d.ts +21 -9
  54. package/dist/swap-vm/strategies/aqua-amm-strategy.d.mts +2 -19
  55. package/dist/swap-vm/strategies/aqua-amm-strategy.d.ts +2 -19
  56. package/dist/swap-vm/strategies/aqua-pegged-amm-strategy.d.mts +11 -0
  57. package/dist/swap-vm/strategies/aqua-pegged-amm-strategy.d.ts +11 -0
  58. package/dist/swap-vm/strategies/aqua-xyc-amm-strategy.d.mts +11 -0
  59. package/dist/swap-vm/strategies/aqua-xyc-amm-strategy.d.ts +11 -0
  60. package/dist/swap-vm/strategies/index.d.mts +3 -0
  61. package/dist/swap-vm/strategies/index.d.ts +3 -0
  62. package/dist/swap-vm/strategies/types.d.mts +19 -0
  63. package/dist/swap-vm/strategies/types.d.ts +19 -0
  64. package/dist/swap-vm/taker-traits.d.mts +12 -2
  65. package/dist/swap-vm/taker-traits.d.ts +12 -2
  66. package/package.json +18 -18
  67. package/dist/swap-vm/instructions/concentrate/concentrate-grow-liquidity-xd-args-coder.d.mts +0 -7
  68. package/dist/swap-vm/instructions/concentrate/concentrate-grow-liquidity-xd-args-coder.d.ts +0 -7
  69. package/dist/swap-vm/instructions/concentrate/concentrate-grow-liquidity-xd-args.d.mts +0 -17
  70. package/dist/swap-vm/instructions/concentrate/concentrate-grow-liquidity-xd-args.d.ts +0 -17
  71. package/dist/swap-vm/instructions/concentrate/types.d.mts +0 -5
  72. package/dist/swap-vm/instructions/concentrate/types.d.ts +0 -5
  73. package/dist/swap-vm/instructions/concentrate/utils.d.mts +0 -4
  74. package/dist/swap-vm/instructions/concentrate/utils.d.ts +0 -4
  75. package/dist/swap-vm/instructions/stable-swap/index.d.mts +0 -2
  76. package/dist/swap-vm/instructions/stable-swap/index.d.ts +0 -2
  77. package/dist/swap-vm/instructions/stable-swap/opcodes.d.mts +0 -4
  78. package/dist/swap-vm/instructions/stable-swap/opcodes.d.ts +0 -4
  79. package/dist/swap-vm/instructions/stable-swap/stable-swap-2d-args-coder.d.mts +0 -7
  80. package/dist/swap-vm/instructions/stable-swap/stable-swap-2d-args-coder.d.ts +0 -7
  81. package/dist/swap-vm/instructions/stable-swap/stable-swap-2d-args.d.mts +0 -25
  82. package/dist/swap-vm/instructions/stable-swap/stable-swap-2d-args.d.ts +0 -25
  83. package/dist/swap-vm/types.d.mts +0 -22
  84. package/dist/swap-vm/types.d.ts +0 -22
@@ -14,9 +14,10 @@ export * as dutchAuction from './dutch-auction';
14
14
  export * as oraclePriceAdjuster from './oracle-price-adjuster';
15
15
  export * as baseFeeAdjuster from './base-fee-adjuster';
16
16
  export * as twapSwap from './twap-swap';
17
- export * as stableSwap from './stable-swap';
17
+ export * as stableSwap from './pegged-swap';
18
18
  export * as fee from './fee';
19
19
  export * as extruction from './extruction';
20
+ export * as peggedSwap from './pegged-swap';
20
21
  /**
21
22
  * Regular opcodes array - matching SwapVM contract exactly (44 opcodes)
22
23
  * @see https://github.com/1inch/swap-vm/blob/main/src/opcodes/Opcodes.sol#L46
@@ -0,0 +1,3 @@
1
+ export * from './opcodes';
2
+ export { PeggedSwapArgs } from './pegged-swap-args';
3
+ export type { PeggedTokenInfo } from './types';
@@ -0,0 +1,3 @@
1
+ export * from './opcodes';
2
+ export { PeggedSwapArgs } from './pegged-swap-args';
3
+ export type { PeggedTokenInfo } from './types';
@@ -0,0 +1,5 @@
1
+ /**
2
+ * PeggedSwap - Square-root linear swap curve for pegged assets
3
+ * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/PeggedSwap.sol
4
+ **/
5
+ export declare const peggedSwapGrowPriceRange2D: any;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * PeggedSwap - Square-root linear swap curve for pegged assets
3
+ * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/PeggedSwap.sol
4
+ **/
5
+ export declare const peggedSwapGrowPriceRange2D: any;
@@ -0,0 +1,7 @@
1
+ import { HexString } from '@1inch/sdk-core';
2
+ import { PeggedSwapArgs } from './pegged-swap-args';
3
+ import type { IArgsCoder } from '../types';
4
+ export declare class PeggedSwapArgsCoder implements IArgsCoder<PeggedSwapArgs> {
5
+ encode(args: PeggedSwapArgs): HexString;
6
+ decode(data: HexString): PeggedSwapArgs;
7
+ }
@@ -0,0 +1,7 @@
1
+ import { HexString } from '@1inch/sdk-core';
2
+ import { PeggedSwapArgs } from './pegged-swap-args';
3
+ import type { IArgsCoder } from '../types';
4
+ export declare class PeggedSwapArgsCoder implements IArgsCoder<PeggedSwapArgs> {
5
+ encode(args: PeggedSwapArgs): HexString;
6
+ decode(data: HexString): PeggedSwapArgs;
7
+ }
@@ -0,0 +1,29 @@
1
+ import type { HexString } from '@1inch/sdk-core';
2
+ import type { PeggedTokenInfo } from './types';
3
+ import type { IArgsData } from '../types';
4
+ /**
5
+ * Arguments for PeggedSwap._peggedSwapGrowPriceRange2D.
6
+ * 5 × uint256: x0, y0, linearWidth, rateLt, rateGt (160 bytes).
7
+ * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/PeggedSwap.sol
8
+ **/
9
+ export declare class PeggedSwapArgs implements IArgsData {
10
+ readonly x0: bigint;
11
+ readonly y0: bigint;
12
+ readonly linearWidth: bigint;
13
+ readonly rateLt: bigint;
14
+ readonly rateGt: bigint;
15
+ static readonly CODER: any;
16
+ /**
17
+ * x0 - Initial X reserve (normalization factor) = initial_balance_X * rateLt (or rateGt)
18
+ * y0 - Initial Y reserve (normalization factor) = initial_balance_Y * rateGt (or rateLt)
19
+ * linearWidth - Linear component coefficient A scaled by 1e27 (e.g., 0.8e27 for A=0.8)
20
+ * rateLt - Rate multiplier for token with LOWER address
21
+ * rateGt - Rate multiplier for token with GREATER address
22
+ * > For equal decimals (e.g., both 18): rateLt = rateGt = 1
23
+ * > For 18 vs 6 decimals: rate18 = 1, rate6 = 1e12 (to scale up to common precision)
24
+ **/
25
+ constructor(x0: bigint, y0: bigint, linearWidth: bigint, rateLt: bigint, rateGt: bigint);
26
+ static fromTokens(tokenA: PeggedTokenInfo, tokenB: PeggedTokenInfo, linearWidth: bigint): PeggedSwapArgs;
27
+ static decode(data: HexString): PeggedSwapArgs;
28
+ toJSON(): Record<string, unknown>;
29
+ }
@@ -0,0 +1,29 @@
1
+ import type { HexString } from '@1inch/sdk-core';
2
+ import type { PeggedTokenInfo } from './types';
3
+ import type { IArgsData } from '../types';
4
+ /**
5
+ * Arguments for PeggedSwap._peggedSwapGrowPriceRange2D.
6
+ * 5 × uint256: x0, y0, linearWidth, rateLt, rateGt (160 bytes).
7
+ * @see https://github.com/1inch/swap-vm/blob/main/src/instructions/PeggedSwap.sol
8
+ **/
9
+ export declare class PeggedSwapArgs implements IArgsData {
10
+ readonly x0: bigint;
11
+ readonly y0: bigint;
12
+ readonly linearWidth: bigint;
13
+ readonly rateLt: bigint;
14
+ readonly rateGt: bigint;
15
+ static readonly CODER: any;
16
+ /**
17
+ * x0 - Initial X reserve (normalization factor) = initial_balance_X * rateLt (or rateGt)
18
+ * y0 - Initial Y reserve (normalization factor) = initial_balance_Y * rateGt (or rateLt)
19
+ * linearWidth - Linear component coefficient A scaled by 1e27 (e.g., 0.8e27 for A=0.8)
20
+ * rateLt - Rate multiplier for token with LOWER address
21
+ * rateGt - Rate multiplier for token with GREATER address
22
+ * > For equal decimals (e.g., both 18): rateLt = rateGt = 1
23
+ * > For 18 vs 6 decimals: rate18 = 1, rate6 = 1e12 (to scale up to common precision)
24
+ **/
25
+ constructor(x0: bigint, y0: bigint, linearWidth: bigint, rateLt: bigint, rateGt: bigint);
26
+ static fromTokens(tokenA: PeggedTokenInfo, tokenB: PeggedTokenInfo, linearWidth: bigint): PeggedSwapArgs;
27
+ static decode(data: HexString): PeggedSwapArgs;
28
+ toJSON(): Record<string, unknown>;
29
+ }
@@ -0,0 +1 @@
1
+ export declare function resolveRate(tokenADecimals: number, tokenBDecimals: number): bigint;
@@ -0,0 +1 @@
1
+ export declare function resolveRate(tokenADecimals: number, tokenBDecimals: number): bigint;
@@ -0,0 +1,6 @@
1
+ import type { Address } from '@1inch/sdk-core';
2
+ export type PeggedTokenInfo = {
3
+ address: Address;
4
+ decimals: number;
5
+ reserve: bigint;
6
+ };
@@ -0,0 +1,6 @@
1
+ import type { Address } from '@1inch/sdk-core';
2
+ export type PeggedTokenInfo = {
3
+ address: Address;
4
+ decimals: number;
5
+ reserve: bigint;
6
+ };
@@ -5,6 +5,7 @@ import * as controls from '../instructions/controls';
5
5
  import * as concentrate from '../instructions/concentrate';
6
6
  import * as decay from '../instructions/decay';
7
7
  import * as fee from '../instructions/fee';
8
+ import * as peggedSwap from '../instructions/pegged-swap';
8
9
  export declare class AquaProgramBuilder extends ProgramBuilder {
9
10
  constructor();
10
11
  static decode(program: SwapVmProgram): AquaProgramBuilder;
@@ -49,14 +50,14 @@ export declare class AquaProgramBuilder extends ProgramBuilder {
49
50
  * Basic swap using constant product formula (x*y=k)
50
51
  **/
51
52
  xycSwapXD(): this;
52
- /**
53
- * Concentrates liquidity within price bounds for multiple tokens
54
- **/
55
- concentrateGrowLiquidityXD(data: DataFor<concentrate.ConcentrateGrowLiquidityXDArgs>): this;
56
53
  /**
57
54
  * Concentrates liquidity within price bounds for two tokens
58
55
  **/
59
56
  concentrateGrowLiquidity2D(data: DataFor<concentrate.ConcentrateGrowLiquidity2DArgs>): this;
57
+ /**
58
+ * Square-root linear swap curve for pegged assets
59
+ **/
60
+ peggedSwapGrowPriceRange2D(data: DataFor<peggedSwap.PeggedSwapArgs>): this;
60
61
  /**
61
62
  * Applies time-based decay to balance adjustments
62
63
  **/
@@ -66,25 +67,21 @@ export declare class AquaProgramBuilder extends ProgramBuilder {
66
67
  **/
67
68
  flatFeeAmountInXD(data: DataFor<fee.FlatFeeArgs>): this;
68
69
  /**
69
- * Applies fee to amountOut
70
- **/
71
- flatFeeAmountOutXD(data: DataFor<fee.FlatFeeArgs>): this;
72
- /**
73
- * Applies progressive fee to amountIn
70
+ * Applies protocol fee to amountIn with direct transfer
74
71
  **/
75
- progressiveFeeInXD(data: DataFor<fee.FlatFeeArgs>): this;
72
+ protocolFeeAmountInXD(data: DataFor<fee.ProtocolFeeArgs>): this;
76
73
  /**
77
- * Applies progressive fee to amountOut
74
+ * Applies protocol fee to amountIn through Aqua protocol
78
75
  **/
79
- progressiveFeeOutXD(data: DataFor<fee.FlatFeeArgs>): this;
76
+ aquaProtocolFeeAmountInXD(data: DataFor<fee.ProtocolFeeArgs>): this;
80
77
  /**
81
- * Applies protocol fee to amountOut with direct transfer
78
+ * Applies protocol fee, fetched from external contract, to amountIn with direct transfer
82
79
  **/
83
- protocolFeeAmountOutXD(data: DataFor<fee.ProtocolFeeArgs>): this;
80
+ dynamicProtocolFeeAmountInXD(data: DataFor<fee.DynamicProtocolFeeArgs>): this;
84
81
  /**
85
- * Applies protocol fee to amountOut through Aqua protocol
82
+ * Applies protocol fee, fetched from external contract, to amountIn through Aqua protocol
86
83
  **/
87
- aquaProtocolFeeAmountOutXD(data: DataFor<fee.ProtocolFeeArgs>): this;
84
+ aquaDynamicProtocolFeeAmountInXD(data: DataFor<fee.DynamicProtocolFeeArgs>): this;
88
85
  /**
89
86
  * DEBUG: Prints current swap registers (amounts and tokens)
90
87
  * WARNING: Requires withDebug() to be called first, otherwise will throw an error
@@ -5,6 +5,7 @@ import * as controls from '../instructions/controls';
5
5
  import * as concentrate from '../instructions/concentrate';
6
6
  import * as decay from '../instructions/decay';
7
7
  import * as fee from '../instructions/fee';
8
+ import * as peggedSwap from '../instructions/pegged-swap';
8
9
  export declare class AquaProgramBuilder extends ProgramBuilder {
9
10
  constructor();
10
11
  static decode(program: SwapVmProgram): AquaProgramBuilder;
@@ -49,14 +50,14 @@ export declare class AquaProgramBuilder extends ProgramBuilder {
49
50
  * Basic swap using constant product formula (x*y=k)
50
51
  **/
51
52
  xycSwapXD(): this;
52
- /**
53
- * Concentrates liquidity within price bounds for multiple tokens
54
- **/
55
- concentrateGrowLiquidityXD(data: DataFor<concentrate.ConcentrateGrowLiquidityXDArgs>): this;
56
53
  /**
57
54
  * Concentrates liquidity within price bounds for two tokens
58
55
  **/
59
56
  concentrateGrowLiquidity2D(data: DataFor<concentrate.ConcentrateGrowLiquidity2DArgs>): this;
57
+ /**
58
+ * Square-root linear swap curve for pegged assets
59
+ **/
60
+ peggedSwapGrowPriceRange2D(data: DataFor<peggedSwap.PeggedSwapArgs>): this;
60
61
  /**
61
62
  * Applies time-based decay to balance adjustments
62
63
  **/
@@ -66,25 +67,21 @@ export declare class AquaProgramBuilder extends ProgramBuilder {
66
67
  **/
67
68
  flatFeeAmountInXD(data: DataFor<fee.FlatFeeArgs>): this;
68
69
  /**
69
- * Applies fee to amountOut
70
- **/
71
- flatFeeAmountOutXD(data: DataFor<fee.FlatFeeArgs>): this;
72
- /**
73
- * Applies progressive fee to amountIn
70
+ * Applies protocol fee to amountIn with direct transfer
74
71
  **/
75
- progressiveFeeInXD(data: DataFor<fee.FlatFeeArgs>): this;
72
+ protocolFeeAmountInXD(data: DataFor<fee.ProtocolFeeArgs>): this;
76
73
  /**
77
- * Applies progressive fee to amountOut
74
+ * Applies protocol fee to amountIn through Aqua protocol
78
75
  **/
79
- progressiveFeeOutXD(data: DataFor<fee.FlatFeeArgs>): this;
76
+ aquaProtocolFeeAmountInXD(data: DataFor<fee.ProtocolFeeArgs>): this;
80
77
  /**
81
- * Applies protocol fee to amountOut with direct transfer
78
+ * Applies protocol fee, fetched from external contract, to amountIn with direct transfer
82
79
  **/
83
- protocolFeeAmountOutXD(data: DataFor<fee.ProtocolFeeArgs>): this;
80
+ dynamicProtocolFeeAmountInXD(data: DataFor<fee.DynamicProtocolFeeArgs>): this;
84
81
  /**
85
- * Applies protocol fee to amountOut through Aqua protocol
82
+ * Applies protocol fee, fetched from external contract, to amountIn through Aqua protocol
86
83
  **/
87
- aquaProtocolFeeAmountOutXD(data: DataFor<fee.ProtocolFeeArgs>): this;
84
+ aquaDynamicProtocolFeeAmountInXD(data: DataFor<fee.DynamicProtocolFeeArgs>): this;
88
85
  /**
89
86
  * DEBUG: Prints current swap registers (amounts and tokens)
90
87
  * WARNING: Requires withDebug() to be called first, otherwise will throw an error
@@ -5,11 +5,11 @@ import * as balances from '../instructions/balances';
5
5
  import * as controls from '../instructions/controls';
6
6
  import * as invalidators from '../instructions/invalidators';
7
7
  import * as concentrate from '../instructions/concentrate';
8
+ import * as peggedSwap from '../instructions/pegged-swap';
8
9
  import * as decay from '../instructions/decay';
9
10
  import * as limitSwap from '../instructions/limit-swap';
10
11
  import * as minRate from '../instructions/min-rate';
11
12
  import * as dutchAuction from '../instructions/dutch-auction';
12
- import * as oraclePriceAdjuster from '../instructions/oracle-price-adjuster';
13
13
  import * as baseFeeAdjuster from '../instructions/base-fee-adjuster';
14
14
  import * as twapSwap from '../instructions/twap-swap';
15
15
  import * as fee from '../instructions/fee';
@@ -78,14 +78,14 @@ export declare class RegularProgramBuilder extends ProgramBuilder {
78
78
  * Basic swap using constant product formula (x*y=k)
79
79
  **/
80
80
  xycSwapXD(): this;
81
- /**
82
- * Concentrates liquidity within price bounds for multiple tokens
83
- **/
84
- concentrateGrowLiquidityXD(data: DataFor<concentrate.ConcentrateGrowLiquidityXDArgs>): this;
85
81
  /**
86
82
  * Concentrates liquidity within price bounds for two tokens
87
83
  **/
88
84
  concentrateGrowLiquidity2D(data: DataFor<concentrate.ConcentrateGrowLiquidity2DArgs>): this;
85
+ /**
86
+ * Square-root linear swap curve for pegged assets
87
+ **/
88
+ peggedSwapGrowPriceRange2D(data: DataFor<peggedSwap.PeggedSwapArgs>): this;
89
89
  /**
90
90
  * Applies time-based decay to balance adjustments
91
91
  **/
@@ -114,10 +114,6 @@ export declare class RegularProgramBuilder extends ProgramBuilder {
114
114
  * Dutch auction with time-based decay on amountOut
115
115
  **/
116
116
  dutchAuctionBalanceOut1D(data: DataFor<dutchAuction.DutchAuctionArgs>): this;
117
- /**
118
- * Adjusts swap prices based on Chainlink oracle feeds
119
- **/
120
- oraclePriceAdjuster1D(data: DataFor<oraclePriceAdjuster.OraclePriceAdjusterArgs>): this;
121
117
  /**
122
118
  * Adjusts swap prices based on network gas costs
123
119
  **/
@@ -146,14 +142,30 @@ export declare class RegularProgramBuilder extends ProgramBuilder {
146
142
  * Applies progressive fee to amountOut
147
143
  **/
148
144
  progressiveFeeOutXD(data: DataFor<fee.FlatFeeArgs>): this;
145
+ /**
146
+ * Applies protocol fee to amountIn with direct transfer
147
+ **/
148
+ protocolFeeAmountInXD(data: DataFor<fee.ProtocolFeeArgs>): this;
149
149
  /**
150
150
  * Applies protocol fee to amountOut with direct transfer
151
151
  **/
152
152
  protocolFeeAmountOutXD(data: DataFor<fee.ProtocolFeeArgs>): this;
153
+ /**
154
+ * Applies protocol fee to amountIn through Aqua protocol
155
+ **/
156
+ aquaProtocolFeeAmountInXD(data: DataFor<fee.ProtocolFeeArgs>): this;
153
157
  /**
154
158
  * Applies protocol fee to amountOut through Aqua protocol
155
159
  **/
156
160
  aquaProtocolFeeAmountOutXD(data: DataFor<fee.ProtocolFeeArgs>): this;
161
+ /**
162
+ * Applies protocol fee, fetched from external contract, to amountIn with direct transfer
163
+ **/
164
+ dynamicProtocolFeeAmountInXD(data: DataFor<fee.DynamicProtocolFeeArgs>): this;
165
+ /**
166
+ * Applies protocol fee, fetched from external contract, to amountIn through Aqua protocol
167
+ **/
168
+ aquaDynamicProtocolFeeAmountInXD(data: DataFor<fee.DynamicProtocolFeeArgs>): this;
157
169
  /**
158
170
  * DEBUG: Prints current swap registers (amounts and tokens)
159
171
  * WARNING: Requires withDebug() to be called first, otherwise will throw an error
@@ -5,11 +5,11 @@ import * as balances from '../instructions/balances';
5
5
  import * as controls from '../instructions/controls';
6
6
  import * as invalidators from '../instructions/invalidators';
7
7
  import * as concentrate from '../instructions/concentrate';
8
+ import * as peggedSwap from '../instructions/pegged-swap';
8
9
  import * as decay from '../instructions/decay';
9
10
  import * as limitSwap from '../instructions/limit-swap';
10
11
  import * as minRate from '../instructions/min-rate';
11
12
  import * as dutchAuction from '../instructions/dutch-auction';
12
- import * as oraclePriceAdjuster from '../instructions/oracle-price-adjuster';
13
13
  import * as baseFeeAdjuster from '../instructions/base-fee-adjuster';
14
14
  import * as twapSwap from '../instructions/twap-swap';
15
15
  import * as fee from '../instructions/fee';
@@ -78,14 +78,14 @@ export declare class RegularProgramBuilder extends ProgramBuilder {
78
78
  * Basic swap using constant product formula (x*y=k)
79
79
  **/
80
80
  xycSwapXD(): this;
81
- /**
82
- * Concentrates liquidity within price bounds for multiple tokens
83
- **/
84
- concentrateGrowLiquidityXD(data: DataFor<concentrate.ConcentrateGrowLiquidityXDArgs>): this;
85
81
  /**
86
82
  * Concentrates liquidity within price bounds for two tokens
87
83
  **/
88
84
  concentrateGrowLiquidity2D(data: DataFor<concentrate.ConcentrateGrowLiquidity2DArgs>): this;
85
+ /**
86
+ * Square-root linear swap curve for pegged assets
87
+ **/
88
+ peggedSwapGrowPriceRange2D(data: DataFor<peggedSwap.PeggedSwapArgs>): this;
89
89
  /**
90
90
  * Applies time-based decay to balance adjustments
91
91
  **/
@@ -114,10 +114,6 @@ export declare class RegularProgramBuilder extends ProgramBuilder {
114
114
  * Dutch auction with time-based decay on amountOut
115
115
  **/
116
116
  dutchAuctionBalanceOut1D(data: DataFor<dutchAuction.DutchAuctionArgs>): this;
117
- /**
118
- * Adjusts swap prices based on Chainlink oracle feeds
119
- **/
120
- oraclePriceAdjuster1D(data: DataFor<oraclePriceAdjuster.OraclePriceAdjusterArgs>): this;
121
117
  /**
122
118
  * Adjusts swap prices based on network gas costs
123
119
  **/
@@ -146,14 +142,30 @@ export declare class RegularProgramBuilder extends ProgramBuilder {
146
142
  * Applies progressive fee to amountOut
147
143
  **/
148
144
  progressiveFeeOutXD(data: DataFor<fee.FlatFeeArgs>): this;
145
+ /**
146
+ * Applies protocol fee to amountIn with direct transfer
147
+ **/
148
+ protocolFeeAmountInXD(data: DataFor<fee.ProtocolFeeArgs>): this;
149
149
  /**
150
150
  * Applies protocol fee to amountOut with direct transfer
151
151
  **/
152
152
  protocolFeeAmountOutXD(data: DataFor<fee.ProtocolFeeArgs>): this;
153
+ /**
154
+ * Applies protocol fee to amountIn through Aqua protocol
155
+ **/
156
+ aquaProtocolFeeAmountInXD(data: DataFor<fee.ProtocolFeeArgs>): this;
153
157
  /**
154
158
  * Applies protocol fee to amountOut through Aqua protocol
155
159
  **/
156
160
  aquaProtocolFeeAmountOutXD(data: DataFor<fee.ProtocolFeeArgs>): this;
161
+ /**
162
+ * Applies protocol fee, fetched from external contract, to amountIn with direct transfer
163
+ **/
164
+ dynamicProtocolFeeAmountInXD(data: DataFor<fee.DynamicProtocolFeeArgs>): this;
165
+ /**
166
+ * Applies protocol fee, fetched from external contract, to amountIn through Aqua protocol
167
+ **/
168
+ aquaDynamicProtocolFeeAmountInXD(data: DataFor<fee.DynamicProtocolFeeArgs>): this;
157
169
  /**
158
170
  * DEBUG: Prints current swap registers (amounts and tokens)
159
171
  * WARNING: Requires withDebug() to be called first, otherwise will throw an error
@@ -1,32 +1,15 @@
1
1
  import type { Address } from '@1inch/sdk-core';
2
- import type { SwapVmProgram } from '../programs';
3
- /**
4
- * Aqua AMM Strategy builder that mirrors AquaAMM.sol
5
- * @see https://github.com/1inch/swap-vm/blob/main/src/strategies/AquaAMM.sol
6
- */
7
- export declare class AquaAMMStrategy {
8
- readonly tokenA: Address;
9
- readonly tokenB: Address;
2
+ export declare abstract class AquaAMMStrategy {
10
3
  feeBpsIn?: number;
11
- deltas?: {
12
- a: bigint;
13
- b: bigint;
14
- };
15
4
  decayPeriod?: bigint;
16
5
  protocolFee?: {
17
6
  bps: number;
18
7
  receiver: Address;
19
8
  };
20
9
  salt?: bigint;
21
- constructor(tokenA: Address, tokenB: Address);
22
- static new(tokens: {
23
- tokenA: Address;
24
- tokenB: Address;
25
- }): AquaAMMStrategy;
10
+ protected constructor();
26
11
  withProtocolFee(bps: number, receiver: Address): this;
27
- withDeltas(a: bigint, b: bigint): this;
28
12
  withDecayPeriod(decayPeriod: bigint): this;
29
13
  withFeeTokenIn(bps: number): this;
30
14
  withSalt(salt: bigint): this;
31
- build(): SwapVmProgram;
32
15
  }
@@ -1,32 +1,15 @@
1
1
  import type { Address } from '@1inch/sdk-core';
2
- import type { SwapVmProgram } from '../programs';
3
- /**
4
- * Aqua AMM Strategy builder that mirrors AquaAMM.sol
5
- * @see https://github.com/1inch/swap-vm/blob/main/src/strategies/AquaAMM.sol
6
- */
7
- export declare class AquaAMMStrategy {
8
- readonly tokenA: Address;
9
- readonly tokenB: Address;
2
+ export declare abstract class AquaAMMStrategy {
10
3
  feeBpsIn?: number;
11
- deltas?: {
12
- a: bigint;
13
- b: bigint;
14
- };
15
4
  decayPeriod?: bigint;
16
5
  protocolFee?: {
17
6
  bps: number;
18
7
  receiver: Address;
19
8
  };
20
9
  salt?: bigint;
21
- constructor(tokenA: Address, tokenB: Address);
22
- static new(tokens: {
23
- tokenA: Address;
24
- tokenB: Address;
25
- }): AquaAMMStrategy;
10
+ protected constructor();
26
11
  withProtocolFee(bps: number, receiver: Address): this;
27
- withDeltas(a: bigint, b: bigint): this;
28
12
  withDecayPeriod(decayPeriod: bigint): this;
29
13
  withFeeTokenIn(bps: number): this;
30
14
  withSalt(salt: bigint): this;
31
- build(): SwapVmProgram;
32
15
  }
@@ -0,0 +1,11 @@
1
+ import { AquaAMMStrategy } from './aqua-amm-strategy';
2
+ import type { PeggedArgs, PeggedTokenInfo } from './types';
3
+ import type { SwapVmProgram } from '../programs';
4
+ export declare class AquaPeggedAmmStrategy extends AquaAMMStrategy {
5
+ readonly tokenA: PeggedTokenInfo;
6
+ readonly tokenB: PeggedTokenInfo;
7
+ readonly linearWidth: bigint;
8
+ constructor(tokenA: PeggedTokenInfo, tokenB: PeggedTokenInfo, linearWidth: bigint);
9
+ static new(data: PeggedArgs): AquaPeggedAmmStrategy;
10
+ build(): SwapVmProgram;
11
+ }
@@ -0,0 +1,11 @@
1
+ import { AquaAMMStrategy } from './aqua-amm-strategy';
2
+ import type { PeggedArgs, PeggedTokenInfo } from './types';
3
+ import type { SwapVmProgram } from '../programs';
4
+ export declare class AquaPeggedAmmStrategy extends AquaAMMStrategy {
5
+ readonly tokenA: PeggedTokenInfo;
6
+ readonly tokenB: PeggedTokenInfo;
7
+ readonly linearWidth: bigint;
8
+ constructor(tokenA: PeggedTokenInfo, tokenB: PeggedTokenInfo, linearWidth: bigint);
9
+ static new(data: PeggedArgs): AquaPeggedAmmStrategy;
10
+ build(): SwapVmProgram;
11
+ }
@@ -0,0 +1,11 @@
1
+ import { AquaAMMStrategy } from './aqua-amm-strategy';
2
+ import type { ConcentrateRawPrices, ConcentrateSqrtPrices } from './types';
3
+ import type { SwapVmProgram } from '../programs';
4
+ import * as concentrate from '../instructions/concentrate';
5
+ export declare class AquaXYCAmmStrategy extends AquaAMMStrategy {
6
+ readonly xycConcentrateArgs?: concentrate.ConcentrateGrowLiquidity2DArgs;
7
+ constructor(xycConcentrateArgs?: concentrate.ConcentrateGrowLiquidity2DArgs);
8
+ static new(): AquaXYCAmmStrategy;
9
+ static newConcentrate(prices: ConcentrateRawPrices | ConcentrateSqrtPrices): AquaXYCAmmStrategy;
10
+ build(): SwapVmProgram;
11
+ }
@@ -0,0 +1,11 @@
1
+ import { AquaAMMStrategy } from './aqua-amm-strategy';
2
+ import type { ConcentrateRawPrices, ConcentrateSqrtPrices } from './types';
3
+ import type { SwapVmProgram } from '../programs';
4
+ import * as concentrate from '../instructions/concentrate';
5
+ export declare class AquaXYCAmmStrategy extends AquaAMMStrategy {
6
+ readonly xycConcentrateArgs?: concentrate.ConcentrateGrowLiquidity2DArgs;
7
+ constructor(xycConcentrateArgs?: concentrate.ConcentrateGrowLiquidity2DArgs);
8
+ static new(): AquaXYCAmmStrategy;
9
+ static newConcentrate(prices: ConcentrateRawPrices | ConcentrateSqrtPrices): AquaXYCAmmStrategy;
10
+ build(): SwapVmProgram;
11
+ }
@@ -1 +1,4 @@
1
1
  export * from './aqua-amm-strategy';
2
+ export * from './aqua-xyc-amm-strategy';
3
+ export * from './aqua-pegged-amm-strategy';
4
+ export * from './types';
@@ -1 +1,4 @@
1
1
  export * from './aqua-amm-strategy';
2
+ export * from './aqua-xyc-amm-strategy';
3
+ export * from './aqua-pegged-amm-strategy';
4
+ export * from './types';
@@ -0,0 +1,19 @@
1
+ import type { Address } from '@1inch/sdk-core';
2
+ export type PeggedTokenInfo = {
3
+ address: Address;
4
+ decimals: number;
5
+ reserve: bigint;
6
+ };
7
+ export type PeggedArgs = {
8
+ tokenA: PeggedTokenInfo;
9
+ tokenB: PeggedTokenInfo;
10
+ linearWidth: bigint;
11
+ };
12
+ export type ConcentrateSqrtPrices = {
13
+ sqrtPriceMin: bigint;
14
+ sqrtPriceMax: bigint;
15
+ };
16
+ export type ConcentrateRawPrices = {
17
+ rawPriceMin: bigint;
18
+ rawPriceMax: bigint;
19
+ };
@@ -0,0 +1,19 @@
1
+ import type { Address } from '@1inch/sdk-core';
2
+ export type PeggedTokenInfo = {
3
+ address: Address;
4
+ decimals: number;
5
+ reserve: bigint;
6
+ };
7
+ export type PeggedArgs = {
8
+ tokenA: PeggedTokenInfo;
9
+ tokenB: PeggedTokenInfo;
10
+ linearWidth: bigint;
11
+ };
12
+ export type ConcentrateSqrtPrices = {
13
+ sqrtPriceMin: bigint;
14
+ sqrtPriceMax: bigint;
15
+ };
16
+ export type ConcentrateRawPrices = {
17
+ rawPriceMin: bigint;
18
+ rawPriceMax: bigint;
19
+ };
@@ -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
- * - 18 bytes: 9 uint16 offsets for data sections
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;