@eco-incorp/sauce 0.99.6 → 0.99.7

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 (1158) hide show
  1. package/README.md +58 -16
  2. package/actions/action-program.schema.json +480 -379
  3. package/actions/dist/abis.d.ts +19 -18
  4. package/actions/dist/abis.d.ts.map +1 -1
  5. package/actions/dist/abis.js +29 -29
  6. package/actions/dist/compile.d.ts +4 -4
  7. package/actions/dist/compile.d.ts.map +1 -1
  8. package/actions/dist/compile.js +3 -1
  9. package/actions/dist/compose.d.ts +63 -6
  10. package/actions/dist/compose.d.ts.map +1 -1
  11. package/actions/dist/compose.js +100 -16
  12. package/actions/dist/index.d.ts +1 -1
  13. package/actions/dist/index.d.ts.map +1 -1
  14. package/actions/dist/names.d.ts +88 -0
  15. package/actions/dist/names.d.ts.map +1 -0
  16. package/actions/dist/names.js +324 -0
  17. package/actions/dist/program.d.ts.map +1 -1
  18. package/actions/dist/program.js +115 -5
  19. package/actions/dist/registry.d.ts +10 -8
  20. package/actions/dist/registry.d.ts.map +1 -1
  21. package/actions/dist/registry.js +10 -8
  22. package/actions/dist/schema.d.ts.map +1 -1
  23. package/actions/dist/schema.js +99 -12
  24. package/actions/dist/semantics.d.ts +12 -2
  25. package/actions/dist/semantics.d.ts.map +1 -1
  26. package/actions/dist/semantics.js +78 -8
  27. package/actions/dist/spec.d.ts +30 -0
  28. package/actions/dist/spec.d.ts.map +1 -1
  29. package/actions/dist/spec.js +151 -138
  30. package/actions/dist/split-swap.d.ts +10 -5
  31. package/actions/dist/split-swap.d.ts.map +1 -1
  32. package/actions/dist/split-swap.js +48 -7
  33. package/actions/dist/to-quote.d.ts +14 -5
  34. package/actions/dist/to-quote.d.ts.map +1 -1
  35. package/actions/dist/to-quote.js +210 -244
  36. package/actions/dist/to-sauce.d.ts +18 -4
  37. package/actions/dist/to-sauce.d.ts.map +1 -1
  38. package/actions/dist/to-sauce.js +232 -205
  39. package/actions/dist/types.d.ts +245 -147
  40. package/actions/dist/types.d.ts.map +1 -1
  41. package/actions/dist/types.js +4 -0
  42. package/docs/README.md +38 -0
  43. package/docs/api/README.md +37 -23
  44. package/docs/api/compiler.md +53 -12
  45. package/docs/api/contracts.md +105 -0
  46. package/docs/api/coverage.md +80 -57
  47. package/docs/api/router.md +238 -0
  48. package/docs/api/routes.md +31 -22
  49. package/docs/concepts/architecture.md +26 -3
  50. package/docs/concepts/saucescript.md +35 -55
  51. package/docs/examples/README.md +21 -14
  52. package/docs/examples/action-program.ts +51 -35
  53. package/docs/examples/cross-chain-cascade.sauce.ts +4 -0
  54. package/docs/examples/cross-chain-intent.sauce.ts +2 -1
  55. package/docs/examples/evm-execution.ts +2 -4
  56. package/docs/examples/first-intent.ts +7 -2
  57. package/docs/examples/pot-router.ts +19 -0
  58. package/docs/examples/registry-names.ts +52 -0
  59. package/docs/examples/router-route.sauce.ts +31 -0
  60. package/docs/examples/router-route.ts +72 -0
  61. package/docs/examples/router-swap.sauce.ts +16 -0
  62. package/docs/examples/router-swap.ts +47 -0
  63. package/docs/examples/venue-where-deployed.sauce.ts +14 -0
  64. package/docs/guides/actions.md +230 -120
  65. package/docs/guides/builders-and-actions.md +20 -14
  66. package/docs/guides/cli.md +1442 -0
  67. package/docs/guides/compiling.md +19 -7
  68. package/docs/guides/intents.md +228 -15
  69. package/docs/guides/mcp.md +539 -0
  70. package/docs/guides/nested-intents.md +21 -6
  71. package/docs/guides/protocols-and-tokens.md +218 -39
  72. package/docs/guides/quick-start.md +5 -0
  73. package/docs/guides/solana.md +199 -52
  74. package/docs/guides/verification.md +2 -2
  75. package/mcp/dist/config.js +78 -0
  76. package/mcp/dist/config.js.map +1 -0
  77. package/mcp/dist/entry.js +112 -0
  78. package/mcp/dist/entry.js.map +1 -0
  79. package/mcp/dist/files.js +64 -0
  80. package/mcp/dist/files.js.map +1 -0
  81. package/mcp/dist/guard.js +262 -0
  82. package/mcp/dist/guard.js.map +1 -0
  83. package/mcp/dist/http.js +111 -0
  84. package/mcp/dist/http.js.map +1 -0
  85. package/mcp/dist/intents.js +579 -0
  86. package/mcp/dist/intents.js.map +1 -0
  87. package/mcp/dist/prompts.js +153 -0
  88. package/mcp/dist/prompts.js.map +1 -0
  89. package/mcp/dist/reach.js +98 -0
  90. package/mcp/dist/reach.js.map +1 -0
  91. package/mcp/dist/resources.js +154 -0
  92. package/mcp/dist/resources.js.map +1 -0
  93. package/mcp/dist/sdk.js +34 -0
  94. package/mcp/dist/sdk.js.map +1 -0
  95. package/mcp/dist/server.js +119 -0
  96. package/mcp/dist/server.js.map +1 -0
  97. package/mcp/dist/setup.js +189 -0
  98. package/mcp/dist/setup.js.map +1 -0
  99. package/mcp/dist/skilltools.js +520 -0
  100. package/mcp/dist/skilltools.js.map +1 -0
  101. package/mcp/dist/terms.js +93 -0
  102. package/mcp/dist/terms.js.map +1 -0
  103. package/mcp/dist/tools.js +1497 -0
  104. package/mcp/dist/tools.js.map +1 -0
  105. package/mcp/dist/wallets.js +168 -0
  106. package/mcp/dist/wallets.js.map +1 -0
  107. package/package.json +18 -13
  108. package/sdk/dist/artifacts/V12Deployments.json +3 -1
  109. package/sdk/dist/artifacts/V12EngineGate.json +1 -2
  110. package/sdk/dist/artifacts/V12KitchenProxy.json +1 -0
  111. package/sdk/dist/chains/canonical.d.ts +15 -24
  112. package/sdk/dist/chains/canonical.d.ts.map +1 -1
  113. package/sdk/dist/chains/canonical.js +18 -29
  114. package/sdk/dist/chains/canonical.js.map +1 -1
  115. package/sdk/dist/cli/actions.d.ts +29 -0
  116. package/sdk/dist/cli/actions.d.ts.map +1 -0
  117. package/sdk/dist/cli/actions.js +122 -0
  118. package/sdk/dist/cli/actions.js.map +1 -0
  119. package/sdk/dist/cli/args.d.ts +118 -0
  120. package/sdk/dist/cli/args.d.ts.map +1 -0
  121. package/sdk/dist/cli/args.js +354 -0
  122. package/sdk/dist/cli/args.js.map +1 -0
  123. package/sdk/dist/cli/assume.d.ts +51 -0
  124. package/sdk/dist/cli/assume.d.ts.map +1 -0
  125. package/sdk/dist/cli/assume.js +207 -0
  126. package/sdk/dist/cli/assume.js.map +1 -0
  127. package/sdk/dist/cli/chain.d.ts +170 -0
  128. package/sdk/dist/cli/chain.d.ts.map +1 -0
  129. package/sdk/dist/cli/chain.js +457 -0
  130. package/sdk/dist/cli/chain.js.map +1 -0
  131. package/sdk/dist/cli/commands.d.ts +226 -0
  132. package/sdk/dist/cli/commands.d.ts.map +1 -0
  133. package/sdk/dist/cli/commands.js +637 -0
  134. package/sdk/dist/cli/commands.js.map +1 -0
  135. package/sdk/dist/cli/create.d.ts +70 -0
  136. package/sdk/dist/cli/create.d.ts.map +1 -0
  137. package/sdk/dist/cli/create.js +483 -0
  138. package/sdk/dist/cli/create.js.map +1 -0
  139. package/sdk/dist/cli/diagnostics.d.ts +12 -0
  140. package/sdk/dist/cli/diagnostics.d.ts.map +1 -0
  141. package/sdk/dist/cli/diagnostics.js +200 -0
  142. package/sdk/dist/cli/diagnostics.js.map +1 -0
  143. package/sdk/dist/cli/effects.d.ts +71 -0
  144. package/sdk/dist/cli/effects.d.ts.map +1 -0
  145. package/sdk/dist/cli/effects.js +279 -0
  146. package/sdk/dist/cli/effects.js.map +1 -0
  147. package/sdk/dist/cli/fill.d.ts +83 -0
  148. package/sdk/dist/cli/fill.d.ts.map +1 -0
  149. package/sdk/dist/cli/fill.js +734 -0
  150. package/sdk/dist/cli/fill.js.map +1 -0
  151. package/sdk/dist/cli/funding.d.ts +126 -0
  152. package/sdk/dist/cli/funding.d.ts.map +1 -0
  153. package/sdk/dist/cli/funding.js +514 -0
  154. package/sdk/dist/cli/funding.js.map +1 -0
  155. package/sdk/dist/cli/globals.d.ts +16 -0
  156. package/sdk/dist/cli/globals.d.ts.map +1 -0
  157. package/sdk/dist/cli/globals.js +197 -0
  158. package/sdk/dist/cli/globals.js.map +1 -0
  159. package/sdk/dist/cli/init.d.ts +34 -0
  160. package/sdk/dist/cli/init.d.ts.map +1 -0
  161. package/sdk/dist/cli/init.js +181 -0
  162. package/sdk/dist/cli/init.js.map +1 -0
  163. package/sdk/dist/cli/inputs.d.ts +72 -0
  164. package/sdk/dist/cli/inputs.d.ts.map +1 -0
  165. package/sdk/dist/cli/inputs.js +152 -0
  166. package/sdk/dist/cli/inputs.js.map +1 -0
  167. package/sdk/dist/cli/inspect.d.ts +48 -0
  168. package/sdk/dist/cli/inspect.d.ts.map +1 -0
  169. package/sdk/dist/cli/inspect.js +536 -0
  170. package/sdk/dist/cli/inspect.js.map +1 -0
  171. package/sdk/dist/cli/intent-commands.d.ts +71 -0
  172. package/sdk/dist/cli/intent-commands.d.ts.map +1 -0
  173. package/sdk/dist/cli/intent-commands.js +698 -0
  174. package/sdk/dist/cli/intent-commands.js.map +1 -0
  175. package/sdk/dist/cli/intent-svm.d.ts +15 -0
  176. package/sdk/dist/cli/intent-svm.d.ts.map +1 -0
  177. package/sdk/dist/cli/intent-svm.js +222 -0
  178. package/sdk/dist/cli/intent-svm.js.map +1 -0
  179. package/sdk/dist/cli/intents.d.ts +43 -0
  180. package/sdk/dist/cli/intents.d.ts.map +1 -0
  181. package/sdk/dist/cli/intents.js +89 -0
  182. package/sdk/dist/cli/intents.js.map +1 -0
  183. package/sdk/dist/cli/interactive.d.ts +11 -0
  184. package/sdk/dist/cli/interactive.d.ts.map +1 -0
  185. package/sdk/dist/cli/interactive.js +161 -0
  186. package/sdk/dist/cli/interactive.js.map +1 -0
  187. package/sdk/dist/cli/lifecycle-svm.d.ts +109 -0
  188. package/sdk/dist/cli/lifecycle-svm.d.ts.map +1 -0
  189. package/sdk/dist/cli/lifecycle-svm.js +299 -0
  190. package/sdk/dist/cli/lifecycle-svm.js.map +1 -0
  191. package/sdk/dist/cli/lifecycle.d.ts +439 -0
  192. package/sdk/dist/cli/lifecycle.d.ts.map +1 -0
  193. package/sdk/dist/cli/lifecycle.js +1721 -0
  194. package/sdk/dist/cli/lifecycle.js.map +1 -0
  195. package/sdk/dist/cli/main.d.ts +3 -0
  196. package/sdk/dist/cli/main.d.ts.map +1 -0
  197. package/sdk/dist/cli/main.js +8 -0
  198. package/sdk/dist/cli/main.js.map +1 -0
  199. package/sdk/dist/cli/mcp.d.ts +66 -0
  200. package/sdk/dist/cli/mcp.d.ts.map +1 -0
  201. package/sdk/dist/cli/mcp.js +169 -0
  202. package/sdk/dist/cli/mcp.js.map +1 -0
  203. package/sdk/dist/cli/password.d.ts +54 -0
  204. package/sdk/dist/cli/password.d.ts.map +1 -0
  205. package/sdk/dist/cli/password.js +148 -0
  206. package/sdk/dist/cli/password.js.map +1 -0
  207. package/sdk/dist/cli/policy.d.ts +130 -0
  208. package/sdk/dist/cli/policy.d.ts.map +1 -0
  209. package/sdk/dist/cli/policy.js +702 -0
  210. package/sdk/dist/cli/policy.js.map +1 -0
  211. package/sdk/dist/cli/pools.d.ts +140 -0
  212. package/sdk/dist/cli/pools.d.ts.map +1 -0
  213. package/sdk/dist/cli/pools.js +658 -0
  214. package/sdk/dist/cli/pools.js.map +1 -0
  215. package/sdk/dist/cli/price.d.ts +74 -0
  216. package/sdk/dist/cli/price.d.ts.map +1 -0
  217. package/sdk/dist/cli/price.js +321 -0
  218. package/sdk/dist/cli/price.js.map +1 -0
  219. package/sdk/dist/cli/prompt.d.ts +30 -0
  220. package/sdk/dist/cli/prompt.d.ts.map +1 -0
  221. package/sdk/dist/cli/prompt.js +53 -0
  222. package/sdk/dist/cli/prompt.js.map +1 -0
  223. package/sdk/dist/cli/publish.d.ts +48 -0
  224. package/sdk/dist/cli/publish.d.ts.map +1 -0
  225. package/sdk/dist/cli/publish.js +480 -0
  226. package/sdk/dist/cli/publish.js.map +1 -0
  227. package/sdk/dist/cli/receipt.d.ts +35 -0
  228. package/sdk/dist/cli/receipt.d.ts.map +1 -0
  229. package/sdk/dist/cli/receipt.js +63 -0
  230. package/sdk/dist/cli/receipt.js.map +1 -0
  231. package/sdk/dist/cli/rehearse.d.ts +80 -0
  232. package/sdk/dist/cli/rehearse.d.ts.map +1 -0
  233. package/sdk/dist/cli/rehearse.js +265 -0
  234. package/sdk/dist/cli/rehearse.js.map +1 -0
  235. package/sdk/dist/cli/report.d.ts +69 -0
  236. package/sdk/dist/cli/report.d.ts.map +1 -0
  237. package/sdk/dist/cli/report.js +206 -0
  238. package/sdk/dist/cli/report.js.map +1 -0
  239. package/sdk/dist/cli/returned.d.ts +16 -0
  240. package/sdk/dist/cli/returned.d.ts.map +1 -0
  241. package/sdk/dist/cli/returned.js +111 -0
  242. package/sdk/dist/cli/returned.js.map +1 -0
  243. package/sdk/dist/cli/run.d.ts +40 -0
  244. package/sdk/dist/cli/run.d.ts.map +1 -0
  245. package/sdk/dist/cli/run.js +3162 -0
  246. package/sdk/dist/cli/run.js.map +1 -0
  247. package/sdk/dist/cli/signer.d.ts +72 -0
  248. package/sdk/dist/cli/signer.d.ts.map +1 -0
  249. package/sdk/dist/cli/signer.js +243 -0
  250. package/sdk/dist/cli/signer.js.map +1 -0
  251. package/sdk/dist/cli/simulate.d.ts +11 -0
  252. package/sdk/dist/cli/simulate.d.ts.map +1 -0
  253. package/sdk/dist/cli/simulate.js +246 -0
  254. package/sdk/dist/cli/simulate.js.map +1 -0
  255. package/sdk/dist/cli/skills.d.ts +77 -0
  256. package/sdk/dist/cli/skills.d.ts.map +1 -0
  257. package/sdk/dist/cli/skills.js +527 -0
  258. package/sdk/dist/cli/skills.js.map +1 -0
  259. package/sdk/dist/cli/solana.d.ts +183 -0
  260. package/sdk/dist/cli/solana.d.ts.map +1 -0
  261. package/sdk/dist/cli/solana.js +1360 -0
  262. package/sdk/dist/cli/solana.js.map +1 -0
  263. package/sdk/dist/cli/store.d.ts +60 -0
  264. package/sdk/dist/cli/store.d.ts.map +1 -0
  265. package/sdk/dist/cli/store.js +196 -0
  266. package/sdk/dist/cli/store.js.map +1 -0
  267. package/sdk/dist/cli/support.d.ts +144 -0
  268. package/sdk/dist/cli/support.d.ts.map +1 -0
  269. package/sdk/dist/cli/support.js +217 -0
  270. package/sdk/dist/cli/support.js.map +1 -0
  271. package/sdk/dist/cli/svm-effects.d.ts +50 -0
  272. package/sdk/dist/cli/svm-effects.d.ts.map +1 -0
  273. package/sdk/dist/cli/svm-effects.js +196 -0
  274. package/sdk/dist/cli/svm-effects.js.map +1 -0
  275. package/sdk/dist/cli/terminal.d.ts +42 -0
  276. package/sdk/dist/cli/terminal.d.ts.map +1 -0
  277. package/sdk/dist/cli/terminal.js +136 -0
  278. package/sdk/dist/cli/terminal.js.map +1 -0
  279. package/sdk/dist/cli/verify.d.ts +32 -0
  280. package/sdk/dist/cli/verify.d.ts.map +1 -0
  281. package/sdk/dist/cli/verify.js +185 -0
  282. package/sdk/dist/cli/verify.js.map +1 -0
  283. package/sdk/dist/cli/wallet-commands.d.ts +59 -0
  284. package/sdk/dist/cli/wallet-commands.d.ts.map +1 -0
  285. package/sdk/dist/cli/wallet-commands.js +222 -0
  286. package/sdk/dist/cli/wallet-commands.js.map +1 -0
  287. package/sdk/dist/cli/wallet-send.d.ts +38 -0
  288. package/sdk/dist/cli/wallet-send.d.ts.map +1 -0
  289. package/sdk/dist/cli/wallet-send.js +303 -0
  290. package/sdk/dist/cli/wallet-send.js.map +1 -0
  291. package/sdk/dist/cli/wallets.d.ts +79 -0
  292. package/sdk/dist/cli/wallets.d.ts.map +1 -0
  293. package/sdk/dist/cli/wallets.js +297 -0
  294. package/sdk/dist/cli/wallets.js.map +1 -0
  295. package/sdk/dist/deployments/index.d.ts +4 -62
  296. package/sdk/dist/deployments/index.d.ts.map +1 -1
  297. package/sdk/dist/deployments/index.js +4 -84
  298. package/sdk/dist/deployments/index.js.map +1 -1
  299. package/sdk/dist/deployments/pot.d.ts +17 -7
  300. package/sdk/dist/deployments/pot.d.ts.map +1 -1
  301. package/sdk/dist/deployments/pot.js +25 -10
  302. package/sdk/dist/deployments/pot.js.map +1 -1
  303. package/sdk/dist/deployments/releases.d.ts +36 -0
  304. package/sdk/dist/deployments/releases.d.ts.map +1 -0
  305. package/sdk/dist/deployments/releases.js +61 -0
  306. package/sdk/dist/deployments/releases.js.map +1 -0
  307. package/sdk/dist/deployments/releases.json +76 -0
  308. package/sdk/dist/deployments/v12-addresses.d.ts +13 -0
  309. package/sdk/dist/deployments/v12-addresses.d.ts.map +1 -1
  310. package/sdk/dist/deployments/v12-addresses.js +16 -3
  311. package/sdk/dist/deployments/v12-addresses.js.map +1 -1
  312. package/sdk/dist/deposit/index.d.ts +6 -6
  313. package/sdk/dist/deposit/index.d.ts.map +1 -1
  314. package/sdk/dist/deposit/index.js +1 -1
  315. package/sdk/dist/deposit/index.js.map +1 -1
  316. package/sdk/dist/deposit/params.d.ts +4 -4
  317. package/sdk/dist/deposit/params.d.ts.map +1 -1
  318. package/sdk/dist/deposit/params.js +7 -4
  319. package/sdk/dist/deposit/params.js.map +1 -1
  320. package/sdk/dist/deposit/source.d.ts +3 -30
  321. package/sdk/dist/deposit/source.d.ts.map +1 -1
  322. package/sdk/dist/deposit/source.js +7 -83
  323. package/sdk/dist/deposit/source.js.map +1 -1
  324. package/sdk/dist/deposit/templates.d.ts +1 -2
  325. package/sdk/dist/deposit/templates.d.ts.map +1 -1
  326. package/sdk/dist/deposit/templates.js +10 -2
  327. package/sdk/dist/deposit/templates.js.map +1 -1
  328. package/sdk/dist/deposit/types.d.ts +14 -12
  329. package/sdk/dist/deposit/types.d.ts.map +1 -1
  330. package/sdk/dist/deposit/types.js +6 -0
  331. package/sdk/dist/deposit/types.js.map +1 -1
  332. package/sdk/dist/descriptors/accessors.d.ts +38 -35
  333. package/sdk/dist/descriptors/accessors.d.ts.map +1 -1
  334. package/sdk/dist/descriptors/accessors.js +16 -0
  335. package/sdk/dist/descriptors/accessors.js.map +1 -1
  336. package/sdk/dist/descriptors/call.d.ts +66 -14
  337. package/sdk/dist/descriptors/call.d.ts.map +1 -1
  338. package/sdk/dist/descriptors/call.js +94 -13
  339. package/sdk/dist/descriptors/call.js.map +1 -1
  340. package/sdk/dist/descriptors/contracts.generated.d.ts +3393 -0
  341. package/sdk/dist/descriptors/contracts.generated.d.ts.map +1 -0
  342. package/sdk/dist/descriptors/contracts.generated.js +728 -0
  343. package/sdk/dist/descriptors/contracts.generated.js.map +1 -0
  344. package/sdk/dist/descriptors/derive.d.ts +20 -11
  345. package/sdk/dist/descriptors/derive.d.ts.map +1 -1
  346. package/sdk/dist/descriptors/derive.js +68 -30
  347. package/sdk/dist/descriptors/derive.js.map +1 -1
  348. package/sdk/dist/descriptors/index.d.ts +6 -7
  349. package/sdk/dist/descriptors/index.d.ts.map +1 -1
  350. package/sdk/dist/descriptors/index.js +2 -2
  351. package/sdk/dist/descriptors/index.js.map +1 -1
  352. package/sdk/dist/descriptors/links.d.ts +23 -214
  353. package/sdk/dist/descriptors/links.d.ts.map +1 -1
  354. package/sdk/dist/descriptors/links.js +1 -232
  355. package/sdk/dist/descriptors/links.js.map +1 -1
  356. package/sdk/dist/descriptors/query.d.ts +1 -1
  357. package/sdk/dist/descriptors/query.d.ts.map +1 -1
  358. package/sdk/dist/descriptors/query.js +1 -1
  359. package/sdk/dist/descriptors/query.js.map +1 -1
  360. package/sdk/dist/descriptors/registry.d.ts +2 -5
  361. package/sdk/dist/descriptors/registry.d.ts.map +1 -1
  362. package/sdk/dist/descriptors/registry.js +11 -66
  363. package/sdk/dist/descriptors/registry.js.map +1 -1
  364. package/sdk/dist/embedded/resolve.d.ts +4 -4
  365. package/sdk/dist/embedded/resolve.d.ts.map +1 -1
  366. package/sdk/dist/embedded/resolve.js +12 -8
  367. package/sdk/dist/embedded/resolve.js.map +1 -1
  368. package/sdk/dist/embedded/skills.generated.d.ts +1 -1
  369. package/sdk/dist/embedded/skills.generated.d.ts.map +1 -1
  370. package/sdk/dist/embedded/skills.generated.js +137 -136
  371. package/sdk/dist/embedded/skills.generated.js.map +1 -1
  372. package/sdk/dist/embedded/sources.generated.d.ts.map +1 -1
  373. package/sdk/dist/embedded/sources.generated.js +40 -6
  374. package/sdk/dist/embedded/sources.generated.js.map +1 -1
  375. package/sdk/dist/evm/engine.d.ts +813 -10
  376. package/sdk/dist/evm/engine.d.ts.map +1 -1
  377. package/sdk/dist/evm/engine.js +127 -8
  378. package/sdk/dist/evm/engine.js.map +1 -1
  379. package/sdk/dist/index.d.ts +3 -2
  380. package/sdk/dist/index.d.ts.map +1 -1
  381. package/sdk/dist/index.js +6 -2
  382. package/sdk/dist/index.js.map +1 -1
  383. package/sdk/dist/price.d.ts +40 -0
  384. package/sdk/dist/price.d.ts.map +1 -0
  385. package/sdk/dist/price.js +101 -0
  386. package/sdk/dist/price.js.map +1 -0
  387. package/sdk/dist/protocols/aerodrome/abis.d.ts +76 -0
  388. package/sdk/dist/protocols/aerodrome/abis.d.ts.map +1 -1
  389. package/sdk/dist/protocols/aerodrome/abis.js +61 -0
  390. package/sdk/dist/protocols/aerodrome/abis.js.map +1 -1
  391. package/sdk/dist/protocols/aerodrome-slipstream/abis.d.ts +70 -0
  392. package/sdk/dist/protocols/aerodrome-slipstream/abis.d.ts.map +1 -1
  393. package/sdk/dist/protocols/aerodrome-slipstream/abis.js +54 -0
  394. package/sdk/dist/protocols/aerodrome-slipstream/abis.js.map +1 -1
  395. package/sdk/dist/protocols/camelot/abis.d.ts +178 -0
  396. package/sdk/dist/protocols/camelot/abis.d.ts.map +1 -1
  397. package/sdk/dist/protocols/camelot/abis.js +139 -0
  398. package/sdk/dist/protocols/camelot/abis.js.map +1 -1
  399. package/sdk/dist/protocols/eco-routes/abis.d.ts +792 -50
  400. package/sdk/dist/protocols/eco-routes/abis.d.ts.map +1 -1
  401. package/sdk/dist/protocols/eco-routes/abis.js +1058 -49
  402. package/sdk/dist/protocols/eco-routes/abis.js.map +1 -1
  403. package/sdk/dist/protocols/eco-routes/addresses.generated.d.ts +44 -61
  404. package/sdk/dist/protocols/eco-routes/addresses.generated.d.ts.map +1 -1
  405. package/sdk/dist/protocols/eco-routes/addresses.generated.js +45 -62
  406. package/sdk/dist/protocols/eco-routes/addresses.generated.js.map +1 -1
  407. package/sdk/dist/protocols/eco-routes/lookup.d.ts +10 -0
  408. package/sdk/dist/protocols/eco-routes/lookup.d.ts.map +1 -1
  409. package/sdk/dist/protocols/eco-routes/lookup.js +16 -0
  410. package/sdk/dist/protocols/eco-routes/lookup.js.map +1 -1
  411. package/sdk/dist/protocols/maverick/abis.d.ts +77 -0
  412. package/sdk/dist/protocols/maverick/abis.d.ts.map +1 -1
  413. package/sdk/dist/protocols/maverick/abis.js +58 -0
  414. package/sdk/dist/protocols/maverick/abis.js.map +1 -1
  415. package/sdk/dist/protocols/maverick/addresses.d.ts.map +1 -1
  416. package/sdk/dist/protocols/maverick/addresses.js +4 -0
  417. package/sdk/dist/protocols/maverick/addresses.js.map +1 -1
  418. package/sdk/dist/protocols/pancakeswap-v2/abis.d.ts +52 -0
  419. package/sdk/dist/protocols/pancakeswap-v2/abis.d.ts.map +1 -1
  420. package/sdk/dist/protocols/pancakeswap-v2/abis.js +43 -0
  421. package/sdk/dist/protocols/pancakeswap-v2/abis.js.map +1 -1
  422. package/sdk/dist/protocols/pancakeswap-v3/abis.d.ts +73 -0
  423. package/sdk/dist/protocols/pancakeswap-v3/abis.d.ts.map +1 -1
  424. package/sdk/dist/protocols/pancakeswap-v3/abis.js +56 -0
  425. package/sdk/dist/protocols/pancakeswap-v3/abis.js.map +1 -1
  426. package/sdk/dist/protocols/permit2/abis.d.ts +113 -0
  427. package/sdk/dist/protocols/permit2/abis.d.ts.map +1 -1
  428. package/sdk/dist/protocols/permit2/abis.js +63 -0
  429. package/sdk/dist/protocols/permit2/abis.js.map +1 -1
  430. package/sdk/dist/protocols/quickswap/abis.d.ts +148 -0
  431. package/sdk/dist/protocols/quickswap/abis.d.ts.map +1 -1
  432. package/sdk/dist/protocols/quickswap/abis.js +119 -0
  433. package/sdk/dist/protocols/quickswap/abis.js.map +1 -1
  434. package/sdk/dist/protocols/sushiswap-v2/abis.d.ts +52 -0
  435. package/sdk/dist/protocols/sushiswap-v2/abis.d.ts.map +1 -1
  436. package/sdk/dist/protocols/sushiswap-v2/abis.js +42 -0
  437. package/sdk/dist/protocols/sushiswap-v2/abis.js.map +1 -1
  438. package/sdk/dist/protocols/synthra-v3/abis.d.ts +73 -0
  439. package/sdk/dist/protocols/synthra-v3/abis.d.ts.map +1 -1
  440. package/sdk/dist/protocols/synthra-v3/abis.js +55 -0
  441. package/sdk/dist/protocols/synthra-v3/abis.js.map +1 -1
  442. package/sdk/dist/protocols/trader-joe/abis.d.ts +133 -0
  443. package/sdk/dist/protocols/trader-joe/abis.d.ts.map +1 -1
  444. package/sdk/dist/protocols/trader-joe/abis.js +101 -0
  445. package/sdk/dist/protocols/trader-joe/abis.js.map +1 -1
  446. package/sdk/dist/protocols/trader-joe/addresses.d.ts.map +1 -1
  447. package/sdk/dist/protocols/trader-joe/addresses.js +5 -0
  448. package/sdk/dist/protocols/trader-joe/addresses.js.map +1 -1
  449. package/sdk/dist/protocols/uniswap-v2/abis.d.ts +52 -0
  450. package/sdk/dist/protocols/uniswap-v2/abis.d.ts.map +1 -1
  451. package/sdk/dist/protocols/uniswap-v2/abis.js +44 -0
  452. package/sdk/dist/protocols/uniswap-v2/abis.js.map +1 -1
  453. package/sdk/dist/protocols/uniswap-v3/abis.d.ts +73 -0
  454. package/sdk/dist/protocols/uniswap-v3/abis.d.ts.map +1 -1
  455. package/sdk/dist/protocols/uniswap-v3/abis.js +55 -0
  456. package/sdk/dist/protocols/uniswap-v3/abis.js.map +1 -1
  457. package/sdk/dist/protocols/uniswap-v4/abis.d.ts +247 -0
  458. package/sdk/dist/protocols/uniswap-v4/abis.d.ts.map +1 -1
  459. package/sdk/dist/protocols/uniswap-v4/abis.js +167 -0
  460. package/sdk/dist/protocols/uniswap-v4/abis.js.map +1 -1
  461. package/sdk/dist/protocols/uniswap-v4/addresses.d.ts.map +1 -1
  462. package/sdk/dist/protocols/uniswap-v4/addresses.js +50 -0
  463. package/sdk/dist/protocols/uniswap-v4/addresses.js.map +1 -1
  464. package/sdk/dist/protocols/unitflow-v3/abis.d.ts +73 -0
  465. package/sdk/dist/protocols/unitflow-v3/abis.d.ts.map +1 -1
  466. package/sdk/dist/protocols/unitflow-v3/abis.js +56 -0
  467. package/sdk/dist/protocols/unitflow-v3/abis.js.map +1 -1
  468. package/sdk/dist/protocols/velodrome/abis.d.ts +76 -0
  469. package/sdk/dist/protocols/velodrome/abis.d.ts.map +1 -1
  470. package/sdk/dist/protocols/velodrome/abis.js +61 -0
  471. package/sdk/dist/protocols/velodrome/abis.js.map +1 -1
  472. package/sdk/dist/recipes/cctp-split.sauce.ts +2 -2
  473. package/sdk/dist/recipes/plain-transfer.sauce.ts +2 -2
  474. package/sdk/dist/routes/accessor-index.d.ts +2 -2
  475. package/sdk/dist/routes/accessor-index.d.ts.map +1 -1
  476. package/sdk/dist/routes/accessor-index.js +4 -3
  477. package/sdk/dist/routes/accessor-index.js.map +1 -1
  478. package/sdk/dist/routes/ambient.d.ts +5 -0
  479. package/sdk/dist/routes/ambient.d.ts.map +1 -1
  480. package/sdk/dist/routes/ambient.js +20 -0
  481. package/sdk/dist/routes/ambient.js.map +1 -1
  482. package/sdk/dist/routes/ast-walk.d.ts +17 -3
  483. package/sdk/dist/routes/ast-walk.d.ts.map +1 -1
  484. package/sdk/dist/routes/ast-walk.js +24 -2
  485. package/sdk/dist/routes/ast-walk.js.map +1 -1
  486. package/sdk/dist/routes/available.d.ts +43 -0
  487. package/sdk/dist/routes/available.d.ts.map +1 -0
  488. package/sdk/dist/routes/available.js +230 -0
  489. package/sdk/dist/routes/available.js.map +1 -0
  490. package/sdk/dist/routes/builtins.generated.d.ts +180 -0
  491. package/sdk/dist/routes/builtins.generated.d.ts.map +1 -0
  492. package/sdk/dist/routes/builtins.generated.js +2 -0
  493. package/sdk/dist/routes/builtins.generated.js.map +1 -0
  494. package/sdk/dist/routes/chain-exports.generated.d.ts +13 -8
  495. package/sdk/dist/routes/chain-exports.generated.d.ts.map +1 -1
  496. package/sdk/dist/routes/chain-exports.generated.js.map +1 -1
  497. package/sdk/dist/routes/closure.d.ts.map +1 -1
  498. package/sdk/dist/routes/closure.js +13 -26
  499. package/sdk/dist/routes/closure.js.map +1 -1
  500. package/sdk/dist/routes/composed.d.ts.map +1 -1
  501. package/sdk/dist/routes/composed.js +20 -8
  502. package/sdk/dist/routes/composed.js.map +1 -1
  503. package/sdk/dist/routes/encode.d.ts +17 -0
  504. package/sdk/dist/routes/encode.d.ts.map +1 -1
  505. package/sdk/dist/routes/encode.js +14 -11
  506. package/sdk/dist/routes/encode.js.map +1 -1
  507. package/sdk/dist/routes/entry.d.ts +76 -0
  508. package/sdk/dist/routes/entry.d.ts.map +1 -0
  509. package/sdk/dist/routes/entry.js +478 -0
  510. package/sdk/dist/routes/entry.js.map +1 -0
  511. package/sdk/dist/routes/index.d.ts +19 -12
  512. package/sdk/dist/routes/index.d.ts.map +1 -1
  513. package/sdk/dist/routes/index.js +11 -8
  514. package/sdk/dist/routes/index.js.map +1 -1
  515. package/sdk/dist/routes/intent-body.d.ts +97 -0
  516. package/sdk/dist/routes/intent-body.d.ts.map +1 -0
  517. package/sdk/dist/routes/intent-body.js +441 -0
  518. package/sdk/dist/routes/intent-body.js.map +1 -0
  519. package/sdk/dist/routes/intent-dsl.d.ts +21 -6
  520. package/sdk/dist/routes/intent-dsl.d.ts.map +1 -1
  521. package/sdk/dist/routes/intent-dsl.js +34 -17
  522. package/sdk/dist/routes/intent-dsl.js.map +1 -1
  523. package/sdk/dist/routes/intent-sugar.d.ts +77 -4
  524. package/sdk/dist/routes/intent-sugar.d.ts.map +1 -1
  525. package/sdk/dist/routes/intent-sugar.js +318 -129
  526. package/sdk/dist/routes/intent-sugar.js.map +1 -1
  527. package/sdk/dist/routes/intent.d.ts +13 -1
  528. package/sdk/dist/routes/intent.d.ts.map +1 -1
  529. package/sdk/dist/routes/intent.js +37 -1
  530. package/sdk/dist/routes/intent.js.map +1 -1
  531. package/sdk/dist/routes/nest.d.ts +3 -2
  532. package/sdk/dist/routes/nest.d.ts.map +1 -1
  533. package/sdk/dist/routes/nest.js +5 -3
  534. package/sdk/dist/routes/nest.js.map +1 -1
  535. package/sdk/dist/routes/parse.d.ts +6 -0
  536. package/sdk/dist/routes/parse.d.ts.map +1 -0
  537. package/sdk/dist/routes/parse.js +39 -0
  538. package/sdk/dist/routes/parse.js.map +1 -0
  539. package/sdk/dist/routes/portal.d.ts +258 -4
  540. package/sdk/dist/routes/portal.d.ts.map +1 -1
  541. package/sdk/dist/routes/portal.js +588 -9
  542. package/sdk/dist/routes/portal.js.map +1 -1
  543. package/sdk/dist/routes/protocol-rewrite.d.ts +71 -1
  544. package/sdk/dist/routes/protocol-rewrite.d.ts.map +1 -1
  545. package/sdk/dist/routes/protocol-rewrite.js +178 -54
  546. package/sdk/dist/routes/protocol-rewrite.js.map +1 -1
  547. package/sdk/dist/routes/rs-compile.d.ts +25 -22
  548. package/sdk/dist/routes/rs-compile.d.ts.map +1 -1
  549. package/sdk/dist/routes/rs-compile.js +55 -49
  550. package/sdk/dist/routes/rs-compile.js.map +1 -1
  551. package/sdk/dist/routes/sauce-calls.d.ts +26 -12
  552. package/sdk/dist/routes/sauce-calls.d.ts.map +1 -1
  553. package/sdk/dist/routes/sauce-calls.js +16 -23
  554. package/sdk/dist/routes/sauce-calls.js.map +1 -1
  555. package/sdk/dist/routes/sauce-route.d.ts +74 -7
  556. package/sdk/dist/routes/sauce-route.d.ts.map +1 -1
  557. package/sdk/dist/routes/sauce-route.js +225 -75
  558. package/sdk/dist/routes/sauce-route.js.map +1 -1
  559. package/sdk/dist/routes/source-globals.d.ts +107 -0
  560. package/sdk/dist/routes/source-globals.d.ts.map +1 -0
  561. package/sdk/dist/routes/source-globals.generated.d.ts +5523 -933
  562. package/sdk/dist/routes/source-globals.generated.d.ts.map +1 -1
  563. package/sdk/dist/routes/source-globals.generated.js +3 -4
  564. package/sdk/dist/routes/source-globals.generated.js.map +1 -1
  565. package/sdk/dist/routes/source-globals.js +174 -0
  566. package/sdk/dist/routes/source-globals.js.map +1 -0
  567. package/sdk/dist/routes/stock-tokens.d.ts +69 -0
  568. package/sdk/dist/routes/stock-tokens.d.ts.map +1 -0
  569. package/sdk/dist/routes/stock-tokens.generated.d.ts +4 -0
  570. package/sdk/dist/routes/stock-tokens.generated.d.ts.map +1 -0
  571. package/sdk/dist/routes/stock-tokens.generated.js +1836 -0
  572. package/sdk/dist/routes/stock-tokens.generated.js.map +1 -0
  573. package/sdk/dist/routes/stock-tokens.js +65 -0
  574. package/sdk/dist/routes/stock-tokens.js.map +1 -0
  575. package/sdk/dist/routes/token-registry.d.ts +64 -8
  576. package/sdk/dist/routes/token-registry.d.ts.map +1 -1
  577. package/sdk/dist/routes/token-registry.js +202 -32
  578. package/sdk/dist/routes/token-registry.js.map +1 -1
  579. package/sdk/dist/routes/token-rewrite.d.ts +1 -1
  580. package/sdk/dist/routes/token-rewrite.d.ts.map +1 -1
  581. package/sdk/dist/routes/token-rewrite.js +5 -9
  582. package/sdk/dist/routes/token-rewrite.js.map +1 -1
  583. package/sdk/dist/routes/unknown-global.d.ts +32 -0
  584. package/sdk/dist/routes/unknown-global.d.ts.map +1 -0
  585. package/sdk/dist/routes/unknown-global.js +106 -0
  586. package/sdk/dist/routes/unknown-global.js.map +1 -0
  587. package/sdk/dist/routes/vault.d.ts +38 -8
  588. package/sdk/dist/routes/vault.d.ts.map +1 -1
  589. package/sdk/dist/routes/vault.js +47 -8
  590. package/sdk/dist/routes/vault.js.map +1 -1
  591. package/sdk/dist/sauce-script/builtins.d.ts +309 -0
  592. package/sdk/dist/sauce-script/declarations.d.ts +3 -0
  593. package/sdk/dist/sauce-script/declarations.d.ts.map +1 -0
  594. package/sdk/dist/sauce-script/declarations.js +229 -0
  595. package/sdk/dist/sauce-script/declarations.js.map +1 -0
  596. package/sdk/dist/sauce-script/index.d.ts +2714 -0
  597. package/sdk/dist/sauce-script/ts-plugin.cjs +85 -0
  598. package/sdk/dist/skills/loader.d.ts.map +1 -1
  599. package/sdk/dist/skills/loader.js +4 -3
  600. package/sdk/dist/skills/loader.js.map +1 -1
  601. package/sdk/dist/std/router/balancer-v2-vault.abi.json +78 -0
  602. package/sdk/dist/std/router/curve-cryptoswap.abi.json +29 -0
  603. package/sdk/dist/std/router/curve-stableswap.abi.json +29 -0
  604. package/sdk/dist/std/router/dodo-v2-pool.abi.json +39 -0
  605. package/sdk/dist/std/router/lb-pair.abi.json +55 -0
  606. package/sdk/dist/std/router/package.json +7 -0
  607. package/sdk/dist/std/router/router.evm.js +567 -0
  608. package/sdk/dist/std/router/sauce-router.abi.json +202 -0
  609. package/sdk/dist/std/router/uniswap-v2-pair.abi.json +49 -0
  610. package/sdk/dist/std/router/woo-pp-v2.abi.json +42 -0
  611. package/sdk/dist/std/token/permit2.abi.json +226 -0
  612. package/sdk/dist/std/token/token.evm.js +73 -0
  613. package/sdk/dist/std/token/token.svm.js +194 -41
  614. package/sdk/dist/svm/client.d.ts +62 -15
  615. package/sdk/dist/svm/client.d.ts.map +1 -1
  616. package/sdk/dist/svm/client.js +103 -42
  617. package/sdk/dist/svm/client.js.map +1 -1
  618. package/sdk/dist/svm/engine.d.ts +66 -5
  619. package/sdk/dist/svm/engine.d.ts.map +1 -1
  620. package/sdk/dist/svm/engine.js +73 -5
  621. package/sdk/dist/svm/engine.js.map +1 -1
  622. package/sdk/dist/svm/index.d.ts +2 -0
  623. package/sdk/dist/svm/index.d.ts.map +1 -1
  624. package/sdk/dist/svm/index.js +2 -0
  625. package/sdk/dist/svm/index.js.map +1 -1
  626. package/sdk/dist/svm/instructions.d.ts +72 -1
  627. package/sdk/dist/svm/instructions.d.ts.map +1 -1
  628. package/sdk/dist/svm/instructions.js +81 -2
  629. package/sdk/dist/svm/instructions.js.map +1 -1
  630. package/sdk/dist/svm/kitchen.d.ts +20 -1
  631. package/sdk/dist/svm/kitchen.d.ts.map +1 -1
  632. package/sdk/dist/svm/kitchen.js +47 -1
  633. package/sdk/dist/svm/kitchen.js.map +1 -1
  634. package/sdk/dist/svm/portal.d.ts +250 -0
  635. package/sdk/dist/svm/portal.d.ts.map +1 -0
  636. package/sdk/dist/svm/portal.js +462 -0
  637. package/sdk/dist/svm/portal.js.map +1 -0
  638. package/sdk/dist/svm/send.d.ts +18 -2
  639. package/sdk/dist/svm/send.d.ts.map +1 -1
  640. package/sdk/dist/svm/send.js +28 -3
  641. package/sdk/dist/svm/send.js.map +1 -1
  642. package/sdk/dist/svm/token-accounts.d.ts +49 -0
  643. package/sdk/dist/svm/token-accounts.d.ts.map +1 -0
  644. package/sdk/dist/svm/token-accounts.js +58 -0
  645. package/sdk/dist/svm/token-accounts.js.map +1 -0
  646. package/sdk/dist/svm/token-extensions.d.ts +18 -7
  647. package/sdk/dist/svm/token-extensions.d.ts.map +1 -1
  648. package/sdk/dist/svm/token-extensions.js +58 -5
  649. package/sdk/dist/svm/token-extensions.js.map +1 -1
  650. package/sdk/dist/token/evm.js +1 -1
  651. package/sdk/dist/token/index.d.ts +1 -1
  652. package/sdk/dist/token/index.js +1 -1
  653. package/sdk/dist/token/params.js +1 -1
  654. package/sdk/dist/token/source.js +3 -3
  655. package/sdk/dist/token/source.js.map +1 -1
  656. package/sdk/dist/token/types.d.ts +2 -2
  657. package/sdk/dist/token/types.js +2 -2
  658. package/sdk/src/protocols/aerodrome/AerodromePoolABI.json +105 -0
  659. package/sdk/src/protocols/aerodrome/abis.ts +62 -0
  660. package/sdk/src/protocols/aerodrome-slipstream/AerodromeSlipstreamPoolABI.json +96 -0
  661. package/sdk/src/protocols/aerodrome-slipstream/abis.ts +55 -0
  662. package/sdk/src/protocols/camelot/CamelotV2FactoryABI.json +25 -0
  663. package/sdk/src/protocols/camelot/CamelotV2PairABI.json +109 -0
  664. package/sdk/src/protocols/camelot/CamelotV3FactoryABI.json +25 -0
  665. package/sdk/src/protocols/camelot/CamelotV3PoolABI.json +92 -0
  666. package/sdk/src/protocols/camelot/abis.ts +143 -0
  667. package/sdk/src/protocols/eco-routes/PortalABI.json +1448 -0
  668. package/sdk/src/protocols/eco-routes/ProverABI.json +162 -0
  669. package/sdk/src/protocols/eco-routes/abis.ts +1060 -51
  670. package/sdk/src/protocols/eco-routes/addresses.generated.ts +45 -62
  671. package/sdk/src/protocols/eco-routes/lookup.ts +18 -0
  672. package/sdk/src/protocols/maverick/MaverickV2PoolABI.json +107 -0
  673. package/sdk/src/protocols/maverick/abis.ts +59 -0
  674. package/sdk/src/protocols/maverick/addresses.ts +4 -0
  675. package/sdk/src/protocols/pancakeswap-v2/PancakeSwapV2PairABI.json +72 -0
  676. package/sdk/src/protocols/pancakeswap-v2/abis.ts +44 -0
  677. package/sdk/src/protocols/pancakeswap-v3/PancakeSwapV3PoolABI.json +100 -0
  678. package/sdk/src/protocols/pancakeswap-v3/abis.ts +57 -0
  679. package/sdk/src/protocols/permit2/Permit2ABI.json +154 -0
  680. package/sdk/src/protocols/permit2/abis.ts +63 -0
  681. package/sdk/src/protocols/quickswap/QuickSwapV2FactoryABI.json +25 -0
  682. package/sdk/src/protocols/quickswap/QuickSwapV2PairABI.json +72 -0
  683. package/sdk/src/protocols/quickswap/QuickSwapV3FactoryABI.json +25 -0
  684. package/sdk/src/protocols/quickswap/QuickSwapV3PoolABI.json +88 -0
  685. package/sdk/src/protocols/quickswap/abis.ts +123 -0
  686. package/sdk/src/protocols/sushiswap-v2/SushiSwapV2PairABI.json +72 -0
  687. package/sdk/src/protocols/sushiswap-v2/abis.ts +43 -0
  688. package/sdk/src/protocols/synthra-v3/SynthraV3PoolABI.json +100 -0
  689. package/sdk/src/protocols/synthra-v3/abis.ts +56 -0
  690. package/sdk/src/protocols/trader-joe/LBPairABI.json +185 -0
  691. package/sdk/src/protocols/trader-joe/abis.ts +102 -0
  692. package/sdk/src/protocols/trader-joe/addresses.ts +5 -0
  693. package/sdk/src/protocols/uniswap-v2/UniswapV2PairABI.json +72 -0
  694. package/sdk/src/protocols/uniswap-v2/abis.ts +45 -0
  695. package/sdk/src/protocols/uniswap-v3/UniswapV3PoolABI.json +100 -0
  696. package/sdk/src/protocols/uniswap-v3/abis.ts +56 -0
  697. package/sdk/src/protocols/uniswap-v4/UniswapV4PoolManagerABI.json +38 -0
  698. package/sdk/src/protocols/uniswap-v4/UniswapV4StateViewABI.json +307 -0
  699. package/sdk/src/protocols/uniswap-v4/abis.ts +168 -0
  700. package/sdk/src/protocols/uniswap-v4/addresses.ts +50 -0
  701. package/sdk/src/protocols/unitflow-v3/UnitFlowV3PoolABI.json +100 -0
  702. package/sdk/src/protocols/unitflow-v3/abis.ts +57 -0
  703. package/sdk/src/protocols/velodrome/VelodromePoolABI.json +105 -0
  704. package/sdk/src/protocols/velodrome/abis.ts +62 -0
  705. package/skills/sauce-actions/SKILL.md +166 -0
  706. package/skills/sauce-actions/examples/swap-and-supply.json +24 -0
  707. package/skills/sauce-actions/examples/swap-by-key.json +15 -0
  708. package/skills/sauce-actions/references/actions.md +731 -0
  709. package/skills/sauce-chains/SKILL.md +137 -0
  710. package/skills/sauce-chains/examples/chains.sauce.ts +25 -0
  711. package/skills/sauce-chains/references/arbitrum.md +158 -0
  712. package/skills/sauce-chains/references/arc.md +107 -0
  713. package/skills/sauce-chains/references/aurora.md +33 -0
  714. package/skills/sauce-chains/references/avalanche.md +106 -0
  715. package/skills/sauce-chains/references/base-stocks.md +77 -0
  716. package/skills/sauce-chains/references/base.md +141 -0
  717. package/skills/sauce-chains/references/berachain.md +33 -0
  718. package/skills/sauce-chains/references/blast.md +60 -0
  719. package/skills/sauce-chains/references/boba.md +33 -0
  720. package/skills/sauce-chains/references/bsc.md +97 -0
  721. package/skills/sauce-chains/references/celo.md +57 -0
  722. package/skills/sauce-chains/references/core.md +33 -0
  723. package/skills/sauce-chains/references/cronos.md +33 -0
  724. package/skills/sauce-chains/references/ethereum-stocks.md +1741 -0
  725. package/skills/sauce-chains/references/ethereum.md +255 -0
  726. package/skills/sauce-chains/references/evmos.md +33 -0
  727. package/skills/sauce-chains/references/fantom.md +61 -0
  728. package/skills/sauce-chains/references/fuse.md +33 -0
  729. package/skills/sauce-chains/references/gnosis.md +57 -0
  730. package/skills/sauce-chains/references/index.md +58 -0
  731. package/skills/sauce-chains/references/ink.md +55 -0
  732. package/skills/sauce-chains/references/kava.md +33 -0
  733. package/skills/sauce-chains/references/klaytn.md +33 -0
  734. package/skills/sauce-chains/references/linea.md +65 -0
  735. package/skills/sauce-chains/references/manta.md +33 -0
  736. package/skills/sauce-chains/references/mantle.md +33 -0
  737. package/skills/sauce-chains/references/metis.md +54 -0
  738. package/skills/sauce-chains/references/mode.md +55 -0
  739. package/skills/sauce-chains/references/monad.md +79 -0
  740. package/skills/sauce-chains/references/moonbeam.md +33 -0
  741. package/skills/sauce-chains/references/opbnb.md +55 -0
  742. package/skills/sauce-chains/references/optimism.md +123 -0
  743. package/skills/sauce-chains/references/plasma.md +35 -0
  744. package/skills/sauce-chains/references/polygon.md +123 -0
  745. package/skills/sauce-chains/references/pulsechain.md +33 -0
  746. package/skills/sauce-chains/references/ronin.md +35 -0
  747. package/skills/sauce-chains/references/scroll.md +62 -0
  748. package/skills/sauce-chains/references/sei.md +55 -0
  749. package/skills/sauce-chains/references/solana.md +53 -0
  750. package/skills/sauce-chains/references/sonic.md +57 -0
  751. package/skills/sauce-chains/references/unichain.md +61 -0
  752. package/skills/sauce-chains/references/zetachain.md +33 -0
  753. package/skills/sauce-chains/references/zksync.md +59 -0
  754. package/skills/sauce-chains/references/zora.md +57 -0
  755. package/skills/sauce-cli/SKILL.md +366 -0
  756. package/skills/sauce-cli/examples/pay.sauce.ts +23 -0
  757. package/skills/sauce-cli/examples/split.sauce.ts +30 -0
  758. package/skills/sauce-distributed-swap/SKILL.md +392 -0
  759. package/skills/sauce-distributed-swap/examples/distributed-swap.mts +251 -0
  760. package/skills/sauce-distributed-swap/examples/distributed-swap.sauce.ts +115 -0
  761. package/skills/sauce-examples/SKILL.md +96 -0
  762. package/skills/sauce-globals/SKILL.md +175 -0
  763. package/skills/sauce-globals/examples/globals.mts +111 -0
  764. package/skills/sauce-globals/examples/globals.sauce.ts +47 -0
  765. package/skills/sauce-globals/references/chains.md +53 -0
  766. package/skills/sauce-globals/references/protocols.md +405 -0
  767. package/skills/sauce-globals/references/stocks.md +1824 -0
  768. package/skills/sauce-globals/references/tokens.md +53 -0
  769. package/skills/sauce-intents/SKILL.md +505 -0
  770. package/skills/sauce-intents/examples/cross-chain.sauce.ts +37 -0
  771. package/skills/sauce-intents/examples/fund-by-transfer.sauce.ts +54 -0
  772. package/skills/sauce-intents/examples/intents.mts +343 -0
  773. package/skills/sauce-intents/examples/swap-on-base.sauce.ts +135 -0
  774. package/skills/sauce-intents/references/portal.md +77 -0
  775. package/skills/sauce-overview/SKILL.md +161 -0
  776. package/skills/sauce-protocols/SKILL.md +118 -0
  777. package/skills/sauce-protocols/examples/protocols.mts +77 -0
  778. package/skills/sauce-protocols/examples/protocols.sauce.ts +27 -0
  779. package/{sdk/src/skills → skills/sauce-protocols/references}/aave-v2.md +35 -17
  780. package/skills/sauce-protocols/references/aave-v3.md +144 -0
  781. package/skills/sauce-protocols/references/aave-v4.md +50 -0
  782. package/skills/sauce-protocols/references/abracadabra.md +72 -0
  783. package/skills/sauce-protocols/references/across.md +73 -0
  784. package/skills/sauce-protocols/references/aerodrome-slipstream.md +50 -0
  785. package/{sdk/src/skills → skills/sauce-protocols/references}/aerodrome.md +43 -24
  786. package/skills/sauce-protocols/references/aevo.md +49 -0
  787. package/{sdk/src/skills → skills/sauce-protocols/references}/alchemix.md +10 -25
  788. package/{sdk/src/skills → skills/sauce-protocols/references}/ambient.md +14 -21
  789. package/{sdk/src/skills → skills/sauce-protocols/references}/arbitrum-bridge.md +11 -14
  790. package/{sdk/src/skills → skills/sauce-protocols/references}/arrakis.md +10 -26
  791. package/skills/sauce-protocols/references/axelar.md +56 -0
  792. package/{sdk/src/skills → skills/sauce-protocols/references}/balancer-v2.md +13 -29
  793. package/{sdk/src/skills → skills/sauce-protocols/references}/base-bridge.md +11 -16
  794. package/{sdk/src/skills → skills/sauce-protocols/references}/baseswap.md +12 -19
  795. package/{sdk/src/skills → skills/sauce-protocols/references}/beefy.md +10 -30
  796. package/{sdk/src/skills → skills/sauce-protocols/references}/benqi.md +11 -21
  797. package/{sdk/src/skills → skills/sauce-protocols/references}/camelot.md +13 -27
  798. package/{sdk/src/skills → skills/sauce-protocols/references}/cbeth.md +10 -22
  799. package/skills/sauce-protocols/references/cctp.md +47 -0
  800. package/{sdk/src/skills → skills/sauce-protocols/references}/celer.md +11 -18
  801. package/{sdk/src/skills → skills/sauce-protocols/references}/chainlink-ccip.md +11 -21
  802. package/skills/sauce-protocols/references/chainlink.md +47 -0
  803. package/{sdk/src/skills → skills/sauce-protocols/references}/circle-gateway.md +12 -38
  804. package/{sdk/src/skills → skills/sauce-protocols/references}/compound-v2.md +11 -25
  805. package/{sdk/src/skills → skills/sauce-protocols/references}/compound-v3.md +43 -27
  806. package/{sdk/src/skills → skills/sauce-protocols/references}/connext.md +11 -15
  807. package/{sdk/src/skills → skills/sauce-protocols/references}/convex.md +10 -28
  808. package/{sdk/src/skills → skills/sauce-protocols/references}/cowswap.md +12 -19
  809. package/{sdk/src/skills → skills/sauce-protocols/references}/crvusd.md +10 -19
  810. package/skills/sauce-protocols/references/curve.md +98 -0
  811. package/{sdk/src/skills → skills/sauce-protocols/references}/debridge.md +11 -33
  812. package/{sdk/src/skills → skills/sauce-protocols/references}/dodo.md +13 -18
  813. package/skills/sauce-protocols/references/eigenlayer.md +48 -0
  814. package/{sdk/src/skills → skills/sauce-protocols/references}/ens.md +10 -26
  815. package/{sdk/src/skills → skills/sauce-protocols/references}/erc20.md +10 -24
  816. package/{sdk/src/skills → skills/sauce-protocols/references}/erc3156.md +10 -13
  817. package/{sdk/src/skills → skills/sauce-protocols/references}/erc4626.md +11 -27
  818. package/{sdk/src/skills → skills/sauce-protocols/references}/ethena.md +10 -27
  819. package/{sdk/src/skills → skills/sauce-protocols/references}/etherfi.md +10 -32
  820. package/{sdk/src/skills → skills/sauce-protocols/references}/euler-v2.md +11 -21
  821. package/{sdk/src/skills → skills/sauce-protocols/references}/fenix.md +12 -18
  822. package/{sdk/src/skills → skills/sauce-protocols/references}/fluid.md +11 -20
  823. package/{sdk/src/skills → skills/sauce-protocols/references}/frax-ether.md +10 -26
  824. package/{sdk/src/skills → skills/sauce-protocols/references}/frax.md +10 -19
  825. package/{sdk/src/skills → skills/sauce-protocols/references}/gains-network.md +11 -28
  826. package/skills/sauce-protocols/references/gamma.md +57 -0
  827. package/{sdk/src/skills → skills/sauce-protocols/references}/gelato.md +12 -20
  828. package/{sdk/src/skills → skills/sauce-protocols/references}/gho.md +10 -19
  829. package/{sdk/src/skills → skills/sauce-protocols/references}/gmx-v1.md +12 -34
  830. package/{sdk/src/skills → skills/sauce-protocols/references}/gmx-v2.md +15 -28
  831. package/skills/sauce-protocols/references/harvest.md +41 -0
  832. package/{sdk/src/skills → skills/sauce-protocols/references}/hegic.md +10 -18
  833. package/{sdk/src/skills → skills/sauce-protocols/references}/hop.md +11 -21
  834. package/{sdk/src/skills → skills/sauce-protocols/references}/hyperlane.md +11 -21
  835. package/skills/sauce-protocols/references/index.md +355 -0
  836. package/{sdk/src/skills → skills/sauce-protocols/references}/instadapp.md +10 -18
  837. package/skills/sauce-protocols/references/kelp.md +46 -0
  838. package/{sdk/src/skills → skills/sauce-protocols/references}/kim.md +12 -18
  839. package/{sdk/src/skills → skills/sauce-protocols/references}/kyberswap-aggregator.md +12 -35
  840. package/skills/sauce-protocols/references/kyberswap.md +72 -0
  841. package/{sdk/src/skills → skills/sauce-protocols/references}/layerbank.md +11 -26
  842. package/{sdk/src/skills → skills/sauce-protocols/references}/layerzero.md +11 -25
  843. package/{sdk/src/skills → skills/sauce-protocols/references}/level-finance.md +10 -24
  844. package/{sdk/src/skills → skills/sauce-protocols/references}/lido.md +10 -28
  845. package/{sdk/src/skills → skills/sauce-protocols/references}/lifi.md +11 -25
  846. package/{sdk/src/skills → skills/sauce-protocols/references}/linea-bridge.md +11 -14
  847. package/{sdk/src/skills → skills/sauce-protocols/references}/liquity-v1.md +10 -21
  848. package/{sdk/src/skills → skills/sauce-protocols/references}/liquity-v2.md +10 -19
  849. package/{sdk/src/skills → skills/sauce-protocols/references}/lynex.md +12 -18
  850. package/skills/sauce-protocols/references/maker.md +57 -0
  851. package/skills/sauce-protocols/references/mantle-meth.md +43 -0
  852. package/{sdk/src/skills → skills/sauce-protocols/references}/maverick.md +13 -25
  853. package/{sdk/src/skills → skills/sauce-protocols/references}/moonwell.md +11 -21
  854. package/{sdk/src/skills → skills/sauce-protocols/references}/morpho-blue.md +44 -21
  855. package/{sdk/src/skills → skills/sauce-protocols/references}/mux-protocol.md +10 -30
  856. package/skills/sauce-protocols/references/olympus.md +39 -0
  857. package/skills/sauce-protocols/references/oneinch.md +81 -0
  858. package/skills/sauce-protocols/references/openocean.md +69 -0
  859. package/{sdk/src/skills → skills/sauce-protocols/references}/optimism-bridge.md +11 -16
  860. package/{sdk/src/skills → skills/sauce-protocols/references}/opyn.md +10 -21
  861. package/{sdk/src/skills → skills/sauce-protocols/references}/pancakeswap-v2.md +39 -41
  862. package/skills/sauce-protocols/references/pancakeswap-v3.md +72 -0
  863. package/skills/sauce-protocols/references/paraswap.md +39 -0
  864. package/{sdk/src/skills → skills/sauce-protocols/references}/pendle.md +47 -29
  865. package/skills/sauce-protocols/references/permit2.md +101 -0
  866. package/skills/sauce-protocols/references/perpetual-protocol.md +53 -0
  867. package/{sdk/src/skills → skills/sauce-protocols/references}/polygon-bridge.md +11 -17
  868. package/{sdk/src/skills → skills/sauce-protocols/references}/premia.md +10 -19
  869. package/{sdk/src/skills → skills/sauce-protocols/references}/puffer.md +10 -21
  870. package/skills/sauce-protocols/references/pyth.md +45 -0
  871. package/{sdk/src/skills → skills/sauce-protocols/references}/quickswap.md +13 -27
  872. package/{sdk/src/skills → skills/sauce-protocols/references}/radiant.md +11 -15
  873. package/{sdk/src/skills → skills/sauce-protocols/references}/ramses.md +12 -18
  874. package/skills/sauce-protocols/references/reflexer.md +52 -0
  875. package/skills/sauce-protocols/references/registry/aave-v2.md +43 -0
  876. package/skills/sauce-protocols/references/registry/aave-v3.md +62 -0
  877. package/skills/sauce-protocols/references/registry/aave-v4.md +80 -0
  878. package/skills/sauce-protocols/references/registry/abracadabra.md +54 -0
  879. package/skills/sauce-protocols/references/registry/across.md +57 -0
  880. package/skills/sauce-protocols/references/registry/aerodrome-slipstream.md +72 -0
  881. package/skills/sauce-protocols/references/registry/aerodrome.md +58 -0
  882. package/skills/sauce-protocols/references/registry/aevo.md +39 -0
  883. package/skills/sauce-protocols/references/registry/alchemix.md +46 -0
  884. package/skills/sauce-protocols/references/registry/ambient.md +40 -0
  885. package/skills/sauce-protocols/references/registry/arbitrum-bridge.md +40 -0
  886. package/skills/sauce-protocols/references/registry/arrakis.md +49 -0
  887. package/skills/sauce-protocols/references/registry/axelar.md +65 -0
  888. package/skills/sauce-protocols/references/registry/balancer-v2.md +50 -0
  889. package/skills/sauce-protocols/references/registry/base-bridge.md +42 -0
  890. package/skills/sauce-protocols/references/registry/baseswap.md +40 -0
  891. package/skills/sauce-protocols/references/registry/beefy.md +51 -0
  892. package/skills/sauce-protocols/references/registry/benqi.md +49 -0
  893. package/skills/sauce-protocols/references/registry/camelot.md +82 -0
  894. package/skills/sauce-protocols/references/registry/cbeth.md +43 -0
  895. package/skills/sauce-protocols/references/registry/cctp.md +48 -0
  896. package/skills/sauce-protocols/references/registry/celer.md +44 -0
  897. package/skills/sauce-protocols/references/registry/chainlink-ccip.md +45 -0
  898. package/skills/sauce-protocols/references/registry/chainlink.md +49 -0
  899. package/skills/sauce-protocols/references/registry/circle-gateway.md +70 -0
  900. package/skills/sauce-protocols/references/registry/compound-v2.md +53 -0
  901. package/skills/sauce-protocols/references/registry/compound-v3.md +52 -0
  902. package/skills/sauce-protocols/references/registry/connext.md +41 -0
  903. package/skills/sauce-protocols/references/registry/convex.md +51 -0
  904. package/skills/sauce-protocols/references/registry/cowswap.md +40 -0
  905. package/skills/sauce-protocols/references/registry/crvusd.md +40 -0
  906. package/skills/sauce-protocols/references/registry/curve.md +81 -0
  907. package/skills/sauce-protocols/references/registry/debridge.md +59 -0
  908. package/skills/sauce-protocols/references/registry/dodo.md +39 -0
  909. package/skills/sauce-protocols/references/registry/eco-routes.md +65 -0
  910. package/skills/sauce-protocols/references/registry/eigenlayer.md +58 -0
  911. package/skills/sauce-protocols/references/registry/ens.md +49 -0
  912. package/skills/sauce-protocols/references/registry/erc20.md +44 -0
  913. package/skills/sauce-protocols/references/registry/erc3156.md +38 -0
  914. package/skills/sauce-protocols/references/registry/erc4626.md +51 -0
  915. package/skills/sauce-protocols/references/registry/ethena.md +50 -0
  916. package/skills/sauce-protocols/references/registry/etherfi.md +57 -0
  917. package/skills/sauce-protocols/references/registry/euler-v2.md +49 -0
  918. package/skills/sauce-protocols/references/registry/fenix.md +39 -0
  919. package/skills/sauce-protocols/references/registry/fluid.md +48 -0
  920. package/skills/sauce-protocols/references/registry/frax-ether.md +49 -0
  921. package/skills/sauce-protocols/references/registry/frax.md +40 -0
  922. package/skills/sauce-protocols/references/registry/gains-network.md +43 -0
  923. package/skills/sauce-protocols/references/registry/gamma.md +56 -0
  924. package/skills/sauce-protocols/references/registry/gelato.md +45 -0
  925. package/skills/sauce-protocols/references/registry/gho.md +40 -0
  926. package/skills/sauce-protocols/references/registry/gmx-v1.md +59 -0
  927. package/skills/sauce-protocols/references/registry/gmx-v2.md +41 -0
  928. package/skills/sauce-protocols/references/registry/harvest.md +44 -0
  929. package/skills/sauce-protocols/references/registry/hegic.md +39 -0
  930. package/skills/sauce-protocols/references/registry/hop.md +49 -0
  931. package/skills/sauce-protocols/references/registry/hyperlane.md +48 -0
  932. package/skills/sauce-protocols/references/registry/instadapp.md +39 -0
  933. package/skills/sauce-protocols/references/registry/kelp.md +47 -0
  934. package/skills/sauce-protocols/references/registry/kim.md +39 -0
  935. package/skills/sauce-protocols/references/registry/kyberswap-aggregator.md +49 -0
  936. package/skills/sauce-protocols/references/registry/kyberswap.md +63 -0
  937. package/skills/sauce-protocols/references/registry/layerbank.md +54 -0
  938. package/skills/sauce-protocols/references/registry/layerzero.md +49 -0
  939. package/skills/sauce-protocols/references/registry/level-finance.md +41 -0
  940. package/skills/sauce-protocols/references/registry/lido.md +51 -0
  941. package/skills/sauce-protocols/references/registry/lifi.md +48 -0
  942. package/skills/sauce-protocols/references/registry/linea-bridge.md +40 -0
  943. package/skills/sauce-protocols/references/registry/liquity-v1.md +42 -0
  944. package/skills/sauce-protocols/references/registry/liquity-v2.md +40 -0
  945. package/skills/sauce-protocols/references/registry/lynex.md +39 -0
  946. package/skills/sauce-protocols/references/registry/maker.md +55 -0
  947. package/skills/sauce-protocols/references/registry/mantle-meth.md +48 -0
  948. package/skills/sauce-protocols/references/registry/maverick.md +60 -0
  949. package/skills/sauce-protocols/references/registry/moonwell.md +49 -0
  950. package/skills/sauce-protocols/references/registry/morpho-blue.md +47 -0
  951. package/skills/sauce-protocols/references/registry/mux-protocol.md +49 -0
  952. package/skills/sauce-protocols/references/registry/olympus.md +42 -0
  953. package/skills/sauce-protocols/references/registry/oneinch.md +45 -0
  954. package/skills/sauce-protocols/references/registry/openocean.md +44 -0
  955. package/skills/sauce-protocols/references/registry/optimism-bridge.md +42 -0
  956. package/skills/sauce-protocols/references/registry/opyn.md +42 -0
  957. package/skills/sauce-protocols/references/registry/pancakeswap-v2.md +71 -0
  958. package/skills/sauce-protocols/references/registry/pancakeswap-v3.md +76 -0
  959. package/skills/sauce-protocols/references/registry/paraswap.md +51 -0
  960. package/skills/sauce-protocols/references/registry/pendle.md +43 -0
  961. package/skills/sauce-protocols/references/registry/permit2.md +50 -0
  962. package/skills/sauce-protocols/references/registry/perpetual-protocol.md +49 -0
  963. package/skills/sauce-protocols/references/registry/polygon-bridge.md +43 -0
  964. package/skills/sauce-protocols/references/registry/premia.md +40 -0
  965. package/skills/sauce-protocols/references/registry/puffer.md +43 -0
  966. package/skills/sauce-protocols/references/registry/pyth.md +40 -0
  967. package/skills/sauce-protocols/references/registry/quickswap.md +80 -0
  968. package/skills/sauce-protocols/references/registry/radiant.md +41 -0
  969. package/skills/sauce-protocols/references/registry/ramses.md +39 -0
  970. package/skills/sauce-protocols/references/registry/reflexer.md +56 -0
  971. package/skills/sauce-protocols/references/registry/renzo.md +47 -0
  972. package/skills/sauce-protocols/references/registry/rocket-pool.md +49 -0
  973. package/skills/sauce-protocols/references/registry/sablier.md +40 -0
  974. package/skills/sauce-protocols/references/registry/safe.md +47 -0
  975. package/skills/sauce-protocols/references/registry/scroll-bridge.md +48 -0
  976. package/skills/sauce-protocols/references/registry/seamless.md +42 -0
  977. package/skills/sauce-protocols/references/registry/seaport.md +44 -0
  978. package/skills/sauce-protocols/references/registry/silo.md +48 -0
  979. package/skills/sauce-protocols/references/registry/socket.md +44 -0
  980. package/skills/sauce-protocols/references/registry/sommelier.md +43 -0
  981. package/skills/sauce-protocols/references/registry/spark.md +42 -0
  982. package/skills/sauce-protocols/references/registry/spookyswap.md +40 -0
  983. package/skills/sauce-protocols/references/registry/squid.md +45 -0
  984. package/skills/sauce-protocols/references/registry/stader.md +47 -0
  985. package/skills/sauce-protocols/references/registry/stargate.md +45 -0
  986. package/skills/sauce-protocols/references/registry/superfluid.md +49 -0
  987. package/skills/sauce-protocols/references/registry/sushiswap-v2.md +71 -0
  988. package/skills/sauce-protocols/references/registry/swell.md +49 -0
  989. package/skills/sauce-protocols/references/registry/synapse.md +46 -0
  990. package/skills/sauce-protocols/references/registry/syncswap.md +38 -0
  991. package/skills/sauce-protocols/references/registry/synthetix-v3.md +48 -0
  992. package/skills/sauce-protocols/references/registry/synthra-v3.md +77 -0
  993. package/skills/sauce-protocols/references/registry/thales.md +51 -0
  994. package/skills/sauce-protocols/references/registry/thena.md +39 -0
  995. package/skills/sauce-protocols/references/registry/thruster.md +38 -0
  996. package/skills/sauce-protocols/references/registry/tokemak.md +45 -0
  997. package/skills/sauce-protocols/references/registry/trader-joe.md +66 -0
  998. package/skills/sauce-protocols/references/registry/uniswap-v2.md +77 -0
  999. package/skills/sauce-protocols/references/registry/uniswap-v3.md +113 -0
  1000. package/skills/sauce-protocols/references/registry/uniswap-v4.md +117 -0
  1001. package/skills/sauce-protocols/references/registry/unitflow-v3.md +65 -0
  1002. package/skills/sauce-protocols/references/registry/velodrome.md +58 -0
  1003. package/skills/sauce-protocols/references/registry/venus.md +62 -0
  1004. package/skills/sauce-protocols/references/registry/vertex.md +46 -0
  1005. package/skills/sauce-protocols/references/registry/wormhole.md +59 -0
  1006. package/skills/sauce-protocols/references/registry/yearn-v3.md +46 -0
  1007. package/skills/sauce-protocols/references/registry/zerolend.md +41 -0
  1008. package/skills/sauce-protocols/references/registry/zerox.md +44 -0
  1009. package/skills/sauce-protocols/references/registry/zksync-bridge.md +40 -0
  1010. package/{sdk/src/skills → skills/sauce-protocols/references}/renzo.md +10 -24
  1011. package/{sdk/src/skills → skills/sauce-protocols/references}/rocket-pool.md +10 -26
  1012. package/{sdk/src/skills → skills/sauce-protocols/references}/sablier.md +10 -27
  1013. package/skills/sauce-protocols/references/safe.md +42 -0
  1014. package/{sdk/src/skills → skills/sauce-protocols/references}/scroll-bridge.md +11 -20
  1015. package/{sdk/src/skills → skills/sauce-protocols/references}/seamless.md +11 -16
  1016. package/skills/sauce-protocols/references/seaport.md +38 -0
  1017. package/{sdk/src/skills → skills/sauce-protocols/references}/silo.md +11 -20
  1018. package/{sdk/src/skills → skills/sauce-protocols/references}/socket.md +11 -18
  1019. package/skills/sauce-protocols/references/sommelier.md +40 -0
  1020. package/{sdk/src/skills → skills/sauce-protocols/references}/spark.md +11 -16
  1021. package/{sdk/src/skills → skills/sauce-protocols/references}/spookyswap.md +12 -19
  1022. package/{sdk/src/skills → skills/sauce-protocols/references}/squid.md +11 -21
  1023. package/skills/sauce-protocols/references/stader.md +39 -0
  1024. package/{sdk/src/skills → skills/sauce-protocols/references}/stargate.md +11 -22
  1025. package/{sdk/src/skills → skills/sauce-protocols/references}/superfluid.md +10 -28
  1026. package/{sdk/src/skills → skills/sauce-protocols/references}/sushiswap-v2.md +38 -43
  1027. package/skills/sauce-protocols/references/swell.md +49 -0
  1028. package/skills/sauce-protocols/references/synapse.md +54 -0
  1029. package/{sdk/src/skills → skills/sauce-protocols/references}/syncswap.md +12 -17
  1030. package/{sdk/src/skills → skills/sauce-protocols/references}/synthetix-v3.md +10 -29
  1031. package/skills/sauce-protocols/references/synthra-v3.md +63 -0
  1032. package/skills/sauce-protocols/references/thales.md +58 -0
  1033. package/{sdk/src/skills → skills/sauce-protocols/references}/thena.md +12 -18
  1034. package/{sdk/src/skills → skills/sauce-protocols/references}/thruster.md +13 -18
  1035. package/skills/sauce-protocols/references/tokemak.md +40 -0
  1036. package/{sdk/src/skills → skills/sauce-protocols/references}/trader-joe.md +13 -26
  1037. package/{sdk/src/skills → skills/sauce-protocols/references}/uniswap-v2.md +46 -44
  1038. package/skills/sauce-protocols/references/uniswap-v3.md +188 -0
  1039. package/skills/sauce-protocols/references/uniswap-v4.md +155 -0
  1040. package/skills/sauce-protocols/references/unitflow-v3.md +63 -0
  1041. package/{sdk/src/skills → skills/sauce-protocols/references}/velodrome.md +12 -24
  1042. package/{sdk/src/skills → skills/sauce-protocols/references}/venus.md +12 -31
  1043. package/skills/sauce-protocols/references/vertex.md +42 -0
  1044. package/skills/sauce-protocols/references/wormhole.md +57 -0
  1045. package/{sdk/src/skills → skills/sauce-protocols/references}/yearn-v3.md +10 -25
  1046. package/{sdk/src/skills → skills/sauce-protocols/references}/zerolend.md +11 -15
  1047. package/skills/sauce-protocols/references/zerox.md +39 -0
  1048. package/{sdk/src/skills → skills/sauce-protocols/references}/zksync-bridge.md +11 -14
  1049. package/skills/sauce-script/SKILL.md +407 -0
  1050. package/skills/sauce-script/examples/IOracle.json +12 -0
  1051. package/skills/sauce-script/examples/saucescript.mts +167 -0
  1052. package/skills/sauce-script/examples/twap.sauce.ts +29 -0
  1053. package/skills/sauce-script/references/builtins.json +823 -0
  1054. package/skills/sauce-script/references/builtins.md +674 -0
  1055. package/skills/sauce-solana/SKILL.md +322 -0
  1056. package/skills/sauce-solana/examples/solana.mts +166 -0
  1057. package/skills/sauce-solana/examples/solana.sauce.ts +45 -0
  1058. package/skills/sauce-solana/examples/token-2022.sauce.ts +38 -0
  1059. package/skills/sauce-swaps/SKILL.md +200 -0
  1060. package/skills/sauce-swaps/examples/swap-leg.sauce.ts +50 -0
  1061. package/skills/sauce-swaps/examples/swaps.mts +124 -0
  1062. package/skills/sauce-typescript/SKILL.md +178 -0
  1063. package/skills/sauce-typescript/examples/actions.mts +100 -0
  1064. package/skills/sauce-typescript/examples/compiler.mts +69 -0
  1065. package/skills/sauce-typescript/examples/cook.mts +65 -0
  1066. package/skills/sauce-typescript/examples/verify.mts +104 -0
  1067. package/dev-tools/README.md +0 -16
  1068. package/dev-tools/artifacts/IERC20.json +0 -1
  1069. package/dev-tools/artifacts/ISauceRouter.json +0 -1
  1070. package/dev-tools/artifacts/IUniswapV3Pool.json +0 -1
  1071. package/dev-tools/artifacts/Router.json +0 -1
  1072. package/dev-tools/hardhat.config.cjs +0 -18
  1073. package/dev-tools/sauce/js/add.js +0 -4
  1074. package/dev-tools/sauce/js/call.js +0 -8
  1075. package/dev-tools/sauce/js/erc20.js +0 -18
  1076. package/dev-tools/sauce/js/example.js +0 -6
  1077. package/dev-tools/sauce/js/fibonacci.js +0 -13
  1078. package/dev-tools/sauce/ts/add.ts +0 -4
  1079. package/dev-tools/sauce/ts/call.ts +0 -8
  1080. package/dev-tools/sauce/ts/erc20.ts +0 -18
  1081. package/dev-tools/sauce/ts/example.ts +0 -6
  1082. package/dev-tools/sauce/ts/fibonacci.ts +0 -13
  1083. package/dev-tools/sauce/ts/saucescript.d.ts +0 -1
  1084. package/dev-tools/sauce/ts/tsconfig.json +0 -12
  1085. package/dev-tools/scripts/deploy.ts +0 -107
  1086. package/dev-tools/scripts/init.js +0 -132
  1087. package/dev-tools/scripts/run.ts +0 -67
  1088. package/dev-tools/scripts/start-fork.sh +0 -92
  1089. package/dev-tools/scripts/start-local.sh +0 -120
  1090. package/dev-tools/scripts/stop-local.sh +0 -40
  1091. package/dev-tools/scripts/sync-artifacts.js +0 -46
  1092. package/dev-tools/scripts/sync-price.ts +0 -58
  1093. package/dev-tools/src/contracts.ts +0 -59
  1094. package/dev-tools/src/runner.ts +0 -355
  1095. package/dev-tools/src/svm-local.ts +0 -305
  1096. package/dev-tools/src/sync-price.ts +0 -217
  1097. package/sdk/dist/deployments/v12.generated.d.ts +0 -95
  1098. package/sdk/dist/deployments/v12.generated.d.ts.map +0 -1
  1099. package/sdk/dist/deployments/v12.generated.js +0 -50
  1100. package/sdk/dist/deployments/v12.generated.js.map +0 -1
  1101. package/sdk/dist/swap/index.d.ts +0 -29
  1102. package/sdk/dist/swap/index.d.ts.map +0 -1
  1103. package/sdk/dist/swap/index.js +0 -27
  1104. package/sdk/dist/swap/index.js.map +0 -1
  1105. package/sdk/dist/swap/params.d.ts +0 -29
  1106. package/sdk/dist/swap/params.d.ts.map +0 -1
  1107. package/sdk/dist/swap/params.js +0 -123
  1108. package/sdk/dist/swap/params.js.map +0 -1
  1109. package/sdk/dist/swap/source.d.ts +0 -30
  1110. package/sdk/dist/swap/source.d.ts.map +0 -1
  1111. package/sdk/dist/swap/source.js +0 -101
  1112. package/sdk/dist/swap/source.js.map +0 -1
  1113. package/sdk/dist/swap/types.d.ts +0 -160
  1114. package/sdk/dist/swap/types.d.ts.map +0 -1
  1115. package/sdk/dist/swap/types.js +0 -106
  1116. package/sdk/dist/swap/types.js.map +0 -1
  1117. package/sdk/src/skills/aave-v3.md +0 -134
  1118. package/sdk/src/skills/aave-v4.md +0 -91
  1119. package/sdk/src/skills/abracadabra.md +0 -93
  1120. package/sdk/src/skills/across.md +0 -90
  1121. package/sdk/src/skills/aerodrome-slipstream.md +0 -57
  1122. package/sdk/src/skills/aevo.md +0 -58
  1123. package/sdk/src/skills/axelar.md +0 -80
  1124. package/sdk/src/skills/chainlink.md +0 -62
  1125. package/sdk/src/skills/curve.md +0 -141
  1126. package/sdk/src/skills/eigenlayer.md +0 -71
  1127. package/sdk/src/skills/gamma.md +0 -79
  1128. package/sdk/src/skills/harvest.md +0 -49
  1129. package/sdk/src/skills/index.md +0 -299
  1130. package/sdk/src/skills/kelp.md +0 -60
  1131. package/sdk/src/skills/kyberswap.md +0 -100
  1132. package/sdk/src/skills/loader.ts +0 -46
  1133. package/sdk/src/skills/maker.md +0 -79
  1134. package/sdk/src/skills/mantle-meth.md +0 -60
  1135. package/sdk/src/skills/olympus.md +0 -46
  1136. package/sdk/src/skills/oneinch.md +0 -64
  1137. package/sdk/src/skills/openocean.md +0 -86
  1138. package/sdk/src/skills/pancakeswap-v3.md +0 -104
  1139. package/sdk/src/skills/paraswap.md +0 -67
  1140. package/sdk/src/skills/permit2.md +0 -73
  1141. package/sdk/src/skills/perpetual-protocol.md +0 -73
  1142. package/sdk/src/skills/pyth.md +0 -58
  1143. package/sdk/src/skills/reflexer.md +0 -73
  1144. package/sdk/src/skills/safe.md +0 -56
  1145. package/sdk/src/skills/seaport.md +0 -65
  1146. package/sdk/src/skills/sommelier.md +0 -47
  1147. package/sdk/src/skills/stader.md +0 -53
  1148. package/sdk/src/skills/swell.md +0 -65
  1149. package/sdk/src/skills/synapse.md +0 -63
  1150. package/sdk/src/skills/synthra-v3.md +0 -57
  1151. package/sdk/src/skills/thales.md +0 -74
  1152. package/sdk/src/skills/tokemak.md +0 -48
  1153. package/sdk/src/skills/uniswap-v3.md +0 -202
  1154. package/sdk/src/skills/uniswap-v4.md +0 -125
  1155. package/sdk/src/skills/unitflow-v3.md +0 -62
  1156. package/sdk/src/skills/vertex.md +0 -55
  1157. package/sdk/src/skills/wormhole.md +0 -76
  1158. package/sdk/src/skills/zerox.md +0 -51
