@otim/utils 0.0.2-development.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 (421) hide show
  1. package/LICENSE +201 -0
  2. package/dist/api/api.d.mts +18 -0
  3. package/dist/api/api.d.ts +18 -0
  4. package/dist/api/api.d.ts.map +1 -0
  5. package/dist/api/core/error.d.mts +74 -0
  6. package/dist/api/core/error.d.ts +74 -0
  7. package/dist/api/core/error.d.ts.map +1 -0
  8. package/dist/api/core/index.d.mts +4 -0
  9. package/dist/api/core/index.d.ts +4 -0
  10. package/dist/api/core/index.d.ts.map +1 -0
  11. package/dist/api/core/instance.d.mts +13 -0
  12. package/dist/api/core/instance.d.ts +13 -0
  13. package/dist/api/core/instance.d.ts.map +1 -0
  14. package/dist/api/core/service.d.mts +51 -0
  15. package/dist/api/core/service.d.ts +51 -0
  16. package/dist/api/core/service.d.ts.map +1 -0
  17. package/dist/api/index.d.mts +7 -0
  18. package/dist/api/index.d.ts +7 -0
  19. package/dist/api/index.d.ts.map +1 -0
  20. package/dist/api/index.js +2061 -0
  21. package/dist/api/index.js.map +7 -0
  22. package/dist/api/index.mjs +2030 -0
  23. package/dist/api/index.mjs.map +7 -0
  24. package/dist/api/schemas/account.d.mts +44 -0
  25. package/dist/api/schemas/account.d.ts +44 -0
  26. package/dist/api/schemas/account.d.ts.map +1 -0
  27. package/dist/api/schemas/activity.d.mts +277 -0
  28. package/dist/api/schemas/activity.d.ts +277 -0
  29. package/dist/api/schemas/activity.d.ts.map +1 -0
  30. package/dist/api/schemas/auth.d.mts +127 -0
  31. package/dist/api/schemas/auth.d.ts +127 -0
  32. package/dist/api/schemas/auth.d.ts.map +1 -0
  33. package/dist/api/schemas/chain.d.mts +15 -0
  34. package/dist/api/schemas/chain.d.ts +15 -0
  35. package/dist/api/schemas/chain.d.ts.map +1 -0
  36. package/dist/api/schemas/config.d.mts +33 -0
  37. package/dist/api/schemas/config.d.ts +33 -0
  38. package/dist/api/schemas/config.d.ts.map +1 -0
  39. package/dist/api/schemas/contacts.d.mts +27 -0
  40. package/dist/api/schemas/contacts.d.ts +27 -0
  41. package/dist/api/schemas/contacts.d.ts.map +1 -0
  42. package/dist/api/schemas/index.d.mts +12 -0
  43. package/dist/api/schemas/index.d.ts +12 -0
  44. package/dist/api/schemas/index.d.ts.map +1 -0
  45. package/dist/api/schemas/instruction.d.mts +446 -0
  46. package/dist/api/schemas/instruction.d.ts +446 -0
  47. package/dist/api/schemas/instruction.d.ts.map +1 -0
  48. package/dist/api/schemas/integration.d.mts +166 -0
  49. package/dist/api/schemas/integration.d.ts +166 -0
  50. package/dist/api/schemas/integration.d.ts.map +1 -0
  51. package/dist/api/schemas/operating-account.d.mts +11 -0
  52. package/dist/api/schemas/operating-account.d.ts +11 -0
  53. package/dist/api/schemas/operating-account.d.ts.map +1 -0
  54. package/dist/api/schemas/payments.d.mts +196 -0
  55. package/dist/api/schemas/payments.d.ts +196 -0
  56. package/dist/api/schemas/payments.d.ts.map +1 -0
  57. package/dist/api/schemas/transaction.d.mts +37 -0
  58. package/dist/api/schemas/transaction.d.ts +37 -0
  59. package/dist/api/schemas/transaction.d.ts.map +1 -0
  60. package/dist/api/services/account.d.mts +8 -0
  61. package/dist/api/services/account.d.ts +8 -0
  62. package/dist/api/services/account.d.ts.map +1 -0
  63. package/dist/api/services/activity.d.mts +7 -0
  64. package/dist/api/services/activity.d.ts +7 -0
  65. package/dist/api/services/activity.d.ts.map +1 -0
  66. package/dist/api/services/auth.d.mts +12 -0
  67. package/dist/api/services/auth.d.ts +12 -0
  68. package/dist/api/services/auth.d.ts.map +1 -0
  69. package/dist/api/services/base.d.mts +10 -0
  70. package/dist/api/services/base.d.ts +10 -0
  71. package/dist/api/services/base.d.ts.map +1 -0
  72. package/dist/api/services/config.d.mts +10 -0
  73. package/dist/api/services/config.d.ts +10 -0
  74. package/dist/api/services/config.d.ts.map +1 -0
  75. package/dist/api/services/contacts.d.mts +8 -0
  76. package/dist/api/services/contacts.d.ts +8 -0
  77. package/dist/api/services/contacts.d.ts.map +1 -0
  78. package/dist/api/services/developer.d.mts +6 -0
  79. package/dist/api/services/developer.d.ts +6 -0
  80. package/dist/api/services/developer.d.ts.map +1 -0
  81. package/dist/api/services/index.d.mts +13 -0
  82. package/dist/api/services/index.d.ts +13 -0
  83. package/dist/api/services/index.d.ts.map +1 -0
  84. package/dist/api/services/instruction.d.mts +12 -0
  85. package/dist/api/services/instruction.d.ts +12 -0
  86. package/dist/api/services/instruction.d.ts.map +1 -0
  87. package/dist/api/services/integration.d.mts +8 -0
  88. package/dist/api/services/integration.d.ts +8 -0
  89. package/dist/api/services/integration.d.ts.map +1 -0
  90. package/dist/api/services/operating-account.d.mts +8 -0
  91. package/dist/api/services/operating-account.d.ts +8 -0
  92. package/dist/api/services/operating-account.d.ts.map +1 -0
  93. package/dist/api/services/payments.d.mts +13 -0
  94. package/dist/api/services/payments.d.ts +13 -0
  95. package/dist/api/services/payments.d.ts.map +1 -0
  96. package/dist/api/services/transaction.d.mts +8 -0
  97. package/dist/api/services/transaction.d.ts +8 -0
  98. package/dist/api/services/transaction.d.ts.map +1 -0
  99. package/dist/api/services/uniswap-token-list-service.d.mts +66 -0
  100. package/dist/api/services/uniswap-token-list-service.d.ts +66 -0
  101. package/dist/api/services/uniswap-token-list-service.d.ts.map +1 -0
  102. package/dist/api/utils/index.d.mts +2 -0
  103. package/dist/api/utils/index.d.ts +2 -0
  104. package/dist/api/utils/index.d.ts.map +1 -0
  105. package/dist/api/utils/pagination.d.mts +32 -0
  106. package/dist/api/utils/pagination.d.ts +32 -0
  107. package/dist/api/utils/pagination.d.ts.map +1 -0
  108. package/dist/chains/config/all-chains.d.mts +4243 -0
  109. package/dist/chains/config/all-chains.d.ts +4243 -0
  110. package/dist/chains/config/all-chains.d.ts.map +1 -0
  111. package/dist/chains/config/custom-chains.d.mts +49 -0
  112. package/dist/chains/config/custom-chains.d.ts +49 -0
  113. package/dist/chains/config/custom-chains.d.ts.map +1 -0
  114. package/dist/chains/config/mainnet-chains.d.mts +1063 -0
  115. package/dist/chains/config/mainnet-chains.d.ts +1063 -0
  116. package/dist/chains/config/mainnet-chains.d.ts.map +1 -0
  117. package/dist/chains/config/supported-chains.d.mts +2172 -0
  118. package/dist/chains/config/supported-chains.d.ts +2172 -0
  119. package/dist/chains/config/supported-chains.d.ts.map +1 -0
  120. package/dist/chains/config/testnet-chains.d.mts +1110 -0
  121. package/dist/chains/config/testnet-chains.d.ts +1110 -0
  122. package/dist/chains/config/testnet-chains.d.ts.map +1 -0
  123. package/dist/chains/index.d.mts +16 -0
  124. package/dist/chains/index.d.ts +16 -0
  125. package/dist/chains/index.d.ts.map +1 -0
  126. package/dist/chains/index.js +490 -0
  127. package/dist/chains/index.js.map +7 -0
  128. package/dist/chains/index.mjs +505 -0
  129. package/dist/chains/index.mjs.map +7 -0
  130. package/dist/chains/lambda/chain-mapping.d.mts +55 -0
  131. package/dist/chains/lambda/chain-mapping.d.ts +55 -0
  132. package/dist/chains/lambda/chain-mapping.d.ts.map +1 -0
  133. package/dist/chains/lambda/index.d.mts +2 -0
  134. package/dist/chains/lambda/index.d.ts +2 -0
  135. package/dist/chains/lambda/index.d.ts.map +1 -0
  136. package/dist/chains/tokens/chain-tokens.d.mts +6 -0
  137. package/dist/chains/tokens/chain-tokens.d.ts +6 -0
  138. package/dist/chains/tokens/chain-tokens.d.ts.map +1 -0
  139. package/dist/chains/tokens/token-addresses.d.mts +8 -0
  140. package/dist/chains/tokens/token-addresses.d.ts +8 -0
  141. package/dist/chains/tokens/token-addresses.d.ts.map +1 -0
  142. package/dist/chains/tokens/token-metadata.d.mts +5 -0
  143. package/dist/chains/tokens/token-metadata.d.ts +5 -0
  144. package/dist/chains/tokens/token-metadata.d.ts.map +1 -0
  145. package/dist/chains/types.d.mts +23 -0
  146. package/dist/chains/types.d.ts +23 -0
  147. package/dist/chains/types.d.ts.map +1 -0
  148. package/dist/chains/utils/filter-tokens.d.mts +3 -0
  149. package/dist/chains/utils/filter-tokens.d.ts +3 -0
  150. package/dist/chains/utils/filter-tokens.d.ts.map +1 -0
  151. package/dist/chains/utils/stablecoin.d.mts +7 -0
  152. package/dist/chains/utils/stablecoin.d.ts +7 -0
  153. package/dist/chains/utils/stablecoin.d.ts.map +1 -0
  154. package/dist/chains/utils/token-maps.d.mts +10 -0
  155. package/dist/chains/utils/token-maps.d.ts +10 -0
  156. package/dist/chains/utils/token-maps.d.ts.map +1 -0
  157. package/dist/constants.d.mts +31 -0
  158. package/dist/constants.d.ts +31 -0
  159. package/dist/constants.d.ts.map +1 -0
  160. package/dist/constants.js +47 -0
  161. package/dist/constants.js.map +7 -0
  162. package/dist/constants.mjs +26 -0
  163. package/dist/constants.mjs.map +7 -0
  164. package/dist/env.d.mts +17 -0
  165. package/dist/env.d.ts +17 -0
  166. package/dist/env.d.ts.map +1 -0
  167. package/dist/formatters/index.d.mts +2 -0
  168. package/dist/formatters/index.d.ts +2 -0
  169. package/dist/formatters/index.d.ts.map +1 -0
  170. package/dist/formatters/index.js +19 -0
  171. package/dist/formatters/index.js.map +7 -0
  172. package/dist/formatters/index.mjs +1 -0
  173. package/dist/formatters/index.mjs.map +7 -0
  174. package/dist/helpers/address.d.mts +7 -0
  175. package/dist/helpers/address.d.ts +7 -0
  176. package/dist/helpers/address.d.ts.map +1 -0
  177. package/dist/helpers/blockchain.d.mts +41 -0
  178. package/dist/helpers/blockchain.d.ts +41 -0
  179. package/dist/helpers/blockchain.d.ts.map +1 -0
  180. package/dist/helpers/date.d.mts +70 -0
  181. package/dist/helpers/date.d.ts +70 -0
  182. package/dist/helpers/date.d.ts.map +1 -0
  183. package/dist/helpers/datetime.d.mts +57 -0
  184. package/dist/helpers/datetime.d.ts +57 -0
  185. package/dist/helpers/datetime.d.ts.map +1 -0
  186. package/dist/helpers/domain.d.mts +2 -0
  187. package/dist/helpers/domain.d.ts +2 -0
  188. package/dist/helpers/domain.d.ts.map +1 -0
  189. package/dist/helpers/index.d.mts +19 -0
  190. package/dist/helpers/index.d.ts +19 -0
  191. package/dist/helpers/index.d.ts.map +1 -0
  192. package/dist/helpers/index.js +1322 -0
  193. package/dist/helpers/index.js.map +7 -0
  194. package/dist/helpers/index.mjs +1294 -0
  195. package/dist/helpers/index.mjs.map +7 -0
  196. package/dist/helpers/intl.d.mts +20 -0
  197. package/dist/helpers/intl.d.ts +20 -0
  198. package/dist/helpers/intl.d.ts.map +1 -0
  199. package/dist/helpers/logger.d.mts +26 -0
  200. package/dist/helpers/logger.d.ts +26 -0
  201. package/dist/helpers/logger.d.ts.map +1 -0
  202. package/dist/helpers/mask-options.d.mts +10 -0
  203. package/dist/helpers/mask-options.d.ts +10 -0
  204. package/dist/helpers/mask-options.d.ts.map +1 -0
  205. package/dist/helpers/num-formatter.d.mts +3 -0
  206. package/dist/helpers/num-formatter.d.ts +3 -0
  207. package/dist/helpers/num-formatter.d.ts.map +1 -0
  208. package/dist/helpers/polling.d.mts +39 -0
  209. package/dist/helpers/polling.d.ts +39 -0
  210. package/dist/helpers/polling.d.ts.map +1 -0
  211. package/dist/helpers/random.d.mts +10 -0
  212. package/dist/helpers/random.d.ts +10 -0
  213. package/dist/helpers/random.d.ts.map +1 -0
  214. package/dist/helpers/sdk-loader.d.mts +25 -0
  215. package/dist/helpers/sdk-loader.d.ts +25 -0
  216. package/dist/helpers/sdk-loader.d.ts.map +1 -0
  217. package/dist/helpers/signatures.d.mts +17 -0
  218. package/dist/helpers/signatures.d.ts +17 -0
  219. package/dist/helpers/signatures.d.ts.map +1 -0
  220. package/dist/helpers/string.d.mts +17 -0
  221. package/dist/helpers/string.d.ts +17 -0
  222. package/dist/helpers/string.d.ts.map +1 -0
  223. package/dist/helpers/types.d.mts +39 -0
  224. package/dist/helpers/types.d.ts +39 -0
  225. package/dist/helpers/types.d.ts.map +1 -0
  226. package/dist/helpers/url.d.mts +11 -0
  227. package/dist/helpers/url.d.ts +11 -0
  228. package/dist/helpers/url.d.ts.map +1 -0
  229. package/dist/helpers/window.d.mts +37 -0
  230. package/dist/helpers/window.d.ts +37 -0
  231. package/dist/helpers/window.d.ts.map +1 -0
  232. package/dist/helpers/zod.d.mts +30 -0
  233. package/dist/helpers/zod.d.ts +30 -0
  234. package/dist/helpers/zod.d.ts.map +1 -0
  235. package/dist/index.d.mts +1 -0
  236. package/dist/index.d.ts +1 -0
  237. package/dist/index.d.ts.map +1 -0
  238. package/dist/index.js +2 -0
  239. package/dist/index.js.map +7 -0
  240. package/dist/index.mjs +1 -0
  241. package/dist/index.mjs.map +7 -0
  242. package/dist/instructions/actions/index.d.mts +5 -0
  243. package/dist/instructions/actions/index.d.ts +5 -0
  244. package/dist/instructions/actions/index.d.ts.map +1 -0
  245. package/dist/instructions/actions/refuel/index.d.mts +15 -0
  246. package/dist/instructions/actions/refuel/index.d.ts +15 -0
  247. package/dist/instructions/actions/refuel/index.d.ts.map +1 -0
  248. package/dist/instructions/actions/swap/index.d.mts +19 -0
  249. package/dist/instructions/actions/swap/index.d.ts +19 -0
  250. package/dist/instructions/actions/swap/index.d.ts.map +1 -0
  251. package/dist/instructions/actions/sweep/index.d.mts +16 -0
  252. package/dist/instructions/actions/sweep/index.d.ts +16 -0
  253. package/dist/instructions/actions/sweep/index.d.ts.map +1 -0
  254. package/dist/instructions/actions/transfer/index.d.mts +13 -0
  255. package/dist/instructions/actions/transfer/index.d.ts +13 -0
  256. package/dist/instructions/actions/transfer/index.d.ts.map +1 -0
  257. package/dist/instructions/activate.d.mts +84 -0
  258. package/dist/instructions/activate.d.ts +84 -0
  259. package/dist/instructions/activate.d.ts.map +1 -0
  260. package/dist/instructions/build.d.mts +146 -0
  261. package/dist/instructions/build.d.ts +146 -0
  262. package/dist/instructions/build.d.ts.map +1 -0
  263. package/dist/instructions/constants.d.mts +9 -0
  264. package/dist/instructions/constants.d.ts +9 -0
  265. package/dist/instructions/constants.d.ts.map +1 -0
  266. package/dist/instructions/contracts/artifacts/abi/build-instruction-action-arguments-abi.d.mts +609 -0
  267. package/dist/instructions/contracts/artifacts/abi/build-instruction-action-arguments-abi.d.ts +609 -0
  268. package/dist/instructions/contracts/artifacts/abi/build-instruction-action-arguments-abi.d.ts.map +1 -0
  269. package/dist/instructions/index.d.mts +6 -0
  270. package/dist/instructions/index.d.ts +6 -0
  271. package/dist/instructions/index.d.ts.map +1 -0
  272. package/dist/instructions/index.js +1152 -0
  273. package/dist/instructions/index.js.map +7 -0
  274. package/dist/instructions/index.mjs +1119 -0
  275. package/dist/instructions/index.mjs.map +7 -0
  276. package/dist/instructions/types.d.mts +289 -0
  277. package/dist/instructions/types.d.ts +289 -0
  278. package/dist/instructions/types.d.ts.map +1 -0
  279. package/dist/payments/action-names.d.mts +16 -0
  280. package/dist/payments/action-names.d.ts +16 -0
  281. package/dist/payments/action-names.d.ts.map +1 -0
  282. package/dist/payments/actions/index.d.mts +5 -0
  283. package/dist/payments/actions/index.d.ts +5 -0
  284. package/dist/payments/actions/index.d.ts.map +1 -0
  285. package/dist/payments/actions/sweep-cctp.d.mts +15 -0
  286. package/dist/payments/actions/sweep-cctp.d.ts +15 -0
  287. package/dist/payments/actions/sweep-cctp.d.ts.map +1 -0
  288. package/dist/payments/actions/sweep-erc20.d.mts +12 -0
  289. package/dist/payments/actions/sweep-erc20.d.ts +12 -0
  290. package/dist/payments/actions/sweep-erc20.d.ts.map +1 -0
  291. package/dist/payments/actions/sweep-uniswap-v3.d.mts +17 -0
  292. package/dist/payments/actions/sweep-uniswap-v3.d.ts +17 -0
  293. package/dist/payments/actions/sweep-uniswap-v3.d.ts.map +1 -0
  294. package/dist/payments/actions/sweep.d.mts +12 -0
  295. package/dist/payments/actions/sweep.d.ts +12 -0
  296. package/dist/payments/actions/sweep.d.ts.map +1 -0
  297. package/dist/payments/build.d.mts +27 -0
  298. package/dist/payments/build.d.ts +27 -0
  299. package/dist/payments/build.d.ts.map +1 -0
  300. package/dist/payments/chain-token-config-builder.d.mts +10 -0
  301. package/dist/payments/chain-token-config-builder.d.ts +10 -0
  302. package/dist/payments/chain-token-config-builder.d.ts.map +1 -0
  303. package/dist/payments/comprehensive-payment-request.d.mts +25 -0
  304. package/dist/payments/comprehensive-payment-request.d.ts +25 -0
  305. package/dist/payments/comprehensive-payment-request.d.ts.map +1 -0
  306. package/dist/payments/config/cctp.d.mts +14 -0
  307. package/dist/payments/config/cctp.d.ts +14 -0
  308. package/dist/payments/config/cctp.d.ts.map +1 -0
  309. package/dist/payments/config/index.d.mts +3 -0
  310. package/dist/payments/config/index.d.ts +3 -0
  311. package/dist/payments/config/index.d.ts.map +1 -0
  312. package/dist/payments/config/tokens.d.mts +14 -0
  313. package/dist/payments/config/tokens.d.ts +14 -0
  314. package/dist/payments/config/tokens.d.ts.map +1 -0
  315. package/dist/payments/index.d.mts +16 -0
  316. package/dist/payments/index.d.ts +16 -0
  317. package/dist/payments/index.d.ts.map +1 -0
  318. package/dist/payments/index.js +1303 -0
  319. package/dist/payments/index.js.map +7 -0
  320. package/dist/payments/index.mjs +1281 -0
  321. package/dist/payments/index.mjs.map +7 -0
  322. package/dist/payments/instruction-registry.d.mts +19 -0
  323. package/dist/payments/instruction-registry.d.ts +19 -0
  324. package/dist/payments/instruction-registry.d.ts.map +1 -0
  325. package/dist/payments/payment-metadata-builder.d.mts +56 -0
  326. package/dist/payments/payment-metadata-builder.d.ts +56 -0
  327. package/dist/payments/payment-metadata-builder.d.ts.map +1 -0
  328. package/dist/payments/payment-metadata.d.mts +15 -0
  329. package/dist/payments/payment-metadata.d.ts +15 -0
  330. package/dist/payments/payment-metadata.d.ts.map +1 -0
  331. package/dist/payments/payment-request-token-resolver.d.mts +25 -0
  332. package/dist/payments/payment-request-token-resolver.d.ts +25 -0
  333. package/dist/payments/payment-request-token-resolver.d.ts.map +1 -0
  334. package/dist/payments/types.d.mts +40 -0
  335. package/dist/payments/types.d.ts +40 -0
  336. package/dist/payments/types.d.ts.map +1 -0
  337. package/dist/payments/validation.d.mts +19 -0
  338. package/dist/payments/validation.d.ts +19 -0
  339. package/dist/payments/validation.d.ts.map +1 -0
  340. package/dist/schemas/account.d.mts +9 -0
  341. package/dist/schemas/account.d.ts +9 -0
  342. package/dist/schemas/account.d.ts.map +1 -0
  343. package/dist/schemas/brand.d.mts +7 -0
  344. package/dist/schemas/brand.d.ts +7 -0
  345. package/dist/schemas/brand.d.ts.map +1 -0
  346. package/dist/schemas/contact.d.mts +18 -0
  347. package/dist/schemas/contact.d.ts +18 -0
  348. package/dist/schemas/contact.d.ts.map +1 -0
  349. package/dist/schemas/index.d.mts +10 -0
  350. package/dist/schemas/index.d.ts +10 -0
  351. package/dist/schemas/index.d.ts.map +1 -0
  352. package/dist/schemas/index.js +433 -0
  353. package/dist/schemas/index.js.map +7 -0
  354. package/dist/schemas/index.mjs +410 -0
  355. package/dist/schemas/index.mjs.map +7 -0
  356. package/dist/schemas/instruction.d.mts +248 -0
  357. package/dist/schemas/instruction.d.ts +248 -0
  358. package/dist/schemas/instruction.d.ts.map +1 -0
  359. package/dist/schemas/misc.d.mts +36 -0
  360. package/dist/schemas/misc.d.ts +36 -0
  361. package/dist/schemas/misc.d.ts.map +1 -0
  362. package/dist/schemas/payment.d.mts +64 -0
  363. package/dist/schemas/payment.d.ts +64 -0
  364. package/dist/schemas/payment.d.ts.map +1 -0
  365. package/dist/schemas/token.d.mts +17 -0
  366. package/dist/schemas/token.d.ts +17 -0
  367. package/dist/schemas/token.d.ts.map +1 -0
  368. package/dist/schemas/transaction.d.mts +65 -0
  369. package/dist/schemas/transaction.d.ts +65 -0
  370. package/dist/schemas/transaction.d.ts.map +1 -0
  371. package/dist/schemas/user.d.mts +24 -0
  372. package/dist/schemas/user.d.ts +24 -0
  373. package/dist/schemas/user.d.ts.map +1 -0
  374. package/dist/server/client.d.mts +3 -0
  375. package/dist/server/client.d.ts +3 -0
  376. package/dist/server/client.d.ts.map +1 -0
  377. package/dist/server/index.d.mts +3 -0
  378. package/dist/server/index.d.ts +3 -0
  379. package/dist/server/index.d.ts.map +1 -0
  380. package/dist/server/index.js +420 -0
  381. package/dist/server/index.js.map +7 -0
  382. package/dist/server/index.mjs +389 -0
  383. package/dist/server/index.mjs.map +7 -0
  384. package/dist/server/routes/account.d.mts +4 -0
  385. package/dist/server/routes/account.d.ts +4 -0
  386. package/dist/server/routes/account.d.ts.map +1 -0
  387. package/dist/server/routes/auth.d.mts +28 -0
  388. package/dist/server/routes/auth.d.ts +28 -0
  389. package/dist/server/routes/auth.d.ts.map +1 -0
  390. package/dist/server/routes/bridge.d.mts +192 -0
  391. package/dist/server/routes/bridge.d.ts +192 -0
  392. package/dist/server/routes/bridge.d.ts.map +1 -0
  393. package/dist/server/routes/config.d.mts +3 -0
  394. package/dist/server/routes/config.d.ts +3 -0
  395. package/dist/server/routes/config.d.ts.map +1 -0
  396. package/dist/server/routes/index.d.mts +8 -0
  397. package/dist/server/routes/index.d.ts +8 -0
  398. package/dist/server/routes/index.d.ts.map +1 -0
  399. package/dist/server/routes/instruction.d.mts +4 -0
  400. package/dist/server/routes/instruction.d.ts +4 -0
  401. package/dist/server/routes/instruction.d.ts.map +1 -0
  402. package/dist/server/routes/integration.d.mts +4 -0
  403. package/dist/server/routes/integration.d.ts +4 -0
  404. package/dist/server/routes/integration.d.ts.map +1 -0
  405. package/dist/server/routes/payments.d.mts +4 -0
  406. package/dist/server/routes/payments.d.ts +4 -0
  407. package/dist/server/routes/payments.d.ts.map +1 -0
  408. package/dist/server/routes/verify.d.mts +3 -0
  409. package/dist/server/routes/verify.d.ts +3 -0
  410. package/dist/server/routes/verify.d.ts.map +1 -0
  411. package/dist/wallet/wagmi/config.d.mts +18 -0
  412. package/dist/wallet/wagmi/config.d.ts +18 -0
  413. package/dist/wallet/wagmi/config.d.ts.map +1 -0
  414. package/dist/wallet/wagmi/index.d.mts +2 -0
  415. package/dist/wallet/wagmi/index.d.ts +2 -0
  416. package/dist/wallet/wagmi/index.d.ts.map +1 -0
  417. package/dist/wallet/wagmi/index.js +429 -0
  418. package/dist/wallet/wagmi/index.js.map +7 -0
  419. package/dist/wallet/wagmi/index.mjs +431 -0
  420. package/dist/wallet/wagmi/index.mjs.map +7 -0
  421. package/package.json +222 -0
