> ## 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.

# routes: Intent, route and reward types

> Intent, route and reward types: 15 exports of the routes module of @eco-incorp/sauce, including assembleIntent, emptyRoute, toBigInt, toUniversalAddress, AddressInput, Call.

The `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`.

```typescript theme={null}
import { routes } from "@eco-incorp/sauce";
```

This page covers `sdk/dist/routes/intent.d.ts`, `sdk/dist/routes/normalize.d.ts`, `sdk/dist/routes/types.d.ts`.

<Note>
  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](/programmable-transactions/sauce/architecture-and-deployments).
</Note>

### `routes.assembleIntent`

*Function* · `sdk/dist/routes/intent.d.ts`

Builds one `Intent` for a leg running from `source` to `destination`.
`route === undefined` means a TERMINAL close: the leg gets a synthesized
empty route (see `emptyRoute`) instead of a caller-supplied one.

```typescript theme={null}
export declare function assembleIntent(source: CanonicalChain, destination: CanonicalChain, route: RouteInput | undefined, reward: RewardInput): Intent;
```

### `routes.emptyRoute`

*Function* · `sdk/dist/routes/normalize.d.ts`

The empty route synthesized for a TERMINAL `.<DestChain>()` close: `salt`
and `portal` stay zero (finalization's job - E3.2/E3.3), `deadline`
inherits the leg's own reward deadline so the shape isn't structurally
expired on arrival, and `tokens`/`calls` are empty. A valid SHAPE, not a
submittable intent.

```typescript theme={null}
export declare function emptyRoute(deadline: bigint): Route;
```

### `routes.toBigInt`

*Function* · `sdk/dist/routes/normalize.d.ts`

Accepts `bigint | number | string`; rejects negative or non-integer values.

A `number` goes through `toExactBigInt`, so it must also be a SAFE integer. Pass a large
value as a `bigint` (`10n ** 18n`) or as a PLAIN DECIMAL string (`'1000000000000000000'`) - exponent notation like `'1e21'` is rejected too, being no more an integer string than `1e21` as
a `number` is a safe one.

```typescript theme={null}
export declare function toBigInt(value: bigint | number | string): bigint;
```

### `routes.toUniversalAddress`

*Function* · `sdk/dist/routes/normalize.d.ts`

Coerces an address into the eco-routes 32-byte `UniversalAddress` format:
a 20-byte EVM address is left-padded to 32 bytes; an already-32-byte value
passes through unchanged. Anything else throws.

```typescript theme={null}
export declare function toUniversalAddress(input: AddressInput): UniversalAddress;
```

### `routes.AddressInput`

*Type* · `sdk/dist/routes/types.d.ts`

Loosened address input: 20-byte EVM hex, 32-byte hex, or an already-typed UniversalAddress.

```typescript theme={null}
export type AddressInput = Hex | UniversalAddress;
```

### `routes.Call`

*Interface* · `sdk/dist/routes/types.d.ts`

Unified call shape. SVM's on-chain `Call` has no `value` field - that
narrowing (dropping `value` for an SVM leg, or rejecting a nonzero one) is
an SVM-encode-time (E3.2) concern, deliberately NOT modeled here so this
layer stays engine-agnostic.

```typescript theme={null}
export interface Call {
    readonly target: UniversalAddress;
    readonly data: Hex;
    readonly value: bigint;
}
```

### `routes.CallInput`

*Interface* · `sdk/dist/routes/types.d.ts`

```typescript theme={null}
export interface CallInput {
    readonly target: AddressInput;
    readonly data: Hex;
    readonly value?: bigint | number | string;
}
```

### `routes.Intent`

*Interface* · `sdk/dist/routes/types.d.ts`

```typescript theme={null}
export interface Intent {
    readonly destination: bigint;
    readonly sourceChainId: bigint;
    readonly route: Route;
    readonly reward: Reward;
}
```

### `routes.Reward`

*Interface* · `sdk/dist/routes/types.d.ts`

```typescript theme={null}
export interface Reward {
    readonly deadline: bigint;
    readonly creator: UniversalAddress;
    readonly prover: UniversalAddress;
    readonly nativeAmount: bigint;
    readonly tokens: readonly TokenAmount[];
}
```

### `routes.RewardInput`

*Interface* · `sdk/dist/routes/types.d.ts`

Caller-facing, widened `Reward` - what a `.route(reward)` call accepts.

```typescript theme={null}
export interface RewardInput {
    readonly deadline: bigint | number | string;
    readonly creator: AddressInput;
    readonly prover: AddressInput;
    readonly nativeAmount?: bigint | number | string;
    readonly tokens?: readonly TokenAmountInput[];
}
```

### `routes.Route`

*Interface* · `sdk/dist/routes/types.d.ts`

```typescript theme={null}
export interface Route {
    readonly salt: Hex;
    readonly deadline: bigint;
    readonly portal: UniversalAddress;
    readonly nativeAmount: bigint;
    readonly tokens: readonly TokenAmount[];
    readonly calls: readonly Call[];
}
```

### `routes.RouteInput`

*Interface* · `sdk/dist/routes/types.d.ts`

Caller-facing, widened `Route` - what a `.<DestChain>(route)` call accepts.

```typescript theme={null}
export interface RouteInput {
    readonly salt?: Hex;
    readonly deadline: bigint | number | string;
    readonly portal: AddressInput;
    readonly nativeAmount?: bigint | number | string;
    readonly tokens?: readonly TokenAmountInput[];
    readonly calls?: readonly CallInput[];
}
```

### `routes.TokenAmount`

*Interface* · `sdk/dist/routes/types.d.ts`

```typescript theme={null}
export interface TokenAmount {
    readonly token: UniversalAddress;
    readonly amount: bigint;
}
```

### `routes.TokenAmountInput`

*Interface* · `sdk/dist/routes/types.d.ts`

```typescript theme={null}
export interface TokenAmountInput {
    readonly token: AddressInput;
    readonly amount: bigint | number | string;
}
```

### `routes.UniversalAddress`

*Type* · `sdk/dist/routes/types.d.ts`

bytes32-normalized 0x-hex address, the eco-routes cross-VM address format.
An EVM 20-byte address is left-padded to 32 bytes; an SVM 32-byte pubkey
passes through unchanged. See `normalize.ts#toUniversalAddress`.

```typescript theme={null}
export type UniversalAddress = Hex;
```
