routes namespace packages a Sauce program as an Eco intent. Base(body, options) and the other chain globals (installed by importing the root package) forward to routes.openRoute(destination, body, options), which returns a PendingSauceRoute; .nest(...) adds child intents and .reward(...) returns a BuiltIntent.
sdk/dist/routes/encode.d.ts, sdk/dist/routes/sauce-calls.d.ts, sdk/dist/routes/nest.d.ts.
Generated from the type declarations shipped in
@eco-incorp/sauce 0.99.4. Each entry shows the package authors’ JSDoc and declaration for this SDK version. For runtime compatibility and deployed addresses, see architecture and deployments.routes.denormalizeToEvm
Function · sdk/dist/routes/encode.d.ts
Narrows a 32-byte UniversalAddress to a 20-byte EVM address. Throws
(rather than silently truncating) if the leading 12 bytes aren’t zero - that shape means the address is not EVM-representable (e.g. a real SVM
pubkey), and truncating it would produce a plausible-looking but wrong hash.
routes.encodeIntent
Function · sdk/dist/routes/encode.d.ts
Encodes an Intent’s route (for intent.destination) and reward (for intent.sourceChainId).
routes.encodeReward
Function · sdk/dist/routes/encode.d.ts
Encodes a Reward for the given chain, forking by ChainKind.
routes.encodeRewardEvm
Function · sdk/dist/routes/encode.d.ts
Encodes a Reward for an EVM (or TVM) source via the deployed Portal ABI shape.
routes.encodeRewardSvm
Function · sdk/dist/routes/encode.d.ts
Encodes a Reward for an SVM source via the Portal IDL’s Borsh layout.
routes.encodeRoute
Function · sdk/dist/routes/encode.d.ts
Encodes a Route for the given chain, forking by ChainKind.
routes.encodeRouteEvm
Function · sdk/dist/routes/encode.d.ts
Encodes a Route for an EVM (or TVM) destination via the deployed Portal ABI shape.
routes.encodeRouteSvm
Function · sdk/dist/routes/encode.d.ts
Encodes a Route for an SVM destination via the Portal IDL’s Borsh layout.
routes.decodeReward
Function · sdk/dist/routes/encode.d.ts
Decodes a Reward for the given chain, forking by ChainKind.
routes.decodeRewardEvm
Function · sdk/dist/routes/encode.d.ts
Decodes a Reward previously produced by encodeRewardEvm, re-normalizing addresses back to 32-byte form.
routes.decodeRewardSvm
Function · sdk/dist/routes/encode.d.ts
Decodes a Reward previously produced by encodeRewardSvm.
routes.decodeRoute
Function · sdk/dist/routes/encode.d.ts
Decodes a Route for the given chain, forking by ChainKind.
routes.decodeRouteEvm
Function · sdk/dist/routes/encode.d.ts
Decodes a Route previously produced by encodeRouteEvm, re-normalizing addresses back to 32-byte form.
routes.decodeRouteSvm
Function · sdk/dist/routes/encode.d.ts
Decodes a Route previously produced by encodeRouteSvm. calls[].value is reconstituted as 0n.
routes.hashIntent
Function · sdk/dist/routes/encode.d.ts
Computes the eco-routes intent hash: keccak256(abi.encodePacked(uint64 destination, bytes32 routeHash, bytes32 rewardHash)), with the route
encoded for intent.destination’s kind and the reward encoded for
intent.sourceChainId’s kind - the asymmetry that makes a cross-VM
(e.g. EVM source -> SVM destination) leg hash correctly.
routes.kindOf
Function · sdk/dist/routes/encode.d.ts
Resolves a ChainKindRef to a ChainKind. An explicit "evm"/"svm"
literal is returned as-is (the escape hatch for a chain id not yet in the
canonical registry). Anything else is looked up via requireChain, which
THROWS for an unregistered id - this never silently defaults to "evm".
routes.rewardHash
Function · sdk/dist/routes/encode.d.ts
keccak256(encodeReward(reward, source)).
routes.routeHash
Function · sdk/dist/routes/encode.d.ts
keccak256(encodeRoute(route, destination)).
routes.EVM_ROUTE_PARAM
Variable · sdk/dist/routes/encode.d.ts
The deployed Portal Route tuple shape (fulfillAndProve.inputs[1]).
routes.EVM_REWARD_PARAM
Variable · sdk/dist/routes/encode.d.ts
The deployed Portal Reward tuple shape (publish.inputs[2]).
routes.svmCallCodec
Variable · sdk/dist/routes/encode.d.ts
Portal IDL Call { target: Bytes32, data: bytes } - NO value field.
routes.svmRewardCodec
Variable · sdk/dist/routes/encode.d.ts
Portal IDL Reward { deadline, creator, prover, native_amount, tokens }, field order per the IDL.
routes.svmRouteCodec
Variable · sdk/dist/routes/encode.d.ts
Portal IDL Route { salt, deadline, portal, native_amount, tokens, calls }, field order per the IDL.
routes.svmTokenAmountCodec
Variable · sdk/dist/routes/encode.d.ts
Portal IDL TokenAmount { token: Bytes32, amount: u64 }.
routes.ChainKindRef
Type · sdk/dist/routes/encode.d.ts
Anything that can select which encoding fork to use: an explicit kind, or anything resolveChain accepts - including a native bigint chain id (eco-routes Intent.destination/sourceChainId are bigint), so a
caller can pass those straight through without a silent evm mis-classification.
routes.IntentHashes
Interface · sdk/dist/routes/encode.d.ts
routes.assertSauceEvmLive
Function · sdk/dist/routes/sauce-calls.d.ts
- @deprecated This checks the historical roster only. Verify pinned release code on chain.
routes.buildSauceCall
Function · sdk/dist/routes/sauce-calls.d.ts
Forks on kindOf(chain) (bigint-aware; throws for an unregistered chain id rather than
defaulting to evm) to build one Sauce-executing Call for either engine.
routes.buildSauceCalls
Function · sdk/dist/routes/sauce-calls.d.ts
Plural fork of buildSauceCall.
routes.buildSauceEvmCall
Function · sdk/dist/routes/sauce-calls.d.ts
One cook(engine, program) call on pot. data is produced by v12Pot.encodeCook - the exact
EVM engine encoder, not re-implemented here.
routes.buildSauceEvmCalls
Function · sdk/dist/routes/sauce-calls.d.ts
One Call per element of cooks, in the given order, all targeting the same pot.
routes.buildSauceSvmCall
Function · sdk/dist/routes/sauce-calls.d.ts
Builds ONE staged SVM route call. Merges account flags within its own instruction only - use
buildSauceSvmCalls for the cross-call merge over a whole leg.
routes.buildSauceSvmCalls
Function · sdk/dist/routes/sauce-calls.d.ts
RECOMMENDED entry point: builds one staged route call per executions element, with account
flags OR-merged across the whole leg by default.
routes.mergeSvmAccountFlags
Function · sdk/dist/routes/sauce-calls.d.ts
Cross-call OR-merge of isSigner/isWritable per pubkey across every given instruction’s
accounts - the Solana runtime dedupes a repeated pubkey in one transaction to the union of its
flags, so a leg’s own two staged calls (e.g. swap half + settle half) sharing an account must
agree on the more-permissive flags before either is built, not just within itself.
routes.sauceEvmDeployPotCall
Function · sdk/dist/routes/sauce-calls.d.ts
The leading deployPot(owner, salt) call a solver issues before its first cook() on a Pot that
may not exist yet.
Supply kitchen explicitly or use chainId to select the pinned release Kitchen. The chain
roster is historical; this helper does no RPC or current deployment verification.
routes.SauceEvmCallParams
Interface · sdk/dist/routes/sauce-calls.d.ts
Verbatim re-export - sizing advice only, emits zero instructions. See the module doc above.
routes.SauceEvmCallsParams
Interface · sdk/dist/routes/sauce-calls.d.ts
routes.SauceEvmDeployPotCallParams
Interface · sdk/dist/routes/sauce-calls.d.ts
routes.SauceSvmAccountMeta
Interface · sdk/dist/routes/sauce-calls.d.ts
One account meta as the caller supplies it - pre-merge, pre-executor-flattening.
routes.SauceSvmCallParams
Interface · sdk/dist/routes/sauce-calls.d.ts
routes.SauceSvmCallsParams
Interface · sdk/dist/routes/sauce-calls.d.ts
routes.SauceSvmExecution
Interface · sdk/dist/routes/sauce-calls.d.ts
routes.StagedBufferRef
Interface · sdk/dist/routes/sauce-calls.d.ts
A buffer this module did NOT stage - only the RESOLVED facts about it. Deliberately carries no
bytecode/seed/authority/payer: see the module doc’s “SVM STAGING IS A PREREQUISITE”
section for why, and where those pieces actually come from.
routes.SvmAddressInput
Type · sdk/dist/routes/sauce-calls.d.ts
A base58 string, a kit Address, or anything duck-typed like a web3.js PublicKey - see the
module doc’s “WHY THIS FILE … NEVER @solana/web3.js” note.
routes.assertNestingInvariants
Function · sdk/dist/routes/nest.d.ts
Asserts the six build-time invariants a static cascade must satisfy (design doc §15.4), all fail
closed:
- EVM parent -
parentChain.kind === "evm". The Solana Portal PROGRAM is not in eco-routes onmain(zero.rs); a child’s OWN destination may still besvm. - Source match - every child’s
sourceChainIdequals the parent’s destination chain id. - Static child -
assertStaticChildper child (the S6 seam). - Deadlines INCREASE with depth -
child.route.deadline >= parentRoute.deadlineANDchild.reward.deadline >= parentRoute.deadline. The child publishes DURING the parent’s fulfillment, whichInbox._fulfillallows right up to the parent’s ownroute.deadline(block.timestamp > route.deadlineis the only revert condition), so an earlier child deadline is publishable-but-already-dead. - Funding coverage - per reward token,
Σ children reward amounts <= Σ parentRoute.tokens amountsfor that token, andΣ children reward nativeAmount <= parentRoute.nativeAmount- skipping any child withfundedByBody: true, and (2026-08-11 directive) UNCONDITIONALLY skipping everyvia: "transfer"child regardless offundedByBody- the transfer itself IS the (balance-based) funding, so there is nothing static left to compare againstparentRoute.tokens/nativeAmount. Seeintent-dsl.ts’s T5 for the one native-only coverage check that DOES still apply to a transfer child (only when it opts intofundNativeFromRoute). - No duplicate intent hash -
normalizeRoutedefaultssaltto 32 zero bytes, so two structurally identical children silently collapse into the SAME intent. A repeatintentHashanywhere inchildrenthrows, pointing atoptions.salt.
routes.assertStaticChild
Function · sdk/dist/routes/nest.d.ts
Asserts every field of child’s reward is concrete (known off-chain). Vacuous today - Intent’s
runtime shape has no lazy/runtime-computed field, so a fully-built Intent is always static by
construction. This is deliberately kept as its own named assertion because it is the SEAM where an
S6 runtime-computed child (design doc §7) will be rejected here, rather than silently mis-encoded
by treating a placeholder as a real amount.
routes.nestedChildCalls
Function · sdk/dist/routes/nest.d.ts
The calls a static child contributes to the PARENT’s own route.calls:
[...approve(P, amount) per distinct reward token, publishAndFund(childDestination, childRouteBytes, childReward, allowPartial)], all issued against opts.portal (the parent’s own route.portal).
Reuses portal.ts#approvalTxs/publishAndFundTx entirely - no second encoder.
routes.AssertNestingInvariantsArgs
Interface · sdk/dist/routes/nest.d.ts
routes.NestChild
Interface · sdk/dist/routes/nest.d.ts
routes.NestedChildOptions
Interface · sdk/dist/routes/nest.d.ts
Per-child options for nestedChildCalls - portal is always the PARENT’s own route.portal.