@@ -0,0 +1,1152 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/instructions/index.ts
31
+ var instructions_exports = {};
32
+ __export(instructions_exports, {
33
+ DEFAULT_INTERVAL_SECONDS: () => DEFAULT_INTERVAL_SECONDS,
34
+ INSTRUCTION_DEFAULT_TIMEOUT: () => INSTRUCTION_DEFAULT_TIMEOUT,
35
+ convertGweiToWei: () => convertGweiToWei,
36
+ createActivationPayload: () => createActivationPayload,
37
+ createBuildPayload: () => createBuildPayload,
38
+ createInstructionDomain: () => createInstructionDomain,
39
+ createInstructionTypedData: () => createInstructionTypedData,
40
+ createRefuelBuildPayload: () => createRefuelBuildPayload,
41
+ createScheduleInterval: () => createScheduleInterval,
42
+ createScheduleIntervalLatencyLimit: () => createScheduleIntervalLatencyLimit,
43
+ createScheduleRepeat: () => createScheduleRepeat,
44
+ createScheduleStart: () => createScheduleStart,
45
+ createSweepDepositAccountBuildPayload: () => createSweepDepositAccountBuildPayload,
46
+ createTransferBuildPayload: () => createTransferBuildPayload,
47
+ createUniswapV3ExactInputBuildPayload: () => createUniswapV3ExactInputBuildPayload,
48
+ decodeInstructionParameters: () => decodeInstructionParameters,
49
+ eip712TypesMap: () => eip712TypesMap,
50
+ resolveDepositorForSweepDepositAccountIfNeeded: () => resolveDepositorForSweepDepositAccountIfNeeded,
51
+ resolveFee: () => resolveFee,
52
+ resolveGasLimitIfNeeded: () => resolveGasLimitIfNeeded,
53
+ resolveRecipientForUniswapV3ExactInputIfNeeded: () => resolveRecipientForUniswapV3ExactInputIfNeeded,
54
+ resolveSchedule: () => resolveSchedule
55
+ });
56
+ module.exports = __toCommonJS(instructions_exports);
57
+
58
+ // src/schemas/instruction.ts
59
+ var import_zod2 = require("zod");
60
+
61
+ // src/schemas/misc.ts
62
+ var import_zod = require("zod");
63
+ var DATE_REGEX = /^(19|20)\d{2}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/;
64
+ var DATE_ISO_8601_REGEX = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?$/;
65
+ var DATE_STANDARD_REGEX = /^(0[1-9]|1[0-2])\/(0[1-9]|[12][0-9]|3[01])\/(19|20)\d{2}$/;
66
+ var TIME_REGEX = /^(0[1-9]|1[0-2]):[0-5][0-9]:[0-5][0-9] (AM|PM)$/;
67
+ var regexSchema = (regex, message) => import_zod.z.string().regex(regex, message);
68
+ var nonEmptyStringSchema = import_zod.z.string().min(1);
69
+ var numberSchema = import_zod.z.union([
70
+ import_zod.z.number().finite(),
71
+ import_zod.z.string().regex(/^-?\d*\.?\d+(?:[eE][-+]?\d+)?$/).transform(Number)
72
+ ]);
73
+ var decimalStringSchema = import_zod.z.string().regex(/^-?\d*\.?\d+$/).refine((val) => !isNaN(parseFloat(val)), {
74
+ message: "Must be a valid decimal number"
75
+ });
76
+ var bigintSchema = import_zod.z.union([
77
+ import_zod.z.bigint(),
78
+ import_zod.z.string().regex(/^-?\d+$/).transform(BigInt)
79
+ ]);
80
+ var hexStringSchema = import_zod.z.string().startsWith("0x").transform((val) => val);
81
+ var dateSchema = regexSchema(DATE_REGEX);
82
+ var dateISO8601Schema = regexSchema(DATE_ISO_8601_REGEX);
83
+ var dateStandardSchema = regexSchema(DATE_STANDARD_REGEX);
84
+ var timeSchema = regexSchema(TIME_REGEX);
85
+ var Sort = {
86
+ Asc: "asc",
87
+ Desc: "desc"
88
+ };
89
+ var sortValues = Object.values(Sort);
90
+ var vrsSchema = import_zod.z.object({
91
+ v: import_zod.z.number(),
92
+ r: import_zod.z.string(),
93
+ s: import_zod.z.string()
94
+ });
95
+ var eip2098SignatureSchema = import_zod.z.object({
96
+ yParity: import_zod.z.number(),
97
+ r: import_zod.z.string(),
98
+ s: import_zod.z.string()
99
+ });
100
+
101
+ // src/schemas/instruction.ts
102
+ var InstructionState = {
103
+ PendingActivation: "PendingActivation",
104
+ Active: "Active",
105
+ PendingDeactivation: "PendingDeactivation",
106
+ Deactivated: "Deactivated",
107
+ Errored: "Errored",
108
+ Completed: "Completed",
109
+ UserNotDelegated: "UserNotDelegated",
110
+ InFlight: "InFlight",
111
+ NotifyUser: "NotifyUser"
112
+ };
113
+ var instructionStateValues = Object.values(InstructionState);
114
+ var instructionStateSchema = import_zod2.z.enum(instructionStateValues);
115
+ var InstructionAction = {
116
+ RefuelERC20: "refuelERC20",
117
+ Refuel: "refuel",
118
+ Transfer: "transfer",
119
+ TransferERC20: "transferERC20",
120
+ UniswapV3ExactInput: "uniswapV3ExactInput",
121
+ Sweep: "sweep",
122
+ SweepERC20: "sweepERC20",
123
+ SweepCCTP: "sweepCCTP",
124
+ SweepUniswapV3: "sweepUniswapV3",
125
+ SweepDepositAccount: "sweepDepositAccount",
126
+ SweepDepositAccountERC20: "sweepDepositAccountERC20",
127
+ DeactivateInstruction: "deactivateInstruction",
128
+ SweepSkipCCTPDepositAccount: "sweepSkipCCTPDepositAccount"
129
+ };
130
+ var instructionActionValues = Object.values(InstructionAction);
131
+ var instructionActionSchema = import_zod2.z.enum(instructionActionValues);
132
+ var InstructionScheduleStartType = {
133
+ Now: "now",
134
+ DateTime: "datetime"
135
+ };
136
+ var instructionScheduleStartValues = Object.values(
137
+ InstructionScheduleStartType
138
+ );
139
+ var baseStartSchema = import_zod2.z.object({
140
+ type: import_zod2.z.enum(instructionScheduleStartValues)
141
+ });
142
+ var nowStartSchema = baseStartSchema.extend({
143
+ type: import_zod2.z.literal(InstructionScheduleStartType.Now)
144
+ });
145
+ var dateTimeStartSchema = baseStartSchema.extend({
146
+ type: import_zod2.z.literal(InstructionScheduleStartType.DateTime),
147
+ startDate: dateStandardSchema,
148
+ startTime: import_zod2.z.string()
149
+ });
150
+ var instructionScheduleStartSchema = import_zod2.z.discriminatedUnion("type", [
151
+ nowStartSchema,
152
+ dateTimeStartSchema
153
+ ]);
154
+ var InstructionScheduleRepeatType = {
155
+ UntilDeactivated: "until-deactivated",
156
+ MaxExecutions: "max-executions"
157
+ };
158
+ var instructionScheduleRepeatValues = Object.values(
159
+ InstructionScheduleRepeatType
160
+ );
161
+ var baseRepeatSchema = import_zod2.z.object({});
162
+ var untilDeactivatedRepeatSchema = baseRepeatSchema.extend({
163
+ type: import_zod2.z.literal(InstructionScheduleRepeatType.UntilDeactivated)
164
+ });
165
+ var maxExecutionsRepeatSchema = baseRepeatSchema.extend({
166
+ type: import_zod2.z.literal(InstructionScheduleRepeatType.MaxExecutions),
167
+ maxExecutions: numberSchema
168
+ });
169
+ var instructionScheduleRepeatSchema = import_zod2.z.discriminatedUnion("type", [
170
+ untilDeactivatedRepeatSchema,
171
+ maxExecutionsRepeatSchema
172
+ ]);
173
+ var InstructionScheduleRetryType = {
174
+ UntilDeactivated: "until-deactivated",
175
+ TimeLimited: "time-limited"
176
+ };
177
+ var instructionScheduleRetryValues = Object.values(
178
+ InstructionScheduleRetryType
179
+ );
180
+ var baseRetrySchema = import_zod2.z.object({});
181
+ var untilDeactivatedRetrySchema = baseRetrySchema.extend({
182
+ type: import_zod2.z.literal(InstructionScheduleRetryType.UntilDeactivated)
183
+ });
184
+ var timeLimitedRetrySchema = baseRetrySchema.extend({
185
+ type: import_zod2.z.literal(InstructionScheduleRetryType.TimeLimited),
186
+ retryCount: numberSchema
187
+ });
188
+ var instructionScheduleRetrySchema = import_zod2.z.discriminatedUnion("type", [
189
+ untilDeactivatedRetrySchema,
190
+ timeLimitedRetrySchema
191
+ ]);
192
+ var TimeUnit = {
193
+ None: "none",
194
+ Second: "second",
195
+ Minute: "minute",
196
+ Hour: "hour",
197
+ Day: "day",
198
+ Week: "week",
199
+ Month: "month"
200
+ };
201
+ var timeUnitValues = Object.values(TimeUnit);
202
+ var timeUnitSchema = import_zod2.z.enum(timeUnitValues);
203
+ var instructionExecutionStateSchema = import_zod2.z.object({
204
+ executionStatus: instructionStateSchema.optional(),
205
+ executionCounter: import_zod2.z.number().int().optional(),
206
+ lastExecuted: import_zod2.z.number().int().optional()
207
+ });
208
+ var instructionSchema = import_zod2.z.object({
209
+ instructionId: hexStringSchema,
210
+ createdAt: import_zod2.z.number().optional(),
211
+ startAt: import_zod2.z.string().nullish(),
212
+ interval: import_zod2.z.number().nullish(),
213
+ timeout: import_zod2.z.number().nullish(),
214
+ maxExecutions: import_zod2.z.number().nullish(),
215
+ executionState: instructionExecutionStateSchema.optional(),
216
+ actionName: import_zod2.z.string().optional(),
217
+ arguments: import_zod2.z.any(),
218
+ nickname: import_zod2.z.string().nullish(),
219
+ lastInstructedValue: import_zod2.z.string().optional(),
220
+ lastErrorCode: import_zod2.z.number().nullish(),
221
+ lastErrorMessage: import_zod2.z.string().nullish(),
222
+ totalInstructedValue: import_zod2.z.string().optional(),
223
+ instructedTokenAddress: hexStringSchema.nullish(),
224
+ chainId: import_zod2.z.number().nullish(),
225
+ chain: import_zod2.z.string().optional()
226
+ });
227
+ var instructionsSchema = import_zod2.z.array(instructionSchema);
228
+ var instructionSummarySchema = import_zod2.z.object({
229
+ instructionId: hexStringSchema,
230
+ chainId: import_zod2.z.number().int(),
231
+ executionCount: import_zod2.z.number().int(),
232
+ onTimeCount: import_zod2.z.number().int(),
233
+ lateCount: import_zod2.z.number().int(),
234
+ wasActivatedDuring: import_zod2.z.boolean(),
235
+ amount: import_zod2.z.number().default(0),
236
+ instructedValue: import_zod2.z.string().nullish().default("0"),
237
+ instructedTokenAddress: import_zod2.z.string().nullish().default(null)
238
+ });
239
+ var instructionSummariesSchema = import_zod2.z.array(instructionSummarySchema);
240
+ var instructionSummariesByDateSchema = import_zod2.z.record(
241
+ import_zod2.z.string(),
242
+ instructionSummariesSchema
243
+ );
244
+ var InstructionViewTimescale = {
245
+ Days: "days",
246
+ Hours: "hours",
247
+ Minutes: "minutes",
248
+ Seconds: "seconds"
249
+ };
250
+ var instructionViewTimescaleValues = Object.values(
251
+ InstructionViewTimescale
252
+ );
253
+
254
+ // src/instructions/build.ts
255
+ var import_viem2 = require("viem");
256
+
257
+ // src/helpers/blockchain.ts
258
+ var import_viem = require("viem");
259
+ var parseSignatureToVRS = (signature) => {
260
+ if (typeof signature !== "string") {
261
+ throw new Error("Signature must be a string");
262
+ }
263
+ if (!signature.startsWith("0x")) {
264
+ throw new Error('Signature must start with "0x"');
265
+ }
266
+ if (signature.length !== 132) {
267
+ throw new Error(
268
+ 'Signature must be 65 bytes (130 hex chars) plus "0x" = 132 total length'
269
+ );
270
+ }
271
+ const r = signature.slice(2, 66);
272
+ const s = signature.slice(66, 130);
273
+ const vHex = signature.slice(130, 132);
274
+ const v = parseInt(vHex, 16);
275
+ return { v, r: `0x${r}`, s: `0x${s}` };
276
+ };
277
+ var isValidV = (v) => {
278
+ return v === 0 || v === 1 || v === 27 || v === 28 || v >= 35;
279
+ };
280
+ var normalizeV = (v) => {
281
+ if (!isValidV(v)) return 0;
282
+ const cmp = v <= 1 ? 1 : 0;
283
+ const result = v % 2 === cmp;
284
+ return Number(result) % 2;
285
+ };
286
+ var createEIP2098Signature = (vrs) => {
287
+ const v = vrs.v;
288
+ const r = vrs.r;
289
+ const s = vrs.s;
290
+ return { yParity: normalizeV(v), r, s };
291
+ };
292
+
293
+ // src/helpers/date.ts
294
+ var import_zod3 = __toESM(require("zod"));
295
+ var iso8601DateSchema = import_zod3.default.string().regex(
296
+ /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{3})?Z$/,
297
+ "Must be a valid ISO 8601 date format (e.g., 2024-12-31T23:59:59.000Z)"
298
+ );
299
+ var TimeUnit2 = {
300
+ Day: "day",
301
+ Month: "month",
302
+ Year: "year"
303
+ };
304
+ var units = {
305
+ [TimeUnit2.Day]: {
306
+ one: "day",
307
+ other: "days"
308
+ },
309
+ [TimeUnit2.Month]: {
310
+ one: "month",
311
+ other: "months"
312
+ },
313
+ [TimeUnit2.Year]: {
314
+ one: "year",
315
+ other: "years"
316
+ }
317
+ };
318
+ var parseDateTime = (dateInput, timeInput) => {
319
+ const dateRegex = /^(\d{1,2})\/(\d{1,2})\/(\d{4})$/;
320
+ const timeRegex = /^(\d{1,2}):(\d{2})(?::(\d{2}))?\s*(AM|PM|am|pm)?$/;
321
+ const dateMatch = dateRegex.exec(dateInput);
322
+ if (!dateMatch) {
323
+ return void 0;
324
+ }
325
+ const month = parseInt(dateMatch[1], 10) - 1;
326
+ const day = parseInt(dateMatch[2], 10);
327
+ const year = parseInt(dateMatch[3], 10);
328
+ let hours = 0;
329
+ let minutes = 0;
330
+ let seconds = 0;
331
+ if (timeInput) {
332
+ timeInput = timeInput.replace(/\u00A0/g, " ").trim();
333
+ const timeMatch = timeRegex.exec(timeInput);
334
+ if (!timeMatch) {
335
+ return void 0;
336
+ }
337
+ hours = parseInt(timeMatch[1], 10);
338
+ minutes = parseInt(timeMatch[2], 10);
339
+ seconds = timeMatch[3] ? parseInt(timeMatch[3], 10) : 0;
340
+ const meridiem = timeMatch[4] ? timeMatch[4].toUpperCase() : null;
341
+ if (meridiem === "PM" && hours < 12) {
342
+ hours += 12;
343
+ } else if (meridiem === "AM" && hours === 12) {
344
+ hours = 0;
345
+ }
346
+ }
347
+ const date = new Date(Date.UTC(year, month, day, hours, minutes, seconds));
348
+ if (isNaN(date.getTime())) {
349
+ return void 0;
350
+ }
351
+ return date;
352
+ };
353
+
354
+ // src/helpers/datetime.ts
355
+ var import_zod4 = require("zod");
356
+ var timeUnitInputValueSchema = import_zod4.z.object({
357
+ unit: timeUnitSchema,
358
+ value: import_zod4.z.number().finite(),
359
+ seconds: import_zod4.z.number().finite()
360
+ });
361
+ var coerceSecondsFromTimeUnitValue = (value) => {
362
+ if (!value) return 0;
363
+ if (typeof value === "object") {
364
+ const obj = value;
365
+ const seconds = obj?.seconds;
366
+ if (typeof seconds === "number" && Number.isFinite(seconds)) return seconds;
367
+ }
368
+ if (typeof value === "string") {
369
+ try {
370
+ const parsed = JSON.parse(value);
371
+ const seconds = parsed?.seconds;
372
+ if (typeof seconds === "number" && Number.isFinite(seconds))
373
+ return seconds;
374
+ } catch {
375
+ }
376
+ }
377
+ return 0;
378
+ };
379
+
380
+ // src/instructions/constants.ts
381
+ var DEFAULT_INTERVAL_SECONDS = 12;
382
+ var INSTRUCTION_DEFAULT_TIMEOUT = 3e4;
383
+
384
+ // src/instructions/build.ts
385
+ function createBuildPayload({
386
+ action,
387
+ address,
388
+ chainId,
389
+ maxExecutions,
390
+ salt,
391
+ actionArguments
392
+ }) {
393
+ return {
394
+ address,
395
+ chainId,
396
+ maxExecutions,
397
+ salt: salt ?? Math.floor(Math.random() * Number.MAX_SAFE_INTEGER),
398
+ actionArguments: {
399
+ [action]: actionArguments
400
+ }
401
+ };
402
+ }
403
+ var createScheduleStart = (values) => {
404
+ if (values && values.type === "datetime") {
405
+ const date = parseDateTime(values.startDate, values.startTime);
406
+ if (!date) throw new Error("Invalid start date or time");
407
+ return { startAt: Math.floor(date.getTime() / 1e3), startBy: 0 };
408
+ }
409
+ return { startAt: 0, startBy: 0 };
410
+ };
411
+ var createScheduleInterval = (values) => {
412
+ if (!values) return { interval: DEFAULT_INTERVAL_SECONDS };
413
+ const seconds = coerceSecondsFromTimeUnitValue(values);
414
+ return { interval: seconds || DEFAULT_INTERVAL_SECONDS };
415
+ };
416
+ var createScheduleIntervalLatencyLimit = (values) => {
417
+ if (!values) return { timeout: 0 };
418
+ const seconds = coerceSecondsFromTimeUnitValue(values);
419
+ return { timeout: seconds };
420
+ };
421
+ var createScheduleRepeat = (values) => {
422
+ if (values.type === "max-executions") {
423
+ return { maxExecutions: values.maxExecutions };
424
+ }
425
+ return { maxExecutions: 0 };
426
+ };
427
+ var resolveSchedule = (repeat, start, interval, advanced) => {
428
+ const { maxExecutions } = createScheduleRepeat(repeat);
429
+ if (!start && !interval && !advanced?.intervalLatencyLimit) {
430
+ return { maxExecutions };
431
+ }
432
+ const { startAt, startBy } = createScheduleStart(start);
433
+ const { interval: intervalSeconds } = createScheduleInterval(interval);
434
+ const { timeout } = createScheduleIntervalLatencyLimit(
435
+ advanced?.intervalLatencyLimit
436
+ );
437
+ return {
438
+ maxExecutions,
439
+ schedule: { interval: intervalSeconds, startBy, startAt, timeout }
440
+ };
441
+ };
442
+ var convertGweiToWei = (gweiValue) => {
443
+ try {
444
+ if (isNaN(Number(gweiValue)) || Number(gweiValue) < 0) {
445
+ throw new Error(`Invalid Gwei value: ${gweiValue}`);
446
+ }
447
+ const gweiString = Number(gweiValue).toFixed(18);
448
+ return (0, import_viem2.toHex)((0, import_viem2.parseUnits)(gweiString, 9));
449
+ } catch {
450
+ return (0, import_viem2.toHex)(0n);
451
+ }
452
+ };
453
+ var resolveFee = (fee, advanced) => {
454
+ const baseFee = {
455
+ fee: {
456
+ executionFee: 0,
457
+ token: fee.token,
458
+ maxBaseFeePerGas: convertGweiToWei(advanced?.maxBaseFeePerGas ?? 0),
459
+ maxPriorityFeePerGas: convertGweiToWei(
460
+ advanced?.maxPriorityFeePerGas ?? 0
461
+ )
462
+ }
463
+ };
464
+ const additionalFields = {};
465
+ if (advanced?.meanPriceLookBack) {
466
+ additionalFields.meanPriceLookBack = coerceSecondsFromTimeUnitValue(
467
+ advanced.meanPriceLookBack
468
+ );
469
+ }
470
+ if (advanced?.maxPriceDeviationBps) {
471
+ const bpsValue = parseInt(String(advanced.maxPriceDeviationBps), 10);
472
+ if (!isNaN(bpsValue)) {
473
+ additionalFields.maxPriceDeviationBps = bpsValue;
474
+ }
475
+ }
476
+ return { ...baseFee, ...additionalFields };
477
+ };
478
+ var resolveGasLimitIfNeeded = (action) => {
479
+ const actionsWithGasLimit = [
480
+ "refuel",
481
+ "transfer"
482
+ ];
483
+ return actionsWithGasLimit.includes(action) ? { gasLimit: 0 } : {};
484
+ };
485
+ var resolveDepositorForSweepDepositAccountIfNeeded = (action, depositorAddress) => {
486
+ const actions = [
487
+ "sweepDepositAccount",
488
+ "sweepDepositAccountERC20"
489
+ ];
490
+ return actions.includes(action) ? { depositor: depositorAddress } : {};
491
+ };
492
+ var resolveRecipientForUniswapV3ExactInputIfNeeded = (action, recipientAddress) => {
493
+ return action === "uniswapV3ExactInput" ? { recipient: recipientAddress } : {};
494
+ };
495
+
496
+ // src/instructions/actions/refuel/index.ts
497
+ function createRefuelBuildPayload(payload) {
498
+ const { address, chainId, maxExecutions, salt } = payload;
499
+ const action = payload.token ? InstructionAction.RefuelERC20 : InstructionAction.Refuel;
500
+ const actionArguments = {
501
+ target: payload.target,
502
+ threshold: payload.threshold,
503
+ endBalance: payload.endBalance,
504
+ fee: payload.fee,
505
+ schedule: payload.schedule
506
+ };
507
+ if (payload.token) {
508
+ actionArguments.token = payload.token;
509
+ }
510
+ if (payload.gasLimit !== void 0) {
511
+ actionArguments.gasLimit = payload.gasLimit;
512
+ }
513
+ return createBuildPayload({
514
+ action,
515
+ actionArguments,
516
+ address,
517
+ chainId,
518
+ maxExecutions,
519
+ salt
520
+ });
521
+ }
522
+
523
+ // src/instructions/actions/sweep/index.ts
524
+ function createSweepDepositAccountBuildPayload(payload) {
525
+ const { address, chainId, maxExecutions, salt } = payload;
526
+ const action = payload.token ? InstructionAction.SweepDepositAccountERC20 : InstructionAction.SweepDepositAccount;
527
+ const actionArguments = {
528
+ depositor: payload.depositor,
529
+ recipient: payload.recipient,
530
+ threshold: payload.threshold,
531
+ fee: payload.fee
532
+ };
533
+ if (payload.token) {
534
+ actionArguments.token = payload.token;
535
+ }
536
+ return createBuildPayload({
537
+ action,
538
+ actionArguments,
539
+ address,
540
+ chainId,
541
+ maxExecutions,
542
+ salt
543
+ });
544
+ }
545
+
546
+ // src/instructions/actions/swap/index.ts
547
+ function createUniswapV3ExactInputBuildPayload(payload) {
548
+ const { address, chainId, maxExecutions, salt } = payload;
549
+ const action = InstructionAction.UniswapV3ExactInput;
550
+ const actionArguments = {
551
+ recipient: payload.recipient,
552
+ tokenIn: payload.tokenIn,
553
+ tokenOut: payload.tokenOut,
554
+ feeTier: payload.feeTier,
555
+ amountIn: payload.amountIn,
556
+ floorAmountOut: payload.floorAmountOut,
557
+ meanPriceLookBack: payload.meanPriceLookBack ?? 500,
558
+ maxPriceDeviationBps: payload.maxPriceDeviationBps ?? 500,
559
+ schedule: payload.schedule,
560
+ fee: payload.fee
561
+ };
562
+ return createBuildPayload({
563
+ action,
564
+ actionArguments,
565
+ address,
566
+ chainId,
567
+ maxExecutions,
568
+ salt
569
+ });
570
+ }
571
+
572
+ // src/instructions/actions/transfer/index.ts
573
+ function createTransferBuildPayload(payload) {
574
+ const { address, chainId, maxExecutions, salt } = payload;
575
+ const action = payload.token ? InstructionAction.TransferERC20 : InstructionAction.Transfer;
576
+ const actionArguments = {
577
+ target: payload.target,
578
+ value: payload.value,
579
+ fee: payload.fee,
580
+ schedule: payload.schedule
581
+ };
582
+ if (payload.token) {
583
+ actionArguments.token = payload.token;
584
+ }
585
+ if (payload.gasLimit !== void 0) {
586
+ actionArguments.gasLimit = payload.gasLimit;
587
+ }
588
+ return createBuildPayload({
589
+ action,
590
+ actionArguments,
591
+ address,
592
+ chainId,
593
+ maxExecutions,
594
+ salt
595
+ });
596
+ }
597
+
598
+ // src/instructions/activate.ts
599
+ var import_viem3 = require("viem");
600
+
601
+ // src/instructions/contracts/artifacts/abi/build-instruction-action-arguments-abi.ts
602
+ var targetField = {
603
+ name: "target",
604
+ type: "address"
605
+ };
606
+ var scheduleField = {
607
+ name: "schedule",
608
+ type: "tuple",
609
+ components: [
610
+ { name: "startAt", type: "uint256" },
611
+ { name: "startBy", type: "uint256" },
612
+ { name: "interval", type: "uint256" },
613
+ { name: "timeout", type: "uint256" }
614
+ ]
615
+ };
616
+ var tokenField = {
617
+ name: "token",
618
+ type: "address"
619
+ };
620
+ var feeField = {
621
+ name: "fee",
622
+ type: "tuple",
623
+ components: [
624
+ { name: "token", type: "address" },
625
+ { name: "maxBaseFeePerGas", type: "uint256" },
626
+ { name: "maxPriorityFeePerGas", type: "uint256" },
627
+ { name: "executionFee", type: "uint256" }
628
+ ]
629
+ };
630
+ var refuelArgumentsAbi = [
631
+ targetField,
632
+ { name: "threshold", type: "uint256" },
633
+ { name: "endBalance", type: "uint256" },
634
+ { name: "gasLimit", type: "uint256" },
635
+ feeField
636
+ ];
637
+ var refuelERC20ArgumentsAbi = [
638
+ tokenField,
639
+ targetField,
640
+ { name: "threshold", type: "uint256" },
641
+ { name: "endBalance", type: "uint256" },
642
+ feeField
643
+ ];
644
+ var transferArgumentsAbi = [
645
+ targetField,
646
+ { name: "value", type: "uint256" },
647
+ { name: "gasLimit", type: "uint256" },
648
+ scheduleField,
649
+ feeField
650
+ ];
651
+ var transferERC20ArgumentsAbi = [
652
+ tokenField,
653
+ targetField,
654
+ { name: "value", type: "uint256" },
655
+ scheduleField,
656
+ feeField
657
+ ];
658
+ var uniswapV3ExactInputArgumentsAbi = [
659
+ { name: "recipient", type: "address" },
660
+ { name: "tokenIn", type: "address" },
661
+ { name: "tokenOut", type: "address" },
662
+ { name: "feeTier", type: "uint24" },
663
+ { name: "amountIn", type: "uint256" },
664
+ { name: "floorAmountOut", type: "uint256" },
665
+ { name: "meanPriceLookBack", type: "uint32" },
666
+ { name: "maxPriceDeviationBPS", type: "uint32" },
667
+ scheduleField,
668
+ feeField
669
+ ];
670
+ var sweepDepositAccountArgumentsAbi = [
671
+ { name: "depositor", type: "address" },
672
+ { name: "recipient", type: "address" },
673
+ { name: "threshold", type: "uint256" },
674
+ feeField
675
+ ];
676
+ var sweepDepositAccountERC20ArgumentsAbi = [
677
+ tokenField,
678
+ { name: "depositor", type: "address" },
679
+ { name: "recipient", type: "address" },
680
+ { name: "threshold", type: "uint256" },
681
+ feeField
682
+ ];
683
+ var sweepSkipCCTPDepositAccountArgumentsAbi = [
684
+ { name: "depositor", type: "address" },
685
+ { name: "destinationDomain", type: "uint32" },
686
+ { name: "destinationMintRecipient", type: "bytes32" },
687
+ { name: "threshold", type: "uint256" },
688
+ feeField
689
+ ];
690
+ var deactivateInstructionArgumentsAbi = [
691
+ { name: "instructionId", type: "bytes32" },
692
+ feeField
693
+ ];
694
+ var buildInstructionActionArgumentsAbiMap = {
695
+ [InstructionAction.Refuel]: refuelArgumentsAbi,
696
+ [InstructionAction.RefuelERC20]: refuelERC20ArgumentsAbi,
697
+ [InstructionAction.Transfer]: transferArgumentsAbi,
698
+ [InstructionAction.TransferERC20]: transferERC20ArgumentsAbi,
699
+ [InstructionAction.UniswapV3ExactInput]: uniswapV3ExactInputArgumentsAbi,
700
+ [InstructionAction.SweepDepositAccount]: sweepDepositAccountArgumentsAbi,
701
+ [InstructionAction.SweepDepositAccountERC20]: sweepDepositAccountERC20ArgumentsAbi,
702
+ [InstructionAction.SweepSkipCCTPDepositAccount]: sweepSkipCCTPDepositAccountArgumentsAbi,
703
+ [InstructionAction.DeactivateInstruction]: deactivateInstructionArgumentsAbi
704
+ };
705
+
706
+ // src/instructions/contracts/schemas/eip-712/actions/deactivate-instruction.json
707
+ var deactivate_instruction_default = {
708
+ types: {
709
+ Instruction: [
710
+ { name: "salt", type: "uint256" },
711
+ { name: "maxExecutions", type: "uint256" },
712
+ { name: "action", type: "address" },
713
+ { name: "deactivateInstruction", type: "DeactivateInstruction" }
714
+ ],
715
+ DeactivateInstruction: [
716
+ { name: "instructionId", type: "bytes32" },
717
+ { name: "fee", type: "Fee" }
718
+ ],
719
+ Fee: [
720
+ { name: "token", type: "address" },
721
+ { name: "maxBaseFeePerGas", type: "uint256" },
722
+ { name: "maxPriorityFeePerGas", type: "uint256" },
723
+ { name: "executionFee", type: "uint256" }
724
+ ]
725
+ }
726
+ };
727
+
728
+ // src/instructions/contracts/schemas/eip-712/actions/refuel-erc20.json
729
+ var refuel_erc20_default = {
730
+ types: {
731
+ Instruction: [
732
+ { name: "salt", type: "uint256" },
733
+ { name: "maxExecutions", type: "uint256" },
734
+ { name: "action", type: "address" },
735
+ { name: "refuelERC20", type: "RefuelERC20" }
736
+ ],
737
+ RefuelERC20: [
738
+ { name: "token", type: "address" },
739
+ { name: "target", type: "address" },
740
+ { name: "threshold", type: "uint256" },
741
+ { name: "endBalance", type: "uint256" },
742
+ { name: "fee", type: "Fee" }
743
+ ],
744
+ Fee: [
745
+ { name: "token", type: "address" },
746
+ { name: "maxBaseFeePerGas", type: "uint256" },
747
+ { name: "maxPriorityFeePerGas", type: "uint256" },
748
+ { name: "executionFee", type: "uint256" }
749
+ ]
750
+ }
751
+ };
752
+
753
+ // src/instructions/contracts/schemas/eip-712/actions/refuel.json
754
+ var refuel_default = {
755
+ types: {
756
+ Instruction: [
757
+ { name: "salt", type: "uint256" },
758
+ { name: "maxExecutions", type: "uint256" },
759
+ { name: "action", type: "address" },
760
+ { name: "refuel", type: "Refuel" }
761
+ ],
762
+ Refuel: [
763
+ { name: "target", type: "address" },
764
+ { name: "threshold", type: "uint256" },
765
+ { name: "endBalance", type: "uint256" },
766
+ { name: "gasLimit", type: "uint256" },
767
+ { name: "fee", type: "Fee" }
768
+ ],
769
+ Fee: [
770
+ { name: "token", type: "address" },
771
+ { name: "maxBaseFeePerGas", type: "uint256" },
772
+ { name: "maxPriorityFeePerGas", type: "uint256" },
773
+ { name: "executionFee", type: "uint256" }
774
+ ]
775
+ }
776
+ };
777
+
778
+ // src/instructions/contracts/schemas/eip-712/actions/sweep-cctp.json
779
+ var sweep_cctp_default = {
780
+ types: {
781
+ Instruction: [
782
+ { name: "salt", type: "uint256" },
783
+ { name: "maxExecutions", type: "uint256" },
784
+ { name: "action", type: "address" },
785
+ { name: "sweepCCTP", type: "SweepCCTP" }
786
+ ],
787
+ SweepCCTP: [
788
+ { name: "token", type: "address" },
789
+ { name: "destinationDomain", type: "uint32" },
790
+ { name: "destinationMintRecipient", type: "bytes32" },
791
+ { name: "threshold", type: "uint256" },
792
+ { name: "endBalance", type: "uint256" },
793
+ { name: "fee", type: "Fee" }
794
+ ],
795
+ Fee: [
796
+ { name: "token", type: "address" },
797
+ { name: "maxBaseFeePerGas", type: "uint256" },
798
+ { name: "maxPriorityFeePerGas", type: "uint256" },
799
+ { name: "executionFee", type: "uint256" }
800
+ ]
801
+ }
802
+ };
803
+
804
+ // src/instructions/contracts/schemas/eip-712/actions/sweep-deposit-account-erc20.json
805
+ var sweep_deposit_account_erc20_default = {
806
+ types: {
807
+ Instruction: [
808
+ { name: "salt", type: "uint256" },
809
+ { name: "maxExecutions", type: "uint256" },
810
+ { name: "action", type: "address" },
811
+ { name: "sweepDepositAccountERC20", type: "SweepDepositAccountERC20" }
812
+ ],
813
+ SweepDepositAccountERC20: [
814
+ { name: "token", type: "address" },
815
+ { name: "depositor", type: "address" },
816
+ { name: "recipient", type: "address" },
817
+ { name: "threshold", type: "uint256" },
818
+ { name: "fee", type: "Fee" }
819
+ ],
820
+ Fee: [
821
+ { name: "token", type: "address" },
822
+ { name: "maxBaseFeePerGas", type: "uint256" },
823
+ { name: "maxPriorityFeePerGas", type: "uint256" },
824
+ { name: "executionFee", type: "uint256" }
825
+ ]
826
+ }
827
+ };
828
+
829
+ // src/instructions/contracts/schemas/eip-712/actions/sweep-deposit-account.json
830
+ var sweep_deposit_account_default = {
831
+ types: {
832
+ Instruction: [
833
+ { name: "salt", type: "uint256" },
834
+ { name: "maxExecutions", type: "uint256" },
835
+ { name: "action", type: "address" },
836
+ { name: "sweepDepositAccount", type: "SweepDepositAccount" }
837
+ ],
838
+ SweepDepositAccount: [
839
+ { name: "depositor", type: "address" },
840
+ { name: "recipient", type: "address" },
841
+ { name: "threshold", type: "uint256" },
842
+ { name: "fee", type: "Fee" }
843
+ ],
844
+ Fee: [
845
+ { name: "token", type: "address" },
846
+ { name: "maxBaseFeePerGas", type: "uint256" },
847
+ { name: "maxPriorityFeePerGas", type: "uint256" },
848
+ { name: "executionFee", type: "uint256" }
849
+ ]
850
+ }
851
+ };
852
+
853
+ // src/instructions/contracts/schemas/eip-712/actions/sweep-erc20.json
854
+ var sweep_erc20_default = {
855
+ types: {
856
+ Instruction: [
857
+ { name: "salt", type: "uint256" },
858
+ { name: "maxExecutions", type: "uint256" },
859
+ { name: "action", type: "address" },
860
+ { name: "sweepERC20", type: "SweepERC20" }
861
+ ],
862
+ SweepERC20: [
863
+ { name: "token", type: "address" },
864
+ { name: "target", type: "address" },
865
+ { name: "threshold", type: "uint256" },
866
+ { name: "endBalance", type: "uint256" },
867
+ { name: "fee", type: "Fee" }
868
+ ],
869
+ Fee: [
870
+ { name: "token", type: "address" },
871
+ { name: "maxBaseFeePerGas", type: "uint256" },
872
+ { name: "maxPriorityFeePerGas", type: "uint256" },
873
+ { name: "executionFee", type: "uint256" }
874
+ ]
875
+ }
876
+ };
877
+
878
+ // src/instructions/contracts/schemas/eip-712/actions/sweep-skip-cctp-deposit-account.json
879
+ var sweep_skip_cctp_deposit_account_default = {
880
+ types: {
881
+ Instruction: [
882
+ { name: "salt", type: "uint256" },
883
+ { name: "maxExecutions", type: "uint256" },
884
+ { name: "action", type: "address" },
885
+ {
886
+ name: "sweepSkipCCTPDepositAccount",
887
+ type: "SweepSkipCCTPDepositAccount"
888
+ }
889
+ ],
890
+ SweepSkipCCTPDepositAccount: [
891
+ { name: "depositor", type: "address" },
892
+ { name: "destinationDomain", type: "uint32" },
893
+ { name: "destinationMintRecipient", type: "bytes32" },
894
+ { name: "threshold", type: "uint256" },
895
+ { name: "fee", type: "Fee" }
896
+ ],
897
+ Fee: [
898
+ { name: "token", type: "address" },
899
+ { name: "maxBaseFeePerGas", type: "uint256" },
900
+ { name: "maxPriorityFeePerGas", type: "uint256" },
901
+ { name: "executionFee", type: "uint256" }
902
+ ]
903
+ }
904
+ };
905
+
906
+ // src/instructions/contracts/schemas/eip-712/actions/sweep-uniswap-v3.json
907
+ var sweep_uniswap_v3_default = {
908
+ types: {
909
+ Instruction: [
910
+ { name: "salt", type: "uint256" },
911
+ { name: "maxExecutions", type: "uint256" },
912
+ { name: "action", type: "address" },
913
+ { name: "sweepUniswapV3", type: "SweepUniswapV3" }
914
+ ],
915
+ SweepUniswapV3: [
916
+ { name: "recipient", type: "address" },
917
+ { name: "tokenIn", type: "address" },
918
+ { name: "tokenOut", type: "address" },
919
+ { name: "feeTier", type: "uint24" },
920
+ { name: "threshold", type: "uint256" },
921
+ { name: "endBalance", type: "uint256" },
922
+ { name: "floorAmountOut", type: "uint256" },
923
+ { name: "meanPriceLookBack", type: "uint32" },
924
+ { name: "maxPriceDeviationBPS", type: "uint32" },
925
+ { name: "fee", type: "Fee" }
926
+ ],
927
+ Fee: [
928
+ { name: "token", type: "address" },
929
+ { name: "maxBaseFeePerGas", type: "uint256" },
930
+ { name: "maxPriorityFeePerGas", type: "uint256" },
931
+ { name: "executionFee", type: "uint256" }
932
+ ]
933
+ }
934
+ };
935
+
936
+ // src/instructions/contracts/schemas/eip-712/actions/sweep.json
937
+ var sweep_default = {
938
+ types: {
939
+ Instruction: [
940
+ { name: "salt", type: "uint256" },
941
+ { name: "maxExecutions", type: "uint256" },
942
+ { name: "action", type: "address" },
943
+ { name: "sweep", type: "Sweep" }
944
+ ],
945
+ Sweep: [
946
+ { name: "target", type: "address" },
947
+ { name: "threshold", type: "uint256" },
948
+ { name: "endBalance", type: "uint256" },
949
+ { name: "gasLimit", type: "uint256" },
950
+ { name: "fee", type: "Fee" }
951
+ ],
952
+ Fee: [
953
+ { name: "token", type: "address" },
954
+ { name: "maxBaseFeePerGas", type: "uint256" },
955
+ { name: "maxPriorityFeePerGas", type: "uint256" },
956
+ { name: "executionFee", type: "uint256" }
957
+ ]
958
+ }
959
+ };
960
+
961
+ // src/instructions/contracts/schemas/eip-712/actions/transfer-erc20.json
962
+ var transfer_erc20_default = {
963
+ types: {
964
+ Instruction: [
965
+ { name: "salt", type: "uint256" },
966
+ { name: "maxExecutions", type: "uint256" },
967
+ { name: "action", type: "address" },
968
+ { name: "transferERC20", type: "TransferERC20" }
969
+ ],
970
+ TransferERC20: [
971
+ { name: "token", type: "address" },
972
+ { name: "target", type: "address" },
973
+ { name: "value", type: "uint256" },
974
+ { name: "schedule", type: "Schedule" },
975
+ { name: "fee", type: "Fee" }
976
+ ],
977
+ Schedule: [
978
+ { name: "startAt", type: "uint256" },
979
+ { name: "startBy", type: "uint256" },
980
+ { name: "interval", type: "uint256" },
981
+ { name: "timeout", type: "uint256" }
982
+ ],
983
+ Fee: [
984
+ { name: "token", type: "address" },
985
+ { name: "maxBaseFeePerGas", type: "uint256" },
986
+ { name: "maxPriorityFeePerGas", type: "uint256" },
987
+ { name: "executionFee", type: "uint256" }
988
+ ]
989
+ }
990
+ };
991
+
992
+ // src/instructions/contracts/schemas/eip-712/actions/transfer.json
993
+ var transfer_default = {
994
+ types: {
995
+ Instruction: [
996
+ { name: "salt", type: "uint256" },
997
+ { name: "maxExecutions", type: "uint256" },
998
+ { name: "action", type: "address" },
999
+ { name: "transfer", type: "Transfer" }
1000
+ ],
1001
+ Transfer: [
1002
+ { name: "target", type: "address" },
1003
+ { name: "value", type: "uint256" },
1004
+ { name: "gasLimit", type: "uint256" },
1005
+ { name: "schedule", type: "Schedule" },
1006
+ { name: "fee", type: "Fee" }
1007
+ ],
1008
+ Schedule: [
1009
+ { name: "startAt", type: "uint256" },
1010
+ { name: "startBy", type: "uint256" },
1011
+ { name: "interval", type: "uint256" },
1012
+ { name: "timeout", type: "uint256" }
1013
+ ],
1014
+ Fee: [
1015
+ { name: "token", type: "address" },
1016
+ { name: "maxBaseFeePerGas", type: "uint256" },
1017
+ { name: "maxPriorityFeePerGas", type: "uint256" },
1018
+ { name: "executionFee", type: "uint256" }
1019
+ ]
1020
+ }
1021
+ };
1022
+
1023
+ // src/instructions/contracts/schemas/eip-712/actions/uniswap-v3-exact-input.json
1024
+ var uniswap_v3_exact_input_default = {
1025
+ types: {
1026
+ Instruction: [
1027
+ { name: "salt", type: "uint256" },
1028
+ { name: "maxExecutions", type: "uint256" },
1029
+ { name: "action", type: "address" },
1030
+ { name: "uniswapV3ExactInput", type: "UniswapV3ExactInput" }
1031
+ ],
1032
+ UniswapV3ExactInput: [
1033
+ { name: "recipient", type: "address" },
1034
+ { name: "tokenIn", type: "address" },
1035
+ { name: "tokenOut", type: "address" },
1036
+ { name: "feeTier", type: "uint24" },
1037
+ { name: "amountIn", type: "uint256" },
1038
+ { name: "floorAmountOut", type: "uint256" },
1039
+ { name: "meanPriceLookBack", type: "uint32" },
1040
+ { name: "maxPriceDeviationBPS", type: "uint32" },
1041
+ { name: "schedule", type: "Schedule" },
1042
+ { name: "fee", type: "Fee" }
1043
+ ],
1044
+ Schedule: [
1045
+ { name: "startAt", type: "uint256" },
1046
+ { name: "startBy", type: "uint256" },
1047
+ { name: "interval", type: "uint256" },
1048
+ { name: "timeout", type: "uint256" }
1049
+ ],
1050
+ Fee: [
1051
+ { name: "token", type: "address" },
1052
+ { name: "maxBaseFeePerGas", type: "uint256" },
1053
+ { name: "maxPriorityFeePerGas", type: "uint256" },
1054
+ { name: "executionFee", type: "uint256" }
1055
+ ]
1056
+ }
1057
+ };
1058
+
1059
+ // src/instructions/types.ts
1060
+ var eip712TypesMap = {
1061
+ refuel: refuel_default,
1062
+ refuelERC20: refuel_erc20_default,
1063
+ transfer: transfer_default,
1064
+ transferERC20: transfer_erc20_default,
1065
+ uniswapV3ExactInput: uniswap_v3_exact_input_default,
1066
+ sweep: sweep_default,
1067
+ sweepERC20: sweep_erc20_default,
1068
+ sweepCCTP: sweep_cctp_default,
1069
+ sweepUniswapV3: sweep_uniswap_v3_default,
1070
+ sweepDepositAccount: sweep_deposit_account_default,
1071
+ sweepDepositAccountERC20: sweep_deposit_account_erc20_default,
1072
+ sweepSkipCCTPDepositAccount: sweep_skip_cctp_deposit_account_default,
1073
+ deactivateInstruction: deactivate_instruction_default
1074
+ };
1075
+
1076
+ // src/instructions/activate.ts
1077
+ function createInstructionDomain(config) {
1078
+ return {
1079
+ chainId: config.chainId,
1080
+ name: "OtimDelegate",
1081
+ salt: (0, import_viem3.keccak256)((0, import_viem3.toHex)("ON_TIME_INSTRUCTED_MONEY")),
1082
+ verifyingContract: config.delegateAddress,
1083
+ version: "1"
1084
+ };
1085
+ }
1086
+ function decodeInstructionParameters(salt, maxExecutions, argumentsHex, actionName) {
1087
+ const eip712Types = eip712TypesMap[actionName];
1088
+ const argumentsAbi = buildInstructionActionArgumentsAbiMap[actionName];
1089
+ if (!eip712Types) {
1090
+ throw new Error(`No EIP-712 types found for action: ${actionName}`);
1091
+ }
1092
+ if (!argumentsAbi) {
1093
+ throw new Error(`No arguments ABI found for action: ${actionName}`);
1094
+ }
1095
+ const [decodedSalt] = (0, import_viem3.decodeAbiParameters)(
1096
+ [eip712Types.types.Instruction[0]],
1097
+ (0, import_viem3.pad)(salt)
1098
+ );
1099
+ const [decodedMaxExecutions] = (0, import_viem3.decodeAbiParameters)(
1100
+ [eip712Types.types.Instruction[1]],
1101
+ (0, import_viem3.pad)(maxExecutions)
1102
+ );
1103
+ const decodedArgsArray = (0, import_viem3.decodeAbiParameters)(argumentsAbi, argumentsHex);
1104
+ const decodedArguments = {};
1105
+ argumentsAbi.forEach((param, index) => {
1106
+ decodedArguments[param.name] = decodedArgsArray[index];
1107
+ });
1108
+ return {
1109
+ decodedSalt,
1110
+ decodedMaxExecutions,
1111
+ decodedArguments
1112
+ };
1113
+ }
1114
+ function createInstructionTypedData(payload, config) {
1115
+ const { decodedSalt, decodedMaxExecutions, decodedArguments } = decodeInstructionParameters(
1116
+ payload.salt,
1117
+ payload.maxExecutions,
1118
+ payload.arguments,
1119
+ payload.actionName
1120
+ );
1121
+ const eip712Types = eip712TypesMap[payload.actionName];
1122
+ if (!eip712Types) {
1123
+ throw new Error(`No EIP-712 types found for action: ${payload.actionName}`);
1124
+ }
1125
+ const domain = createInstructionDomain(config);
1126
+ return {
1127
+ domain,
1128
+ primaryType: "Instruction",
1129
+ types: eip712Types.types,
1130
+ message: {
1131
+ [payload.actionName]: decodedArguments,
1132
+ salt: decodedSalt,
1133
+ maxExecutions: decodedMaxExecutions,
1134
+ action: payload.action
1135
+ }
1136
+ };
1137
+ }
1138
+ function createActivationPayload(payload) {
1139
+ const vrs = parseSignatureToVRS(payload.signature);
1140
+ const primitiveSignature = createEIP2098Signature(vrs);
1141
+ return {
1142
+ nickname: payload.nickname,
1143
+ address: payload.address,
1144
+ chainId: payload.chainId,
1145
+ salt: payload.salt,
1146
+ maxExecutions: payload.maxExecutions,
1147
+ action: payload.action,
1148
+ arguments: payload.arguments,
1149
+ activationSignature: primitiveSignature
1150
+ };
1151
+ }
1152
+ //# sourceMappingURL=index.js.map