@1inch/swap-vm-sdk 0.1.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 (241) hide show
  1. package/LICENSE +103 -0
  2. package/README.md +584 -0
  3. package/dist/abi/SwapVM.abi.d.mts +403 -0
  4. package/dist/abi/SwapVM.abi.d.ts +403 -0
  5. package/dist/abi/index.d.mts +1 -0
  6. package/dist/abi/index.d.ts +1 -0
  7. package/dist/index.d.mts +4 -0
  8. package/dist/index.d.ts +4 -0
  9. package/dist/index.js +3842 -0
  10. package/dist/index.mjs +3777 -0
  11. package/dist/swap-vm/index.d.mts +6 -0
  12. package/dist/swap-vm/index.d.ts +6 -0
  13. package/dist/swap-vm/instructions/balances/balances-args-coder.d.mts +7 -0
  14. package/dist/swap-vm/instructions/balances/balances-args-coder.d.ts +7 -0
  15. package/dist/swap-vm/instructions/balances/balances-args.d.mts +17 -0
  16. package/dist/swap-vm/instructions/balances/balances-args.d.ts +17 -0
  17. package/dist/swap-vm/instructions/balances/index.d.mts +3 -0
  18. package/dist/swap-vm/instructions/balances/index.d.ts +3 -0
  19. package/dist/swap-vm/instructions/balances/opcodes.d.mts +12 -0
  20. package/dist/swap-vm/instructions/balances/opcodes.d.ts +12 -0
  21. package/dist/swap-vm/instructions/balances/types.d.mts +5 -0
  22. package/dist/swap-vm/instructions/balances/types.d.ts +5 -0
  23. package/dist/swap-vm/instructions/base-fee-adjuster/base-fee-adjuster-args-coder.d.mts +7 -0
  24. package/dist/swap-vm/instructions/base-fee-adjuster/base-fee-adjuster-args-coder.d.ts +7 -0
  25. package/dist/swap-vm/instructions/base-fee-adjuster/base-fee-adjuster-args.d.mts +40 -0
  26. package/dist/swap-vm/instructions/base-fee-adjuster/base-fee-adjuster-args.d.ts +40 -0
  27. package/dist/swap-vm/instructions/base-fee-adjuster/index.d.mts +2 -0
  28. package/dist/swap-vm/instructions/base-fee-adjuster/index.d.ts +2 -0
  29. package/dist/swap-vm/instructions/base-fee-adjuster/opcodes.d.mts +5 -0
  30. package/dist/swap-vm/instructions/base-fee-adjuster/opcodes.d.ts +5 -0
  31. package/dist/swap-vm/instructions/concentrate/concentrate-grow-liquidity-2d-args-coder.d.mts +7 -0
  32. package/dist/swap-vm/instructions/concentrate/concentrate-grow-liquidity-2d-args-coder.d.ts +7 -0
  33. package/dist/swap-vm/instructions/concentrate/concentrate-grow-liquidity-2d-args.d.mts +21 -0
  34. package/dist/swap-vm/instructions/concentrate/concentrate-grow-liquidity-2d-args.d.ts +21 -0
  35. package/dist/swap-vm/instructions/concentrate/concentrate-grow-liquidity-xd-args-coder.d.mts +7 -0
  36. package/dist/swap-vm/instructions/concentrate/concentrate-grow-liquidity-xd-args-coder.d.ts +7 -0
  37. package/dist/swap-vm/instructions/concentrate/concentrate-grow-liquidity-xd-args.d.mts +17 -0
  38. package/dist/swap-vm/instructions/concentrate/concentrate-grow-liquidity-xd-args.d.ts +17 -0
  39. package/dist/swap-vm/instructions/concentrate/index.d.mts +5 -0
  40. package/dist/swap-vm/instructions/concentrate/index.d.ts +5 -0
  41. package/dist/swap-vm/instructions/concentrate/opcodes.d.mts +10 -0
  42. package/dist/swap-vm/instructions/concentrate/opcodes.d.ts +10 -0
  43. package/dist/swap-vm/instructions/concentrate/types.d.mts +5 -0
  44. package/dist/swap-vm/instructions/concentrate/types.d.ts +5 -0
  45. package/dist/swap-vm/instructions/concentrate/utils.d.mts +4 -0
  46. package/dist/swap-vm/instructions/concentrate/utils.d.ts +4 -0
  47. package/dist/swap-vm/instructions/controls/deadline-args-coder.d.mts +7 -0
  48. package/dist/swap-vm/instructions/controls/deadline-args-coder.d.ts +7 -0
  49. package/dist/swap-vm/instructions/controls/deadline-args.d.mts +9 -0
  50. package/dist/swap-vm/instructions/controls/deadline-args.d.ts +9 -0
  51. package/dist/swap-vm/instructions/controls/index.d.mts +8 -0
  52. package/dist/swap-vm/instructions/controls/index.d.ts +8 -0
  53. package/dist/swap-vm/instructions/controls/jump-args-coder.d.mts +7 -0
  54. package/dist/swap-vm/instructions/controls/jump-args-coder.d.ts +7 -0
  55. package/dist/swap-vm/instructions/controls/jump-args.d.mts +16 -0
  56. package/dist/swap-vm/instructions/controls/jump-args.d.ts +16 -0
  57. package/dist/swap-vm/instructions/controls/jump-if-token-args-coder.d.mts +7 -0
  58. package/dist/swap-vm/instructions/controls/jump-if-token-args-coder.d.ts +7 -0
  59. package/dist/swap-vm/instructions/controls/jump-if-token-args.d.mts +10 -0
  60. package/dist/swap-vm/instructions/controls/jump-if-token-args.d.ts +10 -0
  61. package/dist/swap-vm/instructions/controls/only-taker-token-balance-gte-args-coder.d.mts +7 -0
  62. package/dist/swap-vm/instructions/controls/only-taker-token-balance-gte-args-coder.d.ts +7 -0
  63. package/dist/swap-vm/instructions/controls/only-taker-token-balance-gte-args.d.mts +17 -0
  64. package/dist/swap-vm/instructions/controls/only-taker-token-balance-gte-args.d.ts +17 -0
  65. package/dist/swap-vm/instructions/controls/only-taker-token-balance-non-zero-args-coder.d.mts +7 -0
  66. package/dist/swap-vm/instructions/controls/only-taker-token-balance-non-zero-args-coder.d.ts +7 -0
  67. package/dist/swap-vm/instructions/controls/only-taker-token-balance-non-zero-args.d.mts +16 -0
  68. package/dist/swap-vm/instructions/controls/only-taker-token-balance-non-zero-args.d.ts +16 -0
  69. package/dist/swap-vm/instructions/controls/only-taker-token-supply-share-gte-args-coder.d.mts +7 -0
  70. package/dist/swap-vm/instructions/controls/only-taker-token-supply-share-gte-args-coder.d.ts +7 -0
  71. package/dist/swap-vm/instructions/controls/only-taker-token-supply-share-gte-args.d.mts +18 -0
  72. package/dist/swap-vm/instructions/controls/only-taker-token-supply-share-gte-args.d.ts +18 -0
  73. package/dist/swap-vm/instructions/controls/opcodes.d.mts +36 -0
  74. package/dist/swap-vm/instructions/controls/opcodes.d.ts +36 -0
  75. package/dist/swap-vm/instructions/controls/salt-args-coder.d.mts +7 -0
  76. package/dist/swap-vm/instructions/controls/salt-args-coder.d.ts +7 -0
  77. package/dist/swap-vm/instructions/controls/salt-args.d.mts +16 -0
  78. package/dist/swap-vm/instructions/controls/salt-args.d.ts +16 -0
  79. package/dist/swap-vm/instructions/debug/debug-args.d.mts +8 -0
  80. package/dist/swap-vm/instructions/debug/debug-args.d.ts +8 -0
  81. package/dist/swap-vm/instructions/debug/debug-empty-args.d.mts +19 -0
  82. package/dist/swap-vm/instructions/debug/debug-empty-args.d.ts +19 -0
  83. package/dist/swap-vm/instructions/debug/opcodes.d.mts +18 -0
  84. package/dist/swap-vm/instructions/debug/opcodes.d.ts +18 -0
  85. package/dist/swap-vm/instructions/debug/print-amount-for-swap.d.mts +16 -0
  86. package/dist/swap-vm/instructions/debug/print-amount-for-swap.d.ts +16 -0
  87. package/dist/swap-vm/instructions/debug/print-context.d.mts +16 -0
  88. package/dist/swap-vm/instructions/debug/print-context.d.ts +16 -0
  89. package/dist/swap-vm/instructions/debug/print-free-memory-pointer.d.mts +16 -0
  90. package/dist/swap-vm/instructions/debug/print-free-memory-pointer.d.ts +16 -0
  91. package/dist/swap-vm/instructions/debug/print-gas-left.d.mts +16 -0
  92. package/dist/swap-vm/instructions/debug/print-gas-left.d.ts +16 -0
  93. package/dist/swap-vm/instructions/debug/print-swap-query.d.mts +16 -0
  94. package/dist/swap-vm/instructions/debug/print-swap-query.d.ts +16 -0
  95. package/dist/swap-vm/instructions/debug/print-swap-registers.d.mts +16 -0
  96. package/dist/swap-vm/instructions/debug/print-swap-registers.d.ts +16 -0
  97. package/dist/swap-vm/instructions/decay/decay-xd-args-coder.d.mts +7 -0
  98. package/dist/swap-vm/instructions/decay/decay-xd-args-coder.d.ts +7 -0
  99. package/dist/swap-vm/instructions/decay/decay-xd-args.d.mts +16 -0
  100. package/dist/swap-vm/instructions/decay/decay-xd-args.d.ts +16 -0
  101. package/dist/swap-vm/instructions/decay/index.d.mts +2 -0
  102. package/dist/swap-vm/instructions/decay/index.d.ts +2 -0
  103. package/dist/swap-vm/instructions/decay/opcodes.d.mts +5 -0
  104. package/dist/swap-vm/instructions/decay/opcodes.d.ts +5 -0
  105. package/dist/swap-vm/instructions/dutch-auction/dutch-auction-args-coder.d.mts +7 -0
  106. package/dist/swap-vm/instructions/dutch-auction/dutch-auction-args-coder.d.ts +7 -0
  107. package/dist/swap-vm/instructions/dutch-auction/dutch-auction-args.d.mts +44 -0
  108. package/dist/swap-vm/instructions/dutch-auction/dutch-auction-args.d.ts +44 -0
  109. package/dist/swap-vm/instructions/dutch-auction/index.d.mts +2 -0
  110. package/dist/swap-vm/instructions/dutch-auction/index.d.ts +2 -0
  111. package/dist/swap-vm/instructions/dutch-auction/opcodes.d.mts +10 -0
  112. package/dist/swap-vm/instructions/dutch-auction/opcodes.d.ts +10 -0
  113. package/dist/swap-vm/instructions/empty.d.mts +13 -0
  114. package/dist/swap-vm/instructions/empty.d.ts +13 -0
  115. package/dist/swap-vm/instructions/extruction/extruction-args-coder.d.mts +7 -0
  116. package/dist/swap-vm/instructions/extruction/extruction-args-coder.d.ts +7 -0
  117. package/dist/swap-vm/instructions/extruction/extruction-args.d.mts +21 -0
  118. package/dist/swap-vm/instructions/extruction/extruction-args.d.ts +21 -0
  119. package/dist/swap-vm/instructions/extruction/index.d.mts +2 -0
  120. package/dist/swap-vm/instructions/extruction/index.d.ts +2 -0
  121. package/dist/swap-vm/instructions/extruction/opcodes.d.mts +5 -0
  122. package/dist/swap-vm/instructions/extruction/opcodes.d.ts +5 -0
  123. package/dist/swap-vm/instructions/fee/flat-fee-args-coder.d.mts +7 -0
  124. package/dist/swap-vm/instructions/fee/flat-fee-args-coder.d.ts +7 -0
  125. package/dist/swap-vm/instructions/fee/flat-fee-args.d.mts +28 -0
  126. package/dist/swap-vm/instructions/fee/flat-fee-args.d.ts +28 -0
  127. package/dist/swap-vm/instructions/fee/index.d.mts +3 -0
  128. package/dist/swap-vm/instructions/fee/index.d.ts +3 -0
  129. package/dist/swap-vm/instructions/fee/opcodes.d.mts +30 -0
  130. package/dist/swap-vm/instructions/fee/opcodes.d.ts +30 -0
  131. package/dist/swap-vm/instructions/fee/protocol-fee-args-coder.d.mts +7 -0
  132. package/dist/swap-vm/instructions/fee/protocol-fee-args-coder.d.ts +7 -0
  133. package/dist/swap-vm/instructions/fee/protocol-fee-args.d.mts +35 -0
  134. package/dist/swap-vm/instructions/fee/protocol-fee-args.d.ts +35 -0
  135. package/dist/swap-vm/instructions/index.d.mts +29 -0
  136. package/dist/swap-vm/instructions/index.d.ts +29 -0
  137. package/dist/swap-vm/instructions/instruction.d.mts +7 -0
  138. package/dist/swap-vm/instructions/instruction.d.ts +7 -0
  139. package/dist/swap-vm/instructions/invalidators/index.d.mts +4 -0
  140. package/dist/swap-vm/instructions/invalidators/index.d.ts +4 -0
  141. package/dist/swap-vm/instructions/invalidators/invalidate-bit-1d-args-coder.d.mts +7 -0
  142. package/dist/swap-vm/instructions/invalidators/invalidate-bit-1d-args-coder.d.ts +7 -0
  143. package/dist/swap-vm/instructions/invalidators/invalidate-bit-1d-args.d.mts +16 -0
  144. package/dist/swap-vm/instructions/invalidators/invalidate-bit-1d-args.d.ts +16 -0
  145. package/dist/swap-vm/instructions/invalidators/invalidate-token-in-1d-args-coder.d.mts +7 -0
  146. package/dist/swap-vm/instructions/invalidators/invalidate-token-in-1d-args-coder.d.ts +7 -0
  147. package/dist/swap-vm/instructions/invalidators/invalidate-token-in-1d-args.d.mts +8 -0
  148. package/dist/swap-vm/instructions/invalidators/invalidate-token-in-1d-args.d.ts +8 -0
  149. package/dist/swap-vm/instructions/invalidators/invalidate-token-out-1d-args-coder.d.mts +7 -0
  150. package/dist/swap-vm/instructions/invalidators/invalidate-token-out-1d-args-coder.d.ts +7 -0
  151. package/dist/swap-vm/instructions/invalidators/invalidate-token-out-1d-args.d.mts +8 -0
  152. package/dist/swap-vm/instructions/invalidators/invalidate-token-out-1d-args.d.ts +8 -0
  153. package/dist/swap-vm/instructions/invalidators/opcodes.d.mts +15 -0
  154. package/dist/swap-vm/instructions/invalidators/opcodes.d.ts +15 -0
  155. package/dist/swap-vm/instructions/limit-swap/index.d.mts +2 -0
  156. package/dist/swap-vm/instructions/limit-swap/index.d.ts +2 -0
  157. package/dist/swap-vm/instructions/limit-swap/limit-swap-direction-args-coder.d.mts +7 -0
  158. package/dist/swap-vm/instructions/limit-swap/limit-swap-direction-args-coder.d.ts +7 -0
  159. package/dist/swap-vm/instructions/limit-swap/limit-swap-direction-args.d.mts +24 -0
  160. package/dist/swap-vm/instructions/limit-swap/limit-swap-direction-args.d.ts +24 -0
  161. package/dist/swap-vm/instructions/limit-swap/opcodes.d.mts +10 -0
  162. package/dist/swap-vm/instructions/limit-swap/opcodes.d.ts +10 -0
  163. package/dist/swap-vm/instructions/min-rate/index.d.mts +2 -0
  164. package/dist/swap-vm/instructions/min-rate/index.d.ts +2 -0
  165. package/dist/swap-vm/instructions/min-rate/min-rate-args-coder.d.mts +7 -0
  166. package/dist/swap-vm/instructions/min-rate/min-rate-args-coder.d.ts +7 -0
  167. package/dist/swap-vm/instructions/min-rate/min-rate-args.d.mts +22 -0
  168. package/dist/swap-vm/instructions/min-rate/min-rate-args.d.ts +22 -0
  169. package/dist/swap-vm/instructions/min-rate/opcodes.d.mts +10 -0
  170. package/dist/swap-vm/instructions/min-rate/opcodes.d.ts +10 -0
  171. package/dist/swap-vm/instructions/opcode.d.mts +8 -0
  172. package/dist/swap-vm/instructions/opcode.d.ts +8 -0
  173. package/dist/swap-vm/instructions/oracle-price-adjuster/index.d.mts +2 -0
  174. package/dist/swap-vm/instructions/oracle-price-adjuster/index.d.ts +2 -0
  175. package/dist/swap-vm/instructions/oracle-price-adjuster/opcodes.d.mts +5 -0
  176. package/dist/swap-vm/instructions/oracle-price-adjuster/opcodes.d.ts +5 -0
  177. package/dist/swap-vm/instructions/oracle-price-adjuster/oracle-price-adjuster-args-coder.d.mts +7 -0
  178. package/dist/swap-vm/instructions/oracle-price-adjuster/oracle-price-adjuster-args-coder.d.ts +7 -0
  179. package/dist/swap-vm/instructions/oracle-price-adjuster/oracle-price-adjuster-args.d.mts +41 -0
  180. package/dist/swap-vm/instructions/oracle-price-adjuster/oracle-price-adjuster-args.d.ts +41 -0
  181. package/dist/swap-vm/instructions/stable-swap/index.d.mts +2 -0
  182. package/dist/swap-vm/instructions/stable-swap/index.d.ts +2 -0
  183. package/dist/swap-vm/instructions/stable-swap/opcodes.d.mts +4 -0
  184. package/dist/swap-vm/instructions/stable-swap/opcodes.d.ts +4 -0
  185. package/dist/swap-vm/instructions/stable-swap/stable-swap-2d-args-coder.d.mts +7 -0
  186. package/dist/swap-vm/instructions/stable-swap/stable-swap-2d-args-coder.d.ts +7 -0
  187. package/dist/swap-vm/instructions/stable-swap/stable-swap-2d-args.d.mts +25 -0
  188. package/dist/swap-vm/instructions/stable-swap/stable-swap-2d-args.d.ts +25 -0
  189. package/dist/swap-vm/instructions/twap-swap/index.d.mts +2 -0
  190. package/dist/swap-vm/instructions/twap-swap/index.d.ts +2 -0
  191. package/dist/swap-vm/instructions/twap-swap/opcodes.d.mts +5 -0
  192. package/dist/swap-vm/instructions/twap-swap/opcodes.d.ts +5 -0
  193. package/dist/swap-vm/instructions/twap-swap/twap-swap-args-coder.d.mts +7 -0
  194. package/dist/swap-vm/instructions/twap-swap/twap-swap-args-coder.d.ts +7 -0
  195. package/dist/swap-vm/instructions/twap-swap/twap-swap-args.d.mts +71 -0
  196. package/dist/swap-vm/instructions/twap-swap/twap-swap-args.d.ts +71 -0
  197. package/dist/swap-vm/instructions/types.d.mts +18 -0
  198. package/dist/swap-vm/instructions/types.d.ts +18 -0
  199. package/dist/swap-vm/instructions/xyc-swap/index.d.mts +2 -0
  200. package/dist/swap-vm/instructions/xyc-swap/index.d.ts +2 -0
  201. package/dist/swap-vm/instructions/xyc-swap/opcodes.d.mts +5 -0
  202. package/dist/swap-vm/instructions/xyc-swap/opcodes.d.ts +5 -0
  203. package/dist/swap-vm/instructions/xyc-swap/xyc-swap-xd-args-coder.d.mts +7 -0
  204. package/dist/swap-vm/instructions/xyc-swap/xyc-swap-xd-args-coder.d.ts +7 -0
  205. package/dist/swap-vm/instructions/xyc-swap/xyc-swap-xd-args.d.mts +15 -0
  206. package/dist/swap-vm/instructions/xyc-swap/xyc-swap-xd-args.d.ts +15 -0
  207. package/dist/swap-vm/maker-traits.d.mts +206 -0
  208. package/dist/swap-vm/maker-traits.d.ts +206 -0
  209. package/dist/swap-vm/order.d.mts +84 -0
  210. package/dist/swap-vm/order.d.ts +84 -0
  211. package/dist/swap-vm/programs/aqua-program-builder.d.mts +118 -0
  212. package/dist/swap-vm/programs/aqua-program-builder.d.ts +118 -0
  213. package/dist/swap-vm/programs/index.d.mts +4 -0
  214. package/dist/swap-vm/programs/index.d.ts +4 -0
  215. package/dist/swap-vm/programs/program-builder.d.mts +26 -0
  216. package/dist/swap-vm/programs/program-builder.d.ts +26 -0
  217. package/dist/swap-vm/programs/regular-program-builder.d.mts +187 -0
  218. package/dist/swap-vm/programs/regular-program-builder.d.ts +187 -0
  219. package/dist/swap-vm/programs/swap-vm-program.d.mts +6 -0
  220. package/dist/swap-vm/programs/swap-vm-program.d.ts +6 -0
  221. package/dist/swap-vm/strategies/aqua-amm-strategy.d.mts +32 -0
  222. package/dist/swap-vm/strategies/aqua-amm-strategy.d.ts +32 -0
  223. package/dist/swap-vm/strategies/index.d.mts +1 -0
  224. package/dist/swap-vm/strategies/index.d.ts +1 -0
  225. package/dist/swap-vm/taker-traits.d.mts +214 -0
  226. package/dist/swap-vm/taker-traits.d.ts +214 -0
  227. package/dist/swap-vm/types.d.mts +22 -0
  228. package/dist/swap-vm/types.d.ts +22 -0
  229. package/dist/swap-vm-contract/constants.d.mts +13 -0
  230. package/dist/swap-vm-contract/constants.d.ts +13 -0
  231. package/dist/swap-vm-contract/events/index.d.mts +1 -0
  232. package/dist/swap-vm-contract/events/index.d.ts +1 -0
  233. package/dist/swap-vm-contract/events/swapped-event.d.mts +19 -0
  234. package/dist/swap-vm-contract/events/swapped-event.d.ts +19 -0
  235. package/dist/swap-vm-contract/index.d.mts +4 -0
  236. package/dist/swap-vm-contract/index.d.ts +4 -0
  237. package/dist/swap-vm-contract/swap-vm-contract.d.mts +38 -0
  238. package/dist/swap-vm-contract/swap-vm-contract.d.ts +38 -0
  239. package/dist/swap-vm-contract/types.d.mts +22 -0
  240. package/dist/swap-vm-contract/types.d.ts +22 -0
  241. package/package.json +72 -0
