# allset-sdk

**GitHub:** [fastxyz/fast-sdk](https://github.com/fastxyz/fast-sdk/blob/main/packages/allset-sdk/README.md)

## What You Can Do

AllSet is the bridge SDK for moving tokens between the Fast payment network and EVM-compatible chains. Use it when you need to:

* **Deposit tokens into Fast** — move tokens from an EVM chain (Ethereum, Arbitrum, Base, etc.) onto the Fast network for fast, low-cost payments
* **Withdraw tokens from Fast** — move tokens from Fast back to an EVM chain to access DeFi, CEXs, or external services
* **Execute custom intents** — define arbitrary EVM operations (swap, supply, any contract call) that get executed on your behalf on the destination chain after funds settle on Fast

AllSet is designed to be **pure** — no embedded chain configs, no environment variables, no file system access. You pass all addresses, RPC URLs, and credentials explicitly, making it easy to test and predictable in any environment.

## Installation

Install from npm as `@fastxyz/allset-sdk`. The package README on GitHub includes the current install command, dependency expectations, and integration examples.

## Architecture

AllSet bridges two ecosystems: EVM chains and the Fast payment network. The key abstraction is the **intent** — a declaration of what you want to happen on the destination chain, paired with funds on Fast to pay for it.

| Function              | Role                                                                                                                              |
| --------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| `createEvmWallet()`   | Creates an EVM wallet from a private key, or generates a fresh random wallet for one-time bridging operations                     |
| `createEvmExecutor()` | Creates a viem `PublicClient` + `WalletClient` bound to a specific EVM chain                                                      |
| `executeDeposit()`    | Locks tokens on the EVM chain and issues a corresponding balance on Fast                                                          |
| `executeWithdraw()`   | Releases or debits tokens on Fast and unlocks them on the destination EVM chain                                                   |
| `executeIntent()`     | Combines a Fast-side token transfer with a predefined EVM execution plan; the intent is processed by the AllSet payment processor |

## Supported Chains

| Chain            | Chain ID | Role in AllSet                  |
| ---------------- | -------- | ------------------------------- |
| Ethereum Mainnet | 1        | Primary production EVM endpoint |
| Sepolia          | 11155111 | Testnet for EVM side            |
| Arbitrum         | 42161    | L2 deposit target               |
| Arbitrum Sepolia | 421614   | Testnet for L2 side             |
| Base             | 8453     | L2 deposit target               |

## How Deposits Work (EVM → Fast)

Depositing moves value from an EVM chain onto Fast. The tokens are locked in a lock contract on the EVM side, and an equivalent amount is issued or credited on Fast.

```
User EVM wallet
    │
    │  executeDeposit()
    │  ── tokens sent to lock contract on EVM
    ▼
EVM Lock Contract (holds tokens)
    │
    │  Payment processor detects event on EVM, submits to Fast
    ▼
Fast Network (credits user's Fast account)
    │
    │  Now usable for Fast-native fast/cheap payments
    ▼
User Fast account (via fast-sdk)
```

**Key properties:**

* Deposits require EVM gas — budget for that in your UX
* Finality on Fast is fast (seconds), but EVM event observation takes 1-3 minutes depending on chain
* Track deposit progress using the response returned by the SDK together with your application or relayer-side status handling

## How Withdrawals Work (Fast → EVM)

Withdrawing moves value from Fast back to an EVM chain. Tokens are released or debited on Fast, and the AllSet payment processor submits a transaction on the EVM destination chain to release the tokens to your wallet.

```
User Fast account
    │
    │  executeWithdraw()
    │  ── tokens debited on Fast
    ▼
AllSet Payment Processor (detects Fast event)
    │
    │  Submits release transaction on EVM destination chain
    ▼
EVM destination wallet (tokens arrive)
```

**Key properties:**

* Withdrawals are asynchronous — the Fast side settles quickly, but EVM delivery depends on payment processor queuing and EVM gas
* The payment processor takes a small fee in FAST for the forwarding service
* Use the returned order identifier to track payment status in your integration

## How Custom Intents Work

Intents unlock powerful composeability. Instead of just bridging tokens, you can specify what should happen on the destination EVM chain — a swap, a lending deposit, a specific contract call — and AllSet executes it automatically after your Fast funds are credited.

```
User Fast account
    │
    │  executeIntent()
    │  ── funds debited on Fast, intent registered
    ▼
Fast Network (credits funds, intent detected)
    │
    │  Payment processor detects intent on Fast
    ▼
Payment Processor (executes EVM operation)
    │
    │  Submits intent execution on EVM destination chain
    ▼
EVM destination (swap, deposit, contract call — result)
```

The payment processor detects the intent on Fast, credits the funds, and executes the described operation on the EVM destination chain — all as one atomic cross-chain workflow from the user's perspective. For intent examples with complete code, see the [AllSet SDK README on GitHub](https://github.com/fastxyz/fast-sdk/blob/main/packages/allset-sdk/README.md).

## Design Principles

All functions are **pure** — the SDK never reads from `process.env`, never reads a config file, and never embeds chain IDs or contract addresses. This means:

* You control exactly which chain and contract addresses your app uses
* Tests can swap in mock executors without SDK changes
* No surprises when new chains are added — you opt in explicitly

***

**For complete API documentation, runnable examples for deposits, withdrawals, and intents, and current configuration details, see the** [**AllSet SDK README on GitHub**](https://github.com/fastxyz/fast-sdk/blob/main/packages/allset-sdk/README.md)**.**


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.fast.xyz/sdk-references/core-sdk-execution/allset-sdk.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
