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

# svm: Engine

> Engine: the declaration and description of each of the 16 exports of @eco-incorp/sauce/svm, @eco-incorp/sauce/svm/engine.

`@eco-incorp/sauce/svm` is the Solana side: the client (`createSauceSvmClient`), clusters, PDAs, account resolution against the compiler's account manifest, Kitchen and engine instructions, transactions and sending, token accounts, and compute planning for `@sauce/router`'s Solana venues. `@eco-incorp/sauce/svm/engine` exports the engine's wire format and instruction builders, `@eco-incorp/sauce/svm/verify` verifies settle programs and engine CPI data, and `@eco-incorp/sauce/svm/engine-artifacts` (Node only) returns file paths to the packaged engine and Kitchen binaries.

```typescript theme={null}
import { createSauceSvmClient, SOLANA_CLUSTERS } from "@eco-incorp/sauce/svm";
```

Generated from the type declarations of `@eco-incorp/sauce`.

### `engineFaultName`

*Function* · `@eco-incorp/sauce/svm`, `@eco-incorp/sauce/svm/engine`

The fault a `Custom(code)` from the engine names, or `undefined` for a code it does not use.

```typescript theme={null}
export declare function engineFaultName(code: number): EngineFault | undefined;
```

### `EXECUTE_DISCRIMINATOR`

*Variable* · `@eco-incorp/sauce/svm`, `@eco-incorp/sauce/svm/engine`

The Kitchen-mediated engine instruction discriminators.

Declared here, not generated. The pre-release engine shipped an `engine-abi.json` these were
derived from; neither that artifact nor the engine it described exists any more - nothing about
the engine is source-controlled now, it is fetched from a pinned release.

```typescript theme={null}
EXECUTE_DISCRIMINATOR: Uint8Array<ArrayBuffer>
```

### `EXECUTE_FROM_ACCOUNT_DISCRIMINATOR`

*Variable* · `@eco-incorp/sauce/svm`, `@eco-incorp/sauce/svm/engine`

```typescript theme={null}
EXECUTE_FROM_ACCOUNT_DISCRIMINATOR: Uint8Array<ArrayBuffer>
```

### `CLOSE_ACCOUNT_DISCRIMINATOR`

*Variable* · `@eco-incorp/sauce/svm`, `@eco-incorp/sauce/svm/engine`

`closeAccount` - the third instruction, previously unrepresented here.

```typescript theme={null}
CLOSE_ACCOUNT_DISCRIMINATOR: Uint8Array<ArrayBuffer>
```

### `COOK_AND_PAY_DISCRIMINATOR`

*Variable* · `@eco-incorp/sauce/svm`, `@eco-incorp/sauce/svm/engine`

The direct paid cooks: `sha256("global:<name>")[..8]`, as the engine declares them.

`cookAndPay` carries `max_execution_fee` (u64 LE) and then the bytecode; `cookAndPayFromAccount`
the fee cap alone, the program being account 0's data; `cookAndPayFromAccountPinned` the fee cap
and the SHA-256 that account 0's whole data must hash to. None carries a Pot gate header.

```typescript theme={null}
COOK_AND_PAY_DISCRIMINATOR: Uint8Array<ArrayBuffer>
```

### `COOK_AND_PAY_FROM_ACCOUNT_DISCRIMINATOR`

*Variable* · `@eco-incorp/sauce/svm`, `@eco-incorp/sauce/svm/engine`

```typescript theme={null}
COOK_AND_PAY_FROM_ACCOUNT_DISCRIMINATOR: Uint8Array<ArrayBuffer>
```

### `COOK_AND_PAY_FROM_ACCOUNT_PINNED_DISCRIMINATOR`

*Variable* · `@eco-incorp/sauce/svm`, `@eco-incorp/sauce/svm/engine`

```typescript theme={null}
COOK_AND_PAY_FROM_ACCOUNT_PINNED_DISCRIMINATOR: Uint8Array<ArrayBuffer>
```

### `ENGINE_FAULTS`

*Variable* · `@eco-incorp/sauce/svm`, `@eco-incorp/sauce/svm/engine`

The engine's `Custom(n)` fault codes, by name - what a failed engine instruction's
`InstructionError` carries. `Revert` (0) is a program's own `throw`/`require`, its payload the
return data; every other code is the engine refusing. The direct cooks add the fee faults
(`InvalidFeeConfig` … `ExecutionFeeExceedsMaximum`) and `CodeHashMismatch`; a legacy instruction
sent by anything but a Kitchen cook is `NotCookedByKitchen`.