@@ -0,0 +1,214 @@
1
+ import type { DataFor } from '@1inch/sdk-core';
2
+ import { Address, HexString } from '@1inch/sdk-core';
3
+ /**
4
+ * TakerTraits encodes taker-specific parameters and flags for swap execution.
5
+ * It defines how the taker wants the swap to be executed, including thresholds,
6
+ * callbacks, hooks, and other execution parameters.
7
+ */
8
+ export declare class TakerTraits {
9
+ /**
10
+ * If true, the taker specifies the exact input amount.
11
+ * If false, the taker specifies the exact output amount.
12
+ */
13
+ readonly exactIn: boolean;
14
+ /**
15
+ * If true, WETH proceeds are unwrapped into native currency when
16
+ * the order is settled.
17
+ */
18
+ readonly shouldUnwrap: boolean;
19
+ /**
20
+ * If true, enables pre-transfer-in callback to the taker contract.
21
+ * The callback flag is automatically set based on preTransferInCallbackData presence.
22
+ */
23
+ readonly preTransferInCallbackEnabled: boolean;
24
+ /**
25
+ * If true, enables pre-transfer-out callback to the taker contract.
26
+ * The callback flag is automatically set based on preTransferOutCallbackData presence.
27
+ */
28
+ readonly preTransferOutCallbackEnabled: boolean;
29
+ /**
30
+ * If true, requires the exact threshold amount (no slippage tolerance).
31
+ * If false, allows better rates than threshold.
32
+ */
33
+ readonly strictThreshold: boolean;
34
+ /**
35
+ * If true, the first transfer is from the taker.
36
+ * If false, it may be from another source (e.g., via Aqua).
37
+ */
38
+ readonly firstTransferFromTaker: boolean;
39
+ /**
40
+ * If true, uses transferFrom and Aqua push mechanism.
41
+ * If false, uses standard transfer mechanism.
42
+ */
43
+ readonly useTransferFromAndAquaPush: boolean;
44
+ /**
45
+ * Minimum output amount (for exactIn) or maximum input amount (for exactOut).
46
+ * Set to 0n for no threshold.
47
+ */
48
+ readonly threshold: bigint;
49
+ /**
50
+ * Custom receiver address for the swap output.
51
+ * Defaults to zero address (meaning taker receives funds).
52
+ */
53
+ readonly customReceiver: Address;
54
+ /**
55
+ * Optional data passed to the maker's pre-transfer-in hook.
56
+ */
57
+ readonly preTransferInHookData: HexString;
58
+ /**
59
+ * Optional data passed to the maker's post-transfer-in hook.
60
+ */
61
+ readonly postTransferInHookData: HexString;
62
+ /**
63
+ * Optional data passed to the maker's pre-transfer-out hook.
64
+ */
65
+ readonly preTransferOutHookData: HexString;
66
+ /**
67
+ * Optional data passed to the maker's post-transfer-out hook.
68
+ */
69
+ readonly postTransferOutHookData: HexString;
70
+ /**
71
+ * Optional callback data for taker's pre-transfer-in callback.
72
+ */
73
+ readonly preTransferInCallbackData: HexString;
74
+ /**
75
+ * Optional callback data for taker's pre-transfer-out callback.
76
+ */
77
+ readonly preTransferOutCallbackData: HexString;
78
+ /**
79
+ * Optional arguments for VM instructions execution.
80
+ */
81
+ readonly instructionsArgs: HexString;
82
+ /**
83
+ * ECDSA signature for order validation (65 bytes typically).
84
+ * Can be empty when using Aqua authentication.
85
+ */
86
+ readonly signature: HexString;
87
+ private static readonly IS_EXACT_IN_BIT_FLAG;
88
+ private static readonly SHOULD_UNWRAP_BIT_FLAG;
89
+ private static readonly HAS_PRE_TRANSFER_IN_CALLBACK_BIT_FLAG;
90
+ private static readonly HAS_PRE_TRANSFER_OUT_CALLBACK_BIT_FLAG;
91
+ private static readonly IS_STRICT_THRESHOLD_BIT_FLAG;
92
+ private static readonly IS_FIRST_TRANSFER_FROM_TAKER_BIT_FLAG;
93
+ private static readonly USE_TRANSFER_FROM_AND_AQUA_PUSH_FLAG;
94
+ constructor(
95
+ /**
96
+ * If true, the taker specifies the exact input amount.
97
+ * If false, the taker specifies the exact output amount.
98
+ */
99
+ exactIn: boolean,
100
+ /**
101
+ * If true, WETH proceeds are unwrapped into native currency when
102
+ * the order is settled.
103
+ */
104
+ shouldUnwrap: boolean,
105
+ /**
106
+ * If true, enables pre-transfer-in callback to the taker contract.
107
+ * The callback flag is automatically set based on preTransferInCallbackData presence.
108
+ */
109
+ preTransferInCallbackEnabled: boolean,
110
+ /**
111
+ * If true, enables pre-transfer-out callback to the taker contract.
112
+ * The callback flag is automatically set based on preTransferOutCallbackData presence.
113
+ */
114
+ preTransferOutCallbackEnabled: boolean,
115
+ /**
116
+ * If true, requires the exact threshold amount (no slippage tolerance).
117
+ * If false, allows better rates than threshold.
118
+ */
119
+ strictThreshold: boolean,
120
+ /**
121
+ * If true, the first transfer is from the taker.
122
+ * If false, it may be from another source (e.g., via Aqua).
123
+ */
124
+ firstTransferFromTaker: boolean,
125
+ /**
126
+ * If true, uses transferFrom and Aqua push mechanism.
127
+ * If false, uses standard transfer mechanism.
128
+ */
129
+ useTransferFromAndAquaPush: boolean,
130
+ /**
131
+ * Minimum output amount (for exactIn) or maximum input amount (for exactOut).
132
+ * Set to 0n for no threshold.
133
+ */
134
+ threshold?: bigint,
135
+ /**
136
+ * Custom receiver address for the swap output.
137
+ * Defaults to zero address (meaning taker receives funds).
138
+ */
139
+ customReceiver?: Address,
140
+ /**
141
+ * Optional data passed to the maker's pre-transfer-in hook.
142
+ */
143
+ preTransferInHookData?: HexString,
144
+ /**
145
+ * Optional data passed to the maker's post-transfer-in hook.
146
+ */
147
+ postTransferInHookData?: HexString,
148
+ /**
149
+ * Optional data passed to the maker's pre-transfer-out hook.
150
+ */
151
+ preTransferOutHookData?: HexString,
152
+ /**
153
+ * Optional data passed to the maker's post-transfer-out hook.
154
+ */
155
+ postTransferOutHookData?: HexString,
156
+ /**
157
+ * Optional callback data for taker's pre-transfer-in callback.
158
+ */
159
+ preTransferInCallbackData?: HexString,
160
+ /**
161
+ * Optional callback data for taker's pre-transfer-out callback.
162
+ */
163
+ preTransferOutCallbackData?: HexString,
164
+ /**
165
+ * Optional arguments for VM instructions execution.
166
+ */
167
+ instructionsArgs?: HexString,
168
+ /**
169
+ * ECDSA signature for order validation (65 bytes typically).
170
+ * Can be empty when using Aqua authentication.
171
+ */
172
+ signature?: HexString);
173
+ /**
174
+ * Creates a new TakerTraits instance with the specified data.
175
+ * Provides default values for unspecified fields.
176
+ */
177
+ static new(data?: Partial<DataFor<TakerTraits>>): TakerTraits;
178
+ /**
179
+ * Creates a default TakerTraits instance with standard settings.
180
+ * - exactIn mode
181
+ * - No unwrapping
182
+ * - No callbacks
183
+ * - No custom receiver
184
+ * - transferFromAndAquaPush enabled
185
+ */
186
+ static default(): TakerTraits;
187
+ /**
188
+ * Decodes a packed TakerTraits from a hex string.
189
+ * The packed format consists of:
190
+ * - 18 bytes: 9 uint16 offsets for data sections
191
+ * - 2 bytes: uint16 flags
192
+ * - Variable: data sections (threshold, to, hook data, callback data, etc.)
193
+ * - Variable: signature
194
+ */
195
+ static decode(packed: HexString): TakerTraits;
196
+ /**
197
+ * Creates a new instance with updated fields.
198
+ * Useful for creating modified versions of existing TakerTraits.
199
+ */
200
+ with(data: Partial<DataFor<TakerTraits>>): this;
201
+ /**
202
+ * Encodes the TakerTraits into a packed hex string format.
203
+ * The encoding includes offsets, flags, data sections, and signature.
204
+ * Callback flags are automatically set based on callback data presence.
205
+ */
206
+ encode(): HexString;
207
+ /**
208
+ * Validates the swap amounts against the threshold settings.
209
+ * @param amountIn - The input amount of the swap
210
+ * @param amountOut - The output amount of the swap
211
+ * @throws Error if the amounts don't meet the threshold requirements
212
+ */
213
+ validate(amountIn: bigint, amountOut: bigint): void;
214
+ }
@@ -0,0 +1,22 @@
1
+ import { Address } from '@1inch/sdk-core';
2
+ export type MakerTraitsBuildArgs = {
3
+ shouldUnwrapWeth?: boolean;
4
+ hasPreTransferOutHook?: boolean;
5
+ hasPostTransferInHook?: boolean;
6
+ useAquaInsteadOfSignature?: boolean;
7
+ ignoreAquaForTransferIn?: boolean;
8
+ expiration?: bigint;
9
+ receiver?: Address;
10
+ preTransferOutDataLength?: bigint;
11
+ postTransferInDataLength?: bigint;
12
+ };
13
+ export type TakerTraitsBuildArgs = {
14
+ isExactIn?: boolean;
15
+ shouldUnwrapWeth?: boolean;
16
+ hasPreTransferInHook?: boolean;
17
+ isStrictThresholdAmount?: boolean;
18
+ isFirstTransferFromTaker?: boolean;
19
+ useTransferFromAndAquaPush?: boolean;
20
+ threshold?: bigint;
21
+ customReceiver?: Address;
22
+ };
@@ -0,0 +1,22 @@
1
+ import { Address } from '@1inch/sdk-core';
2
+ export type MakerTraitsBuildArgs = {
3
+ shouldUnwrapWeth?: boolean;
4
+ hasPreTransferOutHook?: boolean;
5
+ hasPostTransferInHook?: boolean;
6
+ useAquaInsteadOfSignature?: boolean;
7
+ ignoreAquaForTransferIn?: boolean;
8
+ expiration?: bigint;
9
+ receiver?: Address;
10
+ preTransferOutDataLength?: bigint;
11
+ postTransferInDataLength?: bigint;
12
+ };
13
+ export type TakerTraitsBuildArgs = {
14
+ isExactIn?: boolean;
15
+ shouldUnwrapWeth?: boolean;
16
+ hasPreTransferInHook?: boolean;
17
+ isStrictThresholdAmount?: boolean;
18
+ isFirstTransferFromTaker?: boolean;
19
+ useTransferFromAndAquaPush?: boolean;
20
+ threshold?: bigint;
21
+ customReceiver?: Address;
22
+ };
@@ -0,0 +1,13 @@
1
+ import { Address, NetworkEnum } from '@1inch/sdk-core';
2
+ /**
3
+ * AquaSwapVMRouter contract addresses by chain ID
4
+ * These addresses supports only AQUA instructions set
5
+ *
6
+ * Deployed with next params
7
+ * - name = `AquaSwapVMRouter`
8
+ * - version = `1.0.0`
9
+ *
10
+ * @see https://github.com/1inch/swap-vm/blob/8cc4c467374959af9efdb6e2b67d32d3c1083e1e/src/routers/AquaSwapVMRouter.sol#L11
11
+ * @see "../swap-vm/programs/aqua-program-builder"
12
+ */
13
+ export declare const AQUA_SWAP_VM_CONTRACT_ADDRESSES: Record<NetworkEnum, Address>;
@@ -0,0 +1,13 @@
1
+ import { Address, NetworkEnum } from '@1inch/sdk-core';
2
+ /**
3
+ * AquaSwapVMRouter contract addresses by chain ID
4
+ * These addresses supports only AQUA instructions set
5
+ *
6
+ * Deployed with next params
7
+ * - name = `AquaSwapVMRouter`
8
+ * - version = `1.0.0`
9
+ *
10
+ * @see https://github.com/1inch/swap-vm/blob/8cc4c467374959af9efdb6e2b67d32d3c1083e1e/src/routers/AquaSwapVMRouter.sol#L11
11
+ * @see "../swap-vm/programs/aqua-program-builder"
12
+ */
13
+ export declare const AQUA_SWAP_VM_CONTRACT_ADDRESSES: Record<NetworkEnum, Address>;
@@ -0,0 +1 @@
1
+ export * from './swapped-event';
@@ -0,0 +1 @@
1
+ export * from './swapped-event';
@@ -0,0 +1,19 @@
1
+ import type { DataFor, LogLike } from '@1inch/sdk-core';
2
+ import { Address, HexString } from '@1inch/sdk-core';
3
+ export declare class SwappedEvent {
4
+ readonly orderHash: HexString;
5
+ readonly maker: Address;
6
+ readonly taker: Address;
7
+ readonly tokenIn: Address;
8
+ readonly tokenOut: Address;
9
+ readonly amountIn: bigint;
10
+ readonly amountOut: bigint;
11
+ static TOPIC: HexString;
12
+ constructor(orderHash: HexString, maker: Address, taker: Address, tokenIn: Address, tokenOut: Address, amountIn: bigint, amountOut: bigint);
13
+ static new(data: DataFor<SwappedEvent>): SwappedEvent;
14
+ /**
15
+ * Creates a SwappedEvent
16
+ * @throws Error if the log data is invalid or doesn't match the expected event structure
17
+ */
18
+ static fromLog(log: LogLike): SwappedEvent;
19
+ }
@@ -0,0 +1,19 @@
1
+ import type { DataFor, LogLike } from '@1inch/sdk-core';
2
+ import { Address, HexString } from '@1inch/sdk-core';
3
+ export declare class SwappedEvent {
4
+ readonly orderHash: HexString;
5
+ readonly maker: Address;
6
+ readonly taker: Address;
7
+ readonly tokenIn: Address;
8
+ readonly tokenOut: Address;
9
+ readonly amountIn: bigint;
10
+ readonly amountOut: bigint;
11
+ static TOPIC: HexString;
12
+ constructor(orderHash: HexString, maker: Address, taker: Address, tokenIn: Address, tokenOut: Address, amountIn: bigint, amountOut: bigint);
13
+ static new(data: DataFor<SwappedEvent>): SwappedEvent;
14
+ /**
15
+ * Creates a SwappedEvent
16
+ * @throws Error if the log data is invalid or doesn't match the expected event structure
17
+ */
18
+ static fromLog(log: LogLike): SwappedEvent;
19
+ }
@@ -0,0 +1,4 @@
1
+ export * from './swap-vm-contract';
2
+ export * from './types';
3
+ export * from './constants';
4
+ export * from './events';
@@ -0,0 +1,4 @@
1
+ export * from './swap-vm-contract';
2
+ export * from './types';
3
+ export * from './constants';
4
+ export * from './events';
@@ -0,0 +1,38 @@
1
+ import type { CallInfo, Address } from '@1inch/sdk-core';
2
+ import { HexString } from '@1inch/sdk-core';
3
+ import type { QuoteArgs, SwapArgs } from './types';
4
+ import type { Order } from '../swap-vm/order';
5
+ /**
6
+ * SwapVM contract encoding/decoding utilities
7
+ */
8
+ export declare class SwapVMContract {
9
+ readonly address: Address;
10
+ constructor(address: Address);
11
+ /**
12
+ * Encode quote function call data
13
+ * @see https://github.com/1inch/swap-vm/blob/main/src/SwapVM.sol#L84
14
+ */
15
+ static encodeQuoteCallData(args: QuoteArgs): HexString;
16
+ /**
17
+ * Encode `hashOrder` function call data
18
+ * @see https://github.com/1inch/swap-vm/blob/main/src/SwapVM.sol#L70
19
+ */
20
+ static encodeHashOrderCallData(order: Order): HexString;
21
+ /**
22
+ * Encode swap function call data
23
+ * @see https://github.com/1inch/swap-vm/blob/main/src/SwapVM.sol#L124
24
+ */
25
+ static encodeSwapCallData(args: SwapArgs): HexString;
26
+ /**
27
+ * Build quote transaction
28
+ */
29
+ static buildQuoteTx(contractAddress: Address, args: QuoteArgs): CallInfo;
30
+ /**
31
+ * Build swap transaction
32
+ */
33
+ static buildSwapTx(contractAddress: Address, args: SwapArgs): CallInfo;
34
+ static buildHashOrderTx(contractAddress: Address, order: Order): CallInfo;
35
+ swap(args: SwapArgs): CallInfo;
36
+ quote(args: QuoteArgs): CallInfo;
37
+ hashOrder(order: Order): CallInfo;
38
+ }
@@ -0,0 +1,38 @@
1
+ import type { CallInfo, Address } from '@1inch/sdk-core';
2
+ import { HexString } from '@1inch/sdk-core';
3
+ import type { QuoteArgs, SwapArgs } from './types';
4
+ import type { Order } from '../swap-vm/order';
5
+ /**
6
+ * SwapVM contract encoding/decoding utilities
7
+ */
8
+ export declare class SwapVMContract {
9
+ readonly address: Address;
10
+ constructor(address: Address);
11
+ /**
12
+ * Encode quote function call data
13
+ * @see https://github.com/1inch/swap-vm/blob/main/src/SwapVM.sol#L84
14
+ */
15
+ static encodeQuoteCallData(args: QuoteArgs): HexString;
16
+ /**
17
+ * Encode `hashOrder` function call data
18
+ * @see https://github.com/1inch/swap-vm/blob/main/src/SwapVM.sol#L70
19
+ */
20
+ static encodeHashOrderCallData(order: Order): HexString;
21
+ /**
22
+ * Encode swap function call data
23
+ * @see https://github.com/1inch/swap-vm/blob/main/src/SwapVM.sol#L124
24
+ */
25
+ static encodeSwapCallData(args: SwapArgs): HexString;
26
+ /**
27
+ * Build quote transaction
28
+ */
29
+ static buildQuoteTx(contractAddress: Address, args: QuoteArgs): CallInfo;
30
+ /**
31
+ * Build swap transaction
32
+ */
33
+ static buildSwapTx(contractAddress: Address, args: SwapArgs): CallInfo;
34
+ static buildHashOrderTx(contractAddress: Address, order: Order): CallInfo;
35
+ swap(args: SwapArgs): CallInfo;
36
+ quote(args: QuoteArgs): CallInfo;
37
+ hashOrder(order: Order): CallInfo;
38
+ }
@@ -0,0 +1,22 @@
1
+ import type { Address, HexString } from '@1inch/sdk-core';
2
+ import type { TakerTraits } from '../swap-vm';
3
+ import type { Order } from '../swap-vm/order';
4
+ type SwapVmSwapInfo = {
5
+ order: Order;
6
+ tokenIn: Address;
7
+ tokenOut: Address;
8
+ amount: bigint;
9
+ takerTraits: TakerTraits;
10
+ };
11
+ export type QuoteArgs = SwapVmSwapInfo;
12
+ export type SwapArgs = SwapVmSwapInfo;
13
+ export type QuoteResult = {
14
+ amountIn: bigint;
15
+ amountOut: bigint;
16
+ };
17
+ export type SwapResult = {
18
+ amountIn: bigint;
19
+ amountOut: bigint;
20
+ orderHash: HexString;
21
+ };
22
+ export {};
@@ -0,0 +1,22 @@
1
+ import type { Address, HexString } from '@1inch/sdk-core';
2
+ import type { TakerTraits } from '../swap-vm';
3
+ import type { Order } from '../swap-vm/order';
4
+ type SwapVmSwapInfo = {
5
+ order: Order;
6
+ tokenIn: Address;
7
+ tokenOut: Address;
8
+ amount: bigint;
9
+ takerTraits: TakerTraits;
10
+ };
11
+ export type QuoteArgs = SwapVmSwapInfo;
12
+ export type SwapArgs = SwapVmSwapInfo;
13
+ export type QuoteResult = {
14
+ amountIn: bigint;
15
+ amountOut: bigint;
16
+ };
17
+ export type SwapResult = {
18
+ amountIn: bigint;
19
+ amountOut: bigint;
20
+ orderHash: HexString;
21
+ };
22
+ export {};
package/package.json ADDED
@@ -0,0 +1,72 @@
1
+ {
2
+ "name": "@1inch/swap-vm-sdk",
3
+ "version": "0.1.0",
4
+ "description": "1inch Swap VM SDK",
5
+ "author": "@1inch",
6
+ "license": "LicenseRef-Degensoft-SwapVM-1.1",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "ssh://git@github.com:1inch/sdks.git"
10
+ },
11
+ "main": "./dist/index.js",
12
+ "module": "./dist/index.mjs",
13
+ "types": "./dist/index.d.ts",
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "import": "./dist/index.mjs",
18
+ "require": "./dist/index.js"
19
+ },
20
+ "./package.json": "./package.json"
21
+ },
22
+ "files": [
23
+ "dist",
24
+ "LICENSE",
25
+ "README.md",
26
+ "package.json"
27
+ ],
28
+ "keywords": [
29
+ "1inch",
30
+ "swap-vm",
31
+ "sdk",
32
+ "defi",
33
+ "swap",
34
+ "virtual-machine"
35
+ ],
36
+ "peerDependencies": {
37
+ "viem": "^2.21.0"
38
+ },
39
+ "dependencies": {
40
+ "@1inch/byte-utils": "^3.1.7",
41
+ "tslib": "^2.8.1",
42
+ "@1inch/sdk-core": "0.1.0"
43
+ },
44
+ "devDependencies": {
45
+ "@types/node": "^22.13.0",
46
+ "dotenv": "17.2.3",
47
+ "eslint-plugin-license-header": "0.8.0",
48
+ "tsdown": "^0.2.17",
49
+ "typescript": "^5.7.3",
50
+ "vitest": "^3.2.4"
51
+ },
52
+ "volta": {
53
+ "node": "22.13.1"
54
+ },
55
+ "publishConfig": {
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
+ }
72
+ }