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

# actions: Parsing, schema and validation

> Parsing, schema and validation: the declaration and description of each of the 6 exports of @eco-incorp/sauce/actions.

`@eco-incorp/sauce/actions` reads JSON action programs (`{ version, chainId?, actions }`), validates them against the JSON Schema exported as `@eco-incorp/sauce/actions/action-program.schema.json`, and compiles them for a chain. A token field takes a registry symbol and a contract field a namespace reference, beside an address.

```typescript theme={null}
import { parseProgram, compileProgram } from "@eco-incorp/sauce/actions";
```

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

### `parseProgram`

*Function* · `@eco-incorp/sauce/actions`

Parses and validates an action program - JSON text, or an already-parsed value. Returns a fresh
copy with its keys in canonical order. Throws a `ProgramError` whose `issues` lists every
problem, each with its path.

```typescript theme={null}
export declare function parseProgram(input: unknown): ActionProgram;
```

### `serializeProgram`

*Function* · `@eco-incorp/sauce/actions`

The canonical JSON text of `program`: validated first, keys in schema order, so two equal
programs serialize to the same text. `space` indents as `JSON.stringify` does.

```typescript theme={null}
export declare function serializeProgram(program: ActionProgram, space?: number | string): string;
```

### `programSchema`

*Function* · `@eco-incorp/sauce/actions`

The JSON Schema every action program satisfies.

```typescript theme={null}
export declare function programSchema(): JsonSchema;
```

### `JsonSchema`

*Type* · `@eco-incorp/sauce/actions`

```typescript theme={null}
export type JsonSchema = {
    readonly [key: string]: unknown;
};
```

### `ProgramError`

*Class* · `@eco-incorp/sauce/actions`

Thrown for a program that breaks any rule. `issues` lists every problem found, in order; `chain`
is set when they are the compiled chain's - a name it lacks - rather than the document's own.

```typescript theme={null}
export declare class ProgramError extends Error {
    readonly issues: readonly ProgramIssue[];
    readonly chain?: CanonicalChain;
    constructor(issues: readonly ProgramIssue[], chain?: CanonicalChain);
}
```

### `ProgramIssue`

*Interface* · `@eco-incorp/sauce/actions`

One problem with a program, located by a path into the document (`actions[2].amountRef`).

```typescript theme={null}
export interface ProgramIssue {
    readonly path: string;
    readonly message: string;
}
```


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