> ## Documentation Index
> Fetch the complete documentation index at: https://docs.eco.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Sauce programs as intents

> How @eco-incorp/sauce packages a Sauce program as an Eco intent: intent options, fees and deadlines, compiled callbacks and defines, token and protocol globals, the token, swap and deposit builders, nested intents, submission and inspection helpers, and the Solana limitation.

`Base(body, options).reward(reward)` compiles a program for Base and packages it as an [Eco intent](/concepts/intents): the solver delivers the route assets, and the destination fulfillment runs your program through a Pot. Every chain global (`Base`, `Arbitrum`, `Ethereum`, one per canonical chain) forwards to `routes.openRoute(chain, body, options)`. This page is the guided tour of that API; every export is in the [SDK reference](/sdk-reference/sauce/overview).

## Anatomy of a Sauce intent

| Field | Meaning |
| - | - |
| `Base(...)` | Destination chain: selects the compiler target, token addresses and protocol deployments |
| `options.portal`, `options.deadline` | Destination Portal and the absolute route deadline, Unix seconds |
| `options.execution` | `{ pot, engine, value }`: the Pot that runs the program, the engine `cook` names, and the native value sent with the cook |
| `options.tokens`, `options.nativeAmount` | Assets the solver delivers to the Portal Executor |
| `options.precalls` | Calls that run before the program, such as moving delivered tokens from the Executor into the Pot |
| `options.defines`, `options.tokenDefines` | Compile-time scalars for the program, and token symbol overrides |
| `options.sourcePortal` | Source Portal for the submission and read helpers |
| `reward.source`, `reward.tokens`, `reward.nativeAmount` | The chain and assets offered to the solver |
| `reward.creator`, `reward.prover`, `reward.deadline` | Creator, prover and the reward deadline recorded in the intent |

Building an intent publishes, funds and fulfills nothing. Your application sends the source transactions; a solver fulfills on the destination.

### Fees and deadlines

Every EVM `cook` pays the Kitchen's current `executionFee()` in native value, so `execution.value` is the fee plus any native value the program spends, and `nativeAmount` must cover every call value in the route; [Getting started](/programmable-transactions/sauce/getting-started) shows the reads.

`route.deadline` limits destination fulfillment. `reward.deadline` allows source refunds when no valid proof exists; leave time for fulfillment and proof delivery. Both are absolute Unix seconds.

### Callbacks are compiled source

A callback body is read with `Function.prototype.toString()`, parsed and compiled as SauceScript. It is never invoked as JavaScript and captures no outer variables. Pass application values through `defines` (scalar `bigint`, `number` or `boolean`; use `bigint` for addresses and amounts) or write a source string. Callbacks must be synchronous, take no parameters, and survive your bundler unchanged; ship an explicit source string when a build step rewrites function text.

## Token and protocol globals

Inside an EVM route body, token symbols and protocol names resolve against the destination chain:

```typescript theme={null}
USDC.approve(Uniswap.UniversalRouter, 1_000_000n);
let available = USDC.balanceOf(self);
Token(0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913n).approve(Uniswap.UniversalRouter, 1_000_000n);
```

* `USDC` resolves to the chain's registered token address. The registry carries `USDC`, `USDT`, `WETH` and wrapped natives on six EVM chains (Ethereum, Optimism, Polygon, Monad, Base, Arbitrum); a missing symbol means no verified row, and `tokenDefines` adds or overrides one. Amounts are integers in the token's smallest unit.
* The token member syntax supports `transfer`, `approve` and `balanceOf`. `self` is the executing contract, the Pot. `Token(address)` wraps any ERC-20.
* Protocol names are versioned: `UniswapV4.UniversalRouter`, `UniswapV3.SwapRouter02`, `AaveV3.Pool`, `Cctp.TokenMessenger`. A family alias such as `Uniswap.UniversalRouter` resolves only when one member owns the name; `Uniswap.Factory` is ambiguous and fails. Compilation checks for a destination-chain registry entry; it does not check live deployed code.
* A qualified reference such as `Ethereum.UniswapV4.UniversalRouter` selects Ethereum's address but still executes on the route's own chain. Cross-chain execution is separate intents, composed with nesting.
* For a contract outside the registry, pass an ABI through `compile.contracts` and call `Binding.at(address).method(...)`.

These names are route syntax with generated TypeScript declarations; there is no host `USDC` object. Import the root package with a side-effect import (`import "@eco-incorp/sauce"`) so the chain globals are installed. The full list of namespaces and tokens is the SDK's [coverage page](https://unpkg.com/@eco-incorp/sauce@0.99.4/docs/api/coverage.md).

