@eco-incorp/sauce 0.99.5 → 0.99.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +324 -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 +80 -57
- package/docs/api/router.md +238 -0
- package/docs/api/routes.md +31 -22
- package/docs/concepts/architecture.md +30 -5
- package/docs/concepts/saucescript.md +53 -56
- 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 +24 -15
- package/docs/guides/cli.md +1442 -0
- package/docs/guides/compiling.md +24 -10
- package/docs/guides/intents.md +260 -17
- package/docs/guides/mcp.md +539 -0
- package/docs/guides/nested-intents.md +21 -6
- package/docs/guides/protocols-and-tokens.md +235 -36
- 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 +1497 -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 +170 -0
- package/sdk/dist/cli/chain.d.ts.map +1 -0
- package/sdk/dist/cli/chain.js +457 -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 +200 -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 +197 -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 +3162 -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 +183 -0
- package/sdk/dist/cli/solana.d.ts.map +1 -0
- package/sdk/dist/cli/solana.js +1360 -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/plugin/index.d.ts +3 -2
- package/sdk/dist/plugin/index.d.ts.map +1 -1
- package/sdk/dist/plugin/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/cbeth/functions.d.ts +2 -2
- package/sdk/dist/protocols/cbeth/functions.d.ts.map +1 -1
- package/sdk/dist/protocols/cbeth/functions.js +4 -6
- package/sdk/dist/protocols/cbeth/functions.js.map +1 -1
- package/sdk/dist/protocols/crvusd/functions.d.ts +2 -2
- package/sdk/dist/protocols/crvusd/functions.d.ts.map +1 -1
- package/sdk/dist/protocols/crvusd/functions.js +6 -6
- 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/erc20/functions.d.ts +3 -3
- package/sdk/dist/protocols/erc20/functions.d.ts.map +1 -1
- package/sdk/dist/protocols/erc20/functions.js +6 -9
- package/sdk/dist/protocols/erc20/functions.js.map +1 -1
- package/sdk/dist/protocols/frax/functions.d.ts +2 -2
- package/sdk/dist/protocols/frax/functions.d.ts.map +1 -1
- package/sdk/dist/protocols/frax/functions.js +6 -6
- package/sdk/dist/protocols/gho/functions.d.ts +2 -2
- package/sdk/dist/protocols/gho/functions.d.ts.map +1 -1
- package/sdk/dist/protocols/gho/functions.js +4 -6
- package/sdk/dist/protocols/gho/functions.js.map +1 -1
- package/sdk/dist/protocols/liquity-v2/functions.d.ts +2 -2
- package/sdk/dist/protocols/liquity-v2/functions.d.ts.map +1 -1
- package/sdk/dist/protocols/liquity-v2/functions.js +4 -6
- package/sdk/dist/protocols/liquity-v2/functions.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 +5 -3
- package/sdk/dist/recipes/plain-transfer.sauce.ts +5 -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 +21 -3
- package/sdk/dist/routes/ast-walk.d.ts.map +1 -1
- package/sdk/dist/routes/ast-walk.js +33 -4
- 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 +21 -14
- package/sdk/dist/routes/index.d.ts.map +1 -1
- package/sdk/dist/routes/index.js +12 -9
- 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 +358 -152
- 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 +249 -96
- 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 +5530 -936
- 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 +174 -0
- package/sdk/dist/routes/source-globals.js.map +1 -0
- package/sdk/dist/routes/stock-tokens.d.ts +69 -0
- package/sdk/dist/routes/stock-tokens.d.ts.map +1 -0
- package/sdk/dist/routes/stock-tokens.generated.d.ts +4 -0
- package/sdk/dist/routes/stock-tokens.generated.d.ts.map +1 -0
- package/sdk/dist/routes/stock-tokens.generated.js +1836 -0
- package/sdk/dist/routes/stock-tokens.generated.js.map +1 -0
- package/sdk/dist/routes/stock-tokens.js +65 -0
- package/sdk/dist/routes/stock-tokens.js.map +1 -0
- package/sdk/dist/routes/token-registry.d.ts +64 -8
- package/sdk/dist/routes/token-registry.d.ts.map +1 -1
- package/sdk/dist/routes/token-registry.js +208 -33
- package/sdk/dist/routes/token-registry.js.map +1 -1
- package/sdk/dist/routes/token-rewrite.d.ts +63 -28
- package/sdk/dist/routes/token-rewrite.d.ts.map +1 -1
- package/sdk/dist/routes/token-rewrite.js +387 -123
- 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/api.d.ts +7 -4
- package/sdk/dist/token/api.d.ts.map +1 -1
- package/sdk/dist/token/api.js.map +1 -1
- package/sdk/dist/token/evm.js +2 -2
- package/sdk/dist/token/index.d.ts +4 -4
- package/sdk/dist/token/index.js +4 -4
- 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/cbeth/functions.ts +4 -6
- package/sdk/src/protocols/crvusd/functions.ts +6 -6
- 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/erc20/functions.ts +6 -9
- package/sdk/src/protocols/frax/functions.ts +6 -6
- package/sdk/src/protocols/gho/functions.ts +4 -6
- package/sdk/src/protocols/liquity-v2/functions.ts +4 -6
- 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.md +53 -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 +175 -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 +1824 -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/skills/sauce-protocols/references/cbeth.md +48 -0
- 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/skills/sauce-protocols/references/crvusd.md +49 -0
- 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 +18 -34
- 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/skills/sauce-protocols/references/frax.md +48 -0
- 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/skills/sauce-protocols/references/gho.md +50 -0
- 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/skills/sauce-protocols/references/liquity-v2.md +48 -0
- 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 +322 -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/cbeth.md +0 -62
- package/sdk/src/skills/chainlink.md +0 -62
- package/sdk/src/skills/crvusd.md +0 -58
- package/sdk/src/skills/curve.md +0 -141
- package/sdk/src/skills/eigenlayer.md +0 -71
- package/sdk/src/skills/frax.md +0 -57
- package/sdk/src/skills/gamma.md +0 -79
- package/sdk/src/skills/gho.md +0 -61
- 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/liquity-v2.md +0 -59
- 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,674 @@
|
|
|
1
|
+
# SauceScript reference
|
|
2
|
+
|
|
3
|
+
SauceScript is the checked subset of TypeScript that Sauce programs are written in. You compile a program for
|
|
4
|
+
one of two targets:
|
|
5
|
+
|
|
6
|
+
- **EVM** (`target: "evm"`): Ethereum and other EVM chains.
|
|
7
|
+
- **SVM** (`target: "svm"`): Solana.
|
|
8
|
+
|
|
9
|
+
Every entry below says where it works: **Both**, **EVM** or **SVM**. Using something on the wrong target is a
|
|
10
|
+
compile error, never a silent difference.
|
|
11
|
+
|
|
12
|
+
Every example compiles on each target it names, and every error message is quoted as the compiler prints it,
|
|
13
|
+
with `N` for a number and `…` where text is elided. The machine-readable list of every documented builtin, with one
|
|
14
|
+
example program each, is `builtins.json`.
|
|
15
|
+
|
|
16
|
+
**Contents**
|
|
17
|
+
|
|
18
|
+
1. [Types](#1-types)
|
|
19
|
+
2. [Literals](#2-literals)
|
|
20
|
+
3. [Operators](#3-operators)
|
|
21
|
+
4. [Variables, control flow, functions and modules](#4-variables-control-flow-functions-and-modules)
|
|
22
|
+
5. [`require`, `revert`, `throw`, `log`, `eval`](#5-require-revert-throw-log-eval)
|
|
23
|
+
6. [`ctx`: context reads](#6-ctx-context-reads)
|
|
24
|
+
7. [`crypto`](#7-crypto)
|
|
25
|
+
8. [`Math`](#8-math)
|
|
26
|
+
9. [`abi`](#9-abi-evm) (EVM)
|
|
27
|
+
10. [`evm`](#10-evm-evm) (EVM)
|
|
28
|
+
11. [`svm`](#11-svm-svm) (SVM)
|
|
29
|
+
12. [Methods on values, and account properties](#12-methods-on-values-and-account-properties)
|
|
30
|
+
13. [Contract bindings and `.catch()`](#13-contract-bindings-and-catch-evm) (EVM)
|
|
31
|
+
14. [Not supported, and what to write instead](#14-not-supported-and-what-to-write-instead)
|
|
32
|
+
15. [Limits](#15-limits)
|
|
33
|
+
|
|
34
|
+
**On Solana (SVM), at a glance.** Entries marked **Both** work there too. What differs:
|
|
35
|
+
|
|
36
|
+
- Accounts are `main` parameters with roles: `Account` in §1, account properties in §12, and the
|
|
37
|
+
`svm` calls in §11, which only SVM has.
|
|
38
|
+
- `ctx` (§6): `ctx.self()` is the engine's program id (it owns every Pot account, and not only
|
|
39
|
+
Pot accounts),
|
|
40
|
+
`ctx.msgSender()` the first signer among the accounts the engine receives, and
|
|
41
|
+
`ctx.msgValue`, `gasLeft`, `codeSize`, `codeHash`, `isContract` and `isEOA` do not exist.
|
|
42
|
+
- `log` takes no topics (§5).
|
|
43
|
+
- `abi`, `evm` and contract bindings with `.catch()` (§9, §10, §13) are EVM only: a call to another
|
|
44
|
+
program is `svm.call`.
|
|
45
|
+
- Limits (§15): 64 KiB of working memory, and the program, its arguments and the cook together in
|
|
46
|
+
one 1,232-byte transaction unless the program is staged.
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## 1. Types
|
|
51
|
+
|
|
52
|
+
- `Uint256`, `Address`, `number`, `bigint`: A **number**: one unsigned 256-bit integer. An address
|
|
53
|
+
is a number.
|
|
54
|
+
- `bool`, `boolean`: A **bool**: true or false. It is kept apart from numbers, so `flag + 1n` is an
|
|
55
|
+
error. Comparisons produce bools.
|
|
56
|
+
- `bytes`, `string`: A **bytes value**. A `"text"` literal is its UTF-8 bytes.
|
|
57
|
+
- `T[]`: An array whose elements all have type `T`
|
|
58
|
+
- `{ a: T, b: U }`, or the name of an `interface`: A **record** with named fields
|
|
59
|
+
- `Account`, `Account<Writable>`, `Account<Signer>`, `Account<Writable, Signer>`: **SVM:** an
|
|
60
|
+
account the transaction attaches, declared as a `main` parameter, optionally with the roles it
|
|
61
|
+
must have. **EVM:** `Account` is just an address, and roles are an error: "`an Account role` is
|
|
62
|
+
not available on the evm target; an `Account` is an address value on the EVM — write `Account`
|
|
63
|
+
alone".
|
|
64
|
+
- `void`: No value (return type only)
|
|
65
|
+
|
|
66
|
+
- A parameter without an annotation is a number. So is the result of a function without a return annotation,
|
|
67
|
+
even one that returns a comparison or `true`: it comes back as 1 or 0. `if`, `while`, `&&` and `!` take that,
|
|
68
|
+
but a `: bool` function cannot return it: "a return value: expected a bool, found a number". Give a helper
|
|
69
|
+
that answers yes or no a `: bool` return type.
|
|
70
|
+
- An unknown type name is rejected with a list of the valid ones, as in "`uint256` is not a type — write
|
|
71
|
+
`Uint256`, `Address`, `Account`, `bool`, `bytes` or `string`, an array `T[]`, an inline object type `{ a: Uint256 }`
|
|
72
|
+
for a tuple …". Union types, `Array<T>` and `[A, B]` tuple types are rejected the same way.
|
|
73
|
+
- In this reference, **scalar** means a number or a bool.
|
|
74
|
+
|
|
75
|
+
Common type errors:
|
|
76
|
+
|
|
77
|
+
- "`<what>` requires a scalar value": you passed bytes, an array or a record where one value is needed.
|
|
78
|
+
- "`<what>` requires a bytes value": you passed a value where bytes are needed.
|
|
79
|
+
- "`<what>`: expected a number, found a bool". At a call site, "a function argument: expected a number,
|
|
80
|
+
found a bool" usually means the function's parameter has no annotation, so it is a number:
|
|
81
|
+
annotate it, `flag: bool`.
|
|
82
|
+
- "`<what>`: expected an account, found a value" (and the reverse).
|
|
83
|
+
|
|
84
|
+
A builtin that does not exist on your target fails as "`<name>` is not available on the `<evm|svm>` target",
|
|
85
|
+
usually followed by what to use instead.
|
|
86
|
+
|
|
87
|
+
## 2. Literals
|
|
88
|
+
|
|
89
|
+
| Literal | Meaning | Example |
|
|
90
|
+
| ----------------------------------------------------------- | ---------------------------------------------------------------------- | ------------------------------------------ |
|
|
91
|
+
| integers: `1n`, `0xffn`, `1_000n`, `1`, `0xff`, `1_000_000` | numbers | `const ONE_TOKEN = 1000000000000000000n;` |
|
|
92
|
+
| `true`, `false` | bools | `let filled = true;` |
|
|
93
|
+
| `"text"` | bytes (UTF-8) | `throw "below floor";` |
|
|
94
|
+
| `` hex`…` `` | raw bytes: an even number of hex digits, optional `0x`, spaces ignored | ``const selector = hex`a9059cbb`;`` |
|
|
95
|
+
| `[a, b, c]` | an array; every element has the same type | `const amounts = [100n, 200n];` |
|
|
96
|
+
| `{ a: 1n, b }` | a record; shorthand fields work | `const order = { amount, recipient: to };` |
|
|
97
|
+
|
|
98
|
+
**Not literals:**
|
|
99
|
+
|
|
100
|
+
| Rejected | Error | Write instead |
|
|
101
|
+
| --------------------------- | ------------------------------------------------------------------------------------------------------------- | --------------------------------------- |
|
|
102
|
+
| `1e18` | "not a valid integer literal" | `10n ** 18n` or `1000000000000000000n` |
|
|
103
|
+
| `1.5` | "`1.5` is not a valid 256-bit literal" | integers in the smallest unit |
|
|
104
|
+
| `null`, `undefined` | rejected | `0n` or a flag |
|
|
105
|
+
| `` `text` ``, `` `a${b}` `` | rejected, with or without `${}` | `"text"`, or bytes built with `.concat` |
|
|
106
|
+
| a bad `hex` | "`hex`…`` is not a valid hex literal (expected an even number of `[0-9a-fA-F]` digits, optional `0x` prefix)" | |
|
|
107
|
+
| `[]` with no declared type | "an array literal must have at least one element" | `let xs: Uint256[] = [];` |
|
|
108
|
+
| `[1n, true]` | "every element of an array literal must have the same type — …" | |
|
|
109
|
+
|
|
110
|
+
## 3. Operators
|
|
111
|
+
|
|
112
|
+
- `+ - * / % **`, on numbers → number
|
|
113
|
+
- **Checked.** Overflow, underflow and division by zero revert. With constant operands they are
|
|
114
|
+
compile errors: "constant `-` expression overflows 256 bits", "constant `/` expression divides
|
|
115
|
+
by zero".
|
|
116
|
+
- `-x`, on a number → number
|
|
117
|
+
- Two's-complement negation; it never fails. **Use `-x` for a negative amount.** `~x + 1n` reverts
|
|
118
|
+
when `x` is `0`, because the `+` is checked. `-1n` is 2²⁵⁶ − 1.
|
|
119
|
+
- `~x`, on a number → number
|
|
120
|
+
- bitwise NOT. `~0n` is the maximum value.
|
|
121
|
+
- `& | ^ << >>`, on numbers → number
|
|
122
|
+
- Bitwise. `>>` fills with zeros; use `Math.sShr` for a signed shift.
|
|
123
|
+
- `< <= > >=`, on scalars → bool
|
|
124
|
+
- unsigned; use `Math.sLt` and friends for signed
|
|
125
|
+
- `== === != !==`, on scalars, or two accounts → bool
|
|
126
|
+
- Bytes cannot be compared: "a comparison operator requires a scalar value". Compare
|
|
127
|
+
`crypto.keccak256(a) == crypto.keccak256(b)` instead.
|
|
128
|
+
- `!x`, on a scalar → bool
|
|
129
|
+
- `a && b`, `a || b`, on scalars → bool
|
|
130
|
+
- Short-circuit. The result is true or false, not one of the operands.
|
|
131
|
+
- `c ? a : b`, on `a` and `b` of the same type → that type
|
|
132
|
+
- "the two arms of `? :` must have the same type — …"
|
|
133
|
+
- `=`, and `+= -= *= /= %= **= &= |= ^= <<= >>=`
|
|
134
|
+
- Compound forms work on plain variables only: "a compound assignment to an array element …", "a
|
|
135
|
+
compound assignment to a tuple field …".
|
|
136
|
+
- `x++`, `x--`, `++x`, `--x`, on a plain variable, **as a statement only**
|
|
137
|
+
- "`++`/`--` as a value (they are statement-only here — write `i += 1n`)"
|
|
138
|
+
|
|
139
|
+
Accounts compare only with `==` and `!=`: "accounts compare for identity only — `==` and `!=`. …".
|
|
140
|
+
`>>>`, `??`, `typeof`, `instanceof`, `in`, `void`, `delete` and unary `+` are not supported (see §14).
|
|
141
|
+
|
|
142
|
+
## 4. Variables, control flow, functions and modules
|
|
143
|
+
|
|
144
|
+
**Variables**
|
|
145
|
+
|
|
146
|
+
- `let` and `const`, with several declarators per statement and optional annotations.
|
|
147
|
+
- A variable keeps its type: "`a` cannot be reassigned a value of a different type — …". A `const` cannot be
|
|
148
|
+
reassigned: "`a` is declared `const` and cannot be reassigned".
|
|
149
|
+
- Read an array or bytes value with `a[i]`. A record is read by name (`t.amount`) or by a constant position
|
|
150
|
+
(`t[0]`). A computed position is rejected: "a tuple index must be a number literal or a `const` bound to one — …".
|
|
151
|
+
- Write with `a[i] = v` or `t.amount = v`. An out-of-range constant index is a compile error ("array index 5 is
|
|
152
|
+
out of range — this array has 2 element(s). …"), and a computed out-of-range index reverts.
|
|
153
|
+
- **Destructuring:** `const [a, b] = …` works on anything that produces a record: a multi-output contract call,
|
|
154
|
+
`abi.decode`, a record, or `crypto.findPDA`. It does not work on an array: "a destructuring binding needs an
|
|
155
|
+
initializer that produces a tuple — this one does not, so bind it to one name instead".
|
|
156
|
+
- `new Array(n)` makes an array of `n` zeros to fill by index.
|
|
157
|
+
|
|
158
|
+
**Control flow:** `if`/`else`, `while`, `for (init; test; update)`, `for (const x of array)`, unlabeled
|
|
159
|
+
`break`/`continue`, `return`, and blocks.
|
|
160
|
+
|
|
161
|
+
**Functions**
|
|
162
|
+
|
|
163
|
+
- Declare functions at the top level. They may call each other and recurse.
|
|
164
|
+
- A function other than `main` that returns bytes, an array or a record needs a return type: "returning a bytes
|
|
165
|
+
value from a function other than `main` needs a return-type annotation — …".
|
|
166
|
+
- Every path must return ("`f` does not return on every path"). A bare `return;` is allowed only in a `: void`
|
|
167
|
+
function.
|
|
168
|
+
- A `: void` function's result is not a value: "a call to a `: void` function produces no value, so its result
|
|
169
|
+
can't be used as one — call it as a statement instead".
|
|
170
|
+
- `main` is the entry point and cannot be called from your code.
|
|
171
|
+
- A function other than `main` has a fixed budget for its parameters and the values its body keeps live at
|
|
172
|
+
once: about sixteen. Seventeen parameters still compile when the body reads each one once. Past the
|
|
173
|
+
budget — sixteen parameters with a local held beside them, or seventeen with the first one read again — the
|
|
174
|
+
compile fails with "`f` does not fit …". Pass a record or an array instead of a long list of numbers. `main`'s
|
|
175
|
+
parameters are the program's arguments and are not limited this way.
|
|
176
|
+
- **Arrays and records are passed by reference.** A helper that writes `xs[i] = v` or `r.amount = v` changes
|
|
177
|
+
the caller's array or record, so a helper can fill an array it is given. Numbers, bools and bytes are passed
|
|
178
|
+
by value. A helper cannot replace an array parameter with a new array: "`<name>` cannot be reassigned a value
|
|
179
|
+
of a different type — expected an element count known only at run time, found N element(s)".
|
|
180
|
+
|
|
181
|
+
**`main`'s arguments**
|
|
182
|
+
|
|
183
|
+
- `main`'s parameters are the program's runtime inputs. One compiled program serves every argument value.
|
|
184
|
+
- By default the arguments are ABI-encoded. With the compile option `compactArgs: true` they use the smaller
|
|
185
|
+
compact encoding; encode them with `encodeCompactArguments` and the schema the compile returns.
|
|
186
|
+
- Parameters may be any combination of scalars, bytes, arrays and records, with at most 4 levels of nested
|
|
187
|
+
arrays.
|
|
188
|
+
- On **SVM**, `Account` parameters are not encoded arguments: they are the accounts attached to the transaction,
|
|
189
|
+
in declaration order.
|
|
190
|
+
|
|
191
|
+
**Scripts:** a file with top-level statements and no `main` runs as `main(): void`. Its top-level `const` and
|
|
192
|
+
`let` are locals of that entry, so a function cannot read them, and it cannot `return`. Declare `main` to share
|
|
193
|
+
a module-level constant with functions, or to return a value.
|
|
194
|
+
|
|
195
|
+
**Module constants and defines**
|
|
196
|
+
|
|
197
|
+
- A top-level `const` must be a literal or a constant expression over other `const`s.
|
|
198
|
+
- A top-level `const` array, `const FEES = [100n, 500n];`, is a lookup table: it is read only at a literal index,
|
|
199
|
+
`FEES[0]`. A loop over it, `.length` or a write gives "a module-scope lookup table `<name>` can only be read
|
|
200
|
+
by a literal index or a field name …", and a computed index "a module-scope lookup table can only be indexed by
|
|
201
|
+
a non-negative integer literal or a `const` bound to one …". Declare an array you loop over or index at run
|
|
202
|
+
time inside a function.
|
|
203
|
+
- A top-level `let` is scratch space, reset on every run. It is not persistent storage.
|
|
204
|
+
- A top-level `let` starts as a number, address or boolean literal, nothing else: "a module-scope `let <name>`
|
|
205
|
+
must be initialized with a literal — a number, address or boolean literal. …". An array, bytes, a record, a
|
|
206
|
+
negative number, an expression or a call goes inside a function.
|
|
207
|
+
- The compile option `defines` replaces a `const` of the same name.
|
|
208
|
+
|
|
209
|
+
**Imports**
|
|
210
|
+
|
|
211
|
+
| Import | Binds |
|
|
212
|
+
| ----------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
|
|
213
|
+
| `import { f, FEE, Order } from "./lib.ts"` (also `.js`, `.mjs`, `.mts`) | exported functions, constants and interfaces |
|
|
214
|
+
| `import ERC20 from "./erc20.abi.json"` | a contract ABI (§13) |
|
|
215
|
+
| `import cfg from "./config.json" with { type: "json" }` | JSON data, read as compile-time constants (`cfg.fee`) |
|
|
216
|
+
| `import { approve } from "@sauce/token"` | a package. Import the package itself, not a file inside it ("subpath imports are not supported: …"). |
|
|
217
|
+
|
|
218
|
+
A default import of a SauceScript module is rejected: "a `.js` module import must be named — … has no `default`
|
|
219
|
+
export".
|
|
220
|
+
|
|
221
|
+
## 5. `require`, `revert`, `throw`, `log`, `eval`
|
|
222
|
+
|
|
223
|
+
Available on **Both** targets. These are statements, except `eval`, which returns a value. Their names are
|
|
224
|
+
reserved: you cannot declare a function named `require`, `revert`, `log` or `eval` ("`log` is a reserved
|
|
225
|
+
builtin and cannot be a function name").
|
|
226
|
+
|
|
227
|
+
- `require(cond)`, `require(cond, message)`
|
|
228
|
+
- Types: `cond`: scalar. `message`: bytes.
|
|
229
|
+
- Reverts unless `cond` is nonzero. "`require` takes 1 or 2 arguments (a condition and an optional
|
|
230
|
+
bytes payload), got N"; "a `require` condition requires a scalar value". Used as a value:
|
|
231
|
+
"`require` aborts execution and produces no value — use it as a statement".
|
|
232
|
+
- Example: `require(out >= minOut, "slippage");`
|
|
233
|
+
- `revert()`, `revert(data)`
|
|
234
|
+
- Types: `data`: bytes
|
|
235
|
+
- Reverts with `data` as the revert data. "`revert` takes at most 1 argument (an optional bytes
|
|
236
|
+
payload), got 2"; "a revert payload requires a bytes value"
|
|
237
|
+
- Example: `revert(code.toBytesBe(32n));`
|
|
238
|
+
- `throw data`
|
|
239
|
+
- Types: `data`: bytes
|
|
240
|
+
- The same as `revert(data)`. "a `throw` payload requires a bytes value".
|
|
241
|
+
- Example: `throw "below floor";`
|
|
242
|
+
- `log(data)`, `log(data, topic1, …)`
|
|
243
|
+
- Types: `data`: bytes. Up to 4 scalar topics, **EVM only**.
|
|
244
|
+
- Emits a log record. On SVM pass `data` alone: "`log with topics` is not available on the svm
|
|
245
|
+
target; … call log(data) alone and fold any event discriminator into data (concat or abi.encode
|
|
246
|
+
it in front of the fields)". Other errors: "`log` requires a bytes data payload — `log()`
|
|
247
|
+
records nothing"; "`log` carries at most 4 indexed topics after its data payload, got 5".
|
|
248
|
+
- Example: `log(amount.toBytesLe(8n));`
|
|
249
|
+
- `eval(program, ...args)`
|
|
250
|
+
- Types: `program`: compiled Sauce program bytes. Up to 16 scalar `args`. Returns bytes.
|
|
251
|
+
- Runs another program and returns what it returns; `args` become its `main` arguments. If the
|
|
252
|
+
inner program reverts, so does the outer one. On SVM the inner program can read accounts but
|
|
253
|
+
cannot write them. Errors: "`eval` requires bytecode to run — `eval()` has nothing to execute";
|
|
254
|
+
"`eval` takes at most 16 arguments after its bytecode, got 17"; "an eval argument requires a
|
|
255
|
+
scalar value".
|
|
256
|
+
- Example: `const result = eval(program, amount);`
|
|
257
|
+
|
|
258
|
+
**Failure is atomic.** `require`, `revert`, `throw`, a failing call and every checked operation revert the whole
|
|
259
|
+
transaction; nothing that ran before them survives. The only failure a program can survive is a failed
|
|
260
|
+
external call on EVM, with `.catch()` (§13).
|
|
261
|
+
|
|
262
|
+
## 6. `ctx`: context reads
|
|
263
|
+
|
|
264
|
+
Every read is a call: `ctx.self()`, not `ctx.self` (which gives "`ctx` is not a declared variable").
|
|
265
|
+
|
|
266
|
+
- `ctx.msgSender()` → number, **Both**
|
|
267
|
+
- On EVM: the immediate caller (`msg.sender`)
|
|
268
|
+
- On SVM: the first signer among the accounts the engine receives: the Pot, when a slot is
|
|
269
|
+
attached as the Pot. Not proof of who sent the transaction.
|
|
270
|
+
- Example: `require(ctx.msgSender() == OWNER);`
|
|
271
|
+
- `ctx.self()` → number, **Both**
|
|
272
|
+
- On EVM: the executing contract: the Pot, which holds the program's balances and allowances
|
|
273
|
+
- On SVM: the engine's program id, which owns every Pot account: `pot.owner == ctx.self()`
|
|
274
|
+
holds for a Pot, and for any other account assigned to the engine, so it does not prove an
|
|
275
|
+
account is the Pot; re-deriving the Pot's address does
|
|
276
|
+
- Example: `log(ctx.self().toBytesBe(32n));`
|
|
277
|
+
- `ctx.chainId()` → number, **Both**
|
|
278
|
+
- On EVM: the chain id
|
|
279
|
+
- On SVM: 1399811149 on mainnet, 1399811150 on devnet
|
|
280
|
+
- Example: `if (ctx.chainId() == 8453n) { … }`
|
|
281
|
+
- `ctx.blockNumber()` → number, **Both**
|
|
282
|
+
- On EVM: the block number
|
|
283
|
+
- On SVM: the **slot**
|
|
284
|
+
- Example: `const at = ctx.blockNumber();`
|
|
285
|
+
- `ctx.timestamp()` → number, **Both**
|
|
286
|
+
- On EVM: the block time, in seconds
|
|
287
|
+
- On SVM: the cluster time, in seconds
|
|
288
|
+
- Example: `require(ctx.timestamp() <= deadline);`
|
|
289
|
+
- `ctx.selfBalance()` → number, **Both**
|
|
290
|
+
- On EVM: the executing contract's balance, in wei
|
|
291
|
+
- On SVM: the executing program's lamports
|
|
292
|
+
- Example: `const wei = ctx.selfBalance();`
|
|
293
|
+
- `ctx.msgData()` → bytes, **Both**
|
|
294
|
+
- On EVM: the program's whole input, arguments included
|
|
295
|
+
- On SVM: the instruction data
|
|
296
|
+
- Example: `const input = ctx.msgData();`
|
|
297
|
+
- `ctx.balance(address)` → number, **Both**
|
|
298
|
+
- On EVM: the balance of `address`
|
|
299
|
+
- On SVM: the lamports of the attached account with that key. Pass `acct.address`, not the account
|
|
300
|
+
itself ("ctx.balance's address: expected a value, found an account"). A key that is not attached
|
|
301
|
+
fails at run time.
|
|
302
|
+
- Example: `ctx.balance(vault.address)`
|
|
303
|
+
- `ctx.msgValue()` → number, **EVM**
|
|
304
|
+
- On EVM: the native value sent (`msg.value`)
|
|
305
|
+
- On SVM: not available: "…; pass the amount as an argument and move the lamports with a
|
|
306
|
+
system-program transfer through svm.call"
|
|
307
|
+
- Example: `require(ctx.msgValue() >= fee);`
|
|
308
|
+
- `ctx.gasLeft()` → number, **EVM**
|
|
309
|
+
- On EVM: the gas remaining
|
|
310
|
+
- On SVM: not available
|
|
311
|
+
- Example: `const gas = ctx.gasLeft();`
|
|
312
|
+
- `ctx.codeSize(address)` → number, **EVM**
|
|
313
|
+
- On EVM: the size of `address`'s code
|
|
314
|
+
- On SVM: not available
|
|
315
|
+
- Example: `require(ctx.codeSize(token) > 0n);`
|
|
316
|
+
- `ctx.codeHash(address)` → number, **EVM**
|
|
317
|
+
- On EVM: the hash of `address`'s code
|
|
318
|
+
- On SVM: not available
|
|
319
|
+
- Example: `require(ctx.codeHash(pool) == POOL_CODEHASH);`
|
|
320
|
+
- `ctx.isContract(address)` → bool, **EVM**
|
|
321
|
+
- On EVM: true if `address` has code
|
|
322
|
+
- On SVM: not available; check `acct.owner` instead
|
|
323
|
+
- Example: `require(ctx.isContract(token));`
|
|
324
|
+
- `ctx.isEOA(address)` → bool, **EVM**
|
|
325
|
+
- On EVM: true if `address` has no code
|
|
326
|
+
- On SVM: not available
|
|
327
|
+
- Example: `require(ctx.isEOA(ctx.msgSender()));`
|
|
328
|
+
|
|
329
|
+
- A wrong argument count gives "`ctx.timestamp` takes 0 argument(s), but this call passes 1".
|
|
330
|
+
- An unknown name gives "`ctx.origin` is not a context builtin".
|
|
331
|
+
- A bare `gasLeft()` gives "… is called but never declared; write `ctx.gasLeft()` instead".
|
|
332
|
+
- There is no read for the transaction origin, the block hash, the base fee or the gas price. Pass such a value
|
|
333
|
+
in as a `main` argument.
|
|
334
|
+
|
|
335
|
+
## 7. `crypto`
|
|
336
|
+
|
|
337
|
+
- `crypto.keccak256(data)`, **Both**
|
|
338
|
+
- Types: `(bytes) → number`
|
|
339
|
+
- The keccak-256 hash. A number argument gives "keccak256's argument requires a bytes value"; hash
|
|
340
|
+
a word with `crypto.keccak256(x.toBytesBe(32n))`.
|
|
341
|
+
- Example: `const topic = crypto.keccak256("Transfer(address,address,uint256)");`
|
|
342
|
+
- `crypto.ecdsaVerify(hash, signature, signer)`, **Both**
|
|
343
|
+
- Types: `(scalar, bytes, scalar) → bool`. `signature` is the 65-byte `r‖s‖v`.
|
|
344
|
+
- True if `signer` signed `hash`. On EVM a contract signer is also checked (EIP-1271); on SVM only
|
|
345
|
+
key signatures are checked. "ecdsaVerify's signature requires a bytes value"
|
|
346
|
+
- Example: `require(crypto.ecdsaVerify(digest, sig, owner));`
|
|
347
|
+
- `const [address, bump] = crypto.findPDA(programId, seeds)`, **Both** (on EVM it derives the same
|
|
348
|
+
Solana address)
|
|
349
|
+
- Types: `programId`: number. `seeds`: `bytes[]`. Gives two numbers.
|
|
350
|
+
- Derives a Solana program address and its bump. **It must be destructured:** "`crypto.findPDA`
|
|
351
|
+
produces two values — bind them by destructuring, as
|
|
352
|
+
`const [address, bump] = crypto.findPDA(programId, seeds)`". `[a]` and `[, bump]` are fine.
|
|
353
|
+
Seeds must be a `bytes[]` ("`crypto.findPDA`'s seeds argument must be a `bytes[]`, got …"). **At
|
|
354
|
+
most 15 seeds;** more compile but fail when run.
|
|
355
|
+
- Example: ``const [vault, bump] = crypto.findPDA(PROGRAM, [hex`01`, "vault"]);``
|
|
356
|
+
|
|
357
|
+
An unknown name gives "`crypto.sha256` is not a crypto intrinsic".
|
|
358
|
+
|
|
359
|
+
## 8. `Math`
|
|
360
|
+
|
|
361
|
+
These are SauceScript's integer functions, on **Both** targets. They are not JavaScript's `Math`: `Math.min`,
|
|
362
|
+
`max`, `abs`, `pow`, `floor` and the rest give "`Math.min` is not a Math intrinsic".
|
|
363
|
+
|
|
364
|
+
- Every argument is a scalar.
|
|
365
|
+
- Every result is a **number**, including the signed comparisons. `if (Math.sLt(a, b)) { … }` works, but
|
|
366
|
+
returning one from a `: bool` function fails with "a return value: expected a bool, found a number".
|
|
367
|
+
|
|
368
|
+
- `Math.sqrt(x)`: the integer square root
|
|
369
|
+
- Reverts when: never
|
|
370
|
+
- Example: `const root = Math.sqrt(k);`
|
|
371
|
+
- `Math.mulDiv(x, y, d)`: ⌊x·y / d⌋, without intermediate overflow
|
|
372
|
+
- Reverts when: `d` is 0, or the result does not fit 256 bits
|
|
373
|
+
- Example: `const fee = Math.mulDiv(amount, bps, 10000n);`
|
|
374
|
+
- `Math.addMod(a, b, n)`: (a + b) mod n
|
|
375
|
+
- Reverts when: `n` is 0
|
|
376
|
+
- Example: `Math.addMod(a, b, P)`
|
|
377
|
+
- `Math.mulMod(a, b, n)`: (a · b) mod n
|
|
378
|
+
- Reverts when: `n` is 0
|
|
379
|
+
- Example: `Math.mulMod(a, b, P)`
|
|
380
|
+
- `Math.sDiv(a, b)`: signed division
|
|
381
|
+
- Reverts when: `b` is 0
|
|
382
|
+
- Example: `Math.sDiv(delta, 2n)`
|
|
383
|
+
- `Math.sMod(a, b)`: signed remainder
|
|
384
|
+
- Reverts when: `b` is 0
|
|
385
|
+
- Example: `Math.sMod(delta, 3n)`
|
|
386
|
+
- `Math.sShr(value, bits)`: signed (arithmetic) right shift
|
|
387
|
+
- Reverts when: never
|
|
388
|
+
- Example: `Math.sShr(tick, 1n)`
|
|
389
|
+
- `Math.signExtend(value, byte)`: sign-extends from byte `byte`, where 0 is the lowest byte
|
|
390
|
+
- Reverts when: never
|
|
391
|
+
- Example: `Math.signExtend(raw, 2n)` for an int24
|
|
392
|
+
- `Math.sLt(a, b)`, `Math.sGt(a, b)`, `Math.sLte(a, b)`, `Math.sGte(a, b)`: signed comparisons,
|
|
393
|
+
giving 1 or 0
|
|
394
|
+
- Reverts when: never
|
|
395
|
+
- Example: `if (Math.sLt(tick, 0n)) { … }`
|
|
396
|
+
|
|
397
|
+
A wrong argument count gives "`Math.sqrt` takes 1 argument(s), but this call passes 2".
|
|
398
|
+
|
|
399
|
+
## 9. `abi` (EVM)
|
|
400
|
+
|
|
401
|
+
On SVM both give "`abi.encode` is not available on the svm target" (or `abi.decode`). Program arguments still
|
|
402
|
+
work on SVM; they are decoded separately.
|
|
403
|
+
|
|
404
|
+
- `abi.encode(v1, …, vN)`
|
|
405
|
+
- Types: 1 to 255 values of any type except accounts; returns bytes
|
|
406
|
+
- Standard Solidity ABI encoding of the values as one argument list. A single record argument is
|
|
407
|
+
encoded as its fields. "abi.encode requires at least one value to encode"; "abi.encode has 256
|
|
408
|
+
arguments, beyond the 255 …"
|
|
409
|
+
- Example: `return abi.encode(total, recipient);`
|
|
410
|
+
- `abi.decode(data, ["Shape", …])`
|
|
411
|
+
- Types: `data`: bytes. The shapes must be written in place as an array of strings. Returns a
|
|
412
|
+
record with unnamed fields.
|
|
413
|
+
- Read fields by position or by destructuring. Field types use SauceScript names: `"Uint256"`,
|
|
414
|
+
`"Address"`, `"bool"`, `"bytes"`, `"string"`, `"number"`, `"bigint"`, `"boolean"`, any of them
|
|
415
|
+
followed by `[]`, and records `"{Uint256, bool}"`. Solidity spellings are rejected: "`uint256`
|
|
416
|
+
is not an abi.decode field type — …". Errors: "abi.decode takes exactly 2 arguments (data,
|
|
417
|
+
shape), got N"; "abi.decode's first argument must be bytes"; shapes held in a variable give
|
|
418
|
+
"abi.decode's second argument must be an array literal of shape strings, e.g. ["Uint256",
|
|
419
|
+
"bytes[]"]"; `.name` on the result gives "this tuple's N field(s) are unnamed, so `.name`
|
|
420
|
+
resolves against nothing — read a field by position instead (`t[0]`)".
|
|
421
|
+
- Example: `const [amount, to] = abi.decode(data, ["Uint256", "Address"]);`
|
|
422
|
+
|
|
423
|
+
A `"bool"` field decodes as a bool, an `"Address"` field keeps only the address-sized low 20 bytes, and every
|
|
424
|
+
other single-value field decodes as a number.
|
|
425
|
+
|
|
426
|
+
## 10. `evm` (EVM)
|
|
427
|
+
|
|
428
|
+
On SVM every function here gives "`evm.<name>` is not available on the svm target", with a pointer to the `svm`
|
|
429
|
+
equivalent.
|
|
430
|
+
|
|
431
|
+
- `evm.call(address, value, data)`: `(scalar, scalar, bytes) → bytes`
|
|
432
|
+
- A call with native `value`; returns the raw return data. **This is the only way to send value
|
|
433
|
+
with a call.** "`evm.call()` expects 3 argument(s), but this call passes 2"; "`evm.call()`'s
|
|
434
|
+
calldata argument must be bytes"
|
|
435
|
+
- Example: ``evm.call(WETH, amount, hex`d0e30db0`);``
|
|
436
|
+
- `evm.static(address, data)`: `(scalar, bytes) → bytes`
|
|
437
|
+
- A read-only call (staticcall)
|
|
438
|
+
- Example: `const reply = evm.static(pool, query);`
|
|
439
|
+
- `evm.delegate(address, data)`: `(scalar, bytes) → bytes`
|
|
440
|
+
- A delegatecall
|
|
441
|
+
- Example: `evm.delegate(library, data);`
|
|
442
|
+
- `evm.sload(slot)`: `(scalar) → number`
|
|
443
|
+
- Reads the executing contract's storage
|
|
444
|
+
- Example: `const count = evm.sload(0n);`
|
|
445
|
+
- `evm.sstore(slot, value)`: `(scalar, scalar)`, a statement
|
|
446
|
+
- Writes storage. Used as a value: "`evm.sstore` writes storage and produces no value — use it as
|
|
447
|
+
a statement".
|
|
448
|
+
- Example: `evm.sstore(0n, count + 1n);`
|
|
449
|
+
- `evm.tload(key)`: `(scalar) → number`
|
|
450
|
+
- Reads transient storage (EIP-1153), which is cleared after the transaction
|
|
451
|
+
- Example: `const seen = evm.tload(KEY);`
|
|
452
|
+
- `evm.tstore(key, value)`: `(scalar, scalar)`, a statement
|
|
453
|
+
- Writes transient storage
|
|
454
|
+
- Example: `evm.tstore(KEY, 1n);`
|
|
455
|
+
|
|
456
|
+
- Storage belongs to the executing contract, the Pot.
|
|
457
|
+
- An unknown name gives "`evm.create` is not an evm builtin; `evm` is a reserved namespace root".
|
|
458
|
+
- SauceScript cannot deploy contracts.
|
|
459
|
+
|
|
460
|
+
## 11. `svm` (SVM)
|
|
461
|
+
|
|
462
|
+
On EVM every function here gives "`svm.<name>` is not available on the evm target", with a pointer to the
|
|
463
|
+
`evm` equivalent.
|
|
464
|
+
|
|
465
|
+
- `svm.sload(account, offset, length)`: `(Account, scalar, scalar) → bytes`
|
|
466
|
+
- Reads `length` bytes of the account's data, starting at `offset`. Reading past the end fails the
|
|
467
|
+
transaction, and that failure cannot be caught, so check `acct.dataLen` first. A number instead
|
|
468
|
+
of an account gives "svm.sload's account: expected an account, found a value".
|
|
469
|
+
- Example: `const amount = svm.sload(tokenAccount, 64n, 8n).toLe();`
|
|
470
|
+
- `svm.sstore(account, offset, data)`: `(Account, scalar, bytes)`, a statement
|
|
471
|
+
- Writes `data` into the account's data at `offset`. A `main` account parameter must be declared
|
|
472
|
+
`Account<Writable, Signer>`: "`state` is not declared writable, so `svm.sstore` may not write it
|
|
473
|
+
— declare it `Account<Writable>` (or `Account<Writable, Signer>`)", then "`state` is not
|
|
474
|
+
declared a signer, so `svm.sstore` may not write it — … declare it `Account<Writable, Signer>`".
|
|
475
|
+
The data must be bytes ("svm.sstore's value requires a bytes value").
|
|
476
|
+
- Example: `svm.sstore(state, 0n, counter.toBytesLe(8n));`
|
|
477
|
+
- `svm.call(program, accounts, data)`: `(Account, Account[], bytes) → bytes`
|
|
478
|
+
- Invokes another program with the listed accounts and returns the return data. The program is an
|
|
479
|
+
account parameter too ("svm.call's program — declare the callee as an `Account` param: …"). The
|
|
480
|
+
list must hold accounts, not numbers ("`svm.call`'s accounts argument must be an array of
|
|
481
|
+
accounts, e.g. `[a, b]` of `Account` params"). `[]` is fine. **A failed call fails the whole
|
|
482
|
+
transaction.**
|
|
483
|
+
- Example: `svm.call(tokenProgram, [source, destination, owner], instruction);`
|
|
484
|
+
- `svm.remainingAccount(i)`: `(number) → Account`
|
|
485
|
+
- The `i`-th account attached after the ones `main` declares. **Only inside `main`.**
|
|
486
|
+
"`svm.remainingAccount` takes one index, got N"
|
|
487
|
+
- Example: `const extra = svm.remainingAccount(0n);`
|
|
488
|
+
- `const rest = svm.remainingAccounts()`: `() → Account[]`
|
|
489
|
+
- Every account attached after the declared ones. **Only as a `let`/`const` initializer, and only
|
|
490
|
+
inside `main`:** "`svm.remainingAccounts()` can only initialize a `let`/`const` — … Bind it
|
|
491
|
+
first (`const rest = svm.remainingAccounts();`), then use the binding".
|
|
492
|
+
- Example: `const rest = svm.remainingAccounts(); svm.call(router, rest, data);`
|
|
493
|
+
|
|
494
|
+
An unknown name gives "`svm.rent` is not an svm builtin; `svm` is a reserved namespace root".
|
|
495
|
+
|
|
496
|
+
## 12. Methods on values, and account properties
|
|
497
|
+
|
|
498
|
+
### Methods (Both targets)
|
|
499
|
+
|
|
500
|
+
- `.slice(start, end)`, on bytes
|
|
501
|
+
- Types: `(scalar, scalar) → bytes`
|
|
502
|
+
- Covers bytes `start` up to, but not including, `end`. `end < start` reverts. Arrays have no
|
|
503
|
+
`.slice`: "a bytes method's receiver requires a bytes value". "`.slice` takes exactly 2
|
|
504
|
+
arguments (start, end), got N"
|
|
505
|
+
- Example: `const args = input.slice(4n, 68n);`
|
|
506
|
+
- `.concat(b1, b2, …)`, on bytes
|
|
507
|
+
- Types: `(...bytes) → bytes`
|
|
508
|
+
- Joins bytes values. "a `.concat` argument requires a bytes value"
|
|
509
|
+
- Example: `const call = selector.concat(to.toBytesBe(32n), amount.toBytesBe(32n));`
|
|
510
|
+
- `.toBe()`, on bytes, at most 32
|
|
511
|
+
- Types: `() → number`
|
|
512
|
+
- Reads the bytes as a big-endian number. Longer input fails when run.
|
|
513
|
+
- Example: `const word = input.slice(4n, 36n).toBe();`
|
|
514
|
+
- `.toLe()`, on bytes, at most 32
|
|
515
|
+
- Types: `() → number`
|
|
516
|
+
- Reads the bytes as a little-endian number (Solana's layout)
|
|
517
|
+
- Example: `const amount = input.slice(64n, 72n).toLe();`
|
|
518
|
+
- `.toBytesBe(width)`, on a scalar
|
|
519
|
+
- Types: `(scalar) → bytes`
|
|
520
|
+
- The low `width` bytes, big-endian, with `width` from 1 to 32. A constant outside that range
|
|
521
|
+
gives "a `.toBytesBe`/`.toBytesLe` width must be between 1 and 32 bytes, got 33". A computed
|
|
522
|
+
width above 32 reverts, and a computed 0 gives empty bytes.
|
|
523
|
+
- Example: `log(total.toBytesBe(32n));`
|
|
524
|
+
- `.toBytesLe(width)`, on a scalar
|
|
525
|
+
- Types: `(scalar) → bytes`
|
|
526
|
+
- The same, little-endian
|
|
527
|
+
- Example: `const field = amount.toBytesLe(8n);`
|
|
528
|
+
- `.length`, on bytes or an array
|
|
529
|
+
- Types: number
|
|
530
|
+
- The byte count or the element count. On a record, `.length` looks for a field named `length`
|
|
531
|
+
("`length` is not a field of this tuple — …"). It cannot be assigned.
|
|
532
|
+
- Example: `for (let i = 0n; i < amounts.length; i++) { … }`
|
|
533
|
+
|
|
534
|
+
**Call methods on a variable, not on a literal.** ``hex`a9`.concat(d)`` and `"ab".concat(d)` are rejected
|
|
535
|
+
("calling anything other than a plain function name …"). Write ``const selector = hex`a9059cbb`; selector.concat(d)``.
|
|
536
|
+
|
|
537
|
+
### Account properties
|
|
538
|
+
|
|
539
|
+
- `acct.address` → number, **Both**
|
|
540
|
+
- On SVM: the account's public key
|
|
541
|
+
- On EVM: the address itself
|
|
542
|
+
- Example: `require(acct.address == EXPECTED_MINT);`
|
|
543
|
+
- `acct.owner` → number, **SVM**
|
|
544
|
+
- On SVM: the program that owns the account
|
|
545
|
+
- On EVM: not available: "`account.owner` is not available on the evm target; an address on the
|
|
546
|
+
EVM is the code — check it with ctx.isContract"
|
|
547
|
+
- Example: `require(acct.owner == TOKEN_PROGRAM);`
|
|
548
|
+
- `acct.dataLen` → number, **SVM**
|
|
549
|
+
- On SVM: the account's data size, in bytes
|
|
550
|
+
- On EVM: not available
|
|
551
|
+
- Example: `require(acct.dataLen == 165n);`
|
|
552
|
+
|
|
553
|
+
- These properties are read-only: "`.owner` is read-only — …".
|
|
554
|
+
- On SVM, compare accounts with `a == b` or `a != b`; ordering comparisons are rejected.
|
|
555
|
+
- On SVM an account is not an ordinary value. Returning one gives "a return value can't be an account — …", and
|
|
556
|
+
using one where a number is expected, as in arithmetic, gives "…: expected a number, found an account". Use
|
|
557
|
+
`acct.address` when you need its key.
|
|
558
|
+
|
|
559
|
+
## 13. Contract bindings and `.catch()` (EVM)
|
|
560
|
+
|
|
561
|
+
**Bind an ABI** with `import ERC20 from "./erc20.abi.json"`, or with the compile option
|
|
562
|
+
`inlineContracts: [["ERC20", abiJson]]`. Then call through it:
|
|
563
|
+
|
|
564
|
+
- `ERC20.at(address).method(args)`: read-only for `view` and `pure` methods; otherwise a regular
|
|
565
|
+
call sending no value
|
|
566
|
+
- Example: `const balance = ERC20.at(token).balanceOf(ctx.self());`
|
|
567
|
+
- `ERC20.view(address).method(args)`: always read-only
|
|
568
|
+
- Example: `const supply = ERC20.view(token).totalSupply();`
|
|
569
|
+
- `ERC20.lib(address).method(args)`: always a delegatecall
|
|
570
|
+
- Example: `Library.lib(lib).run(x);`
|
|
571
|
+
- `const t = ERC20.at(address); t.method(args)`: the same, through a variable
|
|
572
|
+
- Example: `const t = ERC20.at(token); t.approve(router, amount);`
|
|
573
|
+
|
|
574
|
+
- **Results.**
|
|
575
|
+
- A method with no outputs returns its raw return bytes.
|
|
576
|
+
- A method with one output returns that output.
|
|
577
|
+
- A method with several outputs returns a record named after the ABI's outputs: read `.amountOut` or `[0]`,
|
|
578
|
+
or destructure it with `const [a, b] = …`.
|
|
579
|
+
- **Every single-value output is typed as a number, `bool` and `address` included.** Write
|
|
580
|
+
`ERC20.at(t).transfer(to, x) == 1n` if you need a bool. A `: bool` function cannot return the call directly
|
|
581
|
+
("a return value: expected a bool, found a number").
|
|
582
|
+
- **Struct arguments** can be object literals with the fields in any order; they are matched to the ABI by name.
|
|
583
|
+
- **No value.** A bound call never sends value. Use `evm.call(address, value, data)` (§10) when you need to.
|
|
584
|
+
- **Token transfers.** For ERC-20 `transfer` and `approve`, prefer `@sauce/token` (`import { transfer, approve }
|
|
585
|
+
from "@sauce/token"`), which handles tokens that return nothing, such as USDT. A bound call decodes exactly
|
|
586
|
+
what the ABI declares.
|
|
587
|
+
- **Errors.**
|
|
588
|
+
- "`ERC20` has no method named `totalSupply`".
|
|
589
|
+
- "`ERC20.transfer()` expects 2 argument(s), but this call passes 1".
|
|
590
|
+
- "`.at()` (a contract binding) takes exactly 1 argument (the address)".
|
|
591
|
+
- Overloaded methods with the same argument count are not supported.
|
|
592
|
+
- On SVM: "`Contract.at` is not available on the svm target; invoke another program with svm.call(program,
|
|
593
|
+
accounts, calldata), or import a library's SVM arm (@sauce/token)".
|
|
594
|
+
|
|
595
|
+
### `.catch()`: surviving a failed external call (EVM)
|
|
596
|
+
|
|
597
|
+
- `<call>.catch(() => { … });`
|
|
598
|
+
- If the call fails, its effects are undone and the block runs instead. The block may use and
|
|
599
|
+
assign the enclosing function's variables. Works on bound contract calls and on `evm.call`,
|
|
600
|
+
`evm.static` and `evm.delegate`.
|
|
601
|
+
- Example: `ERC20.at(t).approve(spender, amount).catch(() => { approved = false; });`
|
|
602
|
+
- `const v = <call>.catch(() => { return <constant>; });`
|
|
603
|
+
- If the call fails, `v` is the constant. The call must return one value: a bound method with
|
|
604
|
+
one output. A raw `evm.call`, `evm.static` or `evm.delegate` returns bytes, which no constant
|
|
605
|
+
stands in for ("a `.catch()` fallback: expected a bytes value, found a number"); test a raw
|
|
606
|
+
read with the statement form, then read again only when it worked.
|
|
607
|
+
- Example: `const balance = ERC20.at(t).balanceOf(who).catch(() => { return 0n; });`
|
|
608
|
+
- A call to an address with no code does not revert: it succeeds with no return data, so
|
|
609
|
+
`.catch()` never runs, and decoding that nothing reverts the cook. Check
|
|
610
|
+
`ctx.codeSize(address) > 0n` first when the address may have no code.
|
|
611
|
+
|
|
612
|
+
Rules and errors:
|
|
613
|
+
|
|
614
|
+
- The block takes no parameter: "a `.catch()` handler parameter (the caught error is not supported)".
|
|
615
|
+
- Use a `{ … }` block, not `() => value`. Arrow functions are allowed nowhere else.
|
|
616
|
+
- A `return`, or a `break`/`continue` leaving the block, is not allowed in the statement form ("a `return` in a
|
|
617
|
+
`.catch()` handler …").
|
|
618
|
+
- The value form needs exactly `return <constant>;`:
|
|
619
|
+
- "a captured `.catch()` requires exactly `return <constant scalar>;` in its handler";
|
|
620
|
+
- "the `.catch()` fallback must be a constant scalar that fits the declared ABI result width".
|
|
621
|
+
- A long block can be too large ("a `.catch()` handler is N bytes, beyond the 255 …"). Move the work into a
|
|
622
|
+
function and call it.
|
|
623
|
+
- On anything other than an external EVM call, the compiler rejects it ("a `.catch()` on something other than an
|
|
624
|
+
external contract call …"). On SVM: "`.catch()` is not available on the svm target".
|
|
625
|
+
|
|
626
|
+
## 14. Not supported, and what to write instead
|
|
627
|
+
|
|
628
|
+
| Not supported | Write instead |
|
|
629
|
+
| ---------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
|
|
630
|
+
| `switch` | `if` / `else if` chains |
|
|
631
|
+
| `do { } while (…)` | `while (true) { …; if (!cond) { break; } }` |
|
|
632
|
+
| `for (k in obj)`, `for await` | an index loop or `for (const x of array)` |
|
|
633
|
+
| `try { } catch { }`, `throw new Error(…)` | `require(cond, "reason")`, `throw "reason"`; `.catch()` for a failing EVM call |
|
|
634
|
+
| arrow functions, function expressions, nested functions | top-level `function` declarations (`.catch(() => { … })` is the one exception) |
|
|
635
|
+
| `class`, `enum`, `type` aliases, generics, `namespace` | records, `interface`, constants |
|
|
636
|
+
| `async function`, `await` | plain functions. **`async function` and `function*` compile today, but as ordinary functions: don't write them.** |
|
|
637
|
+
| default parameters, rest parameters, destructuring parameters | plain parameters |
|
|
638
|
+
| object destructuring `const { a } = t` | `const a = t.a;` |
|
|
639
|
+
| spread `[...xs]`, `f(...xs)` | explicit elements, or a loop |
|
|
640
|
+
| `?.`, `??`, `x!`, `as`, `satisfies` | explicit checks; annotations |
|
|
641
|
+
| `>>>`, `typeof`, `instanceof`, `in`, `delete`, `void`, unary `+` | `Math.sShr`, or plain values |
|
|
642
|
+
| `>>>=`, `\|\|=`, `&&=`, `??=` | `x = …` |
|
|
643
|
+
| `a[i] += v`, `t.f += v`, `a[i]++` | `a[i] = a[i] + v` |
|
|
644
|
+
| `i++` used as a value | `i += 1n` on its own line |
|
|
645
|
+
| `t[0] = v` on a record | `t.field = v` |
|
|
646
|
+
| template strings | `"text"`, or bytes built with `.concat` |
|
|
647
|
+
| `1e18`, `1.5`, `null`, `undefined` | `10n ** 18n`, integers in the smallest unit, `0n` |
|
|
648
|
+
| `xs.push(v)`, `console.log`, any JavaScript library | `new Array(n)` with an index; `log(…)` |
|
|
649
|
+
| `Math.min`, `max`, `abs`, `pow` | `if` or a ternary; `**` |
|
|
650
|
+
| comparing bytes with `==` | compare `crypto.keccak256` of each |
|
|
651
|
+
| `export default`, `export { … }`, `import * as X` | `export function` / `export const`; named imports |
|
|
652
|
+
| a method on a literal (``hex`…`.concat(d)``) | bind the literal to a `const` first |
|
|
653
|
+
| sending value through a bound call | `evm.call(address, value, data)` |
|
|
654
|
+
| labeled statements, labeled `break`/`continue` | a flag variable |
|
|
655
|
+
| computed object keys, object methods | plain named fields |
|
|
656
|
+
|
|
657
|
+
The compiler rejects each of these. Most messages read "… is not supported", naming the construct.
|
|
658
|
+
|
|
659
|
+
## 15. Limits
|
|
660
|
+
|
|
661
|
+
| Limit | Value |
|
|
662
|
+
| --------------------------------------------------------------------------------------- | ------------------------------------------------ |
|
|
663
|
+
| Parameters of a function other than `main`, plus the values its body keeps live at once | about 16 (§4) |
|
|
664
|
+
| `log` topics | 4 on EVM; none on SVM |
|
|
665
|
+
| `eval` arguments | 16 |
|
|
666
|
+
| `abi.encode` values, record fields encoded, `abi.decode` fields | 255 |
|
|
667
|
+
| Elements in an array literal | 65,535 |
|
|
668
|
+
| Bytes in a string or `hex` literal | 65,535 |
|
|
669
|
+
| `.catch()` block | about 255 bytes of compiled code |
|
|
670
|
+
| `crypto.findPDA` seeds | 15 (checked when run) |
|
|
671
|
+
| Nested arrays in a `main` parameter | 4 levels |
|
|
672
|
+
| One caller-supplied collection in `main`'s arguments | 16 KiB |
|
|
673
|
+
| Working memory on SVM | 64 KiB per run |
|
|
674
|
+
| One Solana transaction: the program, its arguments and the cook | 1,232 bytes; `sauce run` stages a larger program |
|