@eco-incorp/sauce 0.99.6 → 0.99.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +58 -16
- package/actions/action-program.schema.json +480 -379
- package/actions/dist/abis.d.ts +19 -18
- package/actions/dist/abis.d.ts.map +1 -1
- package/actions/dist/abis.js +29 -29
- package/actions/dist/compile.d.ts +4 -4
- package/actions/dist/compile.d.ts.map +1 -1
- package/actions/dist/compile.js +3 -1
- package/actions/dist/compose.d.ts +63 -6
- package/actions/dist/compose.d.ts.map +1 -1
- package/actions/dist/compose.js +100 -16
- package/actions/dist/index.d.ts +1 -1
- package/actions/dist/index.d.ts.map +1 -1
- package/actions/dist/names.d.ts +88 -0
- package/actions/dist/names.d.ts.map +1 -0
- package/actions/dist/names.js +334 -0
- package/actions/dist/program.d.ts.map +1 -1
- package/actions/dist/program.js +115 -5
- package/actions/dist/registry.d.ts +10 -8
- package/actions/dist/registry.d.ts.map +1 -1
- package/actions/dist/registry.js +10 -8
- package/actions/dist/schema.d.ts.map +1 -1
- package/actions/dist/schema.js +99 -12
- package/actions/dist/semantics.d.ts +12 -2
- package/actions/dist/semantics.d.ts.map +1 -1
- package/actions/dist/semantics.js +78 -8
- package/actions/dist/spec.d.ts +30 -0
- package/actions/dist/spec.d.ts.map +1 -1
- package/actions/dist/spec.js +151 -138
- package/actions/dist/split-swap.d.ts +10 -5
- package/actions/dist/split-swap.d.ts.map +1 -1
- package/actions/dist/split-swap.js +48 -7
- package/actions/dist/to-quote.d.ts +14 -5
- package/actions/dist/to-quote.d.ts.map +1 -1
- package/actions/dist/to-quote.js +210 -244
- package/actions/dist/to-sauce.d.ts +18 -4
- package/actions/dist/to-sauce.d.ts.map +1 -1
- package/actions/dist/to-sauce.js +232 -205
- package/actions/dist/types.d.ts +245 -147
- package/actions/dist/types.d.ts.map +1 -1
- package/actions/dist/types.js +4 -0
- package/docs/README.md +38 -0
- package/docs/api/README.md +37 -23
- package/docs/api/compiler.md +53 -12
- package/docs/api/contracts.md +105 -0
- package/docs/api/coverage.md +96 -57
- package/docs/api/router.md +238 -0
- package/docs/api/routes.md +31 -22
- package/docs/concepts/architecture.md +26 -3
- package/docs/concepts/saucescript.md +35 -55
- package/docs/examples/README.md +21 -14
- package/docs/examples/action-program.ts +51 -35
- package/docs/examples/cross-chain-cascade.sauce.ts +4 -0
- package/docs/examples/cross-chain-intent.sauce.ts +2 -1
- package/docs/examples/evm-execution.ts +2 -4
- package/docs/examples/first-intent.ts +7 -2
- package/docs/examples/pot-router.ts +19 -0
- package/docs/examples/registry-names.ts +52 -0
- package/docs/examples/router-route.sauce.ts +31 -0
- package/docs/examples/router-route.ts +72 -0
- package/docs/examples/router-swap.sauce.ts +16 -0
- package/docs/examples/router-swap.ts +47 -0
- package/docs/examples/venue-where-deployed.sauce.ts +14 -0
- package/docs/guides/actions.md +230 -120
- package/docs/guides/builders-and-actions.md +20 -14
- package/docs/guides/cli.md +1446 -0
- package/docs/guides/compiling.md +19 -7
- package/docs/guides/intents.md +228 -15
- package/docs/guides/mcp.md +540 -0
- package/docs/guides/nested-intents.md +21 -6
- package/docs/guides/protocols-and-tokens.md +218 -39
- package/docs/guides/quick-start.md +5 -0
- package/docs/guides/solana.md +199 -52
- package/docs/guides/verification.md +2 -2
- package/mcp/dist/config.js +78 -0
- package/mcp/dist/config.js.map +1 -0
- package/mcp/dist/entry.js +112 -0
- package/mcp/dist/entry.js.map +1 -0
- package/mcp/dist/files.js +64 -0
- package/mcp/dist/files.js.map +1 -0
- package/mcp/dist/guard.js +262 -0
- package/mcp/dist/guard.js.map +1 -0
- package/mcp/dist/http.js +111 -0
- package/mcp/dist/http.js.map +1 -0
- package/mcp/dist/intents.js +579 -0
- package/mcp/dist/intents.js.map +1 -0
- package/mcp/dist/prompts.js +153 -0
- package/mcp/dist/prompts.js.map +1 -0
- package/mcp/dist/reach.js +98 -0
- package/mcp/dist/reach.js.map +1 -0
- package/mcp/dist/resources.js +154 -0
- package/mcp/dist/resources.js.map +1 -0
- package/mcp/dist/sdk.js +34 -0
- package/mcp/dist/sdk.js.map +1 -0
- package/mcp/dist/server.js +119 -0
- package/mcp/dist/server.js.map +1 -0
- package/mcp/dist/setup.js +189 -0
- package/mcp/dist/setup.js.map +1 -0
- package/mcp/dist/skilltools.js +520 -0
- package/mcp/dist/skilltools.js.map +1 -0
- package/mcp/dist/terms.js +93 -0
- package/mcp/dist/terms.js.map +1 -0
- package/mcp/dist/tools.js +1499 -0
- package/mcp/dist/tools.js.map +1 -0
- package/mcp/dist/wallets.js +168 -0
- package/mcp/dist/wallets.js.map +1 -0
- package/package.json +18 -13
- package/sdk/dist/artifacts/V12Deployments.json +3 -1
- package/sdk/dist/artifacts/V12EngineGate.json +1 -2
- package/sdk/dist/artifacts/V12KitchenProxy.json +1 -0
- package/sdk/dist/chains/canonical.d.ts +15 -24
- package/sdk/dist/chains/canonical.d.ts.map +1 -1
- package/sdk/dist/chains/canonical.js +18 -29
- package/sdk/dist/chains/canonical.js.map +1 -1
- package/sdk/dist/cli/actions.d.ts +29 -0
- package/sdk/dist/cli/actions.d.ts.map +1 -0
- package/sdk/dist/cli/actions.js +122 -0
- package/sdk/dist/cli/actions.js.map +1 -0
- package/sdk/dist/cli/args.d.ts +118 -0
- package/sdk/dist/cli/args.d.ts.map +1 -0
- package/sdk/dist/cli/args.js +354 -0
- package/sdk/dist/cli/args.js.map +1 -0
- package/sdk/dist/cli/assume.d.ts +51 -0
- package/sdk/dist/cli/assume.d.ts.map +1 -0
- package/sdk/dist/cli/assume.js +207 -0
- package/sdk/dist/cli/assume.js.map +1 -0
- package/sdk/dist/cli/chain.d.ts +173 -0
- package/sdk/dist/cli/chain.d.ts.map +1 -0
- package/sdk/dist/cli/chain.js +462 -0
- package/sdk/dist/cli/chain.js.map +1 -0
- package/sdk/dist/cli/commands.d.ts +226 -0
- package/sdk/dist/cli/commands.d.ts.map +1 -0
- package/sdk/dist/cli/commands.js +637 -0
- package/sdk/dist/cli/commands.js.map +1 -0
- package/sdk/dist/cli/create.d.ts +70 -0
- package/sdk/dist/cli/create.d.ts.map +1 -0
- package/sdk/dist/cli/create.js +483 -0
- package/sdk/dist/cli/create.js.map +1 -0
- package/sdk/dist/cli/diagnostics.d.ts +12 -0
- package/sdk/dist/cli/diagnostics.d.ts.map +1 -0
- package/sdk/dist/cli/diagnostics.js +225 -0
- package/sdk/dist/cli/diagnostics.js.map +1 -0
- package/sdk/dist/cli/effects.d.ts +71 -0
- package/sdk/dist/cli/effects.d.ts.map +1 -0
- package/sdk/dist/cli/effects.js +279 -0
- package/sdk/dist/cli/effects.js.map +1 -0
- package/sdk/dist/cli/fill.d.ts +83 -0
- package/sdk/dist/cli/fill.d.ts.map +1 -0
- package/sdk/dist/cli/fill.js +734 -0
- package/sdk/dist/cli/fill.js.map +1 -0
- package/sdk/dist/cli/funding.d.ts +126 -0
- package/sdk/dist/cli/funding.d.ts.map +1 -0
- package/sdk/dist/cli/funding.js +514 -0
- package/sdk/dist/cli/funding.js.map +1 -0
- package/sdk/dist/cli/globals.d.ts +16 -0
- package/sdk/dist/cli/globals.d.ts.map +1 -0
- package/sdk/dist/cli/globals.js +219 -0
- package/sdk/dist/cli/globals.js.map +1 -0
- package/sdk/dist/cli/init.d.ts +34 -0
- package/sdk/dist/cli/init.d.ts.map +1 -0
- package/sdk/dist/cli/init.js +181 -0
- package/sdk/dist/cli/init.js.map +1 -0
- package/sdk/dist/cli/inputs.d.ts +72 -0
- package/sdk/dist/cli/inputs.d.ts.map +1 -0
- package/sdk/dist/cli/inputs.js +152 -0
- package/sdk/dist/cli/inputs.js.map +1 -0
- package/sdk/dist/cli/inspect.d.ts +48 -0
- package/sdk/dist/cli/inspect.d.ts.map +1 -0
- package/sdk/dist/cli/inspect.js +536 -0
- package/sdk/dist/cli/inspect.js.map +1 -0
- package/sdk/dist/cli/intent-commands.d.ts +71 -0
- package/sdk/dist/cli/intent-commands.d.ts.map +1 -0
- package/sdk/dist/cli/intent-commands.js +698 -0
- package/sdk/dist/cli/intent-commands.js.map +1 -0
- package/sdk/dist/cli/intent-svm.d.ts +15 -0
- package/sdk/dist/cli/intent-svm.d.ts.map +1 -0
- package/sdk/dist/cli/intent-svm.js +222 -0
- package/sdk/dist/cli/intent-svm.js.map +1 -0
- package/sdk/dist/cli/intents.d.ts +43 -0
- package/sdk/dist/cli/intents.d.ts.map +1 -0
- package/sdk/dist/cli/intents.js +89 -0
- package/sdk/dist/cli/intents.js.map +1 -0
- package/sdk/dist/cli/interactive.d.ts +11 -0
- package/sdk/dist/cli/interactive.d.ts.map +1 -0
- package/sdk/dist/cli/interactive.js +161 -0
- package/sdk/dist/cli/interactive.js.map +1 -0
- package/sdk/dist/cli/lifecycle-svm.d.ts +109 -0
- package/sdk/dist/cli/lifecycle-svm.d.ts.map +1 -0
- package/sdk/dist/cli/lifecycle-svm.js +299 -0
- package/sdk/dist/cli/lifecycle-svm.js.map +1 -0
- package/sdk/dist/cli/lifecycle.d.ts +439 -0
- package/sdk/dist/cli/lifecycle.d.ts.map +1 -0
- package/sdk/dist/cli/lifecycle.js +1721 -0
- package/sdk/dist/cli/lifecycle.js.map +1 -0
- package/sdk/dist/cli/main.d.ts +3 -0
- package/sdk/dist/cli/main.d.ts.map +1 -0
- package/sdk/dist/cli/main.js +8 -0
- package/sdk/dist/cli/main.js.map +1 -0
- package/sdk/dist/cli/mcp.d.ts +66 -0
- package/sdk/dist/cli/mcp.d.ts.map +1 -0
- package/sdk/dist/cli/mcp.js +169 -0
- package/sdk/dist/cli/mcp.js.map +1 -0
- package/sdk/dist/cli/password.d.ts +54 -0
- package/sdk/dist/cli/password.d.ts.map +1 -0
- package/sdk/dist/cli/password.js +148 -0
- package/sdk/dist/cli/password.js.map +1 -0
- package/sdk/dist/cli/policy.d.ts +130 -0
- package/sdk/dist/cli/policy.d.ts.map +1 -0
- package/sdk/dist/cli/policy.js +702 -0
- package/sdk/dist/cli/policy.js.map +1 -0
- package/sdk/dist/cli/pools.d.ts +140 -0
- package/sdk/dist/cli/pools.d.ts.map +1 -0
- package/sdk/dist/cli/pools.js +658 -0
- package/sdk/dist/cli/pools.js.map +1 -0
- package/sdk/dist/cli/price.d.ts +74 -0
- package/sdk/dist/cli/price.d.ts.map +1 -0
- package/sdk/dist/cli/price.js +321 -0
- package/sdk/dist/cli/price.js.map +1 -0
- package/sdk/dist/cli/prompt.d.ts +30 -0
- package/sdk/dist/cli/prompt.d.ts.map +1 -0
- package/sdk/dist/cli/prompt.js +53 -0
- package/sdk/dist/cli/prompt.js.map +1 -0
- package/sdk/dist/cli/publish.d.ts +48 -0
- package/sdk/dist/cli/publish.d.ts.map +1 -0
- package/sdk/dist/cli/publish.js +480 -0
- package/sdk/dist/cli/publish.js.map +1 -0
- package/sdk/dist/cli/receipt.d.ts +35 -0
- package/sdk/dist/cli/receipt.d.ts.map +1 -0
- package/sdk/dist/cli/receipt.js +63 -0
- package/sdk/dist/cli/receipt.js.map +1 -0
- package/sdk/dist/cli/rehearse.d.ts +80 -0
- package/sdk/dist/cli/rehearse.d.ts.map +1 -0
- package/sdk/dist/cli/rehearse.js +265 -0
- package/sdk/dist/cli/rehearse.js.map +1 -0
- package/sdk/dist/cli/report.d.ts +69 -0
- package/sdk/dist/cli/report.d.ts.map +1 -0
- package/sdk/dist/cli/report.js +206 -0
- package/sdk/dist/cli/report.js.map +1 -0
- package/sdk/dist/cli/returned.d.ts +16 -0
- package/sdk/dist/cli/returned.d.ts.map +1 -0
- package/sdk/dist/cli/returned.js +111 -0
- package/sdk/dist/cli/returned.js.map +1 -0
- package/sdk/dist/cli/run.d.ts +40 -0
- package/sdk/dist/cli/run.d.ts.map +1 -0
- package/sdk/dist/cli/run.js +3163 -0
- package/sdk/dist/cli/run.js.map +1 -0
- package/sdk/dist/cli/signer.d.ts +72 -0
- package/sdk/dist/cli/signer.d.ts.map +1 -0
- package/sdk/dist/cli/signer.js +243 -0
- package/sdk/dist/cli/signer.js.map +1 -0
- package/sdk/dist/cli/simulate.d.ts +11 -0
- package/sdk/dist/cli/simulate.d.ts.map +1 -0
- package/sdk/dist/cli/simulate.js +246 -0
- package/sdk/dist/cli/simulate.js.map +1 -0
- package/sdk/dist/cli/skills.d.ts +77 -0
- package/sdk/dist/cli/skills.d.ts.map +1 -0
- package/sdk/dist/cli/skills.js +527 -0
- package/sdk/dist/cli/skills.js.map +1 -0
- package/sdk/dist/cli/solana.d.ts +184 -0
- package/sdk/dist/cli/solana.d.ts.map +1 -0
- package/sdk/dist/cli/solana.js +1370 -0
- package/sdk/dist/cli/solana.js.map +1 -0
- package/sdk/dist/cli/store.d.ts +60 -0
- package/sdk/dist/cli/store.d.ts.map +1 -0
- package/sdk/dist/cli/store.js +196 -0
- package/sdk/dist/cli/store.js.map +1 -0
- package/sdk/dist/cli/support.d.ts +144 -0
- package/sdk/dist/cli/support.d.ts.map +1 -0
- package/sdk/dist/cli/support.js +217 -0
- package/sdk/dist/cli/support.js.map +1 -0
- package/sdk/dist/cli/svm-effects.d.ts +50 -0
- package/sdk/dist/cli/svm-effects.d.ts.map +1 -0
- package/sdk/dist/cli/svm-effects.js +196 -0
- package/sdk/dist/cli/svm-effects.js.map +1 -0
- package/sdk/dist/cli/terminal.d.ts +42 -0
- package/sdk/dist/cli/terminal.d.ts.map +1 -0
- package/sdk/dist/cli/terminal.js +136 -0
- package/sdk/dist/cli/terminal.js.map +1 -0
- package/sdk/dist/cli/verify.d.ts +32 -0
- package/sdk/dist/cli/verify.d.ts.map +1 -0
- package/sdk/dist/cli/verify.js +185 -0
- package/sdk/dist/cli/verify.js.map +1 -0
- package/sdk/dist/cli/wallet-commands.d.ts +59 -0
- package/sdk/dist/cli/wallet-commands.d.ts.map +1 -0
- package/sdk/dist/cli/wallet-commands.js +222 -0
- package/sdk/dist/cli/wallet-commands.js.map +1 -0
- package/sdk/dist/cli/wallet-send.d.ts +38 -0
- package/sdk/dist/cli/wallet-send.d.ts.map +1 -0
- package/sdk/dist/cli/wallet-send.js +303 -0
- package/sdk/dist/cli/wallet-send.js.map +1 -0
- package/sdk/dist/cli/wallets.d.ts +79 -0
- package/sdk/dist/cli/wallets.d.ts.map +1 -0
- package/sdk/dist/cli/wallets.js +297 -0
- package/sdk/dist/cli/wallets.js.map +1 -0
- package/sdk/dist/deployments/index.d.ts +4 -62
- package/sdk/dist/deployments/index.d.ts.map +1 -1
- package/sdk/dist/deployments/index.js +4 -84
- package/sdk/dist/deployments/index.js.map +1 -1
- package/sdk/dist/deployments/pot.d.ts +17 -7
- package/sdk/dist/deployments/pot.d.ts.map +1 -1
- package/sdk/dist/deployments/pot.js +25 -10
- package/sdk/dist/deployments/pot.js.map +1 -1
- package/sdk/dist/deployments/releases.d.ts +36 -0
- package/sdk/dist/deployments/releases.d.ts.map +1 -0
- package/sdk/dist/deployments/releases.js +61 -0
- package/sdk/dist/deployments/releases.js.map +1 -0
- package/sdk/dist/deployments/releases.json +76 -0
- package/sdk/dist/deployments/v12-addresses.d.ts +13 -0
- package/sdk/dist/deployments/v12-addresses.d.ts.map +1 -1
- package/sdk/dist/deployments/v12-addresses.js +16 -3
- package/sdk/dist/deployments/v12-addresses.js.map +1 -1
- package/sdk/dist/deposit/index.d.ts +6 -6
- package/sdk/dist/deposit/index.d.ts.map +1 -1
- package/sdk/dist/deposit/index.js +1 -1
- package/sdk/dist/deposit/index.js.map +1 -1
- package/sdk/dist/deposit/params.d.ts +4 -4
- package/sdk/dist/deposit/params.d.ts.map +1 -1
- package/sdk/dist/deposit/params.js +7 -4
- package/sdk/dist/deposit/params.js.map +1 -1
- package/sdk/dist/deposit/source.d.ts +3 -30
- package/sdk/dist/deposit/source.d.ts.map +1 -1
- package/sdk/dist/deposit/source.js +7 -83
- package/sdk/dist/deposit/source.js.map +1 -1
- package/sdk/dist/deposit/templates.d.ts +1 -2
- package/sdk/dist/deposit/templates.d.ts.map +1 -1
- package/sdk/dist/deposit/templates.js +10 -2
- package/sdk/dist/deposit/templates.js.map +1 -1
- package/sdk/dist/deposit/types.d.ts +14 -12
- package/sdk/dist/deposit/types.d.ts.map +1 -1
- package/sdk/dist/deposit/types.js +6 -0
- package/sdk/dist/deposit/types.js.map +1 -1
- package/sdk/dist/descriptors/accessors.d.ts +38 -35
- package/sdk/dist/descriptors/accessors.d.ts.map +1 -1
- package/sdk/dist/descriptors/accessors.js +16 -0
- package/sdk/dist/descriptors/accessors.js.map +1 -1
- package/sdk/dist/descriptors/call.d.ts +66 -14
- package/sdk/dist/descriptors/call.d.ts.map +1 -1
- package/sdk/dist/descriptors/call.js +94 -13
- package/sdk/dist/descriptors/call.js.map +1 -1
- package/sdk/dist/descriptors/contracts.generated.d.ts +3393 -0
- package/sdk/dist/descriptors/contracts.generated.d.ts.map +1 -0
- package/sdk/dist/descriptors/contracts.generated.js +728 -0
- package/sdk/dist/descriptors/contracts.generated.js.map +1 -0
- package/sdk/dist/descriptors/derive.d.ts +20 -11
- package/sdk/dist/descriptors/derive.d.ts.map +1 -1
- package/sdk/dist/descriptors/derive.js +68 -30
- package/sdk/dist/descriptors/derive.js.map +1 -1
- package/sdk/dist/descriptors/index.d.ts +6 -7
- package/sdk/dist/descriptors/index.d.ts.map +1 -1
- package/sdk/dist/descriptors/index.js +2 -2
- package/sdk/dist/descriptors/index.js.map +1 -1
- package/sdk/dist/descriptors/links.d.ts +23 -214
- package/sdk/dist/descriptors/links.d.ts.map +1 -1
- package/sdk/dist/descriptors/links.js +1 -232
- package/sdk/dist/descriptors/links.js.map +1 -1
- package/sdk/dist/descriptors/query.d.ts +1 -1
- package/sdk/dist/descriptors/query.d.ts.map +1 -1
- package/sdk/dist/descriptors/query.js +1 -1
- package/sdk/dist/descriptors/query.js.map +1 -1
- package/sdk/dist/descriptors/registry.d.ts +2 -5
- package/sdk/dist/descriptors/registry.d.ts.map +1 -1
- package/sdk/dist/descriptors/registry.js +11 -66
- package/sdk/dist/descriptors/registry.js.map +1 -1
- package/sdk/dist/embedded/resolve.d.ts +4 -4
- package/sdk/dist/embedded/resolve.d.ts.map +1 -1
- package/sdk/dist/embedded/resolve.js +12 -8
- package/sdk/dist/embedded/resolve.js.map +1 -1
- package/sdk/dist/embedded/skills.generated.d.ts +1 -1
- package/sdk/dist/embedded/skills.generated.d.ts.map +1 -1
- package/sdk/dist/embedded/skills.generated.js +137 -136
- package/sdk/dist/embedded/skills.generated.js.map +1 -1
- package/sdk/dist/embedded/sources.generated.d.ts.map +1 -1
- package/sdk/dist/embedded/sources.generated.js +40 -6
- package/sdk/dist/embedded/sources.generated.js.map +1 -1
- package/sdk/dist/evm/engine.d.ts +813 -10
- package/sdk/dist/evm/engine.d.ts.map +1 -1
- package/sdk/dist/evm/engine.js +127 -8
- package/sdk/dist/evm/engine.js.map +1 -1
- package/sdk/dist/index.d.ts +3 -2
- package/sdk/dist/index.d.ts.map +1 -1
- package/sdk/dist/index.js +6 -2
- package/sdk/dist/index.js.map +1 -1
- package/sdk/dist/price.d.ts +40 -0
- package/sdk/dist/price.d.ts.map +1 -0
- package/sdk/dist/price.js +101 -0
- package/sdk/dist/price.js.map +1 -0
- package/sdk/dist/protocols/aerodrome/abis.d.ts +76 -0
- package/sdk/dist/protocols/aerodrome/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/aerodrome/abis.js +61 -0
- package/sdk/dist/protocols/aerodrome/abis.js.map +1 -1
- package/sdk/dist/protocols/aerodrome-slipstream/abis.d.ts +70 -0
- package/sdk/dist/protocols/aerodrome-slipstream/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/aerodrome-slipstream/abis.js +54 -0
- package/sdk/dist/protocols/aerodrome-slipstream/abis.js.map +1 -1
- package/sdk/dist/protocols/camelot/abis.d.ts +178 -0
- package/sdk/dist/protocols/camelot/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/camelot/abis.js +139 -0
- package/sdk/dist/protocols/camelot/abis.js.map +1 -1
- package/sdk/dist/protocols/eco-routes/abis.d.ts +792 -50
- package/sdk/dist/protocols/eco-routes/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/eco-routes/abis.js +1058 -49
- package/sdk/dist/protocols/eco-routes/abis.js.map +1 -1
- package/sdk/dist/protocols/eco-routes/addresses.generated.d.ts +44 -61
- package/sdk/dist/protocols/eco-routes/addresses.generated.d.ts.map +1 -1
- package/sdk/dist/protocols/eco-routes/addresses.generated.js +45 -62
- package/sdk/dist/protocols/eco-routes/addresses.generated.js.map +1 -1
- package/sdk/dist/protocols/eco-routes/lookup.d.ts +10 -0
- package/sdk/dist/protocols/eco-routes/lookup.d.ts.map +1 -1
- package/sdk/dist/protocols/eco-routes/lookup.js +16 -0
- package/sdk/dist/protocols/eco-routes/lookup.js.map +1 -1
- package/sdk/dist/protocols/maverick/abis.d.ts +77 -0
- package/sdk/dist/protocols/maverick/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/maverick/abis.js +58 -0
- package/sdk/dist/protocols/maverick/abis.js.map +1 -1
- package/sdk/dist/protocols/maverick/addresses.d.ts.map +1 -1
- package/sdk/dist/protocols/maverick/addresses.js +4 -0
- package/sdk/dist/protocols/maverick/addresses.js.map +1 -1
- package/sdk/dist/protocols/pancakeswap-v2/abis.d.ts +52 -0
- package/sdk/dist/protocols/pancakeswap-v2/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/pancakeswap-v2/abis.js +43 -0
- package/sdk/dist/protocols/pancakeswap-v2/abis.js.map +1 -1
- package/sdk/dist/protocols/pancakeswap-v3/abis.d.ts +73 -0
- package/sdk/dist/protocols/pancakeswap-v3/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/pancakeswap-v3/abis.js +56 -0
- package/sdk/dist/protocols/pancakeswap-v3/abis.js.map +1 -1
- package/sdk/dist/protocols/permit2/abis.d.ts +113 -0
- package/sdk/dist/protocols/permit2/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/permit2/abis.js +63 -0
- package/sdk/dist/protocols/permit2/abis.js.map +1 -1
- package/sdk/dist/protocols/quickswap/abis.d.ts +148 -0
- package/sdk/dist/protocols/quickswap/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/quickswap/abis.js +119 -0
- package/sdk/dist/protocols/quickswap/abis.js.map +1 -1
- package/sdk/dist/protocols/sushiswap-v2/abis.d.ts +52 -0
- package/sdk/dist/protocols/sushiswap-v2/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/sushiswap-v2/abis.js +42 -0
- package/sdk/dist/protocols/sushiswap-v2/abis.js.map +1 -1
- package/sdk/dist/protocols/synthra-v3/abis.d.ts +73 -0
- package/sdk/dist/protocols/synthra-v3/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/synthra-v3/abis.js +55 -0
- package/sdk/dist/protocols/synthra-v3/abis.js.map +1 -1
- package/sdk/dist/protocols/trader-joe/abis.d.ts +133 -0
- package/sdk/dist/protocols/trader-joe/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/trader-joe/abis.js +101 -0
- package/sdk/dist/protocols/trader-joe/abis.js.map +1 -1
- package/sdk/dist/protocols/trader-joe/addresses.d.ts.map +1 -1
- package/sdk/dist/protocols/trader-joe/addresses.js +5 -0
- package/sdk/dist/protocols/trader-joe/addresses.js.map +1 -1
- package/sdk/dist/protocols/uniswap-v2/abis.d.ts +52 -0
- package/sdk/dist/protocols/uniswap-v2/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/uniswap-v2/abis.js +44 -0
- package/sdk/dist/protocols/uniswap-v2/abis.js.map +1 -1
- package/sdk/dist/protocols/uniswap-v3/abis.d.ts +73 -0
- package/sdk/dist/protocols/uniswap-v3/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/uniswap-v3/abis.js +55 -0
- package/sdk/dist/protocols/uniswap-v3/abis.js.map +1 -1
- package/sdk/dist/protocols/uniswap-v4/abis.d.ts +247 -0
- package/sdk/dist/protocols/uniswap-v4/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/uniswap-v4/abis.js +167 -0
- package/sdk/dist/protocols/uniswap-v4/abis.js.map +1 -1
- package/sdk/dist/protocols/uniswap-v4/addresses.d.ts.map +1 -1
- package/sdk/dist/protocols/uniswap-v4/addresses.js +50 -0
- package/sdk/dist/protocols/uniswap-v4/addresses.js.map +1 -1
- package/sdk/dist/protocols/unitflow-v3/abis.d.ts +73 -0
- package/sdk/dist/protocols/unitflow-v3/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/unitflow-v3/abis.js +56 -0
- package/sdk/dist/protocols/unitflow-v3/abis.js.map +1 -1
- package/sdk/dist/protocols/velodrome/abis.d.ts +76 -0
- package/sdk/dist/protocols/velodrome/abis.d.ts.map +1 -1
- package/sdk/dist/protocols/velodrome/abis.js +61 -0
- package/sdk/dist/protocols/velodrome/abis.js.map +1 -1
- package/sdk/dist/recipes/cctp-split.sauce.ts +2 -2
- package/sdk/dist/recipes/plain-transfer.sauce.ts +2 -2
- package/sdk/dist/routes/accessor-index.d.ts +2 -2
- package/sdk/dist/routes/accessor-index.d.ts.map +1 -1
- package/sdk/dist/routes/accessor-index.js +4 -3
- package/sdk/dist/routes/accessor-index.js.map +1 -1
- package/sdk/dist/routes/ambient.d.ts +5 -0
- package/sdk/dist/routes/ambient.d.ts.map +1 -1
- package/sdk/dist/routes/ambient.js +20 -0
- package/sdk/dist/routes/ambient.js.map +1 -1
- package/sdk/dist/routes/ast-walk.d.ts +17 -3
- package/sdk/dist/routes/ast-walk.d.ts.map +1 -1
- package/sdk/dist/routes/ast-walk.js +24 -2
- package/sdk/dist/routes/ast-walk.js.map +1 -1
- package/sdk/dist/routes/available.d.ts +43 -0
- package/sdk/dist/routes/available.d.ts.map +1 -0
- package/sdk/dist/routes/available.js +230 -0
- package/sdk/dist/routes/available.js.map +1 -0
- package/sdk/dist/routes/builtins.generated.d.ts +180 -0
- package/sdk/dist/routes/builtins.generated.d.ts.map +1 -0
- package/sdk/dist/routes/builtins.generated.js +2 -0
- package/sdk/dist/routes/builtins.generated.js.map +1 -0
- package/sdk/dist/routes/chain-exports.generated.d.ts +13 -8
- package/sdk/dist/routes/chain-exports.generated.d.ts.map +1 -1
- package/sdk/dist/routes/chain-exports.generated.js.map +1 -1
- package/sdk/dist/routes/closure.d.ts.map +1 -1
- package/sdk/dist/routes/closure.js +13 -26
- package/sdk/dist/routes/closure.js.map +1 -1
- package/sdk/dist/routes/composed.d.ts.map +1 -1
- package/sdk/dist/routes/composed.js +20 -8
- package/sdk/dist/routes/composed.js.map +1 -1
- package/sdk/dist/routes/encode.d.ts +17 -0
- package/sdk/dist/routes/encode.d.ts.map +1 -1
- package/sdk/dist/routes/encode.js +14 -11
- package/sdk/dist/routes/encode.js.map +1 -1
- package/sdk/dist/routes/entry.d.ts +76 -0
- package/sdk/dist/routes/entry.d.ts.map +1 -0
- package/sdk/dist/routes/entry.js +478 -0
- package/sdk/dist/routes/entry.js.map +1 -0
- package/sdk/dist/routes/index.d.ts +19 -12
- package/sdk/dist/routes/index.d.ts.map +1 -1
- package/sdk/dist/routes/index.js +11 -8
- package/sdk/dist/routes/index.js.map +1 -1
- package/sdk/dist/routes/intent-body.d.ts +97 -0
- package/sdk/dist/routes/intent-body.d.ts.map +1 -0
- package/sdk/dist/routes/intent-body.js +441 -0
- package/sdk/dist/routes/intent-body.js.map +1 -0
- package/sdk/dist/routes/intent-dsl.d.ts +21 -6
- package/sdk/dist/routes/intent-dsl.d.ts.map +1 -1
- package/sdk/dist/routes/intent-dsl.js +34 -17
- package/sdk/dist/routes/intent-dsl.js.map +1 -1
- package/sdk/dist/routes/intent-sugar.d.ts +77 -4
- package/sdk/dist/routes/intent-sugar.d.ts.map +1 -1
- package/sdk/dist/routes/intent-sugar.js +318 -129
- package/sdk/dist/routes/intent-sugar.js.map +1 -1
- package/sdk/dist/routes/intent.d.ts +13 -1
- package/sdk/dist/routes/intent.d.ts.map +1 -1
- package/sdk/dist/routes/intent.js +37 -1
- package/sdk/dist/routes/intent.js.map +1 -1
- package/sdk/dist/routes/nest.d.ts +3 -2
- package/sdk/dist/routes/nest.d.ts.map +1 -1
- package/sdk/dist/routes/nest.js +5 -3
- package/sdk/dist/routes/nest.js.map +1 -1
- package/sdk/dist/routes/parse.d.ts +6 -0
- package/sdk/dist/routes/parse.d.ts.map +1 -0
- package/sdk/dist/routes/parse.js +39 -0
- package/sdk/dist/routes/parse.js.map +1 -0
- package/sdk/dist/routes/portal.d.ts +258 -4
- package/sdk/dist/routes/portal.d.ts.map +1 -1
- package/sdk/dist/routes/portal.js +588 -9
- package/sdk/dist/routes/portal.js.map +1 -1
- package/sdk/dist/routes/protocol-rewrite.d.ts +71 -1
- package/sdk/dist/routes/protocol-rewrite.d.ts.map +1 -1
- package/sdk/dist/routes/protocol-rewrite.js +178 -54
- package/sdk/dist/routes/protocol-rewrite.js.map +1 -1
- package/sdk/dist/routes/rs-compile.d.ts +25 -22
- package/sdk/dist/routes/rs-compile.d.ts.map +1 -1
- package/sdk/dist/routes/rs-compile.js +55 -49
- package/sdk/dist/routes/rs-compile.js.map +1 -1
- package/sdk/dist/routes/sauce-calls.d.ts +26 -12
- package/sdk/dist/routes/sauce-calls.d.ts.map +1 -1
- package/sdk/dist/routes/sauce-calls.js +16 -23
- package/sdk/dist/routes/sauce-calls.js.map +1 -1
- package/sdk/dist/routes/sauce-route.d.ts +74 -7
- package/sdk/dist/routes/sauce-route.d.ts.map +1 -1
- package/sdk/dist/routes/sauce-route.js +225 -75
- package/sdk/dist/routes/sauce-route.js.map +1 -1
- package/sdk/dist/routes/source-globals.d.ts +107 -0
- package/sdk/dist/routes/source-globals.d.ts.map +1 -0
- package/sdk/dist/routes/source-globals.generated.d.ts +5601 -933
- package/sdk/dist/routes/source-globals.generated.d.ts.map +1 -1
- package/sdk/dist/routes/source-globals.generated.js +3 -4
- package/sdk/dist/routes/source-globals.generated.js.map +1 -1
- package/sdk/dist/routes/source-globals.js +175 -0
- package/sdk/dist/routes/source-globals.js.map +1 -0
- package/sdk/dist/routes/stock-tokens.d.ts +89 -0
- package/sdk/dist/routes/stock-tokens.d.ts.map +1 -0
- package/sdk/dist/routes/stock-tokens.generated.d.ts +7 -0
- package/sdk/dist/routes/stock-tokens.generated.d.ts.map +1 -0
- package/sdk/dist/routes/stock-tokens.generated.js +3664 -0
- package/sdk/dist/routes/stock-tokens.generated.js.map +1 -0
- package/sdk/dist/routes/stock-tokens.js +89 -0
- package/sdk/dist/routes/stock-tokens.js.map +1 -0
- package/sdk/dist/routes/token-registry.d.ts +68 -8
- package/sdk/dist/routes/token-registry.d.ts.map +1 -1
- package/sdk/dist/routes/token-registry.js +218 -32
- package/sdk/dist/routes/token-registry.js.map +1 -1
- package/sdk/dist/routes/token-rewrite.d.ts +1 -1
- package/sdk/dist/routes/token-rewrite.d.ts.map +1 -1
- package/sdk/dist/routes/token-rewrite.js +5 -9
- package/sdk/dist/routes/token-rewrite.js.map +1 -1
- package/sdk/dist/routes/unknown-global.d.ts +32 -0
- package/sdk/dist/routes/unknown-global.d.ts.map +1 -0
- package/sdk/dist/routes/unknown-global.js +106 -0
- package/sdk/dist/routes/unknown-global.js.map +1 -0
- package/sdk/dist/routes/vault.d.ts +38 -8
- package/sdk/dist/routes/vault.d.ts.map +1 -1
- package/sdk/dist/routes/vault.js +47 -8
- package/sdk/dist/routes/vault.js.map +1 -1
- package/sdk/dist/sauce-script/builtins.d.ts +309 -0
- package/sdk/dist/sauce-script/declarations.d.ts +3 -0
- package/sdk/dist/sauce-script/declarations.d.ts.map +1 -0
- package/sdk/dist/sauce-script/declarations.js +229 -0
- package/sdk/dist/sauce-script/declarations.js.map +1 -0
- package/sdk/dist/sauce-script/index.d.ts +2714 -0
- package/sdk/dist/sauce-script/ts-plugin.cjs +85 -0
- package/sdk/dist/skills/loader.d.ts.map +1 -1
- package/sdk/dist/skills/loader.js +4 -3
- package/sdk/dist/skills/loader.js.map +1 -1
- package/sdk/dist/std/router/balancer-v2-vault.abi.json +78 -0
- package/sdk/dist/std/router/curve-cryptoswap.abi.json +29 -0
- package/sdk/dist/std/router/curve-stableswap.abi.json +29 -0
- package/sdk/dist/std/router/dodo-v2-pool.abi.json +39 -0
- package/sdk/dist/std/router/lb-pair.abi.json +55 -0
- package/sdk/dist/std/router/package.json +7 -0
- package/sdk/dist/std/router/router.evm.js +567 -0
- package/sdk/dist/std/router/sauce-router.abi.json +202 -0
- package/sdk/dist/std/router/uniswap-v2-pair.abi.json +49 -0
- package/sdk/dist/std/router/woo-pp-v2.abi.json +42 -0
- package/sdk/dist/std/token/permit2.abi.json +226 -0
- package/sdk/dist/std/token/token.evm.js +73 -0
- package/sdk/dist/std/token/token.svm.js +194 -41
- package/sdk/dist/svm/client.d.ts +62 -15
- package/sdk/dist/svm/client.d.ts.map +1 -1
- package/sdk/dist/svm/client.js +103 -42
- package/sdk/dist/svm/client.js.map +1 -1
- package/sdk/dist/svm/engine.d.ts +66 -5
- package/sdk/dist/svm/engine.d.ts.map +1 -1
- package/sdk/dist/svm/engine.js +73 -5
- package/sdk/dist/svm/engine.js.map +1 -1
- package/sdk/dist/svm/index.d.ts +2 -0
- package/sdk/dist/svm/index.d.ts.map +1 -1
- package/sdk/dist/svm/index.js +2 -0
- package/sdk/dist/svm/index.js.map +1 -1
- package/sdk/dist/svm/instructions.d.ts +72 -1
- package/sdk/dist/svm/instructions.d.ts.map +1 -1
- package/sdk/dist/svm/instructions.js +81 -2
- package/sdk/dist/svm/instructions.js.map +1 -1
- package/sdk/dist/svm/kitchen.d.ts +20 -1
- package/sdk/dist/svm/kitchen.d.ts.map +1 -1
- package/sdk/dist/svm/kitchen.js +47 -1
- package/sdk/dist/svm/kitchen.js.map +1 -1
- package/sdk/dist/svm/portal.d.ts +250 -0
- package/sdk/dist/svm/portal.d.ts.map +1 -0
- package/sdk/dist/svm/portal.js +462 -0
- package/sdk/dist/svm/portal.js.map +1 -0
- package/sdk/dist/svm/send.d.ts +18 -2
- package/sdk/dist/svm/send.d.ts.map +1 -1
- package/sdk/dist/svm/send.js +28 -3
- package/sdk/dist/svm/send.js.map +1 -1
- package/sdk/dist/svm/token-accounts.d.ts +49 -0
- package/sdk/dist/svm/token-accounts.d.ts.map +1 -0
- package/sdk/dist/svm/token-accounts.js +58 -0
- package/sdk/dist/svm/token-accounts.js.map +1 -0
- package/sdk/dist/svm/token-extensions.d.ts +18 -7
- package/sdk/dist/svm/token-extensions.d.ts.map +1 -1
- package/sdk/dist/svm/token-extensions.js +58 -5
- package/sdk/dist/svm/token-extensions.js.map +1 -1
- package/sdk/dist/token/evm.js +1 -1
- package/sdk/dist/token/index.d.ts +1 -1
- package/sdk/dist/token/index.js +1 -1
- package/sdk/dist/token/params.js +1 -1
- package/sdk/dist/token/source.js +3 -3
- package/sdk/dist/token/source.js.map +1 -1
- package/sdk/dist/token/types.d.ts +2 -2
- package/sdk/dist/token/types.js +2 -2
- package/sdk/src/protocols/aerodrome/AerodromePoolABI.json +105 -0
- package/sdk/src/protocols/aerodrome/abis.ts +62 -0
- package/sdk/src/protocols/aerodrome-slipstream/AerodromeSlipstreamPoolABI.json +96 -0
- package/sdk/src/protocols/aerodrome-slipstream/abis.ts +55 -0
- package/sdk/src/protocols/camelot/CamelotV2FactoryABI.json +25 -0
- package/sdk/src/protocols/camelot/CamelotV2PairABI.json +109 -0
- package/sdk/src/protocols/camelot/CamelotV3FactoryABI.json +25 -0
- package/sdk/src/protocols/camelot/CamelotV3PoolABI.json +92 -0
- package/sdk/src/protocols/camelot/abis.ts +143 -0
- package/sdk/src/protocols/eco-routes/PortalABI.json +1448 -0
- package/sdk/src/protocols/eco-routes/ProverABI.json +162 -0
- package/sdk/src/protocols/eco-routes/abis.ts +1060 -51
- package/sdk/src/protocols/eco-routes/addresses.generated.ts +45 -62
- package/sdk/src/protocols/eco-routes/lookup.ts +18 -0
- package/sdk/src/protocols/maverick/MaverickV2PoolABI.json +107 -0
- package/sdk/src/protocols/maverick/abis.ts +59 -0
- package/sdk/src/protocols/maverick/addresses.ts +4 -0
- package/sdk/src/protocols/pancakeswap-v2/PancakeSwapV2PairABI.json +72 -0
- package/sdk/src/protocols/pancakeswap-v2/abis.ts +44 -0
- package/sdk/src/protocols/pancakeswap-v3/PancakeSwapV3PoolABI.json +100 -0
- package/sdk/src/protocols/pancakeswap-v3/abis.ts +57 -0
- package/sdk/src/protocols/permit2/Permit2ABI.json +154 -0
- package/sdk/src/protocols/permit2/abis.ts +63 -0
- package/sdk/src/protocols/quickswap/QuickSwapV2FactoryABI.json +25 -0
- package/sdk/src/protocols/quickswap/QuickSwapV2PairABI.json +72 -0
- package/sdk/src/protocols/quickswap/QuickSwapV3FactoryABI.json +25 -0
- package/sdk/src/protocols/quickswap/QuickSwapV3PoolABI.json +88 -0
- package/sdk/src/protocols/quickswap/abis.ts +123 -0
- package/sdk/src/protocols/sushiswap-v2/SushiSwapV2PairABI.json +72 -0
- package/sdk/src/protocols/sushiswap-v2/abis.ts +43 -0
- package/sdk/src/protocols/synthra-v3/SynthraV3PoolABI.json +100 -0
- package/sdk/src/protocols/synthra-v3/abis.ts +56 -0
- package/sdk/src/protocols/trader-joe/LBPairABI.json +185 -0
- package/sdk/src/protocols/trader-joe/abis.ts +102 -0
- package/sdk/src/protocols/trader-joe/addresses.ts +5 -0
- package/sdk/src/protocols/uniswap-v2/UniswapV2PairABI.json +72 -0
- package/sdk/src/protocols/uniswap-v2/abis.ts +45 -0
- package/sdk/src/protocols/uniswap-v3/UniswapV3PoolABI.json +100 -0
- package/sdk/src/protocols/uniswap-v3/abis.ts +56 -0
- package/sdk/src/protocols/uniswap-v4/UniswapV4PoolManagerABI.json +38 -0
- package/sdk/src/protocols/uniswap-v4/UniswapV4StateViewABI.json +307 -0
- package/sdk/src/protocols/uniswap-v4/abis.ts +168 -0
- package/sdk/src/protocols/uniswap-v4/addresses.ts +50 -0
- package/sdk/src/protocols/unitflow-v3/UnitFlowV3PoolABI.json +100 -0
- package/sdk/src/protocols/unitflow-v3/abis.ts +57 -0
- package/sdk/src/protocols/velodrome/VelodromePoolABI.json +105 -0
- package/sdk/src/protocols/velodrome/abis.ts +62 -0
- package/skills/sauce-actions/SKILL.md +166 -0
- package/skills/sauce-actions/examples/swap-and-supply.json +24 -0
- package/skills/sauce-actions/examples/swap-by-key.json +15 -0
- package/skills/sauce-actions/references/actions.md +731 -0
- package/skills/sauce-chains/SKILL.md +137 -0
- package/skills/sauce-chains/examples/chains.sauce.ts +25 -0
- package/skills/sauce-chains/references/arbitrum.md +158 -0
- package/skills/sauce-chains/references/arc.md +107 -0
- package/skills/sauce-chains/references/aurora.md +33 -0
- package/skills/sauce-chains/references/avalanche.md +106 -0
- package/skills/sauce-chains/references/base-stocks.md +77 -0
- package/skills/sauce-chains/references/base.md +141 -0
- package/skills/sauce-chains/references/berachain.md +33 -0
- package/skills/sauce-chains/references/blast.md +60 -0
- package/skills/sauce-chains/references/boba.md +33 -0
- package/skills/sauce-chains/references/bsc.md +97 -0
- package/skills/sauce-chains/references/celo.md +57 -0
- package/skills/sauce-chains/references/core.md +33 -0
- package/skills/sauce-chains/references/cronos.md +33 -0
- package/skills/sauce-chains/references/ethereum-stocks.md +1741 -0
- package/skills/sauce-chains/references/ethereum.md +255 -0
- package/skills/sauce-chains/references/evmos.md +33 -0
- package/skills/sauce-chains/references/fantom.md +61 -0
- package/skills/sauce-chains/references/fuse.md +33 -0
- package/skills/sauce-chains/references/gnosis.md +57 -0
- package/skills/sauce-chains/references/index.md +58 -0
- package/skills/sauce-chains/references/ink.md +55 -0
- package/skills/sauce-chains/references/kava.md +33 -0
- package/skills/sauce-chains/references/klaytn.md +33 -0
- package/skills/sauce-chains/references/linea.md +65 -0
- package/skills/sauce-chains/references/manta.md +33 -0
- package/skills/sauce-chains/references/mantle.md +33 -0
- package/skills/sauce-chains/references/metis.md +54 -0
- package/skills/sauce-chains/references/mode.md +55 -0
- package/skills/sauce-chains/references/monad.md +79 -0
- package/skills/sauce-chains/references/moonbeam.md +33 -0
- package/skills/sauce-chains/references/opbnb.md +55 -0
- package/skills/sauce-chains/references/optimism.md +123 -0
- package/skills/sauce-chains/references/plasma.md +35 -0
- package/skills/sauce-chains/references/polygon.md +123 -0
- package/skills/sauce-chains/references/pulsechain.md +33 -0
- package/skills/sauce-chains/references/ronin.md +35 -0
- package/skills/sauce-chains/references/scroll.md +62 -0
- package/skills/sauce-chains/references/sei.md +55 -0
- package/skills/sauce-chains/references/solana-stocks.md +1812 -0
- package/skills/sauce-chains/references/solana.md +56 -0
- package/skills/sauce-chains/references/sonic.md +57 -0
- package/skills/sauce-chains/references/unichain.md +61 -0
- package/skills/sauce-chains/references/zetachain.md +33 -0
- package/skills/sauce-chains/references/zksync.md +59 -0
- package/skills/sauce-chains/references/zora.md +57 -0
- package/skills/sauce-cli/SKILL.md +366 -0
- package/skills/sauce-cli/examples/pay.sauce.ts +23 -0
- package/skills/sauce-cli/examples/split.sauce.ts +30 -0
- package/skills/sauce-distributed-swap/SKILL.md +392 -0
- package/skills/sauce-distributed-swap/examples/distributed-swap.mts +251 -0
- package/skills/sauce-distributed-swap/examples/distributed-swap.sauce.ts +115 -0
- package/skills/sauce-examples/SKILL.md +96 -0
- package/skills/sauce-globals/SKILL.md +213 -0
- package/skills/sauce-globals/examples/globals.mts +111 -0
- package/skills/sauce-globals/examples/globals.sauce.ts +47 -0
- package/skills/sauce-globals/references/chains.md +53 -0
- package/skills/sauce-globals/references/protocols.md +405 -0
- package/skills/sauce-globals/references/stocks.md +3635 -0
- package/skills/sauce-globals/references/tokens.md +53 -0
- package/skills/sauce-intents/SKILL.md +505 -0
- package/skills/sauce-intents/examples/cross-chain.sauce.ts +37 -0
- package/skills/sauce-intents/examples/fund-by-transfer.sauce.ts +54 -0
- package/skills/sauce-intents/examples/intents.mts +343 -0
- package/skills/sauce-intents/examples/swap-on-base.sauce.ts +135 -0
- package/skills/sauce-intents/references/portal.md +77 -0
- package/skills/sauce-overview/SKILL.md +161 -0
- package/skills/sauce-protocols/SKILL.md +118 -0
- package/skills/sauce-protocols/examples/protocols.mts +77 -0
- package/skills/sauce-protocols/examples/protocols.sauce.ts +27 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/aave-v2.md +35 -17
- package/skills/sauce-protocols/references/aave-v3.md +144 -0
- package/skills/sauce-protocols/references/aave-v4.md +50 -0
- package/skills/sauce-protocols/references/abracadabra.md +72 -0
- package/skills/sauce-protocols/references/across.md +73 -0
- package/skills/sauce-protocols/references/aerodrome-slipstream.md +50 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/aerodrome.md +43 -24
- package/skills/sauce-protocols/references/aevo.md +49 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/alchemix.md +10 -25
- package/{sdk/src/skills → skills/sauce-protocols/references}/ambient.md +14 -21
- package/{sdk/src/skills → skills/sauce-protocols/references}/arbitrum-bridge.md +11 -14
- package/{sdk/src/skills → skills/sauce-protocols/references}/arrakis.md +10 -26
- package/skills/sauce-protocols/references/axelar.md +56 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/balancer-v2.md +13 -29
- package/{sdk/src/skills → skills/sauce-protocols/references}/base-bridge.md +11 -16
- package/{sdk/src/skills → skills/sauce-protocols/references}/baseswap.md +12 -19
- package/{sdk/src/skills → skills/sauce-protocols/references}/beefy.md +10 -30
- package/{sdk/src/skills → skills/sauce-protocols/references}/benqi.md +11 -21
- package/{sdk/src/skills → skills/sauce-protocols/references}/camelot.md +13 -27
- package/{sdk/src/skills → skills/sauce-protocols/references}/cbeth.md +10 -22
- package/skills/sauce-protocols/references/cctp.md +47 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/celer.md +11 -18
- package/{sdk/src/skills → skills/sauce-protocols/references}/chainlink-ccip.md +11 -21
- package/skills/sauce-protocols/references/chainlink.md +47 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/circle-gateway.md +12 -38
- package/{sdk/src/skills → skills/sauce-protocols/references}/compound-v2.md +11 -25
- package/{sdk/src/skills → skills/sauce-protocols/references}/compound-v3.md +43 -27
- package/{sdk/src/skills → skills/sauce-protocols/references}/connext.md +11 -15
- package/{sdk/src/skills → skills/sauce-protocols/references}/convex.md +10 -28
- package/{sdk/src/skills → skills/sauce-protocols/references}/cowswap.md +12 -19
- package/{sdk/src/skills → skills/sauce-protocols/references}/crvusd.md +10 -19
- package/skills/sauce-protocols/references/curve.md +98 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/debridge.md +11 -33
- package/{sdk/src/skills → skills/sauce-protocols/references}/dodo.md +13 -18
- package/skills/sauce-protocols/references/eigenlayer.md +48 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/ens.md +10 -26
- package/{sdk/src/skills → skills/sauce-protocols/references}/erc20.md +10 -24
- package/{sdk/src/skills → skills/sauce-protocols/references}/erc3156.md +10 -13
- package/{sdk/src/skills → skills/sauce-protocols/references}/erc4626.md +11 -27
- package/{sdk/src/skills → skills/sauce-protocols/references}/ethena.md +10 -27
- package/{sdk/src/skills → skills/sauce-protocols/references}/etherfi.md +10 -32
- package/{sdk/src/skills → skills/sauce-protocols/references}/euler-v2.md +11 -21
- package/{sdk/src/skills → skills/sauce-protocols/references}/fenix.md +12 -18
- package/{sdk/src/skills → skills/sauce-protocols/references}/fluid.md +11 -20
- package/{sdk/src/skills → skills/sauce-protocols/references}/frax-ether.md +10 -26
- package/{sdk/src/skills → skills/sauce-protocols/references}/frax.md +10 -19
- package/{sdk/src/skills → skills/sauce-protocols/references}/gains-network.md +11 -28
- package/skills/sauce-protocols/references/gamma.md +57 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/gelato.md +12 -20
- package/{sdk/src/skills → skills/sauce-protocols/references}/gho.md +10 -19
- package/{sdk/src/skills → skills/sauce-protocols/references}/gmx-v1.md +12 -34
- package/{sdk/src/skills → skills/sauce-protocols/references}/gmx-v2.md +15 -28
- package/skills/sauce-protocols/references/harvest.md +41 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/hegic.md +10 -18
- package/{sdk/src/skills → skills/sauce-protocols/references}/hop.md +11 -21
- package/{sdk/src/skills → skills/sauce-protocols/references}/hyperlane.md +11 -21
- package/skills/sauce-protocols/references/index.md +355 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/instadapp.md +10 -18
- package/skills/sauce-protocols/references/kelp.md +46 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/kim.md +12 -18
- package/{sdk/src/skills → skills/sauce-protocols/references}/kyberswap-aggregator.md +12 -35
- package/skills/sauce-protocols/references/kyberswap.md +72 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/layerbank.md +11 -26
- package/{sdk/src/skills → skills/sauce-protocols/references}/layerzero.md +11 -25
- package/{sdk/src/skills → skills/sauce-protocols/references}/level-finance.md +10 -24
- package/{sdk/src/skills → skills/sauce-protocols/references}/lido.md +10 -28
- package/{sdk/src/skills → skills/sauce-protocols/references}/lifi.md +11 -25
- package/{sdk/src/skills → skills/sauce-protocols/references}/linea-bridge.md +11 -14
- package/{sdk/src/skills → skills/sauce-protocols/references}/liquity-v1.md +10 -21
- package/{sdk/src/skills → skills/sauce-protocols/references}/liquity-v2.md +10 -19
- package/{sdk/src/skills → skills/sauce-protocols/references}/lynex.md +12 -18
- package/skills/sauce-protocols/references/maker.md +57 -0
- package/skills/sauce-protocols/references/mantle-meth.md +43 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/maverick.md +13 -25
- package/{sdk/src/skills → skills/sauce-protocols/references}/moonwell.md +11 -21
- package/{sdk/src/skills → skills/sauce-protocols/references}/morpho-blue.md +44 -21
- package/{sdk/src/skills → skills/sauce-protocols/references}/mux-protocol.md +10 -30
- package/skills/sauce-protocols/references/olympus.md +39 -0
- package/skills/sauce-protocols/references/oneinch.md +81 -0
- package/skills/sauce-protocols/references/openocean.md +69 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/optimism-bridge.md +11 -16
- package/{sdk/src/skills → skills/sauce-protocols/references}/opyn.md +10 -21
- package/{sdk/src/skills → skills/sauce-protocols/references}/pancakeswap-v2.md +39 -41
- package/skills/sauce-protocols/references/pancakeswap-v3.md +72 -0
- package/skills/sauce-protocols/references/paraswap.md +39 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/pendle.md +47 -29
- package/skills/sauce-protocols/references/permit2.md +101 -0
- package/skills/sauce-protocols/references/perpetual-protocol.md +53 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/polygon-bridge.md +11 -17
- package/{sdk/src/skills → skills/sauce-protocols/references}/premia.md +10 -19
- package/{sdk/src/skills → skills/sauce-protocols/references}/puffer.md +10 -21
- package/skills/sauce-protocols/references/pyth.md +45 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/quickswap.md +13 -27
- package/{sdk/src/skills → skills/sauce-protocols/references}/radiant.md +11 -15
- package/{sdk/src/skills → skills/sauce-protocols/references}/ramses.md +12 -18
- package/skills/sauce-protocols/references/reflexer.md +52 -0
- package/skills/sauce-protocols/references/registry/aave-v2.md +43 -0
- package/skills/sauce-protocols/references/registry/aave-v3.md +62 -0
- package/skills/sauce-protocols/references/registry/aave-v4.md +80 -0
- package/skills/sauce-protocols/references/registry/abracadabra.md +54 -0
- package/skills/sauce-protocols/references/registry/across.md +57 -0
- package/skills/sauce-protocols/references/registry/aerodrome-slipstream.md +72 -0
- package/skills/sauce-protocols/references/registry/aerodrome.md +58 -0
- package/skills/sauce-protocols/references/registry/aevo.md +39 -0
- package/skills/sauce-protocols/references/registry/alchemix.md +46 -0
- package/skills/sauce-protocols/references/registry/ambient.md +40 -0
- package/skills/sauce-protocols/references/registry/arbitrum-bridge.md +40 -0
- package/skills/sauce-protocols/references/registry/arrakis.md +49 -0
- package/skills/sauce-protocols/references/registry/axelar.md +65 -0
- package/skills/sauce-protocols/references/registry/balancer-v2.md +50 -0
- package/skills/sauce-protocols/references/registry/base-bridge.md +42 -0
- package/skills/sauce-protocols/references/registry/baseswap.md +40 -0
- package/skills/sauce-protocols/references/registry/beefy.md +51 -0
- package/skills/sauce-protocols/references/registry/benqi.md +49 -0
- package/skills/sauce-protocols/references/registry/camelot.md +82 -0
- package/skills/sauce-protocols/references/registry/cbeth.md +43 -0
- package/skills/sauce-protocols/references/registry/cctp.md +48 -0
- package/skills/sauce-protocols/references/registry/celer.md +44 -0
- package/skills/sauce-protocols/references/registry/chainlink-ccip.md +45 -0
- package/skills/sauce-protocols/references/registry/chainlink.md +49 -0
- package/skills/sauce-protocols/references/registry/circle-gateway.md +70 -0
- package/skills/sauce-protocols/references/registry/compound-v2.md +53 -0
- package/skills/sauce-protocols/references/registry/compound-v3.md +52 -0
- package/skills/sauce-protocols/references/registry/connext.md +41 -0
- package/skills/sauce-protocols/references/registry/convex.md +51 -0
- package/skills/sauce-protocols/references/registry/cowswap.md +40 -0
- package/skills/sauce-protocols/references/registry/crvusd.md +40 -0
- package/skills/sauce-protocols/references/registry/curve.md +81 -0
- package/skills/sauce-protocols/references/registry/debridge.md +59 -0
- package/skills/sauce-protocols/references/registry/dodo.md +39 -0
- package/skills/sauce-protocols/references/registry/eco-routes.md +65 -0
- package/skills/sauce-protocols/references/registry/eigenlayer.md +58 -0
- package/skills/sauce-protocols/references/registry/ens.md +49 -0
- package/skills/sauce-protocols/references/registry/erc20.md +44 -0
- package/skills/sauce-protocols/references/registry/erc3156.md +38 -0
- package/skills/sauce-protocols/references/registry/erc4626.md +51 -0
- package/skills/sauce-protocols/references/registry/ethena.md +50 -0
- package/skills/sauce-protocols/references/registry/etherfi.md +57 -0
- package/skills/sauce-protocols/references/registry/euler-v2.md +49 -0
- package/skills/sauce-protocols/references/registry/fenix.md +39 -0
- package/skills/sauce-protocols/references/registry/fluid.md +48 -0
- package/skills/sauce-protocols/references/registry/frax-ether.md +49 -0
- package/skills/sauce-protocols/references/registry/frax.md +40 -0
- package/skills/sauce-protocols/references/registry/gains-network.md +43 -0
- package/skills/sauce-protocols/references/registry/gamma.md +56 -0
- package/skills/sauce-protocols/references/registry/gelato.md +45 -0
- package/skills/sauce-protocols/references/registry/gho.md +40 -0
- package/skills/sauce-protocols/references/registry/gmx-v1.md +59 -0
- package/skills/sauce-protocols/references/registry/gmx-v2.md +41 -0
- package/skills/sauce-protocols/references/registry/harvest.md +44 -0
- package/skills/sauce-protocols/references/registry/hegic.md +39 -0
- package/skills/sauce-protocols/references/registry/hop.md +49 -0
- package/skills/sauce-protocols/references/registry/hyperlane.md +48 -0
- package/skills/sauce-protocols/references/registry/instadapp.md +39 -0
- package/skills/sauce-protocols/references/registry/kelp.md +47 -0
- package/skills/sauce-protocols/references/registry/kim.md +39 -0
- package/skills/sauce-protocols/references/registry/kyberswap-aggregator.md +49 -0
- package/skills/sauce-protocols/references/registry/kyberswap.md +63 -0
- package/skills/sauce-protocols/references/registry/layerbank.md +54 -0
- package/skills/sauce-protocols/references/registry/layerzero.md +49 -0
- package/skills/sauce-protocols/references/registry/level-finance.md +41 -0
- package/skills/sauce-protocols/references/registry/lido.md +51 -0
- package/skills/sauce-protocols/references/registry/lifi.md +48 -0
- package/skills/sauce-protocols/references/registry/linea-bridge.md +40 -0
- package/skills/sauce-protocols/references/registry/liquity-v1.md +42 -0
- package/skills/sauce-protocols/references/registry/liquity-v2.md +40 -0
- package/skills/sauce-protocols/references/registry/lynex.md +39 -0
- package/skills/sauce-protocols/references/registry/maker.md +55 -0
- package/skills/sauce-protocols/references/registry/mantle-meth.md +48 -0
- package/skills/sauce-protocols/references/registry/maverick.md +60 -0
- package/skills/sauce-protocols/references/registry/moonwell.md +49 -0
- package/skills/sauce-protocols/references/registry/morpho-blue.md +47 -0
- package/skills/sauce-protocols/references/registry/mux-protocol.md +49 -0
- package/skills/sauce-protocols/references/registry/olympus.md +42 -0
- package/skills/sauce-protocols/references/registry/oneinch.md +45 -0
- package/skills/sauce-protocols/references/registry/openocean.md +44 -0
- package/skills/sauce-protocols/references/registry/optimism-bridge.md +42 -0
- package/skills/sauce-protocols/references/registry/opyn.md +42 -0
- package/skills/sauce-protocols/references/registry/pancakeswap-v2.md +71 -0
- package/skills/sauce-protocols/references/registry/pancakeswap-v3.md +76 -0
- package/skills/sauce-protocols/references/registry/paraswap.md +51 -0
- package/skills/sauce-protocols/references/registry/pendle.md +43 -0
- package/skills/sauce-protocols/references/registry/permit2.md +50 -0
- package/skills/sauce-protocols/references/registry/perpetual-protocol.md +49 -0
- package/skills/sauce-protocols/references/registry/polygon-bridge.md +43 -0
- package/skills/sauce-protocols/references/registry/premia.md +40 -0
- package/skills/sauce-protocols/references/registry/puffer.md +43 -0
- package/skills/sauce-protocols/references/registry/pyth.md +40 -0
- package/skills/sauce-protocols/references/registry/quickswap.md +80 -0
- package/skills/sauce-protocols/references/registry/radiant.md +41 -0
- package/skills/sauce-protocols/references/registry/ramses.md +39 -0
- package/skills/sauce-protocols/references/registry/reflexer.md +56 -0
- package/skills/sauce-protocols/references/registry/renzo.md +47 -0
- package/skills/sauce-protocols/references/registry/rocket-pool.md +49 -0
- package/skills/sauce-protocols/references/registry/sablier.md +40 -0
- package/skills/sauce-protocols/references/registry/safe.md +47 -0
- package/skills/sauce-protocols/references/registry/scroll-bridge.md +48 -0
- package/skills/sauce-protocols/references/registry/seamless.md +42 -0
- package/skills/sauce-protocols/references/registry/seaport.md +44 -0
- package/skills/sauce-protocols/references/registry/silo.md +48 -0
- package/skills/sauce-protocols/references/registry/socket.md +44 -0
- package/skills/sauce-protocols/references/registry/sommelier.md +43 -0
- package/skills/sauce-protocols/references/registry/spark.md +42 -0
- package/skills/sauce-protocols/references/registry/spookyswap.md +40 -0
- package/skills/sauce-protocols/references/registry/squid.md +45 -0
- package/skills/sauce-protocols/references/registry/stader.md +47 -0
- package/skills/sauce-protocols/references/registry/stargate.md +45 -0
- package/skills/sauce-protocols/references/registry/superfluid.md +49 -0
- package/skills/sauce-protocols/references/registry/sushiswap-v2.md +71 -0
- package/skills/sauce-protocols/references/registry/swell.md +49 -0
- package/skills/sauce-protocols/references/registry/synapse.md +46 -0
- package/skills/sauce-protocols/references/registry/syncswap.md +38 -0
- package/skills/sauce-protocols/references/registry/synthetix-v3.md +48 -0
- package/skills/sauce-protocols/references/registry/synthra-v3.md +77 -0
- package/skills/sauce-protocols/references/registry/thales.md +51 -0
- package/skills/sauce-protocols/references/registry/thena.md +39 -0
- package/skills/sauce-protocols/references/registry/thruster.md +38 -0
- package/skills/sauce-protocols/references/registry/tokemak.md +45 -0
- package/skills/sauce-protocols/references/registry/trader-joe.md +66 -0
- package/skills/sauce-protocols/references/registry/uniswap-v2.md +77 -0
- package/skills/sauce-protocols/references/registry/uniswap-v3.md +113 -0
- package/skills/sauce-protocols/references/registry/uniswap-v4.md +117 -0
- package/skills/sauce-protocols/references/registry/unitflow-v3.md +65 -0
- package/skills/sauce-protocols/references/registry/velodrome.md +58 -0
- package/skills/sauce-protocols/references/registry/venus.md +62 -0
- package/skills/sauce-protocols/references/registry/vertex.md +46 -0
- package/skills/sauce-protocols/references/registry/wormhole.md +59 -0
- package/skills/sauce-protocols/references/registry/yearn-v3.md +46 -0
- package/skills/sauce-protocols/references/registry/zerolend.md +41 -0
- package/skills/sauce-protocols/references/registry/zerox.md +44 -0
- package/skills/sauce-protocols/references/registry/zksync-bridge.md +40 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/renzo.md +10 -24
- package/{sdk/src/skills → skills/sauce-protocols/references}/rocket-pool.md +10 -26
- package/{sdk/src/skills → skills/sauce-protocols/references}/sablier.md +10 -27
- package/skills/sauce-protocols/references/safe.md +42 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/scroll-bridge.md +11 -20
- package/{sdk/src/skills → skills/sauce-protocols/references}/seamless.md +11 -16
- package/skills/sauce-protocols/references/seaport.md +38 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/silo.md +11 -20
- package/{sdk/src/skills → skills/sauce-protocols/references}/socket.md +11 -18
- package/skills/sauce-protocols/references/sommelier.md +40 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/spark.md +11 -16
- package/{sdk/src/skills → skills/sauce-protocols/references}/spookyswap.md +12 -19
- package/{sdk/src/skills → skills/sauce-protocols/references}/squid.md +11 -21
- package/skills/sauce-protocols/references/stader.md +39 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/stargate.md +11 -22
- package/{sdk/src/skills → skills/sauce-protocols/references}/superfluid.md +10 -28
- package/{sdk/src/skills → skills/sauce-protocols/references}/sushiswap-v2.md +38 -43
- package/skills/sauce-protocols/references/swell.md +49 -0
- package/skills/sauce-protocols/references/synapse.md +54 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/syncswap.md +12 -17
- package/{sdk/src/skills → skills/sauce-protocols/references}/synthetix-v3.md +10 -29
- package/skills/sauce-protocols/references/synthra-v3.md +63 -0
- package/skills/sauce-protocols/references/thales.md +58 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/thena.md +12 -18
- package/{sdk/src/skills → skills/sauce-protocols/references}/thruster.md +13 -18
- package/skills/sauce-protocols/references/tokemak.md +40 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/trader-joe.md +13 -26
- package/{sdk/src/skills → skills/sauce-protocols/references}/uniswap-v2.md +46 -44
- package/skills/sauce-protocols/references/uniswap-v3.md +188 -0
- package/skills/sauce-protocols/references/uniswap-v4.md +155 -0
- package/skills/sauce-protocols/references/unitflow-v3.md +63 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/velodrome.md +12 -24
- package/{sdk/src/skills → skills/sauce-protocols/references}/venus.md +12 -31
- package/skills/sauce-protocols/references/vertex.md +42 -0
- package/skills/sauce-protocols/references/wormhole.md +57 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/yearn-v3.md +10 -25
- package/{sdk/src/skills → skills/sauce-protocols/references}/zerolend.md +11 -15
- package/skills/sauce-protocols/references/zerox.md +39 -0
- package/{sdk/src/skills → skills/sauce-protocols/references}/zksync-bridge.md +11 -14
- package/skills/sauce-script/SKILL.md +407 -0
- package/skills/sauce-script/examples/IOracle.json +12 -0
- package/skills/sauce-script/examples/saucescript.mts +167 -0
- package/skills/sauce-script/examples/twap.sauce.ts +29 -0
- package/skills/sauce-script/references/builtins.json +823 -0
- package/skills/sauce-script/references/builtins.md +674 -0
- package/skills/sauce-solana/SKILL.md +324 -0
- package/skills/sauce-solana/examples/solana.mts +166 -0
- package/skills/sauce-solana/examples/solana.sauce.ts +45 -0
- package/skills/sauce-solana/examples/token-2022.sauce.ts +38 -0
- package/skills/sauce-swaps/SKILL.md +200 -0
- package/skills/sauce-swaps/examples/swap-leg.sauce.ts +50 -0
- package/skills/sauce-swaps/examples/swaps.mts +124 -0
- package/skills/sauce-typescript/SKILL.md +178 -0
- package/skills/sauce-typescript/examples/actions.mts +100 -0
- package/skills/sauce-typescript/examples/compiler.mts +69 -0
- package/skills/sauce-typescript/examples/cook.mts +65 -0
- package/skills/sauce-typescript/examples/verify.mts +104 -0
- package/dev-tools/README.md +0 -16
- package/dev-tools/artifacts/IERC20.json +0 -1
- package/dev-tools/artifacts/ISauceRouter.json +0 -1
- package/dev-tools/artifacts/IUniswapV3Pool.json +0 -1
- package/dev-tools/artifacts/Router.json +0 -1
- package/dev-tools/hardhat.config.cjs +0 -18
- package/dev-tools/sauce/js/add.js +0 -4
- package/dev-tools/sauce/js/call.js +0 -8
- package/dev-tools/sauce/js/erc20.js +0 -18
- package/dev-tools/sauce/js/example.js +0 -6
- package/dev-tools/sauce/js/fibonacci.js +0 -13
- package/dev-tools/sauce/ts/add.ts +0 -4
- package/dev-tools/sauce/ts/call.ts +0 -8
- package/dev-tools/sauce/ts/erc20.ts +0 -18
- package/dev-tools/sauce/ts/example.ts +0 -6
- package/dev-tools/sauce/ts/fibonacci.ts +0 -13
- package/dev-tools/sauce/ts/saucescript.d.ts +0 -1
- package/dev-tools/sauce/ts/tsconfig.json +0 -12
- package/dev-tools/scripts/deploy.ts +0 -107
- package/dev-tools/scripts/init.js +0 -132
- package/dev-tools/scripts/run.ts +0 -67
- package/dev-tools/scripts/start-fork.sh +0 -92
- package/dev-tools/scripts/start-local.sh +0 -120
- package/dev-tools/scripts/stop-local.sh +0 -40
- package/dev-tools/scripts/sync-artifacts.js +0 -46
- package/dev-tools/scripts/sync-price.ts +0 -58
- package/dev-tools/src/contracts.ts +0 -59
- package/dev-tools/src/runner.ts +0 -355
- package/dev-tools/src/svm-local.ts +0 -305
- package/dev-tools/src/sync-price.ts +0 -217
- package/sdk/dist/deployments/v12.generated.d.ts +0 -95
- package/sdk/dist/deployments/v12.generated.d.ts.map +0 -1
- package/sdk/dist/deployments/v12.generated.js +0 -50
- package/sdk/dist/deployments/v12.generated.js.map +0 -1
- package/sdk/dist/swap/index.d.ts +0 -29
- package/sdk/dist/swap/index.d.ts.map +0 -1
- package/sdk/dist/swap/index.js +0 -27
- package/sdk/dist/swap/index.js.map +0 -1
- package/sdk/dist/swap/params.d.ts +0 -29
- package/sdk/dist/swap/params.d.ts.map +0 -1
- package/sdk/dist/swap/params.js +0 -123
- package/sdk/dist/swap/params.js.map +0 -1
- package/sdk/dist/swap/source.d.ts +0 -30
- package/sdk/dist/swap/source.d.ts.map +0 -1
- package/sdk/dist/swap/source.js +0 -101
- package/sdk/dist/swap/source.js.map +0 -1
- package/sdk/dist/swap/types.d.ts +0 -160
- package/sdk/dist/swap/types.d.ts.map +0 -1
- package/sdk/dist/swap/types.js +0 -106
- package/sdk/dist/swap/types.js.map +0 -1
- package/sdk/src/skills/aave-v3.md +0 -134
- package/sdk/src/skills/aave-v4.md +0 -91
- package/sdk/src/skills/abracadabra.md +0 -93
- package/sdk/src/skills/across.md +0 -90
- package/sdk/src/skills/aerodrome-slipstream.md +0 -57
- package/sdk/src/skills/aevo.md +0 -58
- package/sdk/src/skills/axelar.md +0 -80
- package/sdk/src/skills/chainlink.md +0 -62
- package/sdk/src/skills/curve.md +0 -141
- package/sdk/src/skills/eigenlayer.md +0 -71
- package/sdk/src/skills/gamma.md +0 -79
- package/sdk/src/skills/harvest.md +0 -49
- package/sdk/src/skills/index.md +0 -299
- package/sdk/src/skills/kelp.md +0 -60
- package/sdk/src/skills/kyberswap.md +0 -100
- package/sdk/src/skills/loader.ts +0 -46
- package/sdk/src/skills/maker.md +0 -79
- package/sdk/src/skills/mantle-meth.md +0 -60
- package/sdk/src/skills/olympus.md +0 -46
- package/sdk/src/skills/oneinch.md +0 -64
- package/sdk/src/skills/openocean.md +0 -86
- package/sdk/src/skills/pancakeswap-v3.md +0 -104
- package/sdk/src/skills/paraswap.md +0 -67
- package/sdk/src/skills/permit2.md +0 -73
- package/sdk/src/skills/perpetual-protocol.md +0 -73
- package/sdk/src/skills/pyth.md +0 -58
- package/sdk/src/skills/reflexer.md +0 -73
- package/sdk/src/skills/safe.md +0 -56
- package/sdk/src/skills/seaport.md +0 -65
- package/sdk/src/skills/sommelier.md +0 -47
- package/sdk/src/skills/stader.md +0 -53
- package/sdk/src/skills/swell.md +0 -65
- package/sdk/src/skills/synapse.md +0 -63
- package/sdk/src/skills/synthra-v3.md +0 -57
- package/sdk/src/skills/thales.md +0 -74
- package/sdk/src/skills/tokemak.md +0 -48
- package/sdk/src/skills/uniswap-v3.md +0 -202
- package/sdk/src/skills/uniswap-v4.md +0 -125
- package/sdk/src/skills/unitflow-v3.md +0 -62
- package/sdk/src/skills/vertex.md +0 -55
- package/sdk/src/skills/wormhole.md +0 -76
- package/sdk/src/skills/zerox.md +0 -51
|
@@ -0,0 +1,1499 @@
|
|
|
1
|
+
import { formatUnits, parseAbi } from "viem";
|
|
2
|
+
import * as z from "zod";
|
|
3
|
+
import { callFiles, DEFAULT_FILE } from "./files.js";
|
|
4
|
+
import { callReach } from "./reach.js";
|
|
5
|
+
import { toolTerms } from "./terms.js";
|
|
6
|
+
import { actionsCommand, actionsProgram, addressDefinesOf, assumedBalances, CANONICAL_CHAINS, CHAIN_SUPPORT_NEW_ISSUE_URL, chainSupport, compileCommand, compileProgram, connect, definesReach, fillTargets, fundingFor, globalsCommand, inspectCommand, inspectFile, intentRecord, kitchenFee, parseAccounts, parseAddress, parseChain, parseDefineMap, parseLamports, MAX_V4_KEYS, parsePin, parsePubkey, parseSalt, plannedTransactions, parseUnixSeconds, parseV4Key, parseVia, parseWei, poolsCommand, potCommand, potState, potTarget, priceCommand, pricedChain, priceGiven, previewRefusal, PreviewChainError, programChain, programChains, withoutShebang, publishCommand, registeredBalances, requireSupported, resolvePriceTokens, tokenGiven, simulateCommand, svmPotCommand, svmPotExists, svmPotTokenAccounts, svmSimulateCommand, svmTxCommand, supportedChainNames, svmVerifyCommand, txCommand, UsageError, verifyCommand, } from "./sdk.js";
|
|
7
|
+
/** Input bounds, so one call cannot hand the server unbounded work. */
|
|
8
|
+
export const LIMITS = {
|
|
9
|
+
/** Characters of one program or module, or of an action document. */
|
|
10
|
+
source: 256 * 1024,
|
|
11
|
+
/** Modules besides the program. */
|
|
12
|
+
modules: 32,
|
|
13
|
+
/** Characters of every module together. */
|
|
14
|
+
modulesTotal: 512 * 1024,
|
|
15
|
+
/** Characters of hex: calldata, a payload, a program. */
|
|
16
|
+
hex: 1024 * 1024,
|
|
17
|
+
/** Entries of a list or map: defines, arguments, accounts, balances. */
|
|
18
|
+
entries: 64,
|
|
19
|
+
};
|
|
20
|
+
// ---------------------------------------------------------------------------------------------
|
|
21
|
+
// Input schemas
|
|
22
|
+
// ---------------------------------------------------------------------------------------------
|
|
23
|
+
export const chainRef = z
|
|
24
|
+
.union([z.string().min(1).max(64), z.number().int().nonnegative()])
|
|
25
|
+
.describe("The chain: its slug (base, ethereum, solana), an alias, or its numeric id (8453). " +
|
|
26
|
+
"sauce_chains lists every one, and which the release supports.");
|
|
27
|
+
/** An integer as a JSON number (exact to 2^53) or as a decimal or 0x-hex string. */
|
|
28
|
+
const integer = z.union([z.string().min(1).max(80), z.number().int().nonnegative()]);
|
|
29
|
+
const RPC_URL = z
|
|
30
|
+
.string()
|
|
31
|
+
.min(1)
|
|
32
|
+
.max(2048)
|
|
33
|
+
.optional()
|
|
34
|
+
.describe("An RPC endpoint for the chain, used for this call only; it takes precedence over the " +
|
|
35
|
+
"server's own endpoint for the chain. It is never returned or logged. A server someone " +
|
|
36
|
+
"else runs sees it, so pass only a key you would share with them, or run the server " +
|
|
37
|
+
"yourself. A server served over HTTP reaches only public https endpoints.");
|
|
38
|
+
export const PROGRAM = {
|
|
39
|
+
source: z
|
|
40
|
+
.string()
|
|
41
|
+
.min(1)
|
|
42
|
+
.max(LIMITS.source)
|
|
43
|
+
.describe("The SauceScript program: the whole text of a .sauce.ts file."),
|
|
44
|
+
file: z
|
|
45
|
+
.string()
|
|
46
|
+
.min(1)
|
|
47
|
+
.max(256)
|
|
48
|
+
.optional()
|
|
49
|
+
.describe(`The program's file name, for messages and for resolving its relative imports ` +
|
|
50
|
+
`(default ${DEFAULT_FILE}).`),
|
|
51
|
+
modules: z
|
|
52
|
+
.record(z.string().min(1).max(256), z.string().max(LIMITS.source))
|
|
53
|
+
.optional()
|
|
54
|
+
.describe("Other files the program imports by relative path, as path → text, each path from the " +
|
|
55
|
+
"directory of `file` (lib/math.sauce.ts). The server reads nothing from its own disk, " +
|
|
56
|
+
"but serves what the SDK ships without being passed: @sauce/token, @sauce/router, " +
|
|
57
|
+
"./artifacts/IERC20.json, ./artifacts/ISauceRouter.json and ./protocols/<slug>/<Export>.json."),
|
|
58
|
+
chain: chainRef
|
|
59
|
+
.optional()
|
|
60
|
+
.describe("The chain the program runs on: slug, alias or id. Default: the program's own " +
|
|
61
|
+
"`// @chain <slug>` header line; with target svm alone, solana."),
|
|
62
|
+
target: z
|
|
63
|
+
.enum(["evm", "svm"])
|
|
64
|
+
.optional()
|
|
65
|
+
.describe("evm or svm, checked against the chain; svm alone means solana."),
|
|
66
|
+
defines: z
|
|
67
|
+
.record(z.string().min(1).max(128), z.union([z.string().max(100), z.number().int().nonnegative(), z.boolean()]))
|
|
68
|
+
.optional()
|
|
69
|
+
.describe("Compile-time values, by the name the program reads: an integer in base units (decimal " +
|
|
70
|
+
"or 0x hex; a string past 2^53), an EVM address as 0x hex, a Solana key in base58 " +
|
|
71
|
+
"(Solana programs), true or false. A define replaces the program's module-level const " +
|
|
72
|
+
"of that name."),
|
|
73
|
+
compactArgs: z
|
|
74
|
+
.boolean()
|
|
75
|
+
.optional()
|
|
76
|
+
.describe("Encode main's arguments compact-v1 instead of ABI-v1 (default false)."),
|
|
77
|
+
intentDeadline: integer
|
|
78
|
+
.optional()
|
|
79
|
+
.describe("For intents the program opens: their deadline, as Unix seconds."),
|
|
80
|
+
intentCreator: z
|
|
81
|
+
.string()
|
|
82
|
+
.max(64)
|
|
83
|
+
.optional()
|
|
84
|
+
.describe("For intents the program opens: their creator (0x address), who may reclaim an unearned " +
|
|
85
|
+
"reward."),
|
|
86
|
+
intentRewardDeadline: integer
|
|
87
|
+
.optional()
|
|
88
|
+
.describe("For intents the program opens: from when an unproven intent's reward may be refunded, " +
|
|
89
|
+
"as Unix seconds (default: the intent's deadline)."),
|
|
90
|
+
intentProver: z
|
|
91
|
+
.string()
|
|
92
|
+
.max(64)
|
|
93
|
+
.optional()
|
|
94
|
+
.describe("For intents the program opens: the reward's prover (0x address; default the registry's " +
|
|
95
|
+
"for the pair)."),
|
|
96
|
+
intentExecutionFee: integer
|
|
97
|
+
.optional()
|
|
98
|
+
.describe("For intents that run a program on their destination: that chain's Kitchen fee, in wei."),
|
|
99
|
+
intentFundVia: z
|
|
100
|
+
.enum(["transfer", "publishAndFund"])
|
|
101
|
+
.optional()
|
|
102
|
+
.describe("For intents the program opens: how their reward reaches the intent's vault. transfer " +
|
|
103
|
+
"(default) pays it into the vault, then Portal.publish; publishAndFund approves the " +
|
|
104
|
+
"Portal, then Portal.publishAndFund, which emits IntentFunded (for an intent built from " +
|
|
105
|
+
"a solver's quote)."),
|
|
106
|
+
};
|
|
107
|
+
const POT = {
|
|
108
|
+
owner: z
|
|
109
|
+
.string()
|
|
110
|
+
.max(64)
|
|
111
|
+
.optional()
|
|
112
|
+
.describe("The Pot's owner: a 0x address on an EVM chain, a base58 public key on Solana. With the " +
|
|
113
|
+
"salt it derives the Pot; only the owner may cook on it. To rehearse (sauce_simulate) any " +
|
|
114
|
+
"address will do: nothing is signed, and a missing Pot or balance is supplied."),
|
|
115
|
+
salt: z
|
|
116
|
+
.string()
|
|
117
|
+
.max(256)
|
|
118
|
+
.optional()
|
|
119
|
+
.describe("A label naming one of the owner's Pots; the salt is keccak256 of it. With neither salt " +
|
|
120
|
+
"nor saltHex: the owner's default Pot (salt 0)."),
|
|
121
|
+
saltHex: z.string().max(66).optional().describe("Or the salt itself, 32 bytes of 0x hex."),
|
|
122
|
+
};
|
|
123
|
+
const ARGS = z
|
|
124
|
+
.array(z.unknown())
|
|
125
|
+
.max(LIMITS.entries)
|
|
126
|
+
.optional()
|
|
127
|
+
.describe("main's runtime arguments, in order, as JSON values: an integer in base units as a decimal " +
|
|
128
|
+
"string (or a number up to 2^53), an address as 0x hex (on Solana a base58 key), bytes " +
|
|
129
|
+
"as 0x hex, a bool as true/false, an array as an array, a tuple as an array of its fields " +
|
|
130
|
+
"or an object naming them. sauce_compile's entryParams lists what main takes.");
|
|
131
|
+
const COOK = {
|
|
132
|
+
...POT,
|
|
133
|
+
pot: z
|
|
134
|
+
.string()
|
|
135
|
+
.max(64)
|
|
136
|
+
.optional()
|
|
137
|
+
.describe("EVM only: the Pot by its 0x address, instead of owner and salt."),
|
|
138
|
+
value: integer
|
|
139
|
+
.optional()
|
|
140
|
+
.describe("EVM only: the cook's value in wei — the Kitchen's execution fee plus any native " +
|
|
141
|
+
"currency the program spends. Default: the fee, read from the chain (which needs an " +
|
|
142
|
+
"endpoint: rpcUrl or the server's)."),
|
|
143
|
+
args: ARGS,
|
|
144
|
+
accounts: z
|
|
145
|
+
.record(z.string().min(1).max(64), z.string().max(64))
|
|
146
|
+
.optional()
|
|
147
|
+
.describe("Solana only: each Account parameter main takes, by name: a base58 address, or `pot` (the " +
|
|
148
|
+
"Pot, signed for by the Kitchen) or `owner`. sauce_compile's manifest lists them."),
|
|
149
|
+
via: z
|
|
150
|
+
.enum(["kitchen", "engine"])
|
|
151
|
+
.optional()
|
|
152
|
+
.describe("Solana only: how the cook reaches the engine. kitchen (the default) is the Kitchen's cook " +
|
|
153
|
+
"on the owner's Pot: the program can hold and spend what the Pot owns. engine is the " +
|
|
154
|
+
"engine's own paid cook, with no Kitchen and no Pot: the owner signs as the authority the " +
|
|
155
|
+
"program acts with (accounts `owner` where it needs one; `pot` cannot sign there) and pays " +
|
|
156
|
+
"the fee, and the program's own calls get one more level of CPI depth. Both pay the same " +
|
|
157
|
+
"execution fee."),
|
|
158
|
+
maxExecutionFee: integer
|
|
159
|
+
.optional()
|
|
160
|
+
.describe("Solana only: the most the cook may pay in execution fee, in lamports. The fee is read from " +
|
|
161
|
+
"the cluster and returned as `fee`; above this the call refuses before building anything. " +
|
|
162
|
+
"Either way the cook signs the fee it read as its max_execution_fee."),
|
|
163
|
+
rpcUrl: RPC_URL,
|
|
164
|
+
};
|
|
165
|
+
/** Endpoints by chain, for a call that reads more than one: each intent's destination. */
|
|
166
|
+
export const RPC_URLS = z.record(z.string().max(64), z.string().min(1).max(2048)).optional();
|
|
167
|
+
const TOKEN_AMOUNTS = z
|
|
168
|
+
.array(z.string().min(3).max(200))
|
|
169
|
+
.max(LIMITS.entries)
|
|
170
|
+
.optional()
|
|
171
|
+
.describe("Each <TOKEN|address>:<amount>: a symbol the chain registers or a 0x token address, and " +
|
|
172
|
+
"the amount in whole units (USDC:1.5) or in base units ending in n (USDC:1500000n); " +
|
|
173
|
+
"ETH:<amount> is the chain's native currency.");
|
|
174
|
+
/** An integer argument as the text the commands parse; a JSON number only while it is exact. */
|
|
175
|
+
function integerText(value, name) {
|
|
176
|
+
if (typeof value === "string")
|
|
177
|
+
return value;
|
|
178
|
+
if (!Number.isSafeInteger(value)) {
|
|
179
|
+
throw new UsageError(`${name}: ${value} is past 2^53 as a JSON number; give it as a string`);
|
|
180
|
+
}
|
|
181
|
+
return String(value);
|
|
182
|
+
}
|
|
183
|
+
/** The intents a program opens, as `ProgramInput.intents` takes them. */
|
|
184
|
+
function intentsOf(args) {
|
|
185
|
+
const { intentDeadline, intentRewardDeadline, intentCreator, intentProver } = args;
|
|
186
|
+
const { intentExecutionFee, intentFundVia } = args;
|
|
187
|
+
return {
|
|
188
|
+
...(intentDeadline === undefined
|
|
189
|
+
? {}
|
|
190
|
+
: {
|
|
191
|
+
deadline: parseUnixSeconds("intent-deadline", integerText(intentDeadline, "intentDeadline")),
|
|
192
|
+
}),
|
|
193
|
+
...(intentRewardDeadline === undefined
|
|
194
|
+
? {}
|
|
195
|
+
: {
|
|
196
|
+
rewardDeadline: parseUnixSeconds("intent-reward-deadline", integerText(intentRewardDeadline, "intentRewardDeadline")),
|
|
197
|
+
}),
|
|
198
|
+
...(intentProver === undefined ? {} : { prover: parseAddress("intent-prover", intentProver) }),
|
|
199
|
+
...(intentCreator === undefined
|
|
200
|
+
? {}
|
|
201
|
+
: { creator: parseAddress("intent-creator", intentCreator) }),
|
|
202
|
+
...(intentExecutionFee === undefined
|
|
203
|
+
? {}
|
|
204
|
+
: {
|
|
205
|
+
executionFee: parseWei("intent-execution-fee", integerText(intentExecutionFee, "intentExecutionFee")),
|
|
206
|
+
}),
|
|
207
|
+
...(intentFundVia === undefined ? {} : { fundVia: intentFundVia }),
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
export function programOf(given, fallback) {
|
|
211
|
+
// A `#!` line, as a program file may start with, is blanked as the command blanks it.
|
|
212
|
+
const args = { ...given, source: withoutShebang(given.source) };
|
|
213
|
+
const moduleText = Object.values(args.modules ?? {});
|
|
214
|
+
if (moduleText.length > LIMITS.modules) {
|
|
215
|
+
throw new UsageError(`modules: at most ${LIMITS.modules} files`);
|
|
216
|
+
}
|
|
217
|
+
if (moduleText.reduce((sum, text) => sum + text.length, 0) > LIMITS.modulesTotal) {
|
|
218
|
+
throw new UsageError(`modules: at most ${LIMITS.modulesTotal} characters in all`);
|
|
219
|
+
}
|
|
220
|
+
if (Object.keys(args.defines ?? {}).length > LIMITS.entries) {
|
|
221
|
+
throw new UsageError(`defines: at most ${LIMITS.entries}`);
|
|
222
|
+
}
|
|
223
|
+
const { file, files } = callFiles(args.file, args.source, args.modules);
|
|
224
|
+
const chain = programChain({
|
|
225
|
+
...(args.chain === undefined ? {} : { chain: String(args.chain) }),
|
|
226
|
+
...(args.target === undefined ? {} : { target: args.target }),
|
|
227
|
+
}, file, args.source, fallback);
|
|
228
|
+
const defines = parseDefineMap(args.defines ?? {}, "defines", chain.kind);
|
|
229
|
+
definesReach(file, args.source, Object.keys(defines));
|
|
230
|
+
// The defines written as addresses, which the compile report shows as one; any other value is the
|
|
231
|
+
// integer it is.
|
|
232
|
+
const addresses = addressDefinesOf(args.defines ?? {}, chain.kind);
|
|
233
|
+
return {
|
|
234
|
+
input: {
|
|
235
|
+
file,
|
|
236
|
+
text: args.source,
|
|
237
|
+
chain,
|
|
238
|
+
defines,
|
|
239
|
+
...(addresses.length === 0 ? {} : { addressDefines: addresses }),
|
|
240
|
+
compactArgs: args.compactArgs === true,
|
|
241
|
+
intents: intentsOf(args),
|
|
242
|
+
},
|
|
243
|
+
files,
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
const argsOf = (args) => args.args === undefined ? {} : { args: { from: "--args-json", values: args.args } };
|
|
247
|
+
/** A call's `rpcUrls`, each reached as `reach` reaches a call's URL: by chain id. */
|
|
248
|
+
export async function endpointsByChain(urls, reach) {
|
|
249
|
+
if (Object.keys(urls ?? {}).length > LIMITS.entries) {
|
|
250
|
+
throw new UsageError(`rpcUrls: at most ${LIMITS.entries}`);
|
|
251
|
+
}
|
|
252
|
+
const byChain = new Map();
|
|
253
|
+
for (const [key, url] of Object.entries(urls ?? {})) {
|
|
254
|
+
const chain = parseChain(key, "rpcUrls");
|
|
255
|
+
byChain.set(chain.id, (await reach.endpoint(chain, url)));
|
|
256
|
+
}
|
|
257
|
+
return byChain;
|
|
258
|
+
}
|
|
259
|
+
/** An EVM cook: the program on the Pot `owner`/`salt` or `pot` names. */
|
|
260
|
+
function evmCook(args, program) {
|
|
261
|
+
if (args.accounts !== undefined) {
|
|
262
|
+
throw new UsageError(`accounts names a Solana program's accounts; a program on ${program.input.chain.slug} takes none`);
|
|
263
|
+
}
|
|
264
|
+
for (const [name, given] of [
|
|
265
|
+
["via", args.via],
|
|
266
|
+
["maxExecutionFee", args.maxExecutionFee],
|
|
267
|
+
]) {
|
|
268
|
+
if (given !== undefined) {
|
|
269
|
+
throw new UsageError(`${name} is for a Solana cook, which can reach the engine through the Kitchen or ` +
|
|
270
|
+
`directly; on ${program.input.chain.slug} a cook is the Pot's, and value carries the fee`);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
if (args.owner === undefined && args.pot === undefined) {
|
|
274
|
+
throw new UsageError("give owner (the Pot's owner, whose Pot the cook runs on; to rehearse, any address will do) " +
|
|
275
|
+
"or pot (the Pot's address)");
|
|
276
|
+
}
|
|
277
|
+
return {
|
|
278
|
+
...program.input,
|
|
279
|
+
target: potTarget({ pot: args.pot, owner: args.owner, salt: args.salt, saltHex: args.saltHex }),
|
|
280
|
+
...(args.value === undefined
|
|
281
|
+
? {}
|
|
282
|
+
: { value: parseWei("value", integerText(args.value, "value")) }),
|
|
283
|
+
...argsOf(args),
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
/** A Solana cook: the program on the Kitchen Pot of `owner` and `salt`, with its accounts. */
|
|
287
|
+
function svmCook(args, program, rpcUrl) {
|
|
288
|
+
if (args.pot !== undefined) {
|
|
289
|
+
throw new UsageError("on Solana a cook names its Pot by owner and salt, which the Kitchen derives it from: give " +
|
|
290
|
+
"owner (and salt), not pot");
|
|
291
|
+
}
|
|
292
|
+
if (args.value !== undefined) {
|
|
293
|
+
throw new UsageError("value is for EVM: on Solana the Kitchen's fee is read from the cluster, and lamports a " +
|
|
294
|
+
"program spends come from its accounts");
|
|
295
|
+
}
|
|
296
|
+
if (args.owner === undefined) {
|
|
297
|
+
throw new UsageError("missing owner: whose Pot it is (a base58 public key)");
|
|
298
|
+
}
|
|
299
|
+
if (Object.keys(args.accounts ?? {}).length > LIMITS.entries) {
|
|
300
|
+
throw new UsageError(`accounts: at most ${LIMITS.entries}`);
|
|
301
|
+
}
|
|
302
|
+
return {
|
|
303
|
+
...program.input,
|
|
304
|
+
owner: parsePubkey("owner", args.owner),
|
|
305
|
+
...parseSalt(args.salt, args.saltHex),
|
|
306
|
+
accounts: parseAccounts(Object.entries(args.accounts ?? {}).map(([name, value]) => `${name}=${value}`)),
|
|
307
|
+
...argsOf(args),
|
|
308
|
+
rpcUrl,
|
|
309
|
+
...(args.via === undefined ? {} : { via: parseVia(args.via, "via") }),
|
|
310
|
+
...(args.maxExecutionFee === undefined
|
|
311
|
+
? {}
|
|
312
|
+
: {
|
|
313
|
+
maxExecutionFee: parseLamports("maxExecutionFee", integerText(args.maxExecutionFee, "maxExecutionFee")),
|
|
314
|
+
}),
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
/** The unsigned cook of `program` with `args`'s Pot, value and arguments: `sauce tx`'s output. */
|
|
318
|
+
async function cookTransaction(args, program, reach) {
|
|
319
|
+
const chain = program.input.chain;
|
|
320
|
+
if (chain.kind === "svm") {
|
|
321
|
+
const rpcUrl = await reach.require(chain, args.rpcUrl, "A Solana cook transaction (its blockhash and the Kitchen's fee)");
|
|
322
|
+
return svmTxCommand(svmCook(args, program, rpcUrl), program.files);
|
|
323
|
+
}
|
|
324
|
+
const cook = evmCook(args, program);
|
|
325
|
+
const rpcUrl = await reach.endpoint(chain, args.rpcUrl);
|
|
326
|
+
if (cook.value === undefined && rpcUrl === undefined) {
|
|
327
|
+
throw new UsageError(`missing value: the cook pays the Kitchen's execution fee plus any native the program ` +
|
|
328
|
+
`spends, and there is no endpoint for ${chain.slug} to read the fee from. Give value, in ` +
|
|
329
|
+
"wei, or rpcUrl.");
|
|
330
|
+
}
|
|
331
|
+
return txCommand({ ...cook, ...(rpcUrl === undefined ? {} : { rpcUrl }) }, program.files);
|
|
332
|
+
}
|
|
333
|
+
/** `sauce compile --json`: the command's own report, its defines among it. */
|
|
334
|
+
async function compiled(program) {
|
|
335
|
+
return fromCommand(await compileCommand(program.input, program.files));
|
|
336
|
+
}
|
|
337
|
+
const POOL = parseAbi([
|
|
338
|
+
"function slot0() view returns (uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked)",
|
|
339
|
+
"function liquidity() view returns (uint128)",
|
|
340
|
+
"function fee() view returns (uint24)",
|
|
341
|
+
"function token0() view returns (address)",
|
|
342
|
+
"function token1() view returns (address)",
|
|
343
|
+
]);
|
|
344
|
+
/** A Uniswap V3-style pool's price, liquidity, fee and tokens, read now. */
|
|
345
|
+
async function readPool(client, pool) {
|
|
346
|
+
const read = async (what, call) => {
|
|
347
|
+
try {
|
|
348
|
+
return await call();
|
|
349
|
+
}
|
|
350
|
+
catch (error) {
|
|
351
|
+
const why = (error.shortMessage ?? String(error)).split("\n")[0];
|
|
352
|
+
throw new UsageError(`reading the pool's ${what} failed (${why}): is ${pool} a V3-style pool on this chain?`);
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
const [slot0, liquidity, fee, token0, token1] = await Promise.all([
|
|
356
|
+
read("slot0()", () => client.readContract({ address: pool, abi: POOL, functionName: "slot0" })),
|
|
357
|
+
read("liquidity()", () => client.readContract({ address: pool, abi: POOL, functionName: "liquidity" })),
|
|
358
|
+
read("fee()", () => client.readContract({ address: pool, abi: POOL, functionName: "fee" })),
|
|
359
|
+
read("token0()", () => client.readContract({ address: pool, abi: POOL, functionName: "token0" })),
|
|
360
|
+
read("token1()", () => client.readContract({ address: pool, abi: POOL, functionName: "token1" })),
|
|
361
|
+
]);
|
|
362
|
+
return { sqrtPriceX96: slot0[0], tick: slot0[1], liquidity, fee, token0, token1 };
|
|
363
|
+
}
|
|
364
|
+
/** The decimal `price` times `numerator / denominator`, to 24 decimal places. */
|
|
365
|
+
function scaled(price, numerator, denominator) {
|
|
366
|
+
const [whole = "0", fraction = ""] = price.split(".");
|
|
367
|
+
const PLACES = 24;
|
|
368
|
+
const units = BigInt(`${whole}${fraction.padEnd(PLACES, "0").slice(0, PLACES)}`);
|
|
369
|
+
const result = (units * numerator) / denominator;
|
|
370
|
+
const text = result.toString().padStart(PLACES + 1, "0");
|
|
371
|
+
const integer = text.slice(0, -PLACES);
|
|
372
|
+
const decimals = text.slice(-PLACES).replace(/0+$/, "");
|
|
373
|
+
return decimals === "" ? integer : `${integer}.${decimals}`;
|
|
374
|
+
}
|
|
375
|
+
const HEX = /^0x(?:[0-9a-fA-F]{2})*$/;
|
|
376
|
+
/** A rehearsal's approver: it sends nothing, so there is nothing to approve and no one to ask. */
|
|
377
|
+
const NO_APPROVER = { auto: false, canAsk: false, approve: async () => undefined };
|
|
378
|
+
/** The name an actions document goes by in messages: it comes from the call, not a file. */
|
|
379
|
+
const ACTIONS_FILE = "actions.json";
|
|
380
|
+
/** An intent's claimant, as fulfill records it: an address, or 32 bytes. */
|
|
381
|
+
export const CLAIMANT = /^0x(?:[0-9a-fA-F]{40}|[0-9a-fA-F]{64})$/;
|
|
382
|
+
export const TX_HASH = /^0x[0-9a-fA-F]{64}$/;
|
|
383
|
+
function hexArg(raw, what) {
|
|
384
|
+
if (!HEX.test(raw))
|
|
385
|
+
throw new UsageError(`${what}: not 0x-prefixed hex bytes`);
|
|
386
|
+
return raw;
|
|
387
|
+
}
|
|
388
|
+
// ---------------------------------------------------------------------------------------------
|
|
389
|
+
// Results
|
|
390
|
+
// ---------------------------------------------------------------------------------------------
|
|
391
|
+
/** What a tool returns: the command's JSON, and its notes — what must be true for it to land. */
|
|
392
|
+
/**
|
|
393
|
+
* `output`'s intents, each with its `record`: the intent in full, as the intent tools take it, so
|
|
394
|
+
* what is published here is named there with no import. A file whose intents cannot be built
|
|
395
|
+
* without running it (one the publish refuses anyway) gets none.
|
|
396
|
+
*/
|
|
397
|
+
function withRecords(program, output) {
|
|
398
|
+
const intents = output.json.intents;
|
|
399
|
+
let records;
|
|
400
|
+
try {
|
|
401
|
+
records = new Map(fillTargets(program.input, program.files).map((target) => {
|
|
402
|
+
const record = intentRecord(target.intent, { sourcePortal: target.sourcePortal });
|
|
403
|
+
return [record.intentHash.toLowerCase(), record];
|
|
404
|
+
}));
|
|
405
|
+
}
|
|
406
|
+
catch {
|
|
407
|
+
return fromCommand(output);
|
|
408
|
+
}
|
|
409
|
+
return {
|
|
410
|
+
json: {
|
|
411
|
+
...output.json,
|
|
412
|
+
...(intents === undefined
|
|
413
|
+
? {}
|
|
414
|
+
: {
|
|
415
|
+
intents: intents.map((intent) => {
|
|
416
|
+
const record = records.get(String(intent.intentHash).toLowerCase());
|
|
417
|
+
return record === undefined ? intent : { ...intent, record };
|
|
418
|
+
}),
|
|
419
|
+
}),
|
|
420
|
+
},
|
|
421
|
+
notes: output.notes,
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
export const fromCommand = (output) => ({
|
|
425
|
+
json: output.json,
|
|
426
|
+
notes: output.notes,
|
|
427
|
+
});
|
|
428
|
+
/** Fields that hold a program's or a file's own text, never reworded. */
|
|
429
|
+
const VERBATIM = new Set(["source", "text"]);
|
|
430
|
+
/** `value` with every string passed through `scrub`, and put in the tools' words (`terms.ts`)
|
|
431
|
+
* unless it is a program's own text. */
|
|
432
|
+
function scrubbed(value, scrub, verbatim = false) {
|
|
433
|
+
if (typeof value === "string")
|
|
434
|
+
return verbatim ? scrub(value) : toolTerms(scrub(value));
|
|
435
|
+
if (typeof value === "bigint")
|
|
436
|
+
return value.toString();
|
|
437
|
+
if (Array.isArray(value))
|
|
438
|
+
return value.map((each) => scrubbed(each, scrub, verbatim));
|
|
439
|
+
if (value !== null && typeof value === "object") {
|
|
440
|
+
return Object.fromEntries(Object.entries(value).map(([k, v]) => [scrub(k), scrubbed(v, scrub, VERBATIM.has(k))]));
|
|
441
|
+
}
|
|
442
|
+
return value;
|
|
443
|
+
}
|
|
444
|
+
/** A failure as the one message the caller reads, scrubbed by `scrub` (the call's, by default
|
|
445
|
+
* the server's alone). */
|
|
446
|
+
export function errorText(error, scrub = callReach({ chainIds: [], endpoint: () => undefined }, undefined).scrub) {
|
|
447
|
+
// The command's message, in the tools' words: an input where it names a flag.
|
|
448
|
+
return toolTerms(scrub(error instanceof Error ? error.message : String(error)));
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* A tool refused on a preview chain: an error result whose structured content is the refusal, as
|
|
452
|
+
* `refused` — the supported chains, and for each preview chain the GitHub search for an existing
|
|
453
|
+
* request, the prefilled new one, and the title, body and comment to post.
|
|
454
|
+
*/
|
|
455
|
+
export const refusedResult = (refusal, scrub) => {
|
|
456
|
+
const structured = scrubbed({ refused: refusal }, scrub);
|
|
457
|
+
return {
|
|
458
|
+
isError: true,
|
|
459
|
+
structuredContent: structured,
|
|
460
|
+
content: [{ type: "text", text: JSON.stringify(structured, null, 2) }],
|
|
461
|
+
};
|
|
462
|
+
};
|
|
463
|
+
const result = (output, scrub) => {
|
|
464
|
+
const notes = output.notes ?? [];
|
|
465
|
+
const structured = scrubbed({ ...output.json, ...(notes.length === 0 ? {} : { notes }) }, scrub);
|
|
466
|
+
return {
|
|
467
|
+
structuredContent: structured,
|
|
468
|
+
content: [{ type: "text", text: JSON.stringify(structured, null, 2) }],
|
|
469
|
+
};
|
|
470
|
+
};
|
|
471
|
+
/** Reads nothing, writes nothing: the result follows from the arguments. */
|
|
472
|
+
const PURE = {
|
|
473
|
+
readOnlyHint: true,
|
|
474
|
+
destructiveHint: false,
|
|
475
|
+
idempotentHint: true,
|
|
476
|
+
openWorldHint: false,
|
|
477
|
+
};
|
|
478
|
+
/** May read a chain, through an endpoint, and never writes one. */
|
|
479
|
+
export const READS_CHAIN = { ...PURE, openWorldHint: true };
|
|
480
|
+
const notesSchema = z.array(z.string()).optional();
|
|
481
|
+
/** A refusal on a preview chain, as `refused` holds it (`sdk/src/cli/support.ts`). */
|
|
482
|
+
const REFUSED = z.looseObject({
|
|
483
|
+
code: z.literal("preview-chain"),
|
|
484
|
+
action: z.string(),
|
|
485
|
+
message: z.string(),
|
|
486
|
+
supportedChains: z.array(z.looseObject({ slug: z.string(), id: z.number(), name: z.string() })),
|
|
487
|
+
previewChains: z.array(z.looseObject({
|
|
488
|
+
slug: z.string(),
|
|
489
|
+
id: z.number(),
|
|
490
|
+
name: z.string(),
|
|
491
|
+
request: z.looseObject({}),
|
|
492
|
+
})),
|
|
493
|
+
});
|
|
494
|
+
/**
|
|
495
|
+
* The output of a tool a preview chain refuses: every field optional, beside `refused`. A client
|
|
496
|
+
* validates an error result's structured content against the tool's output schema too (the MCP
|
|
497
|
+
* SDK's `callTool` does, once it has listed the tools), so a refusal — `{ refused }`, with none of
|
|
498
|
+
* the fields a built transaction has — has to satisfy it.
|
|
499
|
+
*/
|
|
500
|
+
export function refusable(shape) {
|
|
501
|
+
return {
|
|
502
|
+
...Object.fromEntries(Object.entries(shape).map(([key, field]) => [key, field.optional()])),
|
|
503
|
+
refused: REFUSED.optional(),
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
/** The sentence every tool that builds a transaction ends on. */
|
|
507
|
+
export const UNSIGNED = "Nothing is signed or sent: the caller signs and sends with its own wallet or signer.";
|
|
508
|
+
/** What every tool that builds a transaction says about where it builds one. */
|
|
509
|
+
export const SUPPORTED_ONLY = `It builds transactions only on ${supportedChainNames()}, the chains this release supports. On ` +
|
|
510
|
+
"any other (a preview chain: sauce_chains marks each) it is refused before any endpoint is " +
|
|
511
|
+
"reached, with `refused`: the supported chains, the search for an existing request for that " +
|
|
512
|
+
"chain and a prefilled new one, and the title, body and comment to post. Offer the user that " +
|
|
513
|
+
"request; compile and simulate work on every chain.";
|
|
514
|
+
/** That sentence on a server with wallets (`sauce mcp --wallets`). */
|
|
515
|
+
export const WALLET_UNSIGNED = "Nothing is signed or sent here: pass the result to sauce_wallet_send to send it from one of " +
|
|
516
|
+
"this server's wallets, or sign it with any other wallet.";
|
|
517
|
+
/** How many tokens `sauce_globals` returns at a time. */
|
|
518
|
+
const TOKEN_PAGE = 200;
|
|
519
|
+
/** The names of the tools, in the order `tools/list` gives them. */
|
|
520
|
+
export const TOOL_NAMES = [
|
|
521
|
+
"sauce_chains",
|
|
522
|
+
"sauce_globals",
|
|
523
|
+
"sauce_price",
|
|
524
|
+
"sauce_pools",
|
|
525
|
+
"sauce_compile",
|
|
526
|
+
"sauce_actions",
|
|
527
|
+
"sauce_tx",
|
|
528
|
+
"sauce_pot",
|
|
529
|
+
"sauce_simulate",
|
|
530
|
+
"sauce_intent_publish",
|
|
531
|
+
"sauce_inspect",
|
|
532
|
+
"sauce_verify",
|
|
533
|
+
];
|
|
534
|
+
/**
|
|
535
|
+
* Registers tools on `server` whose handlers return a ToolOutput; a throw becomes an error
|
|
536
|
+
* result. Each call gets its own reach: its rpcUrl, scrubbed from everything it returns, and
|
|
537
|
+
* released after.
|
|
538
|
+
*/
|
|
539
|
+
export function toolRegistrar(server, context) {
|
|
540
|
+
const { endpoints, guard } = context;
|
|
541
|
+
return (name, config, run) => {
|
|
542
|
+
// A tool that builds a transaction, on a server that can send it: the result says how.
|
|
543
|
+
const sendable = context.wallets !== undefined && config.description.includes(UNSIGNED);
|
|
544
|
+
server.registerTool(name, {
|
|
545
|
+
title: config.title,
|
|
546
|
+
description: sendable
|
|
547
|
+
? config.description.replace(UNSIGNED, WALLET_UNSIGNED)
|
|
548
|
+
: config.description,
|
|
549
|
+
// A tool that takes nothing declares no schema, so a call that sends no arguments is
|
|
550
|
+
// still a call; every other refuses a field it does not know.
|
|
551
|
+
inputSchema: Object.keys(config.input).length === 0 ? undefined : z.object(config.input).strict(),
|
|
552
|
+
outputSchema: z.looseObject({ ...config.output, notes: notesSchema }),
|
|
553
|
+
annotations: { title: config.title, ...config.annotations },
|
|
554
|
+
}, async (args) => {
|
|
555
|
+
const reach = callReach(endpoints, guard);
|
|
556
|
+
try {
|
|
557
|
+
const output = await run(args, reach);
|
|
558
|
+
return result(sendable && args.dryRun !== true
|
|
559
|
+
? withSendNote(output)
|
|
560
|
+
: output, reach.scrub);
|
|
561
|
+
}
|
|
562
|
+
catch (error) {
|
|
563
|
+
if (error instanceof PreviewChainError)
|
|
564
|
+
return refusedResult(error.refusal, reach.scrub);
|
|
565
|
+
return {
|
|
566
|
+
isError: true,
|
|
567
|
+
content: [{ type: "text", text: errorText(error, reach.scrub) }],
|
|
568
|
+
};
|
|
569
|
+
}
|
|
570
|
+
finally {
|
|
571
|
+
reach.release();
|
|
572
|
+
}
|
|
573
|
+
});
|
|
574
|
+
};
|
|
575
|
+
}
|
|
576
|
+
/** `output` with a note on sending it from a wallet, when it carries transactions to send. */
|
|
577
|
+
function withSendNote(output) {
|
|
578
|
+
// A Pot that is there already: its deployment is not to be sent.
|
|
579
|
+
if (output.json.deployed === true)
|
|
580
|
+
return output;
|
|
581
|
+
try {
|
|
582
|
+
const count = plannedTransactions(output.json).length;
|
|
583
|
+
return {
|
|
584
|
+
...output,
|
|
585
|
+
notes: [
|
|
586
|
+
...(output.notes ?? []),
|
|
587
|
+
`To send ${count === 1 ? "it" : `these ${count}`} from one of this server's wallets: ` +
|
|
588
|
+
"sauce_wallet_send { wallet, transaction: <this result> }. It rehearses them first, " +
|
|
589
|
+
"and holds them to the wallet's policy.",
|
|
590
|
+
],
|
|
591
|
+
};
|
|
592
|
+
}
|
|
593
|
+
catch {
|
|
594
|
+
return output;
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
export function registerTools(server, context) {
|
|
598
|
+
const { endpoints } = context;
|
|
599
|
+
const tool = toolRegistrar(server, context);
|
|
600
|
+
tool("sauce_chains", {
|
|
601
|
+
title: "List the chains",
|
|
602
|
+
description: "Lists every chain a Sauce program can run on, to choose the `chain` the other tools " +
|
|
603
|
+
"take: each chain's slug, numeric id, name, kind (evm or svm) and aliases, `support`, " +
|
|
604
|
+
`and \`endpoint\`. \`support\` is "supported" for ${supportedChainNames()}, where this ` +
|
|
605
|
+
'release builds transactions, and "preview" for every other chain: programs compile ' +
|
|
606
|
+
"and simulate there, but the tools that build a transaction refuse it (`refused` says " +
|
|
607
|
+
"how to request the chain). `endpoint` is whether this server has its own RPC endpoint " +
|
|
608
|
+
"for the chain; a tool that reads a chain without one needs the call's rpcUrl. Reads " +
|
|
609
|
+
"nothing.",
|
|
610
|
+
input: {},
|
|
611
|
+
output: {
|
|
612
|
+
chains: z.array(z.looseObject({
|
|
613
|
+
slug: z.string(),
|
|
614
|
+
id: z.number(),
|
|
615
|
+
kind: z.enum(["evm", "svm"]),
|
|
616
|
+
support: z.enum(["supported", "preview"]),
|
|
617
|
+
endpoint: z.boolean(),
|
|
618
|
+
})),
|
|
619
|
+
supported: z.array(z.string()),
|
|
620
|
+
requestChain: z.string(),
|
|
621
|
+
},
|
|
622
|
+
annotations: PURE,
|
|
623
|
+
}, () => ({
|
|
624
|
+
json: {
|
|
625
|
+
chains: CANONICAL_CHAINS.map((chain) => ({
|
|
626
|
+
slug: chain.slug,
|
|
627
|
+
id: chain.id,
|
|
628
|
+
name: chain.name,
|
|
629
|
+
kind: chain.kind,
|
|
630
|
+
aliases: chain.aliases,
|
|
631
|
+
support: chainSupport(chain),
|
|
632
|
+
endpoint: endpoints.chainIds.includes(chain.id),
|
|
633
|
+
})),
|
|
634
|
+
supported: CANONICAL_CHAINS.filter((chain) => chainSupport(chain) === "supported").map((chain) => chain.slug),
|
|
635
|
+
requestChain: CHAIN_SUPPORT_NEW_ISSUE_URL,
|
|
636
|
+
},
|
|
637
|
+
}));
|
|
638
|
+
tool("sauce_globals", {
|
|
639
|
+
title: "List the names a program can use on a chain",
|
|
640
|
+
description: "Lists the names a program on one chain may use without declaring them — use it before " +
|
|
641
|
+
"writing a program, to call tokens and protocols by name instead of by address: token " +
|
|
642
|
+
"symbols with their addresses and decimals, protocol namespaces with each contract's " +
|
|
643
|
+
"address (with `protocol`, also its methods), the chain names that open intents, the " +
|
|
644
|
+
"defines, and the @sauce/token functions. With no filter, everything but the chain's " +
|
|
645
|
+
"tokenized stocks (Ethereum and Solana have over a thousand each; Base's include " +
|
|
646
|
+
"Coinbase's, such as SPCXc for SpaceX; Solana's are Token-2022 mints, such as TSLAx), " +
|
|
647
|
+
"which a program names like any token: `stocks` lists them and " +
|
|
648
|
+
"`search` finds one by symbol, company name or ticker, each with its issuer, the " +
|
|
649
|
+
"underlying's ticker and the issuer's list it was copied from. Tokens come " +
|
|
650
|
+
`${TOKEN_PAGE} at a time: \`offset\` pages on. Reads nothing.`,
|
|
651
|
+
input: {
|
|
652
|
+
chain: chainRef,
|
|
653
|
+
tokens: z.boolean().optional().describe("Only the token symbols."),
|
|
654
|
+
protocols: z.boolean().optional().describe("Only the protocol namespaces."),
|
|
655
|
+
stocks: z.boolean().optional().describe("Only the chain's tokenized stocks."),
|
|
656
|
+
search: z
|
|
657
|
+
.string()
|
|
658
|
+
.min(1)
|
|
659
|
+
.max(100)
|
|
660
|
+
.optional()
|
|
661
|
+
.describe("Only the tokens, stocks included, whose symbol, name, ticker or issuer contains " +
|
|
662
|
+
"this text, without regard to case: spacex, SPCX, Tesla."),
|
|
663
|
+
offset: z
|
|
664
|
+
.number()
|
|
665
|
+
.int()
|
|
666
|
+
.min(0)
|
|
667
|
+
.optional()
|
|
668
|
+
.describe(`The first token to return, for the next page (${TOKEN_PAGE} a page).`),
|
|
669
|
+
protocol: z
|
|
670
|
+
.string()
|
|
671
|
+
.min(1)
|
|
672
|
+
.max(100)
|
|
673
|
+
.optional()
|
|
674
|
+
.describe("One namespace, as a program writes it (UniswapV4) or by its slug (uniswap-v4), " +
|
|
675
|
+
"with its methods' signatures."),
|
|
676
|
+
},
|
|
677
|
+
output: { chain: z.looseObject({ slug: z.string(), id: z.number() }) },
|
|
678
|
+
annotations: PURE,
|
|
679
|
+
}, (args) => {
|
|
680
|
+
const output = fromCommand(globalsCommand({
|
|
681
|
+
chain: parseChain(String(args.chain), "chain"),
|
|
682
|
+
tokens: args.tokens === true,
|
|
683
|
+
protocols: args.protocols === true,
|
|
684
|
+
stocks: args.stocks === true,
|
|
685
|
+
...(args.protocol === undefined ? {} : { protocol: args.protocol }),
|
|
686
|
+
...(args.search === undefined ? {} : { search: args.search }),
|
|
687
|
+
}));
|
|
688
|
+
const protocols = output.json.protocols;
|
|
689
|
+
const tokens = output.json.tokens;
|
|
690
|
+
// A page of tokens: `stocks` on Ethereum is over a thousand.
|
|
691
|
+
const offset = args.offset ?? 0;
|
|
692
|
+
const page = tokens === undefined
|
|
693
|
+
? {}
|
|
694
|
+
: {
|
|
695
|
+
tokens: tokens.slice(offset, offset + TOKEN_PAGE),
|
|
696
|
+
...(tokens.length > TOKEN_PAGE || offset > 0
|
|
697
|
+
? {
|
|
698
|
+
page: {
|
|
699
|
+
offset,
|
|
700
|
+
total: tokens.length,
|
|
701
|
+
...(offset + TOKEN_PAGE < tokens.length ? { next: offset + TOKEN_PAGE } : {}),
|
|
702
|
+
},
|
|
703
|
+
}
|
|
704
|
+
: {}),
|
|
705
|
+
};
|
|
706
|
+
// Every namespace's methods are tens of kilobytes: they come with `protocol`, for one.
|
|
707
|
+
return {
|
|
708
|
+
...output,
|
|
709
|
+
json: {
|
|
710
|
+
...output.json,
|
|
711
|
+
...page,
|
|
712
|
+
...(protocols === undefined
|
|
713
|
+
? {}
|
|
714
|
+
: {
|
|
715
|
+
protocols: protocols.map((namespace) => ({
|
|
716
|
+
...namespace,
|
|
717
|
+
contracts: (namespace.contracts ?? []).map(({ methods: _methods, ...contract }) => contract),
|
|
718
|
+
})),
|
|
719
|
+
}),
|
|
720
|
+
},
|
|
721
|
+
};
|
|
722
|
+
});
|
|
723
|
+
tool("sauce_price", {
|
|
724
|
+
title: "Turn a price into a swap's limits, or read a pool's price",
|
|
725
|
+
description: "The numbers a swap program takes, for a pair on an EVM chain: the pool's sqrtPriceX96 " +
|
|
726
|
+
"for the pair's order (token0 is the lower address) — which is also a swap's " +
|
|
727
|
+
"sqrtPriceLimitX96 — and, for selling and for buying the base token, the minAvgPrice a " +
|
|
728
|
+
"program checks a fill against (out * 1e18 >= minAvgPrice * spent). Give the price one " +
|
|
729
|
+
"of three ways: `price` (a decimal), `sqrtPriceX96` (to read it back), or `pool` with an " +
|
|
730
|
+
"endpoint, which reads a Uniswap V3-style pool's slot0, liquidity and fee now. With " +
|
|
731
|
+
"slippageBps, `limits` gives each direction's sqrtPriceLimitX96 that far from the price, " +
|
|
732
|
+
"and a minAvgPrice that also pays the pool's fee (feePpm, or the pool's own). Uniswap V3 " +
|
|
733
|
+
"and V4 and their forks share the arithmetic. Use it to set a swap's limits, then pass " +
|
|
734
|
+
"them as defines or arguments.",
|
|
735
|
+
input: {
|
|
736
|
+
chain: chainRef,
|
|
737
|
+
base: z
|
|
738
|
+
.string()
|
|
739
|
+
.min(1)
|
|
740
|
+
.max(64)
|
|
741
|
+
.describe("The token the price is per one of: a symbol the chain registers (WETH, or a " +
|
|
742
|
+
"tokenized stock's such as SPCXc, in any case), or <0x address>:<decimals>, or with " +
|
|
743
|
+
"an endpoint a 0x address alone (its decimals read from the token)."),
|
|
744
|
+
quote: z
|
|
745
|
+
.string()
|
|
746
|
+
.min(1)
|
|
747
|
+
.max(64)
|
|
748
|
+
.describe("The token the price is in: a symbol (USDC), or <0x address>:<decimals>, or with an " +
|
|
749
|
+
"endpoint a 0x address alone."),
|
|
750
|
+
price: z
|
|
751
|
+
.string()
|
|
752
|
+
.max(80)
|
|
753
|
+
.optional()
|
|
754
|
+
.describe("How many whole quote tokens one whole base token is worth, a decimal: 2700."),
|
|
755
|
+
sqrtPriceX96: z
|
|
756
|
+
.string()
|
|
757
|
+
.max(80)
|
|
758
|
+
.optional()
|
|
759
|
+
.describe("A pool's sqrtPriceX96, a decimal integer, to read back as a price."),
|
|
760
|
+
pool: z
|
|
761
|
+
.string()
|
|
762
|
+
.max(64)
|
|
763
|
+
.optional()
|
|
764
|
+
.describe("A Uniswap V3-style pool of the pair (0x address), read now through an endpoint: its " +
|
|
765
|
+
"slot0 price, liquidity and fee. (A V4 pool has no address; read it with its " +
|
|
766
|
+
"StateView in sauce_simulate.)"),
|
|
767
|
+
slippageBps: z
|
|
768
|
+
.number()
|
|
769
|
+
.int()
|
|
770
|
+
.min(0)
|
|
771
|
+
.max(5000)
|
|
772
|
+
.optional()
|
|
773
|
+
.describe("How far from the price each direction's limit sits, in basis points: 50 = 0.5%."),
|
|
774
|
+
feePpm: z
|
|
775
|
+
.number()
|
|
776
|
+
.int()
|
|
777
|
+
.min(0)
|
|
778
|
+
.max(999_999)
|
|
779
|
+
.optional()
|
|
780
|
+
.describe("The pool's fee in millionths (3000 = 0.3%), paid into each minAvgPrice. Default: the " +
|
|
781
|
+
"pool's own when `pool` is given, else none."),
|
|
782
|
+
rpcUrl: RPC_URL,
|
|
783
|
+
},
|
|
784
|
+
output: {
|
|
785
|
+
price: z.string(),
|
|
786
|
+
sqrtPriceX96: z.string(),
|
|
787
|
+
token0: z.string(),
|
|
788
|
+
token1: z.string(),
|
|
789
|
+
},
|
|
790
|
+
annotations: READS_CHAIN,
|
|
791
|
+
}, async (args, reach) => {
|
|
792
|
+
const chain = pricedChain(parseChain(String(args.chain), "chain"));
|
|
793
|
+
const given = [args.price, args.sqrtPriceX96, args.pool].filter((each) => each !== undefined);
|
|
794
|
+
if (given.length !== 1) {
|
|
795
|
+
throw new UsageError("give one of price, sqrtPriceX96, or pool (with an endpoint)");
|
|
796
|
+
}
|
|
797
|
+
// A pool is read now, and an address with no decimals given has them read from the token;
|
|
798
|
+
// otherwise the call reaches no chain.
|
|
799
|
+
const reads = args.pool !== undefined ||
|
|
800
|
+
[args.base, args.quote].some((raw) => typeof tokenGiven(raw, chain) === "string");
|
|
801
|
+
const rpcUrl = reads ? await reach.endpoint(chain, args.rpcUrl) : undefined;
|
|
802
|
+
const client = rpcUrl === undefined ? undefined : await connect(rpcUrl, chain);
|
|
803
|
+
const tokens = await resolvePriceTokens([args.base, args.quote], chain, client);
|
|
804
|
+
const [base, quote] = [tokens[0], tokens[1]];
|
|
805
|
+
let pool;
|
|
806
|
+
let sqrtPriceX96 = args.sqrtPriceX96;
|
|
807
|
+
let feePpm = args.feePpm;
|
|
808
|
+
if (args.pool !== undefined) {
|
|
809
|
+
const address = parseAddress("pool", args.pool);
|
|
810
|
+
if (client === undefined)
|
|
811
|
+
await reach.require(chain, args.rpcUrl, "Reading a pool");
|
|
812
|
+
const read = await readPool(client, address);
|
|
813
|
+
const pair = [base.address, quote.address].map((token) => token.toLowerCase()).sort();
|
|
814
|
+
if (read.token0.toLowerCase() !== pair[0] || read.token1.toLowerCase() !== pair[1]) {
|
|
815
|
+
throw new UsageError(`the pool trades ${read.token0} and ${read.token1}, not ${base.symbol} and ${quote.symbol}`);
|
|
816
|
+
}
|
|
817
|
+
sqrtPriceX96 = read.sqrtPriceX96.toString();
|
|
818
|
+
feePpm ??= read.fee;
|
|
819
|
+
pool = {
|
|
820
|
+
address,
|
|
821
|
+
sqrtPriceX96: read.sqrtPriceX96.toString(),
|
|
822
|
+
tick: read.tick,
|
|
823
|
+
liquidity: read.liquidity.toString(),
|
|
824
|
+
feePpm: read.fee,
|
|
825
|
+
readFrom: chain.slug,
|
|
826
|
+
};
|
|
827
|
+
}
|
|
828
|
+
const at = (price) => priceCommand({ chain, base, quote, price });
|
|
829
|
+
const now = at(priceGiven(args.price, sqrtPriceX96));
|
|
830
|
+
const json = {
|
|
831
|
+
...now.json,
|
|
832
|
+
...(pool === undefined ? {} : { pool }),
|
|
833
|
+
};
|
|
834
|
+
if (args.slippageBps !== undefined) {
|
|
835
|
+
const price = now.json.price;
|
|
836
|
+
const bps = BigInt(args.slippageBps);
|
|
837
|
+
const fee = BigInt(feePpm ?? 0);
|
|
838
|
+
const side = (output, name) => output.json[name];
|
|
839
|
+
// The limit is the pool's price that far out; the floor also pays the pool's fee.
|
|
840
|
+
const sellLimit = at({ decimal: scaled(price, 10000n - bps, 10000n) });
|
|
841
|
+
const buyLimit = at({ decimal: scaled(price, 10000n + bps, 10000n) });
|
|
842
|
+
const sellFloor = at({
|
|
843
|
+
decimal: scaled(price, (10000n - bps) * (1000000n - fee), 10000n * 1000000n),
|
|
844
|
+
});
|
|
845
|
+
const buyFloor = at({
|
|
846
|
+
decimal: scaled(price, (10000n + bps) * 1000000n, 10000n * (1000000n - fee)),
|
|
847
|
+
});
|
|
848
|
+
json.limits = {
|
|
849
|
+
slippageBps: args.slippageBps,
|
|
850
|
+
feePpm: feePpm ?? 0,
|
|
851
|
+
sell: {
|
|
852
|
+
price: sellLimit.json.price,
|
|
853
|
+
sqrtPriceLimitX96: side(sellLimit, "sell").sqrtPriceLimitX96,
|
|
854
|
+
minAvgPrice: side(sellFloor, "sell").minAvgPrice,
|
|
855
|
+
},
|
|
856
|
+
buy: {
|
|
857
|
+
price: buyLimit.json.price,
|
|
858
|
+
sqrtPriceLimitX96: side(buyLimit, "buy").sqrtPriceLimitX96,
|
|
859
|
+
minAvgPrice: side(buyFloor, "buy").minAvgPrice,
|
|
860
|
+
},
|
|
861
|
+
};
|
|
862
|
+
}
|
|
863
|
+
return { json, notes: now.notes };
|
|
864
|
+
});
|
|
865
|
+
tool("sauce_pools", {
|
|
866
|
+
title: "List a pair's price-limit pools on a chain",
|
|
867
|
+
description: "Every pool of a pair on an EVM chain at the price-limit venues the registry records " +
|
|
868
|
+
"there — Uniswap V3 and PancakeSwap V3 at each fee tier their factory enables, Aerodrome " +
|
|
869
|
+
"Slipstream at each tick spacing of each CLFactory, hookless Uniswap V4 pools at the " +
|
|
870
|
+
"keys 100:1, 500:10, 3000:60 and 10000:200 and any in v4Pools — read now through an " +
|
|
871
|
+
"endpoint. Use it before a distributed or limit swap, to know which pools exist, how " +
|
|
872
|
+
"deep each is and what each charges. `pools` holds those with liquidity, deepest " +
|
|
873
|
+
"first (by liquidity at the pool's price): each pool's venue, the contract a program " +
|
|
874
|
+
"finds it through (UniswapV3.Factory), its address (a V4 pool's poolId and key), fee " +
|
|
875
|
+
"in millionths read from the pool (a V4 pool's LP fee and protocolFee), tickSpacing, " +
|
|
876
|
+
"liquidity, tick and sqrtPriceX96, and two `sides`, paying tokenA for tokenB then the " +
|
|
877
|
+
"reverse: `mid` and `taker` (pay tokens per buy token, before and with the fee), " +
|
|
878
|
+
"`maxPrice` (the taker price as the distributed swap's maxPrice argument: pay base " +
|
|
879
|
+
"units per buy base unit times 1e18) and `depth1Pct` (pay tokens, fee included, that " +
|
|
880
|
+
"move the price 1% against the taker, through its ticks). `empty` lists the pools with " +
|
|
881
|
+
"no liquidity at their price, which a swap skips; `checked`, what was looked at.",
|
|
882
|
+
input: {
|
|
883
|
+
chain: chainRef,
|
|
884
|
+
tokenA: z
|
|
885
|
+
.string()
|
|
886
|
+
.min(1)
|
|
887
|
+
.max(64)
|
|
888
|
+
.describe("One token of the pair, paid in the first side: a symbol the chain registers " +
|
|
889
|
+
"(USDC, or a tokenized stock's such as SPCXc, in any case), or a 0x address (its " +
|
|
890
|
+
"decimals and symbol read from the token), or <0x address>:<decimals>."),
|
|
891
|
+
tokenB: z.string().min(1).max(64).describe("The other token, written the same ways."),
|
|
892
|
+
v4Pools: z
|
|
893
|
+
.array(z.string().min(3).max(16))
|
|
894
|
+
.max(MAX_V4_KEYS)
|
|
895
|
+
.optional()
|
|
896
|
+
.describe("More hookless Uniswap V4 pools to try, each by its key's <fee>:<tickSpacing>, the " +
|
|
897
|
+
"fee in millionths: 50:1."),
|
|
898
|
+
rpcUrl: RPC_URL,
|
|
899
|
+
},
|
|
900
|
+
output: {
|
|
901
|
+
chain: z.string(),
|
|
902
|
+
tokens: z.array(z.looseObject({ symbol: z.string(), address: z.string(), decimals: z.number() })),
|
|
903
|
+
sortedBy: z.string(),
|
|
904
|
+
pools: z.array(z.looseObject({
|
|
905
|
+
venue: z.string(),
|
|
906
|
+
contract: z.string(),
|
|
907
|
+
fee: z.number(),
|
|
908
|
+
tickSpacing: z.number(),
|
|
909
|
+
liquidity: z.string(),
|
|
910
|
+
sqrtPriceX96: z.string(),
|
|
911
|
+
sides: z.array(z.looseObject({
|
|
912
|
+
pay: z.string(),
|
|
913
|
+
buy: z.string(),
|
|
914
|
+
mid: z.string(),
|
|
915
|
+
taker: z.string(),
|
|
916
|
+
maxPrice: z.string(),
|
|
917
|
+
})),
|
|
918
|
+
})),
|
|
919
|
+
empty: z.array(z.looseObject({ venue: z.string(), why: z.string() })),
|
|
920
|
+
checked: z.array(z.looseObject({ venue: z.string(), contract: z.string() })),
|
|
921
|
+
},
|
|
922
|
+
annotations: READS_CHAIN,
|
|
923
|
+
}, async (args, reach) => {
|
|
924
|
+
const chain = parseChain(String(args.chain), "chain");
|
|
925
|
+
if (chain.kind !== "evm") {
|
|
926
|
+
throw new UsageError(`sauce_pools lists Uniswap V3- and V4-style pools, on an EVM chain; ${chain.slug} has none`);
|
|
927
|
+
}
|
|
928
|
+
const v4Keys = (args.v4Pools ?? []).map((raw) => parseV4Key(raw, "v4Pools"));
|
|
929
|
+
const rpcUrl = await reach.require(chain, args.rpcUrl, "Listing a pair's pools");
|
|
930
|
+
return fromCommand(await poolsCommand({
|
|
931
|
+
chain,
|
|
932
|
+
client: await connect(rpcUrl, chain),
|
|
933
|
+
tokens: [args.tokenA, args.tokenB],
|
|
934
|
+
v4Keys,
|
|
935
|
+
}));
|
|
936
|
+
});
|
|
937
|
+
tool("sauce_compile", {
|
|
938
|
+
title: "Compile a SauceScript program",
|
|
939
|
+
description: "Compiles a SauceScript program for a chain — use it to check a program and to learn " +
|
|
940
|
+
"what it takes, before sauce_simulate or sauce_tx. The chain's token symbols, protocol " +
|
|
941
|
+
"namespaces, chainId, the @sauce/token functions and the intents the program opens all " +
|
|
942
|
+
"resolve against that chain. Returns the bytecode (0x hex) and its size in bytes, " +
|
|
943
|
+
"`entryParams` (main's runtime parameters, which sauce_tx's args fill) and how they are " +
|
|
944
|
+
"encoded (`entryEncoding`; with compactArgs, the compact-v1 `entrySchema`), the defines " +
|
|
945
|
+
"it was given, the compiler and the released engine it pairs with, and on Solana the " +
|
|
946
|
+
"account `manifest` (the accounts a cook attaches, in order). A program that does not " +
|
|
947
|
+
"compile is an error naming its line. Also `contracts`, each protocol contract it calls " +
|
|
948
|
+
"with its address, and with args the `payload` (the program with main's arguments " +
|
|
949
|
+
"appended, what a cook carries) and its size; on Solana, with args and accounts, the " +
|
|
950
|
+
"cook's transaction size against the one-transaction limit. For a program that opens " +
|
|
951
|
+
"intents, the result is the program the source chain runs; sauce_inspect with the " +
|
|
952
|
+
"source alone lists each intent's destination, route and reward. Reads no chain unless " +
|
|
953
|
+
"rpcUrls is given: then each intent's destination is checked for the Pot its cook " +
|
|
954
|
+
"needs (`intentPots`).",
|
|
955
|
+
input: {
|
|
956
|
+
...PROGRAM,
|
|
957
|
+
args: COOK.args,
|
|
958
|
+
accounts: COOK.accounts,
|
|
959
|
+
via: COOK.via.describe("Solana only: size the Kitchen's cook (the default) or the engine's own paid cook, " +
|
|
960
|
+
"which carries no Kitchen, Pot or salt."),
|
|
961
|
+
rpcUrls: RPC_URLS.describe("For a program that opens intents: each destination's endpoint by chain (slug or " +
|
|
962
|
+
'id), { "base": "<url>" }, to check the Pot its cook runs on is deployed there. ' +
|
|
963
|
+
"Used for this call only, never returned or logged."),
|
|
964
|
+
},
|
|
965
|
+
output: {
|
|
966
|
+
chain: z.string(),
|
|
967
|
+
chainId: z.number(),
|
|
968
|
+
target: z.enum(["evm", "svm"]),
|
|
969
|
+
bytecode: z.string(),
|
|
970
|
+
size: z.number(),
|
|
971
|
+
entryEncoding: z.string(),
|
|
972
|
+
entryParams: z.array(z.looseObject({ name: z.string(), type: z.string() })),
|
|
973
|
+
entrySchema: z.string().nullable(),
|
|
974
|
+
defines: z.unknown(),
|
|
975
|
+
manifest: z.unknown().optional(),
|
|
976
|
+
},
|
|
977
|
+
annotations: READS_CHAIN,
|
|
978
|
+
}, async (args, reach) => {
|
|
979
|
+
const program = programOf(args);
|
|
980
|
+
if (args.accounts !== undefined && program.input.chain.kind !== "svm") {
|
|
981
|
+
throw new UsageError(`accounts names a Solana program's accounts; a program on ${program.input.chain.slug} takes none`);
|
|
982
|
+
}
|
|
983
|
+
if (args.via !== undefined && program.input.chain.kind !== "svm") {
|
|
984
|
+
throw new UsageError(`via chooses how a Solana cook reaches the engine; a cook on ${program.input.chain.slug} ` +
|
|
985
|
+
"is the Pot's");
|
|
986
|
+
}
|
|
987
|
+
const byChain = await endpointsByChain(args.rpcUrls, reach);
|
|
988
|
+
return compiled({
|
|
989
|
+
input: {
|
|
990
|
+
...program.input,
|
|
991
|
+
...argsOf(args),
|
|
992
|
+
...(args.accounts === undefined
|
|
993
|
+
? {}
|
|
994
|
+
: {
|
|
995
|
+
accounts: parseAccounts(Object.entries(args.accounts).map(([name, value]) => `${name}=${value}`)),
|
|
996
|
+
}),
|
|
997
|
+
...(args.via === undefined ? {} : { via: parseVia(args.via, "via") }),
|
|
998
|
+
...(byChain.size === 0
|
|
999
|
+
? {}
|
|
1000
|
+
: { endpoints: (chain) => byChain.get(chain.id) }),
|
|
1001
|
+
},
|
|
1002
|
+
files: program.files,
|
|
1003
|
+
});
|
|
1004
|
+
});
|
|
1005
|
+
tool("sauce_actions", {
|
|
1006
|
+
title: "Compile an actions document, and build its cook",
|
|
1007
|
+
description: "Compiles an actions document — protocol operations written as JSON (swaps, bridges, " +
|
|
1008
|
+
"wraps, staking, lending, token moves), validated against its JSON Schema (resource " +
|
|
1009
|
+
"sauce://actions/schema.json; the sauce-actions skill lists every action) — into the " +
|
|
1010
|
+
"SauceScript program that runs them on a chain, as `sauce actions` does. Use it instead " +
|
|
1011
|
+
"of writing SauceScript when the task is a fixed sequence of protocol operations. Names " +
|
|
1012
|
+
"resolve on the chain it compiles for: tokens by registry symbol (USDC), contracts as " +
|
|
1013
|
+
"Namespace.Contract (AaveV3.Pool), pools by their factory's key; a document without a " +
|
|
1014
|
+
"chainId compiles on any chain that has its names, given `chain`. Returns sauce_compile's " +
|
|
1015
|
+
"report for the generated program (bytecode, size, entryParams, …) with `source` (the " +
|
|
1016
|
+
"generated SauceScript), `parameters` (the argument actions, in the order main takes " +
|
|
1017
|
+
"them as args) and the bindings it calls through; given owner or pot, also " +
|
|
1018
|
+
"`transaction`: the unsigned cook, exactly as sauce_tx returns it — on a preview chain " +
|
|
1019
|
+
"the report with `refused` instead of it. EVM chains only. " +
|
|
1020
|
+
`${UNSIGNED} ${SUPPORTED_ONLY}`,
|
|
1021
|
+
input: {
|
|
1022
|
+
program: z
|
|
1023
|
+
.union([z.string().min(2).max(LIMITS.source), z.looseObject({})])
|
|
1024
|
+
.describe('The actions document: { "version": 1, "actions": [...] }, as an object or its JSON ' +
|
|
1025
|
+
'text. Amounts are base-unit integers as decimal strings; `recipient: "self"` is ' +
|
|
1026
|
+
"the Pot. Leave chainId out to compile it for `chain`."),
|
|
1027
|
+
chain: chainRef
|
|
1028
|
+
.optional()
|
|
1029
|
+
.describe("The chain to compile for (slug, alias or id). Needed when the document has no " +
|
|
1030
|
+
"chainId; one with a chainId compiles for that chain only."),
|
|
1031
|
+
target: z.enum(["evm"]).optional().describe("Always evm: actions run on EVM chains."),
|
|
1032
|
+
compactArgs: PROGRAM.compactArgs,
|
|
1033
|
+
...COOK,
|
|
1034
|
+
},
|
|
1035
|
+
output: {
|
|
1036
|
+
bytecode: z.string(),
|
|
1037
|
+
size: z.number(),
|
|
1038
|
+
source: z.string(),
|
|
1039
|
+
parameters: z.array(z.string()),
|
|
1040
|
+
transaction: z.looseObject({}).optional(),
|
|
1041
|
+
refused: REFUSED.optional(),
|
|
1042
|
+
},
|
|
1043
|
+
annotations: READS_CHAIN,
|
|
1044
|
+
}, async (args, reach) => {
|
|
1045
|
+
const text = typeof args.program === "string" ? args.program : JSON.stringify(args.program);
|
|
1046
|
+
if (text.length > LIMITS.source) {
|
|
1047
|
+
throw new UsageError(`program: at most ${LIMITS.source} characters`);
|
|
1048
|
+
}
|
|
1049
|
+
const input = {
|
|
1050
|
+
file: ACTIONS_FILE,
|
|
1051
|
+
text,
|
|
1052
|
+
...(args.chain === undefined ? {} : { chain: String(args.chain) }),
|
|
1053
|
+
compactArgs: args.compactArgs === true,
|
|
1054
|
+
};
|
|
1055
|
+
const report = await actionsCommand(input);
|
|
1056
|
+
const cook = args.owner !== undefined || args.pot !== undefined
|
|
1057
|
+
? { input: await actionsProgram(input), files: callFiles(ACTIONS_FILE, text, {}).files }
|
|
1058
|
+
: undefined;
|
|
1059
|
+
// The report on every chain; its cook only on a supported one, before any endpoint.
|
|
1060
|
+
const refused = cook === undefined
|
|
1061
|
+
? undefined
|
|
1062
|
+
: previewRefusal("building the cook transaction", programChains(cook.input, cook.files));
|
|
1063
|
+
const building = cook === undefined || refused !== undefined
|
|
1064
|
+
? undefined
|
|
1065
|
+
: await cookTransaction(args, cook, reach);
|
|
1066
|
+
return {
|
|
1067
|
+
json: {
|
|
1068
|
+
...report.json,
|
|
1069
|
+
...(building === undefined ? {} : { transaction: building.json }),
|
|
1070
|
+
...(refused === undefined ? {} : { refused }),
|
|
1071
|
+
},
|
|
1072
|
+
notes: [
|
|
1073
|
+
...(report.notes ?? []),
|
|
1074
|
+
...(building?.notes ?? []),
|
|
1075
|
+
...(refused === undefined ? [] : [refused.message]),
|
|
1076
|
+
],
|
|
1077
|
+
};
|
|
1078
|
+
});
|
|
1079
|
+
tool("sauce_tx", {
|
|
1080
|
+
title: "Build the unsigned cook transaction",
|
|
1081
|
+
description: "Builds the transaction that runs a program on its Pot, unsigned, for the Pot's owner to " +
|
|
1082
|
+
"sign — the last step, once sauce_compile succeeds (and, ideally, sauce_simulate). On " +
|
|
1083
|
+
"an EVM chain it returns { chainId, to: the Pot, data: Pot.cook(engine, program ++ " +
|
|
1084
|
+
"arguments), value }; only the owner may send it, and value (wei) is the Kitchen's fee " +
|
|
1085
|
+
"plus any native the program spends — give it, or an endpoint to read the fee from, " +
|
|
1086
|
+
"which also says whether the Pot is deployed. On Solana it returns { chain, via, " +
|
|
1087
|
+
"feePayer, pot, fee, maxExecutionFee, transaction }: the Kitchen cook (or, via engine, " +
|
|
1088
|
+
"the engine's own paid cook, with no Pot) as a base64 transaction for the owner to sign, " +
|
|
1089
|
+
"which needs an endpoint (its blockhash and the fee). `notes` say what must be true for " +
|
|
1090
|
+
`it to land: a deployed, funded Pot (sauce_pot deploys it). ${UNSIGNED} ${SUPPORTED_ONLY}`,
|
|
1091
|
+
input: { ...PROGRAM, ...COOK },
|
|
1092
|
+
output: refusable({
|
|
1093
|
+
chainId: z.number(),
|
|
1094
|
+
to: z.string(),
|
|
1095
|
+
data: z.string(),
|
|
1096
|
+
value: z.string(),
|
|
1097
|
+
transaction: z.string(),
|
|
1098
|
+
}),
|
|
1099
|
+
annotations: READS_CHAIN,
|
|
1100
|
+
}, async (args, reach) => {
|
|
1101
|
+
const program = programOf(args);
|
|
1102
|
+
// Before any endpoint: the chain, and every chain an intent the program opens goes to.
|
|
1103
|
+
requireSupported("building the cook transaction", programChains(program.input, program.files));
|
|
1104
|
+
const output = await cookTransaction(args, program, reach);
|
|
1105
|
+
if (program.input.chain.kind === "svm")
|
|
1106
|
+
return fromCommand(output);
|
|
1107
|
+
const chain = program.input.chain;
|
|
1108
|
+
const rpcUrl = await reach.endpoint(chain, args.rpcUrl);
|
|
1109
|
+
const client = rpcUrl === undefined ? undefined : await connect(rpcUrl, chain);
|
|
1110
|
+
const fee = client === undefined ? undefined : await kitchenFee(client, chain);
|
|
1111
|
+
const owner = args.owner !== undefined
|
|
1112
|
+
? parseAddress("owner", args.owner)
|
|
1113
|
+
: client === undefined
|
|
1114
|
+
? undefined
|
|
1115
|
+
: (await potState(client, output.json.to)).owner;
|
|
1116
|
+
return {
|
|
1117
|
+
json: {
|
|
1118
|
+
...output.json,
|
|
1119
|
+
from: owner ?? null,
|
|
1120
|
+
kitchenFee: fee === undefined
|
|
1121
|
+
? null
|
|
1122
|
+
: { wei: fee.toString(), native: formatUnits(fee, 18), readFrom: chain.slug },
|
|
1123
|
+
},
|
|
1124
|
+
notes: [
|
|
1125
|
+
...(output.notes ?? []),
|
|
1126
|
+
...(fee === undefined
|
|
1127
|
+
? ["The Kitchen's fee was not read (no endpoint): value is as given."]
|
|
1128
|
+
: []),
|
|
1129
|
+
"sauce_tx does not rehearse the cook: run sauce_simulate to see whether it reverts now.",
|
|
1130
|
+
],
|
|
1131
|
+
};
|
|
1132
|
+
});
|
|
1133
|
+
tool("sauce_pot", {
|
|
1134
|
+
title: "Predict a Pot, build its deployment, and read what it holds",
|
|
1135
|
+
description: "A Pot is the owner's on-chain account that runs their programs and holds their " +
|
|
1136
|
+
"tokens. Its address is known before it exists: the released Kitchen derives it from " +
|
|
1137
|
+
"(owner, salt). Returns `pot` and the unsigned deployment — on an EVM chain " +
|
|
1138
|
+
"Kitchen.deployPot as { to, data, value }, which any account may send (the Pot is the " +
|
|
1139
|
+
"owner's either way); on Solana the Kitchen's create_pot `instruction`, which the owner " +
|
|
1140
|
+
"signs. With an endpoint it also says `deployed` (null without one) — when true, do not " +
|
|
1141
|
+
"send the deployment — and reads what the cook will need: on an EVM chain the Kitchen's " +
|
|
1142
|
+
"fee (the least a cook's value can be) and the Pot's balance of the native currency and " +
|
|
1143
|
+
"of every token the chain registers but its tokenized stocks; on Solana the Pot's " +
|
|
1144
|
+
"associated token account for each registered mint but the tokenized stocks, whether it " +
|
|
1145
|
+
"exists, and its balance. On a preview chain the Pot " +
|
|
1146
|
+
"is predicted and read, and the deployment is left out: `refused` says why, and how to " +
|
|
1147
|
+
`request the chain. ${UNSIGNED} ${SUPPORTED_ONLY}`,
|
|
1148
|
+
input: {
|
|
1149
|
+
chain: chainRef,
|
|
1150
|
+
...POT,
|
|
1151
|
+
balances: z
|
|
1152
|
+
.boolean()
|
|
1153
|
+
.optional()
|
|
1154
|
+
.describe("With an endpoint, read the Pot's balances (default true); false skips those reads."),
|
|
1155
|
+
rpcUrl: RPC_URL,
|
|
1156
|
+
},
|
|
1157
|
+
output: {
|
|
1158
|
+
pot: z.string(),
|
|
1159
|
+
owner: z.string(),
|
|
1160
|
+
salt: z.string(),
|
|
1161
|
+
deployed: z.boolean().nullable(),
|
|
1162
|
+
refused: REFUSED.optional(),
|
|
1163
|
+
},
|
|
1164
|
+
annotations: READS_CHAIN,
|
|
1165
|
+
}, async (args, reach) => {
|
|
1166
|
+
const chain = parseChain(String(args.chain), "chain");
|
|
1167
|
+
if (args.owner === undefined)
|
|
1168
|
+
throw new UsageError("missing owner: whose Pot");
|
|
1169
|
+
const salt = parseSalt(args.salt, args.saltHex);
|
|
1170
|
+
const rpcUrl = await reach.endpoint(chain, args.rpcUrl);
|
|
1171
|
+
const reading = rpcUrl !== undefined && args.balances !== false;
|
|
1172
|
+
const unchecked = `There is no endpoint for ${chain.slug}, so whether the Pot exists was not checked: pass rpcUrl to check.`;
|
|
1173
|
+
const deployedNote = "The Pot is deployed already: do not send the deployment.";
|
|
1174
|
+
if (chain.kind === "svm") {
|
|
1175
|
+
const target = { owner: parsePubkey("owner", args.owner), ...salt };
|
|
1176
|
+
const output = await svmPotCommand(target);
|
|
1177
|
+
const deployed = rpcUrl === undefined ? null : await svmPotExists(target, rpcUrl);
|
|
1178
|
+
const tokenAccounts = reading
|
|
1179
|
+
? await svmPotTokenAccounts(target, rpcUrl, chain)
|
|
1180
|
+
: undefined;
|
|
1181
|
+
return {
|
|
1182
|
+
json: {
|
|
1183
|
+
...output.json,
|
|
1184
|
+
deployed,
|
|
1185
|
+
...(tokenAccounts === undefined ? {} : { tokenAccounts }),
|
|
1186
|
+
},
|
|
1187
|
+
notes: [
|
|
1188
|
+
...(output.notes ?? []),
|
|
1189
|
+
...(deployed === null ? [unchecked] : deployed ? [deployedNote] : []),
|
|
1190
|
+
],
|
|
1191
|
+
};
|
|
1192
|
+
}
|
|
1193
|
+
const output = potCommand({ chain, owner: parseAddress("owner", args.owner), ...salt });
|
|
1194
|
+
const pot = output.json.pot;
|
|
1195
|
+
const client = rpcUrl === undefined ? undefined : await connect(rpcUrl, chain);
|
|
1196
|
+
const deployed = client === undefined ? null : (await potState(client, pot)).deployed;
|
|
1197
|
+
const fee = client === undefined ? undefined : await kitchenFee(client, chain);
|
|
1198
|
+
const held = reading && client !== undefined ? await registeredBalances(client, chain, pot) : undefined;
|
|
1199
|
+
return {
|
|
1200
|
+
json: {
|
|
1201
|
+
...output.json,
|
|
1202
|
+
deployed,
|
|
1203
|
+
...(fee === undefined
|
|
1204
|
+
? {}
|
|
1205
|
+
: { kitchenFee: { wei: fee.toString(), native: formatUnits(fee, 18) } }),
|
|
1206
|
+
...(held === undefined
|
|
1207
|
+
? {}
|
|
1208
|
+
: {
|
|
1209
|
+
balances: {
|
|
1210
|
+
native: { wei: held.native.toString(), formatted: formatUnits(held.native, 18) },
|
|
1211
|
+
tokens: held.tokens.map((token) => ({
|
|
1212
|
+
symbol: token.symbol,
|
|
1213
|
+
address: token.address,
|
|
1214
|
+
balance: token.balance === null ? null : token.balance.toString(),
|
|
1215
|
+
formatted: token.balance === null ? null : formatUnits(token.balance, token.decimals),
|
|
1216
|
+
})),
|
|
1217
|
+
},
|
|
1218
|
+
}),
|
|
1219
|
+
},
|
|
1220
|
+
notes: [
|
|
1221
|
+
...(output.notes ?? []),
|
|
1222
|
+
...(deployed === null ? [unchecked] : deployed ? [deployedNote] : []),
|
|
1223
|
+
],
|
|
1224
|
+
};
|
|
1225
|
+
});
|
|
1226
|
+
tool("sauce_simulate", {
|
|
1227
|
+
title: "Rehearse a cook, with no key and nothing sent",
|
|
1228
|
+
description: "Rehearses the cook from the Pot's owner on the chain as it is now, to see what it would " +
|
|
1229
|
+
"do before building the transaction with sauce_tx. Needs an endpoint (rpcUrl, or the " +
|
|
1230
|
+
"server's). EVM: through eth_simulateV1 (else eth_call with state overrides; `path` " +
|
|
1231
|
+
"says which), on a Pot that need not be deployed yet — the rehearsal deploys it first. " +
|
|
1232
|
+
"Returns ok, gas, what main returns, the ERC-20 transfers and approvals, native " +
|
|
1233
|
+
"transfers and each address's net balance change; or the `stage` and decoded `reason` " +
|
|
1234
|
+
"it reverts — a revert is a result (ok: false), not an error. assumeBalance gives the " +
|
|
1235
|
+
"Pot balances for the rehearsal only; fund rehearses pulling tokens from the owner into " +
|
|
1236
|
+
"the Pot in the cook, the Pot credited what they would bring. Solana: the Kitchen cook " +
|
|
1237
|
+
"simulated from the owner (a missing Pot created first), or via engine the engine's own " +
|
|
1238
|
+
"paid cook with no Pot: compute units, the fee, or the reason and the program logs. Nothing is signed or sent.",
|
|
1239
|
+
input: {
|
|
1240
|
+
...PROGRAM,
|
|
1241
|
+
...COOK,
|
|
1242
|
+
assumeBalance: TOKEN_AMOUNTS.describe("EVM only: balances the Pot holds for this rehearsal only, by state override. Each " +
|
|
1243
|
+
"<TOKEN|address>:<amount>, the amount in whole units (USDC:2) or base units ending " +
|
|
1244
|
+
"in n (USDC:2000000n); ETH:<amount> for the native currency."),
|
|
1245
|
+
fund: TOKEN_AMOUNTS.describe("EVM only: tokens the cook would pull from the owner into the Pot before the program " +
|
|
1246
|
+
"runs; with no key here, the Pot is credited them instead. Each " +
|
|
1247
|
+
"<TOKEN|address>:<amount>, as assumeBalance."),
|
|
1248
|
+
fundMode: z
|
|
1249
|
+
.enum(["permit2", "permit", "allowance", "transfer"])
|
|
1250
|
+
.optional()
|
|
1251
|
+
.describe("How fund pulls (default permit2)."),
|
|
1252
|
+
sweep: z
|
|
1253
|
+
.boolean()
|
|
1254
|
+
.optional()
|
|
1255
|
+
.describe("With fund: return what is left of each funded token to the owner afterwards."),
|
|
1256
|
+
},
|
|
1257
|
+
output: { ok: z.boolean() },
|
|
1258
|
+
annotations: READS_CHAIN,
|
|
1259
|
+
}, async (args, reach) => {
|
|
1260
|
+
const program = programOf(args);
|
|
1261
|
+
const chain = program.input.chain;
|
|
1262
|
+
const rpcUrl = await reach.require(chain, args.rpcUrl, "Simulating");
|
|
1263
|
+
const funding = {
|
|
1264
|
+
chain,
|
|
1265
|
+
rpcUrl,
|
|
1266
|
+
fund: args.fund ?? [],
|
|
1267
|
+
...(args.fundMode === undefined ? {} : { mode: args.fundMode }),
|
|
1268
|
+
sweep: args.sweep === true,
|
|
1269
|
+
// A rehearsal: nothing sent, no key, so the pulls are credited rather than signed.
|
|
1270
|
+
send: false,
|
|
1271
|
+
approver: NO_APPROVER,
|
|
1272
|
+
};
|
|
1273
|
+
if (chain.kind === "svm") {
|
|
1274
|
+
if ((args.assumeBalance ?? []).length > 0) {
|
|
1275
|
+
throw new UsageError("assumeBalance is for EVM chains: a Solana endpoint's simulateTransaction takes no " +
|
|
1276
|
+
"account overrides, so on solana the rehearsal runs on the accounts as they are");
|
|
1277
|
+
}
|
|
1278
|
+
fundingFor(funding);
|
|
1279
|
+
return fromCommand(await svmSimulateCommand(svmCook(args, program, rpcUrl), program.files));
|
|
1280
|
+
}
|
|
1281
|
+
const cook = evmCook(args, program);
|
|
1282
|
+
const assume = assumedBalances(args.assumeBalance ?? [], chain);
|
|
1283
|
+
const fund = fundingFor(funding);
|
|
1284
|
+
return fromCommand(await simulateCommand({ ...cook, rpcUrl, assume, ...(fund === undefined ? {} : { fund }) }, program.files));
|
|
1285
|
+
});
|
|
1286
|
+
tool("sauce_intent_publish", {
|
|
1287
|
+
title: "Build an intent's unsigned publish transactions",
|
|
1288
|
+
description: "For a program that only opens cross-chain intents whose amounts are fixed when it is " +
|
|
1289
|
+
"built (every amount a define or a literal): the source chain's transactions that fund " +
|
|
1290
|
+
"and publish each intent from a wallet — each reward token transferred to the intent's " +
|
|
1291
|
+
"vault (and a native reward sent to it), then Portal.publish, with no approval — with " +
|
|
1292
|
+
"each intent's hash, vault and `record`, the intent in full, which sauce_intent_status " +
|
|
1293
|
+
"and the other intent tools take. Send them in order from the wallet that funds the " +
|
|
1294
|
+
"reward, the transfers first, and publish once they have landed. The vault is the " +
|
|
1295
|
+
"package's own computation; with `from` and an endpoint it is also read from the Portal " +
|
|
1296
|
+
"and must agree, or the tool refuses, and only what the vault does not hold yet is " +
|
|
1297
|
+
"transferred. intentFundVia publishAndFund gives each reward token's approve to the " +
|
|
1298
|
+
"Portal (a USDT-style reset to 0 first where needed), then Portal.publishAndFund, " +
|
|
1299
|
+
"instead. dryRun rehearses them together through eth_simulateV1 from `from` and reports " +
|
|
1300
|
+
"each intent's isIntentFunded after them (intents[].funded), assumeBalance giving that " +
|
|
1301
|
+
"wallet balances for the rehearsal only. A program that measures an amount on chain, or " +
|
|
1302
|
+
"does anything besides open intents, is refused: run it on a Pot (sauce_tx) instead. " +
|
|
1303
|
+
"dryRun works on every chain; the transactions only where the source and every " +
|
|
1304
|
+
`destination are supported. ${UNSIGNED} ${SUPPORTED_ONLY}`,
|
|
1305
|
+
input: {
|
|
1306
|
+
...PROGRAM,
|
|
1307
|
+
from: z
|
|
1308
|
+
.string()
|
|
1309
|
+
.max(64)
|
|
1310
|
+
.optional()
|
|
1311
|
+
.describe("The 0x wallet that funds and publishes: with an endpoint, the vault is read and " +
|
|
1312
|
+
"only what it lacks is transferred (or, with intentFundVia publishAndFund, the " +
|
|
1313
|
+
"approvals are planned against its allowance); dryRun's sender."),
|
|
1314
|
+
dryRun: z
|
|
1315
|
+
.boolean()
|
|
1316
|
+
.optional()
|
|
1317
|
+
.describe("Rehearse the transactions together (eth_simulateV1) instead; needs from and an " +
|
|
1318
|
+
"endpoint."),
|
|
1319
|
+
assumeBalance: TOKEN_AMOUNTS.describe("With dryRun: balances `from` holds for the rehearsal only, by state override. Each " +
|
|
1320
|
+
"<TOKEN|address>:<amount>, whole units or base units ending in n."),
|
|
1321
|
+
rpcUrl: RPC_URL,
|
|
1322
|
+
},
|
|
1323
|
+
output: refusable({ intents: z.array(z.looseObject({ intentHash: z.string() })) }),
|
|
1324
|
+
annotations: READS_CHAIN,
|
|
1325
|
+
}, async (args, reach) => {
|
|
1326
|
+
const program = programOf(args);
|
|
1327
|
+
const chain = program.input.chain;
|
|
1328
|
+
const from = args.from === undefined ? undefined : parseAddress("from", args.from);
|
|
1329
|
+
const assume = chain.kind === "evm" ? assumedBalances(args.assumeBalance ?? [], chain) : [];
|
|
1330
|
+
if (assume.length > 0 && args.dryRun !== true) {
|
|
1331
|
+
throw new UsageError("assumeBalance goes with dryRun: it gives the wallet a balance for a rehearsal, and " +
|
|
1332
|
+
"nothing to transactions that are sent");
|
|
1333
|
+
}
|
|
1334
|
+
if (args.dryRun === true) {
|
|
1335
|
+
if (from === undefined)
|
|
1336
|
+
throw new UsageError("a dry run needs whose wallet: give from");
|
|
1337
|
+
return withRecords(program, await publishCommand({
|
|
1338
|
+
...program.input,
|
|
1339
|
+
dryRun: true,
|
|
1340
|
+
rpcUrl: await reach.require(chain, args.rpcUrl, "A dry run"),
|
|
1341
|
+
from,
|
|
1342
|
+
...(assume.length === 0 ? {} : { assume }),
|
|
1343
|
+
}, program.files));
|
|
1344
|
+
}
|
|
1345
|
+
// Before any endpoint: the source, and every chain the intents go to.
|
|
1346
|
+
requireSupported("publishing intents", programChains(program.input, program.files));
|
|
1347
|
+
const rpcUrl = from === undefined ? undefined : await reach.endpoint(chain, args.rpcUrl);
|
|
1348
|
+
return withRecords(program, await publishCommand({
|
|
1349
|
+
...program.input,
|
|
1350
|
+
format: "json",
|
|
1351
|
+
dryRun: false,
|
|
1352
|
+
...(from === undefined ? {} : { from }),
|
|
1353
|
+
...(rpcUrl === undefined ? {} : { rpcUrl }),
|
|
1354
|
+
}, program.files));
|
|
1355
|
+
});
|
|
1356
|
+
tool("sauce_inspect", {
|
|
1357
|
+
title: "Take a call or a program apart",
|
|
1358
|
+
description: "Reads a transaction, calldata or program back into what its author wrote — use it to " +
|
|
1359
|
+
"check what you are about to sign, or what landed: a Pot.cook (its engine, its program, " +
|
|
1360
|
+
"the intents the program opens), a Kitchen.deployPot (the Pot it makes), a Portal " +
|
|
1361
|
+
"publish or publishAndFund (the route and the reward), an ERC-20 call, or a bare " +
|
|
1362
|
+
"program. A 32-byte hash is a transaction on `chain`, fetched through an endpoint " +
|
|
1363
|
+
"(rpcUrl, or the server's). With `source`, a cook's program is checked against that " +
|
|
1364
|
+
"program's and the arguments after it are decoded against main; `source` alone is " +
|
|
1365
|
+
"compiled and the intents it opens are listed.",
|
|
1366
|
+
input: {
|
|
1367
|
+
hex: z
|
|
1368
|
+
.string()
|
|
1369
|
+
.max(LIMITS.hex)
|
|
1370
|
+
.optional()
|
|
1371
|
+
.describe("0x hex: calldata, a program, or a 32-byte transaction hash."),
|
|
1372
|
+
...PROGRAM,
|
|
1373
|
+
source: PROGRAM.source
|
|
1374
|
+
.optional()
|
|
1375
|
+
.describe("The program the hex was compiled from, to check and decode it against; or, with " +
|
|
1376
|
+
"no hex, the program to inspect."),
|
|
1377
|
+
rpcUrl: RPC_URL,
|
|
1378
|
+
},
|
|
1379
|
+
output: {},
|
|
1380
|
+
annotations: READS_CHAIN,
|
|
1381
|
+
}, async (args, reach) => {
|
|
1382
|
+
if (args.hex === undefined) {
|
|
1383
|
+
if (args.source === undefined) {
|
|
1384
|
+
throw new UsageError("give hex (calldata, a program or a transaction hash), or source");
|
|
1385
|
+
}
|
|
1386
|
+
const program = programOf({ ...args, source: args.source });
|
|
1387
|
+
return fromCommand(inspectFile(program.input.file, compileProgram(program.input, program.files)));
|
|
1388
|
+
}
|
|
1389
|
+
const hex = hexArg(args.hex, "hex");
|
|
1390
|
+
const given = args.chain === undefined ? undefined : parseChain(String(args.chain), "chain");
|
|
1391
|
+
const source = args.source === undefined ? undefined : programOf({ ...args, source: args.source }, given);
|
|
1392
|
+
const chain = given ?? source?.input.chain;
|
|
1393
|
+
let rpcUrl;
|
|
1394
|
+
if (TX_HASH.test(hex)) {
|
|
1395
|
+
if (chain === undefined) {
|
|
1396
|
+
throw new UsageError("32 bytes of hex is a transaction hash: give the chain it is on");
|
|
1397
|
+
}
|
|
1398
|
+
rpcUrl = await reach.require(chain, args.rpcUrl, "Fetching a transaction");
|
|
1399
|
+
}
|
|
1400
|
+
return fromCommand(await inspectCommand({
|
|
1401
|
+
hex,
|
|
1402
|
+
...(chain === undefined ? {} : { chain }),
|
|
1403
|
+
...(rpcUrl === undefined ? {} : { rpcUrl }),
|
|
1404
|
+
...(source === undefined
|
|
1405
|
+
? {}
|
|
1406
|
+
: {
|
|
1407
|
+
source: {
|
|
1408
|
+
file: source.input.file,
|
|
1409
|
+
program: compileProgram(source.input, source.files),
|
|
1410
|
+
},
|
|
1411
|
+
}),
|
|
1412
|
+
}));
|
|
1413
|
+
});
|
|
1414
|
+
tool("sauce_verify", {
|
|
1415
|
+
title: "Check that a settle runs the audited program",
|
|
1416
|
+
description: "Checks whether a settle payload, a Pot.cook, a Portal publish or a transaction runs " +
|
|
1417
|
+
"the audited settle program, and with which parameters: valid with its tokens, minOut " +
|
|
1418
|
+
"and recipient, or valid: false with the rejection `code` (a rejection is a result, not " +
|
|
1419
|
+
"an error). A 32-byte hash is a transaction on `chain`, fetched through an endpoint " +
|
|
1420
|
+
"(rpcUrl, or the server's). On Solana (chain solana): a cook transaction's signature, " +
|
|
1421
|
+
"with the minOut and splCount the settle was compiled for. Use it to confirm an " +
|
|
1422
|
+
"intent's settlement before relying on it.",
|
|
1423
|
+
input: {
|
|
1424
|
+
hex: z
|
|
1425
|
+
.string()
|
|
1426
|
+
.max(LIMITS.hex)
|
|
1427
|
+
.optional()
|
|
1428
|
+
.describe("0x hex: a settle payload, Pot.cook or Portal calldata, or a transaction hash."),
|
|
1429
|
+
signature: z
|
|
1430
|
+
.string()
|
|
1431
|
+
.max(128)
|
|
1432
|
+
.optional()
|
|
1433
|
+
.describe("Solana: the cook transaction's signature, base58."),
|
|
1434
|
+
chain: chainRef.optional().describe("The chain a transaction is on."),
|
|
1435
|
+
pins: z
|
|
1436
|
+
.array(z.string().max(100))
|
|
1437
|
+
.max(LIMITS.entries)
|
|
1438
|
+
.optional()
|
|
1439
|
+
.describe("Historical settle programs also accepted, each <0x keccak256>:<bytes>."),
|
|
1440
|
+
engines: z
|
|
1441
|
+
.array(z.string().max(64))
|
|
1442
|
+
.max(LIMITS.entries)
|
|
1443
|
+
.optional()
|
|
1444
|
+
.describe("Engines also accepted besides the released one, each a 0x address."),
|
|
1445
|
+
minOut: integer
|
|
1446
|
+
.optional()
|
|
1447
|
+
.describe("Solana: the floor the settle enforces, in base units."),
|
|
1448
|
+
splCount: integer
|
|
1449
|
+
.optional()
|
|
1450
|
+
.describe("Solana: how many escrows the settle sweeps with its first token program."),
|
|
1451
|
+
rpcUrl: RPC_URL,
|
|
1452
|
+
},
|
|
1453
|
+
output: { valid: z.boolean() },
|
|
1454
|
+
annotations: READS_CHAIN,
|
|
1455
|
+
}, async (args, reach) => {
|
|
1456
|
+
const chain = args.chain === undefined ? undefined : parseChain(String(args.chain), "chain");
|
|
1457
|
+
if (chain?.kind === "svm") {
|
|
1458
|
+
if (args.signature === undefined) {
|
|
1459
|
+
throw new UsageError("missing signature: the cook's transaction on solana");
|
|
1460
|
+
}
|
|
1461
|
+
const amount = (name) => {
|
|
1462
|
+
const raw = args[name];
|
|
1463
|
+
if (raw === undefined)
|
|
1464
|
+
throw new UsageError(`missing ${name}: the settle compiles it in`);
|
|
1465
|
+
const text = integerText(raw, name);
|
|
1466
|
+
if (!/^\d+$/.test(text))
|
|
1467
|
+
throw new UsageError(`${name}: '${text}' is not a whole number`);
|
|
1468
|
+
return BigInt(text);
|
|
1469
|
+
};
|
|
1470
|
+
return fromCommand(await svmVerifyCommand({
|
|
1471
|
+
signature: args.signature,
|
|
1472
|
+
rpcUrl: await reach.require(chain, args.rpcUrl, "Verifying a Solana cook"),
|
|
1473
|
+
minOut: amount("minOut"),
|
|
1474
|
+
splCount: amount("splCount"),
|
|
1475
|
+
}));
|
|
1476
|
+
}
|
|
1477
|
+
if (args.hex === undefined) {
|
|
1478
|
+
throw new UsageError("missing hex: a settle payload, calldata, or a transaction hash");
|
|
1479
|
+
}
|
|
1480
|
+
const hex = hexArg(args.hex, "hex");
|
|
1481
|
+
let fetched;
|
|
1482
|
+
if (TX_HASH.test(hex)) {
|
|
1483
|
+
if (chain === undefined) {
|
|
1484
|
+
throw new UsageError("32 bytes of hex is a transaction hash: give the chain it is on");
|
|
1485
|
+
}
|
|
1486
|
+
fetched = {
|
|
1487
|
+
chain,
|
|
1488
|
+
rpcUrl: await reach.require(chain, args.rpcUrl, "Fetching a transaction"),
|
|
1489
|
+
};
|
|
1490
|
+
}
|
|
1491
|
+
return fromCommand(await verifyCommand({
|
|
1492
|
+
hex,
|
|
1493
|
+
pins: (args.pins ?? []).map(parsePin),
|
|
1494
|
+
engines: (args.engines ?? []).map((engine) => parseAddress("engine", engine)),
|
|
1495
|
+
...(fetched === undefined ? {} : fetched),
|
|
1496
|
+
}));
|
|
1497
|
+
});
|
|
1498
|
+
}
|
|
1499
|
+
//# sourceMappingURL=tools.js.map
|