# SpendControls

> Client-side limits checked before anything is signed.

```ts
import type { SpendControls } from 'x402-avm-js';
```

```ts
export interface SpendControls {
  /**
   * Maximum amount per payment in base units. A single value applies to every asset; a record maps
   * asset ids (`"0"` for ALGO) to limits, with `"*"` as the fallback for assets not listed. Anything
   * not covered falls back to {@link DEFAULT_MAX_AMOUNT}. Pass `Infinity` to remove the cap.
   */
  maxAmount?: AmountLimit | Record<string, AmountLimit>;
  /** If set, only these asset ids may be paid. */
  allowedAssets?: Array<string | number | bigint>;
  /** If set, only these networks (names or CAIP-2 ids) may be paid. */
  allowedNetworks?: string[];
  /** If set, only these recipient addresses may be paid. */
  allowedPayTo?: string[];
}
```

Client-side limits checked before anything is signed.

The server chooses the amount in a 402 challenge, so a hostile or buggy server could ask for any amount.
These controls bound what the client will agree to.

## Properties

- `maxAmount` (`true`): ">
Maximum amount per payment in base units. A single value applies to every asset; a record maps
asset ids (`"0"` for ALGO) to limits, with `"*"` as the fallback for assets not listed. Anything
not covered falls back to {@link DEFAULT_MAX_AMOUNT}. Pass `Infinity` to remove the cap.

- `allowedAssets` (`true`): ">
If set, only these asset ids may be paid.

- `allowedNetworks` (`string[]`):
If set, only these networks (names or CAIP-2 ids) may be paid.

- `allowedPayTo` (`string[]`):
If set, only these recipient addresses may be paid.

Source: [src/index.ts](https://github.com/x402-avm/x402-avm-js/blob/main/src/index.ts#L442)

Source: https://x402-avm.github.io/reference/js/spend-controls