@@ -0,0 +1,200 @@
1
+ ---
2
+ name: sauce-swaps
3
+ description: Swapping inside a Sauce program with @sauce/router — one function per venue (uniswapV2, uniswapV3, uniswapV4, curve, balancerV2, dodoV2, traderJoeLB, woofi, maverickV2, and the try forms), every argument a run-time value, each returning what the recipient received and reverting below minOut; which venues are paid first and which call back through the Pot's Router, which pool families the Router's callbacks service (Uniswap V3 and forks, PancakeSwap V3, Algebra, Synthra, UnitFlow, Uniswap V4), exact input only, how a price limit produces a partial fill, the PancakeSwap Infinity entry points on the Router itself, and the guard that stops a leg from stranding input. Use when the user wants a swap, trade, price limit, sqrtPriceLimitX96, min-out or slippage bound, a partial fill, "swap then …", or asks which venues Sauce can swap on.
4
+ ---
5
+
6
+ # Swaps with `@sauce/router`
7
+
8
+ `@sauce/router` is the package's swap library: one SauceScript function per venue. A program
9
+ imports the ones it uses, and the package serves the library to every compile, so the import is all
10
+ it needs:
11
+
12
+ ```sauce chain=base,arbitrum
13
+ import { uniswapV3 } from "@sauce/router";
14
+
15
+ function main(amount: Uint256, sqrtPriceLimitX96: Uint256, minOut: Uint256) {
16
+ const pool = UniswapV3.Factory.getPool(WETH, USDC, 500n);
17
+ uniswapV3(pool, WETH, USDC, amount, sqrtPriceLimitX96, minOut, ctx.self());
18
+ }
19
+ ```
20
+
21
+ Every argument is a run-time value, so a program can choose the pool, the direction and the amount
22
+ while it runs: spend what an earlier swap returned, read a balance, loop over a list of pools.
23
+
24
+ A tokenized stock (`SPCXc` on Base, `TSLAon` on Ethereum) is swapped like any token; its symbol
25
+ and what differs about it are in `sauce-globals`
26
+ ([Tokenized stocks](../sauce-globals/SKILL.md#tokenized-stocks)).
27
+
28
+ ## Functions
29
+
30
+ Every function takes its arguments in one order — the pool, the two tokens, the amount, the venue's
31
+ own facts, then the floor and the recipient — and returns the amount of `tokenOut` the recipient
32
+ received:
33
+
34
+ | Function | Arguments | Reached through |
35
+ | ------------- | --------------------------------------------------------------------------------------------------------- | ---------------- |
36
+ | `uniswapV2` | `pair, tokenIn, tokenOut, amountIn, feePpm, minOut, recipient` | the pair |
37
+ | `uniswapV3` | `pool, tokenIn, tokenOut, amountIn, sqrtPriceLimitX96, minOut, recipient` | the Pot's Router |
38
+ | `uniswapV4` | `poolManager, tokenIn, tokenOut, amountIn, fee, tickSpacing, hooks, sqrtPriceLimitX96, minOut, recipient` | the Pot's Router |
39
+ | `curve` | `pool, tokenIn, tokenOut, amountIn, i, j, uint256Indices, minOut, recipient` | the pool |
40
+ | `balancerV2` | `vault, tokenIn, tokenOut, amountIn, poolId, minOut, recipient` | the Vault |
41
+ | `dodoV2` | `pool, tokenIn, tokenOut, amountIn, baseToken, quoteToken, minOut, recipient` | the pool |
42
+ | `traderJoeLB` | `pair, tokenIn, tokenOut, amountIn, tokenX, tokenY, minOut, recipient` | the pair |
43
+ | `woofi` | `pool, tokenIn, tokenOut, amountIn, minOut, recipient` | the WooPPV2 |
44
+ | `maverickV2` | `pool, tokenIn, tokenOut, amountIn, minOut, recipient` | the Pot's Router |
45
+
46
+ - **`amountIn`** is what the Pot pays. **Every swap is exact input.**
47
+ - **`minOut`** is the least the swap may deliver; below it the whole program reverts. `0n` sets no
48
+ floor, except for `woofi`, which requires a positive one.
49
+ - **`recipient`** receives the output; `ctx.self()` keeps it in the Pot.
50
+ - `feePpm` is a V2 pair's LP fee in parts per million (3000, which `0n` also means, for Uniswap V2;
51
+ 2500 for PancakeSwap V2). `uniswapV4` takes the pool key's `fee`, `tickSpacing` and `hooks`, and
52
+ builds the key from `tokenIn` and `tokenOut` in sort order. `uint256Indices` picks a Curve
53
+ CryptoSwap pool's `uint256` coin indices over a StableSwap pool's `int128` ones.
54
+
55
+ `tryUniswapV2`, `tryCurve`, `tryBalancerV2` and `tryTraderJoeLB` take the same arguments as the
56
+ function they name and return `0n`, having moved nothing, instead of reverting when the swap cannot
57
+ be made. DODO V2 and WOOFi have no `try` form.
58
+
59
+ ## How each venue is reached
60
+
61
+ **Paid first.** Uniswap V2 and its forks, Curve, Balancer V2, DODO V2, Trader Joe LB and WOOFi never
62
+ call back: the function pushes the input to the pool, or approves exactly the input for the pool to
63
+ pull, and calls it. Such a swap **consumes its whole input or reverts**; nothing is refunded.
64
+
65
+ **Called back.** Uniswap V3 and its forks, Uniswap V4 and Maverick V2 pools re-enter their caller
66
+ mid-swap to be paid, which a program cannot answer. Those functions call the **Pot's Router**,
67
+ `ctx.self()`: the Pot's fallback delegatecalls the Router it is configured with (`router()` on the
68
+ Pot), so the Router runs in the Pot's context, holds the Pot's balances, and answers the callback.
69
+ It services these callbacks:
70
+
71
+ - `uniswapV3SwapCallback`: Uniswap V3 and forks that keep the name, including Aerodrome Slipstream;
72
+ - `pancakeV3SwapCallback`: PancakeSwap V3;
73
+ - `algebraSwapCallback`: Algebra pools (Camelot V3, QuickSwap V3), whose `swap` has the same
74
+ selector as Uniswap V3's;
75
+ - `synthraV3SwapCallback`, `unitFlowV3SwapCallback`: Synthra V3 and UnitFlow V3;
76
+ - `unlockCallback`: Uniswap V4.
77
+
78
+ So `uniswapV3` drives every one of those V3-style pools. Each callback is authenticated to the pool
79
+ being swapped (`InvalidPool` for a pool that is not the requested pair), pays **once**, and pays only
80
+ the input the pool asks for, never more than `amountIn` (`InputExceedsAuthorized`).
81
+
82
+ Every token write is `@sauce/token`'s SafeERC20: a token that returns nothing (USDT) works, one that
83
+ returns `false` reverts the program.
84
+
85
+ **Direction is checked from the arguments.** A V2 pair's and a V4 pool's direction is the sort order
86
+ of `tokenIn` and `tokenOut`; `dodoV2` takes the pool's base and quote tokens and `traderJoeLB` its X
87
+ and Y tokens, and each reverts unless `tokenIn` and `tokenOut` are those two; the Router checks a V3
88
+ pool's tokens itself. Take these facts from the pool, as you take the pool itself.
89
+
90
+ ## Price limits and partial fills
91
+
92
+ `sqrtPriceLimitX96` is `floor(sqrt(token1Units / token0Units) * 2^96)`, with token0 the lower of
93
+ the two addresses, so one number means the same price on every V3-style pool of the pair and on V4
94
+ pools of the same two currencies. Selling token0 moves the price down, so the limit is a floor;
95
+ selling token1 moves it up, so it is a ceiling. It must lie strictly between `4295128739` and
96
+ `1461446703485210103287273052203988822378723970342` and on the far side of the pool's current
97
+ price, or the pool reverts `SPL`. A limit of `0n` means none, which leaves `minOut` as the only
98
+ bound: set a real limit.
99
+
100
+ **Convert a price with `sauce price`**, which reads no network:
101
+ `npx sauce price --chain base WETH USDC 2686.5`. The price is **quote per base**: the first token
102
+ is the one priced, the second what it is priced in, so this is 2,686.5 USDC per WETH. Swapped,
103
+ `USDC WETH 2686.5` would mean 2,686.5 WETH per USDC, a limit nowhere near any pool. It prints the
104
+ pair's order on the chain (on Base WETH is token0, the lower address, and USDC token1) and two
105
+ blocks:
106
+
107
+ - **`sell`** (the base token in: WETH → USDC): its `sqrtPriceLimitX96` is a **floor**;
108
+ - **`buy`** (the base token out: USDC → WETH): its `sqrtPriceLimitX96` is a **ceiling**.
109
+
110
+ Each block also gives `minAvgPrice` for that direction. Take the limit from the block of the
111
+ direction you trade.
112
+
113
+ **Put the limit near the current price, on the far side of it.** A limit far beyond the price, such
114
+ as the bound itself, is no limit at all: the pool fills down (or up) to it at any price. One on the
115
+ wrong side fills nothing: a single swap reverts `SPL`, and a distributed swap skips every pool and
116
+ refunds everything, which is not a success. In a real run never pass `minOut` as `0`.
117
+
118
+ **Build the limit from the best price a taker gets among pools with liquidity**: drop the pools
119
+ with no in-range liquidity (`liquidity()`, or less than the order needs), take the best price after
120
+ each pool's fee, and move it by the slippage you accept. Never a pool's price alone: a pool with no
121
+ liquidity at its price keeps a stale price that can be far from the market. Nor the deepest pool's
122
+ mid price: a pool's mid sits up to its fee away from the cheap pools, so a 0.3% pool's price is a
123
+ loose reference. `sauce-distributed-swap` works this through on Base.
124
+
125
+ **It bounds the pool's price after the swap, not the price paid.** One number is the same pool price
126
+ on every V3-style pool of the pair, but the fee comes on top, and it differs per pool: under one
127
+ limit, the last unit a 1% pool fills costs about 1% more than the limit, a 0.05% pool's about
128
+ 0.05%. To bound the price paid, give each pool its own limit: `limit ÷ √(1 − fee)` selling token0,
129
+ `limit × √(1 − fee)` selling token1 (`sauce-distributed-swap` computes it for each pool).
130
+
131
+ A pool offered more than it can fill before its price reaches the limit **takes only what it
132
+ can**: the Router pays exactly the pool's delta, and the rest of the input stays in the Pot. That
133
+ is what a limit is for (the remainder can go to another venue or back to the user), and why a leg
134
+ must never end with any of its input left in the Pot.
135
+
136
+ A V4 pool priced in native ETH has `currency0` = `0x0`: it is a different pair from the WETH pools,
137
+ and it needs native ETH in the Pot.
138
+
139
+ ## When a swap reverts
140
+
141
+ A V3-style pool reverts with a short string, and the Router with a custom error:
142
+
143
+ | Revert | From | Means |
144
+ | ---------------------------------------- | ---------- | ----------------------------------------------------------------------------------------------- |
145
+ | `SPL` | the pool | the price limit is on the wrong side of the pool's current price, or at or past a bound (above) |
146
+ | `AS` | the pool | the amount is zero |
147
+ | `LOK` | the pool | the pool is not initialized (or is mid-swap) |
148
+ | `IIA` | the pool | its callback paid less input than it asked for |
149
+ | `TF` | the pool | its transfer of the output token failed |
150
+ | `InvalidPool()`, `0x2083cd40` | the Router | the pool's `token0`/`token1` are not the pair passed |
151
+ | `InputExceedsAuthorized()`, `0x510db218` | the Router | the pool asked for more input than the exact input offered |
152
+
153
+ A revert inside the program (a `require`, the library's `minOut` check) is the program's own; the
154
+ cook reverts as a whole either way.
155
+
156
+ ## PancakeSwap Infinity
157
+
158
+ PancakeSwap Infinity pools are not in the library: the Router's own entry points swap them, called
159
+ through the Pot with the Router ABI the package serves (`import { ISauceRouter } from
160
+ "./artifacts/ISauceRouter.json"`, then `ISauceRouter.at(ctx.self())`). Their exact input is a
161
+ negative amount (`-amount`), and they return the pool's signed deltas, not a received amount: the
162
+ program measures the output and checks its own floor.
163
+
164
+ | Entry point | Price bound |
165
+ | -------------------------------------------------------------------------------------------------------- | ------------------- |
166
+ | `swapInfinityCL(vault, key, zeroForOne, amountSpecified, sqrtPriceLimitX96, payer, recipient, callback)` | `sqrtPriceLimitX96` |
167
+ | `swapInfinityBin(vault, key, swapForY, amountSpecified, payer, recipient, callback)` | none |
168
+
169
+ ## The guard (required on every leg)
170
+
171
+ The library checks `minOut`; what is left is the input a price limit left unspent:
172
+
173
+ 1. Pass a `minOut` that is a `main` input, so a short fill reverts the whole transaction.
174
+ 2. Pay the output to its recipient (`recipient` does it), or keep it in the Pot for the next step.
175
+ 3. Send the rest of the input back to the user or a refund address: `amountIn` less what the
176
+ swap took (the input balance before minus after), not the Pot's whole balance of the token,
177
+ which on an owner's Pot may hold more of it for other uses. A full sweep is only for an intent
178
+ body on the shared intent Pot, which holds nothing of anyone's (`sauce-intents`).
179
+
180
+ [examples/swap-leg.sauce.ts](examples/swap-leg.sauce.ts) is exactly this for one Uniswap V3 pool.
181
+ Rehearse it, then run it, with the input in the Pot (or pulled in with `--fund`):
182
+
183
+ ```sh
184
+ npx sauce simulate swap-leg.sauce.ts --chain base --owner <address> --config sauce.config.json \
185
+ --args <tokenIn> <tokenOut> 500 <amountIn> <sqrtPriceLimitX96> <minOut> <recipient>
186
+ npx sauce run swap-leg.sauce.ts --chain base --config sauce.config.json --keystore <keystore> \
187
+ --fund WETH:0.5 --args <tokenIn> <tokenOut> 500 <amountIn> <sqrtPriceLimitX96> <minOut> <recipient>
188
+ ```
189
+
190
+ A swap is sent on a chain the initial release supports, Ethereum or Base here; on a preview chain
191
+ the leg compiles and simulates, and `sauce tx` and `sauce run` refuse it with the chain-support
192
+ request for that chain (`sauce-chains`).
193
+
194
+ For several venues under one price limit, use `sauce-distributed-swap`.
195
+
196
+ ## Example
197
+
198
+ [examples/swaps.mts](examples/swaps.mts) compiles the leg and pins the library's functions, the
199
+ Router's entry points, their price parameters and the callbacks above against what the package
200
+ serves.
@@ -0,0 +1,50 @@
1
+ // One guarded swap leg: sell `amountIn` of `tokenIn` on the chain's Uniswap V3 pool at `fee`, never
2
+ // past `sqrtPriceLimitX96`. `uniswapV3` swaps through the Pot's Router, pays `recipient` and reverts
3
+ // below `minOut`. The pool takes only what it can fill before the limit, so the rest of `amountIn`
4
+ // goes back too. Only this trade's tokens move: what else the Pot holds stays there.
5
+ //
6
+ // sauce run swap-leg.sauce.ts --chain <chain> --config sauce.config.json --keystore <keystore> \
7
+ // --args <tokenIn> <tokenOut> <fee> <amountIn> <sqrtPriceLimitX96> <minOut> <recipient>
8
+ //
9
+ // tokenIn: Address the token sold
10
+ // tokenOut: Address the token bought
11
+ // fee: Uint256 the pool's fee tier, in millionths: 500 is 0.05%
12
+ // amountIn: Uint256 how much `tokenIn` to sell, in its smallest units:
13
+ // 100000000000000000 is 0.1 WETH (18 decimals)
14
+ // sqrtPriceLimitX96: Uint256 the pool price past which nothing more is sold, as the pool
15
+ // states it (`sauce price` turns "2500 USDC per WETH" into it)
16
+ // minOut: Uint256 the least `tokenOut` to accept, in its smallest units:
17
+ // 249000000 is 249 USDC (6 decimals)
18
+ // recipient: Address who receives `tokenOut` and the unsold `tokenIn`
19
+ //
20
+ // On Base, 0.1 WETH sold for USDC on the 0.05% pool, no lower than 2,500 USDC per WETH:
21
+ //
22
+ // sauce run swap-leg.sauce.ts --chain base --config sauce.config.json --keystore <keystore> \
23
+ // --args 0x4200000000000000000000000000000000000006 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 \
24
+ // 500 100000000000000000 3961408125713216879677197 249000000 <recipient>
25
+ import { uniswapV3 } from "@sauce/router";
26
+
27
+ function main(
28
+ tokenIn: Address,
29
+ tokenOut: Address,
30
+ fee: Uint256,
31
+ amountIn: Uint256,
32
+ sqrtPriceLimitX96: Uint256,
33
+ minOut: Uint256,
34
+ recipient: Address,
35
+ ) {
36
+ const self = ctx.self();
37
+ const pool = UniswapV3.Factory.getPool(tokenIn, tokenOut, fee);
38
+ require(pool != 0n, "no pool at that fee tier");
39
+ const inBefore = Token(tokenIn).balanceOf(self);
40
+ require(inBefore >= amountIn, "amountIn is not in the Pot");
41
+
42
+ uniswapV3(pool, tokenIn, tokenOut, amountIn, sqrtPriceLimitX96, minOut, recipient);
43
+
44
+ // The rest of amountIn: what the pool did not take. Not the Pot's whole balance, which may hold
45
+ // more of the token for other uses.
46
+ const unspent = amountIn - (inBefore - Token(tokenIn).balanceOf(self));
47
+ if (unspent > 0n) {
48
+ Token(tokenIn).transfer(recipient, unspent);
49
+ }
50
+ }
@@ -0,0 +1,124 @@
1
+ // Compiles swap-leg.sauce.ts for Base and Arbitrum the way `sauce compile` does, and pins the facts
2
+ // the sauce-swaps skill states: the functions `@sauce/router` exports and their argument order, the
3
+ // Router entry points that take a sqrt-price limit, which pool callbacks the Router services, and
4
+ // what a callback is held to. Offline: nothing is sent.
5
+ //
6
+ // node swaps.mts
7
+ import { readFileSync } from "node:fs";
8
+ import { createRequire } from "node:module";
9
+ import { dirname, join } from "node:path";
10
+
11
+ import { routes } from "@eco-incorp/sauce";
12
+ import { resolveSdkModule, resolveSdkPackage } from "@eco-incorp/sauce/compiler";
13
+
14
+ function check(condition: unknown, message: string): asserts condition {
15
+ if (!condition) throw new Error(`check failed: ${message}`);
16
+ }
17
+
18
+ const source = readFileSync(new URL("./swap-leg.sauce.ts", import.meta.url), "utf8");
19
+ for (const slug of ["base", "arbitrum"]) {
20
+ const leg = routes.compileSauceProgram(slug, source);
21
+ check(
22
+ leg.entryParams.map((param) => `${param.name}: ${param.type}`).join(", ") ===
23
+ "tokenIn: Address, tokenOut: Address, fee: Uint256, amountIn: Uint256, " +
24
+ "sqrtPriceLimitX96: Uint256, minOut: Uint256, recipient: Address",
25
+ "main's inputs, as --args takes them",
26
+ );
27
+ check(/from "@sauce\/router"/.test(leg.source), "the leg swaps through @sauce/router");
28
+ console.log(`guarded V3 leg on ${slug}: ${leg.bytecode.length} bytes`);
29
+ }
30
+
31
+ // The library the package serves for `import ... from "@sauce/router"`: its EVM arm, and every
32
+ // function the skill lists, with its arguments in the order the skill gives them.
33
+ const entry = resolveSdkPackage("@sauce/router");
34
+ if (entry === undefined) throw new Error("the SDK serves @sauce/router");
35
+ const library = resolveSdkModule(entry.replace(/\.js$/, ".evm.js"));
36
+ if (library === undefined) throw new Error("@sauce/router has an EVM arm");
37
+ const text = new TextDecoder().decode(library);
38
+ const params = (name: string) => {
39
+ const found = new RegExp(`export function ${name}\\(([^)]*)\\)`).exec(text);
40
+ return found?.[1]
41
+ ?.split(",")
42
+ .map((p) => p.trim().split(":")[0]!.trim())
43
+ .filter(Boolean)
44
+ .join(", ");
45
+ };
46
+ const LIBRARY = {
47
+ uniswapV2: "pair, tokenIn, tokenOut, amountIn, feePpm, minOut, recipient",
48
+ uniswapV3: "pool, tokenIn, tokenOut, amountIn, sqrtPriceLimitX96, minOut, recipient",
49
+ uniswapV4:
50
+ "poolManager, tokenIn, tokenOut, amountIn, fee, tickSpacing, hooks, sqrtPriceLimitX96, minOut, recipient",
51
+ curve: "pool, tokenIn, tokenOut, amountIn, i, j, uint256Indices, minOut, recipient",
52
+ balancerV2: "vault, tokenIn, tokenOut, amountIn, poolId, minOut, recipient",
53
+ dodoV2: "pool, tokenIn, tokenOut, amountIn, baseToken, quoteToken, minOut, recipient",
54
+ traderJoeLB: "pair, tokenIn, tokenOut, amountIn, tokenX, tokenY, minOut, recipient",
55
+ woofi: "pool, tokenIn, tokenOut, amountIn, minOut, recipient",
56
+ maverickV2: "pool, tokenIn, tokenOut, amountIn, minOut, recipient",
57
+ };
58
+ for (const [name, args] of Object.entries(LIBRARY)) {
59
+ check(params(name) === args, `@sauce/router's ${name}(${args})`);
60
+ }
61
+ for (const name of ["UniswapV2", "Curve", "BalancerV2", "TraderJoeLB"]) {
62
+ const base = name.charAt(0).toLowerCase() + name.slice(1);
63
+ check(params(`try${name}`) === params(base), `try${name} takes ${base}'s arguments`);
64
+ }
65
+ for (const name of ["DodoV2", "Woofi"]) {
66
+ check(params(`try${name}`) === undefined, `${name} has no try form`);
67
+ }
68
+
69
+ // The Router ABI the package serves, which `@sauce/router` calls for the venues that call back.
70
+ interface AbiFunction {
71
+ type: string;
72
+ name: string;
73
+ inputs: { name: string }[];
74
+ }
75
+ const served = resolveSdkModule("./artifacts/ISauceRouter.json");
76
+ if (served === undefined) throw new Error("the SDK serves ISauceRouter.json");
77
+ const parsed = JSON.parse(new TextDecoder().decode(served)) as
78
+ AbiFunction[] | { abi: AbiFunction[] };
79
+ const abi = (Array.isArray(parsed) ? parsed : parsed.abi).filter((f) => f.type === "function");
80
+ const has = (name: string) => abi.some((f) => f.name === name);
81
+ const inputs = (name: string) => abi.find((f) => f.name === name)?.inputs.map((i) => i.name) ?? [];
82
+
83
+ check(inputs("swapV3").includes("sqrtPriceLimitX96"), "swapV3 takes a limit");
84
+ check(inputs("swapV4").includes("sqrtPriceLimitX96"), "swapV4 takes a limit");
85
+ check(
86
+ inputs("swapInfinityCL").join() ===
87
+ "vault,key,zeroForOne,amountSpecified,sqrtPriceLimitX96,payer,recipient,callback",
88
+ "PancakeSwap Infinity CL takes a limit",
89
+ );
90
+ check(
91
+ inputs("swapInfinityBin").join() ===
92
+ "vault,key,swapForY,amountSpecified,payer,recipient,callback",
93
+ "PancakeSwap Infinity Bin has no limit",
94
+ );
95
+
96
+ // The pool callbacks the Router services: which pool families `uniswapV3`/`uniswapV4` can drive.
97
+ for (const callback of [
98
+ "uniswapV3SwapCallback",
99
+ "pancakeV3SwapCallback",
100
+ "algebraSwapCallback",
101
+ "synthraV3SwapCallback",
102
+ "unitFlowV3SwapCallback",
103
+ "unlockCallback",
104
+ ]) {
105
+ check(has(callback), `the Router implements ${callback}`);
106
+ }
107
+
108
+ // What a callback is held to: the pool must be the requested pair, and it is paid at most the
109
+ // exact input. The deployed Router's full ABI ships beside the package's other artifacts.
110
+ const routerAbi = (
111
+ JSON.parse(
112
+ readFileSync(
113
+ join(
114
+ dirname(createRequire(import.meta.url).resolve("@eco-incorp/sauce")),
115
+ "artifacts/Router.json",
116
+ ),
117
+ "utf8",
118
+ ),
119
+ ) as { abi: { type: string; name?: string }[] }
120
+ ).abi;
121
+ const errors = routerAbi.filter((entry) => entry.type === "error").map((entry) => entry.name);
122
+ check(errors.includes("InvalidPool"), "a pool that is not the requested pair is refused");
123
+ check(errors.includes("InputExceedsAuthorized"), "a callback takes at most the exact input");
124
+ console.log(`@sauce/router: ${Object.keys(LIBRARY).join(", ")}`);
@@ -0,0 +1,178 @@
1
+ ---
2
+ name: sauce-typescript
3
+ description: The TypeScript side of Sauce (@eco-incorp/sauce) — compiling a .sauce.ts program for a chain from application code exactly as the sauce command does, encoding its main(...) arguments and the Pot.cook transaction, deriving and deploying the owner's Pot, the raw compiler and compact arguments, JSON action programs, settlement verification, browser compilation with ready(), and the rule that the package embeds no RPC. Use when writing application or script code that compiles, encodes, verifies or submits Sauce programs, or when the user asks which import or subpath to use.
4
+ ---
5
+
6
+ # Sauce from TypeScript
7
+
8
+ Write the program in SauceScript first (`sauce-script`, `sauce-globals`), and run it with the
9
+ `sauce` command (`sauce-cli`). Reach for TypeScript when an application builds the transactions
10
+ itself: every command is a thin layer over the functions below. The package embeds no RPC endpoint
11
+ and reads no environment variable: anything that touches a chain takes a client or an `rpcUrl` from
12
+ you. Every address comes from the package (`/deployments`, the registries) or from the developer;
13
+ never invent one. The shipped manual starts at `node_modules/@eco-incorp/sauce/docs/README.md`; the
14
+ subpath list is `node_modules/@eco-incorp/sauce/docs/api/README.md`.
15
+
16
+ ## Supported chains
17
+
18
+ For the initial release, Sauce supports transactions on Ethereum, Base and Solana. Every other
19
+ chain the registry knows is a preview chain: its programs compile and simulate, and the `sauce`
20
+ command and the MCP server build and send no transaction there. Application code follows the same
21
+ rule: build and send a cook, a Pot's deployment or an intent's transactions only for a supported
22
+ chain, and treat a preview chain as compile and simulate only. To ask for a preview chain, find its
23
+ request among the
24
+ [existing chain-support requests](https://github.com/eco-incorp/sauce/issues?q=is%3Aissue+label%3Achain-support)
25
+ and add the use case, or
26
+ [open one](https://github.com/eco-incorp/sauce/issues/new?template=chain-support.yml).
27
+
28
+ ## Compile a program for a chain, and cook it
29
+
30
+ `routes.compileSauceProgram(chain, source, options)` is what `sauce compile` runs: the chain's
31
+ names, its defines and `@sauce/token`, with `options.defines` for the program's own compile-time
32
+ values and `options.intents` for the intents it opens. The result carries `main`'s declared
33
+ parameters (`entryParams`); `routes.encodeEntryArguments` encodes values for them as `--args` does,
34
+ and program plus arguments is the `program` of the owner's `Pot.cook(engine, program)`.
35
+
36
+ ```ts
37
+ import { readFileSync } from "node:fs";
38
+ import { destinationExecutionFee, routes, v12PredictPot } from "@eco-incorp/sauce";
39
+ import { v12EngineAddress } from "@eco-incorp/sauce/deployments";
40
+ import { v12Pot } from "@eco-incorp/sauce/evm/engine";
41
+ import { bytesToHex, concatHex, getAddress, type PublicClient } from "viem";
42
+
43
+ type Address = `0x${string}`;
44
+
45
+ export async function cookTransactions(
46
+ client: PublicClient, // the chain's: the program is compiled for it and the fee read from it
47
+ file: string,
48
+ chain: string,
49
+ owner: Address,
50
+ args: readonly (bigint | string | boolean)[],
51
+ ) {
52
+ const salt = `0x${"00".repeat(32)}` as const;
53
+ const pot = v12PredictPot(owner, salt); // the owner's Pot, derived through the released Kitchen
54
+ const deploy = routes.sauceEvmDeployPotCall({ owner, salt }); // once, through the Kitchen
55
+ const program = routes.compileSauceProgram(chain, readFileSync(file, "utf8"));
56
+ const encoded = routes.encodeEntryArguments(program, args); // checked against main's types
57
+ const engine = getAddress(v12EngineAddress());
58
+ const payload = concatHex([bytesToHex(program.bytecode), bytesToHex(encoded)]);
59
+ // The cook's value is the Kitchen's executionFee(), read just before sending: a cook paying
60
+ // less reverts.
61
+ const fee = destinationExecutionFee();
62
+ const { data: answer } = await client.call({ to: fee.to, data: fee.data });
63
+ if (answer === undefined) throw new Error("the Kitchen did not answer executionFee()");
64
+ const cook = {
65
+ chainId: await client.getChainId(),
66
+ to: pot,
67
+ data: v12Pot.encodeCook(engine, payload),
68
+ value: fee.decode(answer),
69
+ };
70
+
71
+ return { deploy, cook }; // cook is what `sauce tx` prints: { chainId, to, data, value }
72
+ }
73
+ ```
74
+
75
+ - `destinationExecutionFee()` builds the fee read (`{ to, data, decode }`) for the chain's
76
+ Kitchen; the example sends it as an `eth_call` with the chain's client just before the cook.
77
+ - `routes.sauceEvmDeployPotCall` and `routes.buildSauceEvmCall` return `{ to, data, value }` to send
78
+ as a transaction, plus `target`, the same contract as a route's `calls` entry names it.
79
+ - `v12EngineAddress()` and `v12KitchenAddress()` are recorded release addresses, and the deploy
80
+ call goes to the Kitchen unless you pass `kitchen`: check the chain has code at them. Deploy the
81
+ Pot only where it has no code yet.
82
+ - A Pot swaps through the Router its Kitchen handed it when it was minted. `potRouterUpdate(client,
83
+ pot)` from `/evm/engine` reads both, and returns the `setRouter` call for the Pot's owner to send
84
+ when the Kitchen has a newer one.
85
+ - A program that opens an intent also needs `options.intents`, `{ deadline, creator,
86
+ executionFee }` (`sauce-intents`).
87
+
88
+ ## The raw compiler
89
+
90
+ `compile({ target, entry, resolve, ... })` from `/compiler` compiles a program and resolves nothing
91
+ for you: no registry names, no chain defines, no token syntax. Reach for it for full control of the
92
+ source and resolver, and for compact arguments.
93
+
94
+ - ABI-v1 arguments by default: `abi.encode` of `main`'s parameters, except that a tuple parameter
95
+ is always behind an offset word, even one whose fields are all fixed-size. `encodeAbiParameters`
96
+ inlines that tuple instead; `routes.encodeEntryArguments` writes the layout `main` reads.
97
+ - `compactArgs: true` returns an `entrySchema` for
98
+ `encodeCompactArguments`/`decodeCompactArguments` (`scalarWidth` keeps offsets fixed).
99
+ - `resolveSdkModule` and `resolveSdkPackage` serve `@sauce/token`, the package's artifact ABIs and
100
+ every `./protocols/<slug>/<Export>.json` to your resolver.
101
+ - In a browser, `await ready()` once before the first compile; `/svm/engine-artifacts` is the one
102
+ Node-only subpath. See [examples/compiler.mts](examples/compiler.mts) and
103
+ `node_modules/@eco-incorp/sauce/docs/api/compiler.md`.
104
+
105
+ ## The protocol registry
106
+
107
+ ```ts
108
+ import { contracts, getProtocol, getProtocolsByChain, listProtocolSlugs } from "@eco-incorp/sauce";
109
+ import * as pancakeV3 from "@eco-incorp/sauce/protocols/pancakeswap-v3";
110
+
111
+ export const onBase = getProtocolsByChain(8453).map((p) => p.slug); // catalogued on Base
112
+ export const info = getProtocol("pancakeswap-v3"); // name, category, chains, website
113
+ export const slugs = listProtocolSlugs();
114
+ // Per-chain addresses by role, e.g. { factory, smartRouter, nonfungiblePositionManager }.
115
+ export const pancakeOnBase = pancakeV3.deployments.find((d) => d.chainId === 8453)?.addresses;
116
+ // Whether a namespace contract is deployed on a chain, and where.
117
+ export const aave = contracts.on("base").AaveV3.Pool; // { available, address, abi, methods, … }
118
+ export const pancake = contracts.on("optimism").PancakeswapV3.Factory.available; // false
119
+ ```
120
+
121
+ Each protocol module (`@eco-incorp/sauce/protocols/<slug>`) exports `protocolInfo`, `deployments`,
122
+ its ABIs (`…ABI`), and its SauceScript templates by name (`supply`, `swap`, `getPool`, …).
123
+ `getProtocolSkill(slug)`, `getProtocolIndex()` and `listSkillSlugs()` from
124
+ `@eco-incorp/sauce/skills` return the `sauce-protocols` documents. An address in `deployments` is
125
+ a recorded address, not proof of live code on the chain.
126
+
127
+ ## Other host tools
128
+
129
+ - **JSON action programs** (`/actions`): a document names tokens by registry symbol (`"USDC"`) and
130
+ contracts by namespace (`"UniswapV3.Factory"`), and a swap may give its pool by its factory's
131
+ key (`factory` and `fee`). `compileProgram(program, { chain })` compiles it for any chain that
132
+ has those names; a name the chain lacks throws `ProgramError`, whose `issues` and `chain` say
133
+ which. `argument` actions become runtime amounts. `programIntent(...)`, `quoteAction(...)` and
134
+ `compileSplitSwap(...)` resolve names on `chain` the same way. Reference:
135
+ `node_modules/@eco-incorp/sauce/docs/guides/actions.md`; see
136
+ [examples/actions.mts](examples/actions.mts), and `sauce-actions` for writing the documents.
137
+ - **Settlement verification** (`/verify`, `/svm/verify`): `validateSettleProgram`,
138
+ `decodeSettleCall`, `extractEvmSettleFromIntent`, historical pins. It identifies the program and
139
+ its parameters; the Pot, engine and every other call stay yours to check (`sauce verify` runs
140
+ it). See [examples/verify.mts](examples/verify.mts).
141
+ - **Solana execution** (`/svm`): the Kitchen client,
142
+ `createSauceSvmClient({ rpcUrl, payer, programId, kitchen, maxExecutionFee })`, with no default
143
+ endpoint; the SVM route helpers (`Solana(...)` routes, `buildSauceSvmCall`) do not produce an
144
+ instruction the engine accepts, so build execution with the Kitchen client. `USDC_MINT` is the
145
+ mainnet USDC mint. The token builder generates Token-2022 and `TransferChecked` programs:
146
+ `token.Token.transfer({ amount, svm: { ... } }).source("svm")`, with top-level
147
+ `tokenProgram: "token-2022"`. For a `@sauce/token` program's accounts,
148
+ `resolveSvmToken(load, mint)` reads a mint through an owned-account loader and returns its token
149
+ program (by the mint's owner), decimals and extensions, and why a checked transfer of it would be
150
+ refused; `svmTokenAccount(token, owner)` derives a holder's account under that program, and
151
+ `svmTokenReceived`/`svmTokenToSend` net a Token-2022 transfer fee exactly, either way. Venue adapters (`venue("raydium-cp-swap")`, also `Solana.RaydiumCpSwap`) build
152
+ pool configs, quote source and swap CPIs over an account loader you supply. For a local validator
153
+ or LiteSVM, `svmEnginePath()`, `svmKitchenPath()` and `svmKitchenIdlPath()` from
154
+ `@eco-incorp/sauce/svm/engine-artifacts` (Node only) locate the packaged programs; the program
155
+ ids are `v12SvmEngineProgramId()` and `v12SvmKitchenProgramId()` from `/deployments`. Writing the
156
+ programs is `sauce-solana`.
157
+ - **Intents** (`sauce-intents`): `routes.hashIntent(intent)` gives the three hashes,
158
+ `routes.encodeRouteEvm(intent.route)` the route bytes (decode with `routes.EVM_ROUTE_PARAM` for
159
+ `fulfill`), `destinationPot(chain)` the shared Pot and
160
+ `routes.sauceEvmDeployPotCall({ owner: ecoRoutesExecutor(chain), salt: SAUCE_INTENT_POT_SALT })`
161
+ its deploy; the intents runner builds a rehearsal with them. For the source side,
162
+ `built.sourceTxs()` (`routes.intentSourceTxs` for an intent built some other way) is the
163
+ funding and publication in order: a transfer of each reward token to the vault, then `publish`
164
+ (`{ fundVia: "publishAndFund" }` for the approvals and `publishAndFund`). Pass `{ vault }` read with
165
+ `routes.intentVaultAddressCall`: it is checked against `routes.predictIntentVault`, the package's
166
+ own computation. `routes.publishTx`, `routes.publishAndFundTx`, `routes.approvalTxs` and
167
+ `routes.isIntentFundedCall` build the single calls (`{ to, data }`, with `decode` for a read).
168
+ - **Cascades from TypeScript**: `routes.openRoute(chain, body, options).nest(child, { via })`
169
+ attaches a child intent to a route. By default (`via: "transfer"`) the parent's route funds the
170
+ child by a transfer into the child's vault, with no publication of its own;
171
+ `via: "publishAndFund"` publishes and funds it for public discovery instead.
172
+
173
+ ## Example
174
+
175
+ [examples/cook.mts](examples/cook.mts) builds the Pot, its deploy call and a cook with arguments
176
+ offline; [examples/compiler.mts](examples/compiler.mts),
177
+ [examples/actions.mts](examples/actions.mts) and [examples/verify.mts](examples/verify.mts) run the
178
+ raw compiler and argument codecs, the action-program pipeline, and settlement verification.
@@ -0,0 +1,100 @@
1
+ // JSON action programs: validate at the edge, compile once for a chain with a runtime amount, and
2
+ // build (not send) the quote that prices a swap action. Documents name tokens by registry symbol and
3
+ // contracts by namespace, so one document compiles for every chain that has those names.
4
+ import {
5
+ ProgramError,
6
+ compileProgram,
7
+ parseProgram,
8
+ quoteAction,
9
+ type ActionProgram,
10
+ type UniswapV4SwapAction,
11
+ } from "@eco-incorp/sauce/actions";
12
+ import { v12RouterAddress } from "@eco-incorp/sauce/deployments";
13
+ import { toHex } from "viem";
14
+
15
+ function check(condition: unknown, message: string): asserts condition {
16
+ if (!condition) throw new Error(`check failed: ${message}`);
17
+ }
18
+
19
+ // The Sauce Router of the release, which quotes Uniswap V3 and V4 swap actions with the code that
20
+ // swaps them. A Pot swaps through its own Router, the Kitchen's when it was minted.
21
+ const ROUTER = toHex(BigInt(v12RouterAddress()), { size: 20 });
22
+
23
+ // 1. Strict validation: every problem at once, each with a path. Amounts are base-10 STRINGS.
24
+ try {
25
+ parseProgram({ version: 1, actions: [{ type: "approve", token: "USDT", amuont: 5 }] });
26
+ throw new Error("expected rejection");
27
+ } catch (error) {
28
+ if (!(error instanceof ProgramError)) throw error;
29
+ check(error.issues.length >= 1, "issues carry paths");
30
+ }
31
+
32
+ // 2. One compiled program for every amount: `argument` becomes a runtime parameter of `main`. The
33
+ // names resolve on the chain given; token writes are SafeERC20 (approve is forceApprove), so USDT
34
+ // is fine here.
35
+ const reusable: ActionProgram = parseProgram({
36
+ version: 1,
37
+ actions: [
38
+ { type: "argument", name: "amount" },
39
+ { type: "approve", token: "USDT", spender: "AaveV3.Pool" },
40
+ ],
41
+ });
42
+ const compiled = compileProgram(reusable, { chain: "ethereum" });
43
+ const p1 = compiled.payload({ amount: 5n });
44
+ const p2 = compiled.payload({ amount: "900000" });
45
+ check(
46
+ p1.length === compiled.bytecode.length + 32 && p1.length === p2.length,
47
+ "ABI-v1: one word per argument",
48
+ );
49
+ check(compiled.argumentOffset("amount") === compiled.bytecode.length, "splice offset of `amount`");
50
+ check(
51
+ !/IERC20\.at\([^)]*\)\.approve/.test(compiled.source),
52
+ "the approve is not a typed IERC20 call",
53
+ );
54
+ // The same document compiles for another chain with those names, to that chain's addresses: the
55
+ // source names them, and the bytecode holds each chain's own.
56
+ const onOptimism = compileProgram(reusable, { chain: "optimism" });
57
+ check(onOptimism.source === compiled.source, "the source names the tokens and contracts");
58
+ check(
59
+ toHex(onOptimism.bytecode) !== toHex(compiled.bytecode),
60
+ "the bytecode holds each chain's addresses",
61
+ );
62
+
63
+ // 3. A name the chain lacks throws ProgramError, with the issues and the chain: Base registers no
64
+ // USDT, so the same document does not compile there.
65
+ try {
66
+ compileProgram(reusable, { chain: "base" });
67
+ throw new Error("expected rejection");
68
+ } catch (error) {
69
+ if (!(error instanceof ProgramError)) throw error;
70
+ check(
71
+ error.chain?.slug === "base" && error.issues[0]?.path === "actions[1].token",
72
+ "the issue names the field and the chain",
73
+ );
74
+ }
75
+
76
+ // 4. A quote is an eth_call you send yourself; nothing here touches the network. A swap action is
77
+ // a call into @sauce/router, here its `uniswapV4`: a hookless USDC/USDT pool, named by its key.
78
+ const swapAction: UniswapV4SwapAction = {
79
+ type: "uniswapV4Swap",
80
+ poolManager: "UniswapV4.PoolManager",
81
+ tokenIn: "USDC",
82
+ tokenOut: "USDT",
83
+ fee: 100,
84
+ tickSpacing: 1,
85
+ amount: "1000000",
86
+ amountOutMin: "990000",
87
+ recipient: "self",
88
+ };
89
+ const swapping = compileProgram(parseProgram({ version: 1, actions: [swapAction] }), {
90
+ chain: "ethereum",
91
+ });
92
+ check(/from "@sauce\/router"/.test(swapping.source), "a swap action calls @sauce/router");
93
+ const quote = quoteAction(swapAction, { chain: "ethereum", router: ROUTER });
94
+ check(
95
+ quote.data.startsWith("0x") && typeof quote.decode === "function",
96
+ "quote = { to, data, decode }",
97
+ );
98
+
99
+ console.log(`reusable approval: ${compiled.bytecode.length} bytes + 32-byte argument`);
100
+ console.log(`quote: eth_call to ${quote.to}`);