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

> ## Agent Instructions
> This page is part of the Solana developer documentation at https://solana.com/developers/docs. Append `.md` to any docs URL, or send `Accept: text/markdown`, to get the page as Markdown.
> Index of all pages: https://solana.com/llms.txt. Per-section indexes such as https://solana.com/developers/docs/payments/llms.txt are smaller; prefer them when working on one task.
> Coding agents: install the official Solana skill for current APIs and conventions with `npx skills add https://github.com/solana-foundation/solana-dev-skill` (also served at https://solana.com/SKILL.md).
> Code in the cookbook and task pages comes from tested example files. Prefer it over writing API calls from memory.

# Kit Client Integration

> Build gasless transactions using createKitKoraClient with Kit's plugin architecture for automatic fee handling.

_Last Updated: 2026-03-09_

## What You'll Build

The Kit client (`createKitKoraClient`) is the recommended way to integrate Kora
into Solana applications. It wraps Kora's fee abstraction into Kit's plugin
architecture, giving you a client that automatically handles:

- Blockhash management
- Fee estimation and payment instruction injection
- Transaction signing via Kora
- Transaction submission and confirmation
- Compute budget optimization (simulation-based CU estimation)

This means you can use Kit program plugins like `tokenProgram()` and have Kora
handle all the gas fee complexity behind the scenes.

## Prerequisites

- Completed the
  [Kora Quick Start Guide](/developers/docs/tools/kora/getting-started/quick-start) —
  running Kora server and local validator
- Familiarity with [Solana Kit](https://www.solanakit.com/) and its plugin
  system

## Installation

```bash
npm install @solana/kora @solana/kit@^6.1 @solana-program/token@^0.12 \
  @solana-program/compute-budget@^0.13 \
  @solana/kit-plugin-instruction-plan@^0.6 @solana/kit-plugin-payer@^0.6 \
  @solana/kit-plugin-rpc@^0.6
```

Pin the peer dependencies (`@solana/kit`, `@solana-program/token`,
`@solana-program/compute-budget`, `@solana/kit-plugin-*`) to these versions.
`@solana/kora` 0.2.x requires Kit 6.1 or later in the 6.x line. **Kit 7 and
later are not supported.** A project that already has Kit 7 or later fails to
install with an `ERESOLVE` conflict, and installs that skip peer checks
(`--legacy-peer-deps`, or pnpm without pinned versions) get the latest Kit,
which `@solana/kora` 0.2.x can't load. See
[Installation](/developers/docs/tools/kora/getting-started/installation#peer-dependencies)
for the exact errors.

## Creating the Client

`createKitKoraClient` composes multiple Kit plugins into a single client that
satisfies `ClientWithPayer`, `ClientWithTransactionPlanning`, and
`ClientWithTransactionSending`.

```typescript
import { createKitKoraClient } from "@solana/kora";
import { address } from "@solana/kit";

const client = await createKitKoraClient({
  endpoint: "http://localhost:8080", // Kora RPC endpoint
  rpcUrl: "http://127.0.0.1:8899", // Solana RPC for CU estimation
  feeToken: address("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"), // USDC mint
  feePayerWallet: userSigner, // TransactionSigner for fee payment
});
```

The `feePayerWallet` must be a `TransactionSigner` — this is the wallet that
authorizes the SPL token fee payment to the Kora operator. The Kora operator
handles the SOL network fees.

### Configuration Options

| Option             | Required | Description                                                                                                |
| ------------------ | -------- | ---------------------------------------------------------------------------------------------------------- |
| `endpoint`         | Yes      | Kora RPC endpoint URL                                                                                      |
| `rpcUrl`           | Yes      | Solana RPC URL (not the Kora endpoint) — used for compute unit simulation and program plugin compatibility |
| `feeToken`         | Yes      | SPL mint address for fee payment (e.g., USDC)                                                              |
| `feePayerWallet`   | Yes      | `TransactionSigner` that authorizes the SPL fee payment                                                    |
| `apiKey`           | No       | API key for Kora authentication                                                                            |
| `hmacSecret`       | No       | HMAC secret for signature-based authentication                                                             |
| `computeUnitLimit` | No       | Fixed CU limit. If omitted, Kora simulates the transaction to estimate optimal CU (recommended)            |
| `computeUnitPrice` | No       | Priority fee in micro-lamports                                                                             |
| `tokenProgramId`   | No       | Defaults to Token Program. Set to `TOKEN_2022_PROGRAM_ADDRESS` for Token-2022 fee tokens                   |

## Using with Kit Program Plugins

The Kit client is composable with Kit program plugins. For example, with
`tokenProgram()`:

```typescript
import { createKitKoraClient } from "@solana/kora";
import {
  findAssociatedTokenPda,
  tokenProgram,
  TOKEN_PROGRAM_ADDRESS,
} from "@solana-program/token";
import { address } from "@solana/kit";

const usdcMint = address("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v");

const koraClient = await createKitKoraClient({
  endpoint: "http://localhost:8080",
  rpcUrl: "http://127.0.0.1:8899",
  feeToken: usdcMint,
  feePayerWallet: userSigner,
});

// Derive the sender's and recipient's associated token accounts
const [senderAta] = await findAssociatedTokenPda({
  owner: userSigner.address,
  mint: usdcMint,
  tokenProgram: TOKEN_PROGRAM_ADDRESS,
});
const [recipientAta] = await findAssociatedTokenPda({
  owner: recipientAddress,
  mint: usdcMint,
  tokenProgram: TOKEN_PROGRAM_ADDRESS,
});

// Compose with the token program plugin
const client = koraClient.use(tokenProgram());

// Use token program methods — Kora handles all fee abstraction
await client.token.instructions
  .transferToATA({
    source: senderAta,
    destination: recipientAta, // the recipient's ATA, not their wallet address
    recipient: recipientAddress, // wallet that owns the destination ATA
    mint: usdcMint,
    decimals: 6,
    amount: 1_000_000n, // 1 USDC
    authority: userSigner,
  })
  .sendTransaction();
```

`transferToATA` requires `mint`, `decimals`, and `recipient` in addition to the
source, destination, amount, and authority. The `destination` must be the
recipient's associated token account (it is created idempotently if missing),
not the recipient's wallet address.

Behind the scenes, the Kit client:

1. Plans the transaction with a Kora-managed blockhash and compute budget
   instructions
2. Estimates the fee and injects (or updates) the SPL payment instruction to the
   Kora operator
3. Partially signs the transaction with the user's wallet
4. Sends the transaction to Kora for co-signing and submission to Solana

## Accessing Kora RPC Methods

The Kit client also exposes the full Kora API via the `.kora` namespace (from
the `koraPlugin`):

```typescript
// Get server configuration
const config = await client.kora.getConfig();

// Get supported fee tokens
const { tokens } = await client.kora.getSupportedTokens();

// Estimate fees for an arbitrary transaction
const estimate = await client.kora.estimateTransactionFee({
  transaction: base64EncodedTx,
  fee_token: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
});
```

All `.kora` method responses use Kit-typed values (`Address`, `Blockhash`,
`Signature`) instead of raw strings.

## Token-2022 Support

To pay fees with a Token-2022 token, pass the Token-2022 program address as
the `tokenProgramId` option:

```typescript
import { createKitKoraClient } from "@solana/kora";
import { address } from "@solana/kit";

// Token-2022 program address
const TOKEN_2022_PROGRAM_ADDRESS = address(
  "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb",
);

const client = await createKitKoraClient({
  endpoint: "http://localhost:8080",
  rpcUrl: "http://127.0.0.1:8899",
  feeToken: address("your-token-2022-mint"),
  feePayerWallet: userSigner,
  tokenProgramId: TOKEN_2022_PROGRAM_ADDRESS,
});
```

The example defines the address itself instead of importing
`TOKEN_2022_PROGRAM_ADDRESS` from `@solana-program/token-2022`: every release of
that package that works with Kit 6 declares a peer dependency on
`@solana/sysvars` 5, which conflicts with Kit 6 (`npm install` fails with
`ERESOLVE`).

## Compute Budget

By default, the Kit client simulates the transaction against the Solana RPC to
determine the optimal compute unit limit. This results in tighter CU allocation
and lower fees.

To override with a fixed value:

```typescript
import type { MicroLamports } from "@solana/kit";

const client = await createKitKoraClient({
  // ...
  computeUnitLimit: 200_000,
  computeUnitPrice: 1_000_000n as MicroLamports, // priority fee in micro-lamports
});
```

`computeUnitPrice` is typed as Kit's branded `MicroLamports` type, so a plain
`bigint` fails type-checking; cast it with `as MicroLamports`.

## When to Use Each Client

| Client                | Use Case                                                                                                            |
| --------------------- | ------------------------------------------------------------------------------------------------------------------- |
| `createKitKoraClient` | **Recommended.** Full Kit integration with automatic fee handling. Best for applications using Kit program plugins. |
| `KoraClient`          | Direct RPC access when you need full control over transaction construction, signing, and submission.                |
| `koraPlugin`          | Adding Kora methods to an existing Kit client you've already composed with other plugins.                           |

## Next Steps

- [Full Transaction Flow](/developers/docs/tools/kora/guides/full-demo) — Lower-level
  walkthrough using `KoraClient` directly
- [API Reference](/developers/docs/tools/kora/json-rpc-api) — All available RPC methods
- [Kora Configuration](/developers/docs/tools/kora/operators/configuration) — Server-side
  configuration options