```typescript theme={null}
ENGINE_FAULTS: {
    readonly AccountDataTooSmall: 63;
    readonly AccountIndexOutOfBounds: 60;
    readonly AccountNotFound: 61;
    readonly AccountNotSigner: 66;
    readonly AccountNotWritable: 62;
    readonly BytecodeOutOfBounds: 12;
    readonly CodeHashMismatch: 72;
    readonly DataTooLarge: 41;
    readonly DivisionByZero: 50;
    readonly ExecutionFeeExceedsMaximum: 84;
    readonly ExecutionFeeNotPaid: 82;
    readonly ExpectedDescriptor: 30;
    readonly ExpectedScalar: 31;
    readonly HeapFull: 40;
    readonly IndexOutOfBounds: 42;
    readonly InvalidArrayElement: 14;
    readonly InvalidDescriptor: 32;
    readonly InvalidFeeConfig: 80;
    readonly InvalidFeePayer: 81;
    readonly InvalidInstruction: 11;
    readonly InvalidOpcode: 10;
    readonly InvalidStackSlot: 13;
    readonly InvalidSystemProgram: 83;
    readonly InvokeFailed: 64;
    readonly NotCookedByKitchen: 67;
    readonly Overflow: 51;
    readonly Revert: 0;
    readonly SeedTooLong: 71;
    readonly StackOverflow: 20;
    readonly StackUnderflow: 21;
    readonly SysvarUnavailable: 65;
    readonly TooManySeeds: 70;
}
```

### `EngineFault`

*Type* · `@eco-incorp/sauce/svm`, `@eco-incorp/sauce/svm/engine`

```typescript theme={null}
export type EngineFault = keyof typeof ENGINE_FAULTS;
```

### `HEAP_FRAME_BYTES`

*Variable* · `@eco-incorp/sauce/svm`, `@eco-incorp/sauce/svm/engine`

The required 256 KiB heap-frame request for every cook transaction: without it the cook fails before the program runs. Include `buildHeapFramePrepend()` exactly once. Duplicate ComputeBudget instruction types fail the transaction. Buffer-staging transactions do not require it.

```typescript theme={null}
HEAP_FRAME_BYTES = 262144
```

### `HEAP_FRAME_CU_PER_INVOCATION`

*Variable* · `@eco-incorp/sauce/svm`, `@eco-incorp/sauce/svm/engine`

CU cost of the heap-frame request, charged per program invocation in the transaction.

```typescript theme={null}
HEAP_FRAME_CU_PER_INVOCATION = 56
```

### `REQUEST_HEAP_FRAME_WIRE_BYTES`

*Variable* · `@eco-incorp/sauce/svm`, `@eco-incorp/sauce/svm/engine`

The size the SDK records for the RequestHeapFrame instruction. Measured with `getTransactionSize`, the instruction adds 8 bytes to a transaction that already carries another ComputeBudget instruction, and 40 bytes to one that carries none: the 8 and the ComputeBudget program's 32-byte key. Size a transaction with `getTransactionSize`.

```typescript theme={null}
REQUEST_HEAP_FRAME_WIRE_BYTES = 9
```

### `MAX_RETURN_DATA`

*Variable* · `@eco-incorp/sauce/svm`, `@eco-incorp/sauce/svm/engine`

```typescript theme={null}
MAX_RETURN_DATA = 1024
```

### `MAX_CPI_ACCOUNTS`

*Variable* · `@eco-incorp/sauce/svm`, `@eco-incorp/sauce/svm/engine`

```typescript theme={null}
MAX_CPI_ACCOUNTS = 64
```

### `ENGINE_GAS_LIMIT_CU`

*Variable* · `@eco-incorp/sauce/svm`, `@eco-incorp/sauce/svm/engine`

```typescript theme={null}
ENGINE_GAS_LIMIT_CU = 1400000
```

### `ENGINE_CHAIN_IDS`

*Variable* · `@eco-incorp/sauce/svm`, `@eco-incorp/sauce/svm/engine`

The chain IDs reported by `ctx.chainId()` for the supported Solana clusters.

```typescript theme={null}
ENGINE_CHAIN_IDS: {
    readonly mainnet: 1399811149n;
    readonly devnet: 1399811150n;
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.