## Builders

For programs constructed from data, the SDK emits SauceScript for you. None of these selects a market route or sends a transaction.

| Builder | Emits |
| - | - |
| `token.Token.transfer({ token, to, amount })`, `.approve(...)`, `.balanceOf(...)` | A token operation; `.toCall()` for a fixed EVM call, `.toSauceScript("evm")` for source |
| `swap.swapSource(spec)` | A program calling the Sauce Router's unified swap entry (UniV2, UniV3, UniV4, Curve, BalancerV2, DODOV2, TraderJoeLB, MaverickV2, WOOFi) |
| `deposit.depositSource(spec)` | A protocol deposit or withdrawal with its approval: Aave/Spark, Compound V3, ERC-4626/Euler, Lido, WETH wrapping |
| `actionsToSauce(actions)` from `/actions` | Compiled EVM bytecode from a sequence of routing actions |

Compile emitted source with `routes.compileSauceRoute(destination, source, execution, { baseDirs })`, passing the builder's base directories (`swap.SWAP_BASE_DIRS`, `deposit.DEPOSIT_BASE_DIRS`) so its ABI imports resolve.

## Nested intents

`.nest(child, options)` adds a child intent whose source is the parent's destination. When the parent fulfills, its route funds the child's reward; a solver fulfills the child in a later transaction. Each leg is a separate intent, so a failed child does not roll back a completed parent.

```typescript theme={null}
Base("return 1n;", parentOptions)
  .nest(
    (on) => Arbitrum("return 1n;", childOptions).reward({ ...childReward, source: on }),
    { requireCap: true, executionFee },
  )
  .reward(parentReward);
```

The default funding mode, `via: "transfer"`, appends a Sauce program that reads the Pot's balance and transfers up to the declared child reward to the child's vault, for one more cook and fee. Set `requireCap: true` to revert the parent when the Pot cannot cover the child. The alternative, `via: "publishAndFund"`, inserts approvals and a Portal `publishAndFund` call instead. Child deadlines must be at least as late as the parent's route deadline, and children must use distinct salts to be distinct intents.

## Submit and inspect

| Helper | Returns |
| - | - |
| `built.approvals()` | Source approvals for the root reward |
| `built.publishAndFundCalldata(allowPartial)`, `publishCalldata()`, `fundCalldata(allowPartial)` | Source Portal requests as `{ to, data, value }` |
| `built.hash()` | `intentHash`, `routeHash`, `rewardHash` |
| `built.vaultCall()`, `hashCall()`, `fundedCall()` | Source-chain read requests with decoders |
| `built.intent`, `built.intents()`, `built.children` | The normalized intent, the root and descendants in preorder, direct children |

The helpers perform no RPC and require an EVM source. Set `sourcePortal` in the options or pass `{ portal }` to each helper; the destination Portal is never reused as the submission target.

## Solana destinations

The route model can represent an SVM destination, but the SDK's SVM route helpers emit a legacy engine instruction that the released engine does not accept. Execute Solana programs through the Kitchen client from `@eco-incorp/sauce/svm`, as in [Getting started](/programmable-transactions/sauce/getting-started#solana).

## Package entry points

| Import | Contents |
| - | - |
| `@eco-incorp/sauce` | `routes`, `token`, `swap`, `deposit`, `contracts`, protocol and chain queries; installs the chain globals |
| `/compiler` | `compile`, compiler types, `encodeCompactArguments`, `decodeCompactArguments` |
| `/actions` | Routing action primitives and `actionsToSauce` |
| `/protocols/*` | One protocol's metadata, deployments and ABIs |
| `/chains`, `/deployments` | Canonical chains; release engine and Kitchen addresses |
| `/recipes` | The settle program and the CCTP split and plain-transfer builders |
| `/svm`, `/svm/engine`, `/svm/verify` | Solana client, staging, Kitchen instructions, settlement verification |
| `/evm/engine` | Pot and Kitchen ABIs and call encoders |
| `/verify` | EVM settlement validation against the pinned program; viem only, browser safe |
| `/skills` | Protocol Markdown for AI agents |

There is no `/routes`, `/token`, `/swap` or `/deposit` subpath; import those namespaces from the root. The complete manual ships in the package under `docs/`, readable on [unpkg](https://unpkg.com/@eco-incorp/sauce@0.99.4/docs/README.md).

## Next steps

* [Prepare a Pot and fund an intent](/programmable-transactions/sauce/getting-started).
* [Explore complete programs](/cookbook/sauce/small-programs).
