> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fluton.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Intent client (planned)

> The planned cross-chain side of the Fluton SDK: a client that creates intents, requests quotes, streams offers and executes them, with React bindings.

> [!NOTE]
>
> This interface is planned and not available yet. It is published here so integrators can see where
> the SDK is going; names and shapes may change before release. The pool client that exists today is
> documented from [Keys, notes and scanning](https://docs.fluton.io/sdk/keys-and-scanning.md) onwards and listed in the
> [Pool client reference](https://docs.fluton.io/sdk/reference.md).

The intent client lets a dApp create intents, request quotes, stream offers in real time, execute the selected offer and track an intent's status from start to finish, across chains. It also carries optional confidentiality settings and post-fulfillment actions.

## Packages and entry points

* `@fluton/sdk` (core)
* `@fluton/sdk/react` (hooks and providers)
* `@fluton/sdk/viem` (optional adapter helpers)
* `@fluton/sdk/ethers` (optional adapter helpers)

## Create a client

```ts theme={null}
import { FlutonClient } from "@fluton/sdk";

const fluton = new FlutonClient({
  chains: {
    ethereum: { chainId: 1, rpcUrl: "…" },
    arbitrum: { chainId: 42161, rpcUrl: "…" },
  },
  signer: ethersOrViemSigner, // optional
});
```

The signer is optional for server-side quoting and intent creation, and required for `execute()`.

## Quote, execute and track

```ts theme={null}
const quote = await fluton.bridge.quote({
  fromChain: "ethereum",
  toChain: "arbitrum",
  token: "USDC",
  amount: "100",
});

const res = await fluton.bridge.execute(quote);

fluton.bridge.track(res.intentId, (s) => console.log(s.status));
```

## Custom intents

The bridge helpers sit on a lower-level intent engine, which you can drive directly:

```ts theme={null}
const draft = await fluton.intent.create({ ... });
const signed = await fluton.intent.sign(draft);
const { intentId } = await fluton.intent.submit(signed);

const offer = await fluton.offers.selectBest(intentId);

await fluton.intent.execute(intentId, offer);
```

## Modules

### `fluton.supported`

Discover what is supported: networks, tokens and adapters.

* `getSupportedChains(): Promise<SupportedChains>`
* `getSupportedTokens(chain): Promise<Token[]>`
* `getCapabilities(): Promise<Capabilities>` (confidential support per chain and token)

### `fluton.bridge`

Simple bridge workflows.

* `quote(params): Promise<BridgeQuote>`
* `execute(quote, opts?): Promise<ExecutionResult>`
* `track(intentId | txHash, cb?): Unsubscribe`

### `fluton.intent`

The low-level intent engine.

* `create(params): Promise<IntentDraft>`
* `sign(draft, signer?): Promise<SignedIntent>` (private key or browser wallet signing)
* `submit(signed): Promise<{ intentId: string }>` (registers the intent with the backend)
* `get(intentId): Promise<Intent>`
* `status(intentId): Promise<IntentStatus>`
* `execute(intentId | SignedIntent, opts?): Promise<ExecutionResult>`

### `fluton.offers`

Offer discovery and selection.

* `list(intentId): Promise<Offer[]>`
* `subscribe(intentId, onOffer, onError?): Unsubscribe` (WebSocket or SSE, both supported)
* `selectBest(intentId, strategy?): Promise<Offer>`

### `fluton.utils`

Utility methods.

* `parseUnits(amount, decimals)`
* `formatUnits(bigint, decimals)`
* `toChainKey(chainId)` / `toChainId(key)`

## Types

### Chains and tokens

```ts theme={null}
type ChainKey = "ethereum" | "arbitrum" | string;

type Token = {
  symbol: string;         // "USDC"
  address: `0x${string}`; // on that chain
  decimals: number;
  name?: string;
};

type SupportedChains = Record<ChainKey, {
  chainId: number;
  rpcUrl?: string;
  nativeSymbol: string; // "ETH"
}>;
```

### Intent params

```ts theme={null}
type IntentCreateParams = {
  fromChain: ChainKey;
  toChain: ChainKey;

  inputToken: Token | string;  // a token symbol is enough
  outputToken: Token | string;
  inputAmount: string;         // human string, e.g. "100.1"

  receiver?: `0x${string}`;    // default: the signer's address
  slippageBps?: number;        // default 30 (0.30%)
  deadlineSecs?: number;       // default 300

  confidential?: boolean;      // v1 preview

  actions?: Action[];          // v1: limited post-fulfillment actions
};

type Action =
  | {
      type: "contractCall";
      chain: ChainKey;          // usually toChain
      contract: `0x${string}`;
      abiFragment: string;      // minimal ABI string for the method
      method: string;
      args: unknown[];
      value?: string;           // optional native value
    }
  | {
      type: "noop";             // placeholder for future kinds
    };
```

### Offer

```ts theme={null}
type Offer = {
  id: string;
  relayer: `0x${string}`;
  outputAmount: string;  // human string in output token units
  feeAmount?: string;
  etaSeconds?: number;
  expiresAt: string;     // ISO
  signature: `0x${string}`;
};
```

## React bindings

`@fluton/sdk/react` wraps the client in a provider and a set of hooks.

```tsx theme={null}
<FlutonProvider client={fluton}>
  <App />
</FlutonProvider>
```

Hooks (v1):

* `useSupportedChains()`
* `useSupportedTokens(chain)`
* `useBridgeQuote(params, { enabled })`
* `useExecuteBridge()`: returns `execute(quote)` plus the transaction state
* `useIntentStatus(intentId)` (polling or stream)
* `useOffers(intentId)` (stream)

Hook return shapes follow the TanStack Query style:

```ts theme={null}
{
  data: T;
  error: Error | null;
  isLoading: boolean;
  refetch: () => void;
}
```

Until this client ships, the [pool client](https://docs.fluton.io/sdk/overview.md) is the SDK: private deposits, withdrawals and transfers in Fluton Pool on Arbitrum One.


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