Skip to main content
The routes namespace compiles a SauceScript program for one chain by name and builds the calls that run it. routes.compileSauceProgram(chain, source, options?) compiles with the chain’s token symbols, protocol namespaces and @sauce/token in scope; routes.encodeEntryArguments(program, values) encodes main’s run-time arguments; routes.buildSauceEvmCall(params) builds one cook(engine, program) call on a Pot. The chain exports (Base, Solana, …), chain and Token are named exports of the root, and importing the package puts nothing on globalThis.
Generated from the type declarations of @eco-incorp/sauce.

routes.compileSauceProgram

Function · @eco-incorp/sauce Compiles a standalone program for chain: a program that runs directly on a Pot. It gets the chain’s ambient bundle (chainId, protocol addresses and token symbols as compile-time values scoped to this chain, and the @sauce/token functions with no import) and the token and protocol syntax. So one source compiles, unchanged, for any chain whose names it uses. main may declare typed runtime parameters; entryParams reports them and encodeEntryArguments encodes values for them. Or options.args binds them into the program as it compiles.

routes.compileSauceRoute

Function · @eco-incorp/sauce Compiles sauce for destination’s ChainKind, and slots the result into exactly one CallInput via the existing buildSauceEvmCall/buildSauceSvmCall fork - never a new encoder. sauce is a SauceScript file: a module declaring function main, or a script whose top-level statements run as the entry. It reaches the compiler as written, apart from the SDK’s rewrites. A value-returning or early-exiting program declares main, since a top-level return is not SauceScript.

routes.CompiledSauceProgram

Interface · @eco-incorp/sauce A standalone program, compiled for one chain: compileSauceProgram’s result.

routes.CompiledSauceRoute

Interface · @eco-incorp/sauce

routes.SauceCompileOptions

Interface · @eco-incorp/sauce

routes.SauceProgramOptions

Interface · @eco-incorp/sauce compileSauceProgram’s options: a route’s, and main’s arguments to bind.

routes.SauceEvmExecutionInput

Interface · @eco-incorp/sauce

routes.SauceSvmExecutionInput

Type · @eco-incorp/sauce Staged SVM execution settings from the route call builder. The caller supplies a finalized CODE account and its execution accounts. expectedSha256 is rejected because the engine instruction does not carry a pin; see svm/instructions.ts#assertNoExecutePin.

routes.SourcePosition

Interface · @eco-incorp/sauce A place in a program’s text, 1-based.

routes.decodeEntryArguments

Function · @eco-incorp/sauce The strict inverse of encodeEntryArguments: main’s arguments read back from the bytes a cook appended to program’s bytecode, one value per declared parameter. Throws when encoded is not exactly the encoding encodeEntryArguments produces for the values it decodes to - a truncated, padded or otherwise non-canonical tail - so a decoded value is the only one those bytes carry.

routes.encodeEntryArguments

Function · @eco-incorp/sauce The encoded entry arguments for program: values checked against main’s declared parameters, in their order, and encoded as the program was compiled to read them. Append them to the program’s bytecode; that whole payload is the program of Pot.cook(engine, program). Throws, naming the parameter and what it takes, on a wrong count or a value that is not of the declared type.

routes.EntryParam

Interface · @eco-incorp/sauce One of main’s runtime parameters, as the program declares it.

routes.EntryValue

Type · @eco-incorp/sauce A value for an entry parameter: a scalar as a bigint, safe-integer number or integer string, an address as hex, a bool as a boolean, bytes as a Uint8Array or hex, an array as an array, and a tuple as an array of its fields in order or an object naming them.

routes.isSauceClosure

Function · @eco-incorp/sauce True for anything sauceBodyToSource (rather than the plain string path) should handle.

routes.sauceBodyToSource

Function · @eco-incorp/sauce Extracts a complete function main(){...} program from a closure’s own declared source text. Fails closed (never silently falls back) on anything this first cut doesn’t support.

routes.chainAmbient

Function · @eco-incorp/sauce The ambient-MODULE half of a chain bundle. Returns the ambient module specifier list active for chain: whole SauceScript library modules whose exported functions/consts are broadcast into a chain’s compiled program with no import line (see sauce-route.ts#SauceCompileOptions.ambient/rs-compile.ts). Currently a SINGLE source of truth, not yet chain-specific: every chain gets the same list, the plugin manifest’s own ambient array - ["@sauce/token"] by default, resolved to the SDK’s own vendored copy on the route path. Extensible to a genuinely per-chain bundle later (e.g. an SVM destination activating an SVM-only ambient module an EVM one shouldn’t see) without changing this function’s signature - a caller already threads chain through.

routes.chainDefines

Function · @eco-incorp/sauce The chain-scoped ambient defines map for chain: chainId/CHAIN_ID, every EVM protocol contract address that has a real entry on chain.id, and any caller-supplied token symbols. Byte-identical output: loadPluginData().protocolAddresses IS DESCRIPTORS and .tokens IS resolveTokenMap, not a copy.

routes.AmbientDefinesOptions

Interface · @eco-incorp/sauce