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

# JSON-RPC API Overview

> Kora implements a JSON-RPC 2.0 interface for gasless transaction processing on Solana.

> **Using Kora v2.2.0-beta?** See the
> [Beta docs](/developers/docs/tools/kora/beta/bundle-methods) for new bundle methods
> (`signBundle`, `signAndSendBundle`, `estimateBundleFee`) and `getVersion`.

## TypeScript SDK

The `@solana/kora` package provides three client options for interacting with a
Kora server. All three need `@solana/kora` 0.2.x with `@solana/kit` `^6.1`
(Kit 7 and later are not supported) and TypeScript 5.4 or later. See
[Installation](/developers/docs/tools/kora/getting-started/installation#typescript-sdk)
for the install command.

### KoraClient (Standalone)

Use `KoraClient` for standalone usage.

```typescript
import { KoraClient } from "@solana/kora";

const kora = new KoraClient({ rpcUrl: "https://your-kora-server.com" });
const config = await kora.getConfig();
```

### koraPlugin (Kit Composable)

Use `koraPlugin()` to compose Kora methods into an existing Kit client built with
`createEmptyClient().use()`.

```typescript
import { createEmptyClient } from "@solana/kit";
import { koraPlugin } from "@solana/kora";

const client = createEmptyClient().use(
  koraPlugin({ endpoint: "https://your-kora-server.com" }),
);

const config = await client.kora.getConfig();
```

The plugin provides Kit-typed responses (`Address`, `Blockhash`,
`Base64EncodedWireTransaction`) and exports the `KoraPlugin` type for
composition with other plugins.

### createKitKoraClient (Kit Client)

Use `createKitKoraClient()` for full Kit integration with automatic transaction
planning, fee estimation, payment injection, and execution. This is the
recommended approach for most applications.

The Kit client composes Kora with Kit's plugin architecture (planner, executor,
payer plugins) so you can use Kit program plugins like `tokenProgram()`
directly.

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

const client = await createKitKoraClient({
  endpoint: "https://your-kora-server.com",
  rpcUrl: "https://api.mainnet.solana.com",
  feeToken: address("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"), // USDC
  feePayerWallet: userSigner, // TransactionSigner that authorizes SPL fee payment
});

// Compose with Kit program plugins
const tokenClient = client.use(tokenProgram());

// Send transactions — Kora handles blockhash, fee estimation,
// payment instruction injection, signing, and submission
await tokenClient.token.instructions
  .transferToATA({/* ... */})
  .sendTransaction();
```

**Configuration options:**

| Option             | Required | Description                                                                                |
| ------------------ | -------- | ------------------------------------------------------------------------------------------ |
| `endpoint`         | Yes      | Kora RPC endpoint URL                                                                      |
| `rpcUrl`           | Yes      | Solana RPC URL for compute unit estimation and program plugin compatibility                |
| `feeToken`         | Yes      | SPL mint address for fee payment                                                           |
| `feePayerWallet`   | Yes      | `TransactionSigner` that authorizes the SPL fee payment                                    |
| `apiKey`           | No       | API key for authentication                                                                 |
| `hmacSecret`       | No       | HMAC secret for signature-based authentication                                             |
| `computeUnitLimit` | No       | Fixed compute unit limit (uses simulation-based estimation if not set)                     |
| `computeUnitPrice` | No       | Priority fee in micro-lamports                                                             |
| `tokenProgramId`   | No       | Token program ID (defaults to Token Program; use Token-2022 address for Token-2022 tokens) |

## Protocol

- **Standard**: JSON-RPC 2.0
- **Transport**: HTTP POST
- **Content-Type**: application/json
- **Endpoint**: `http://your-kora-instance/`

## Available Methods

| Method                                                                            | Description                                                                                                                         |
| --------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| [estimateTransactionFee](/developers/docs/tools/kora/json-rpc-api/estimate-transaction-fee)  | Estimates the transaction fee in both lamports and the specified token.                                                             |
| [getBlockhash](/developers/docs/tools/kora/json-rpc-api/get-blockhash)                       | Gets the latest blockhash from the Solana RPC that the Kora server is connected to.                                                 |
| [getConfig](/developers/docs/tools/kora/json-rpc-api/get-config)                             | Retrieves the current Kora server configuration.                                                                                    |
| [getPayerSigner](/developers/docs/tools/kora/json-rpc-api/get-payer-signer)                  | Retrieves the payer signer and payment destination from the Kora server.                                                            |
| [getPaymentInstruction](/developers/docs/tools/kora/json-rpc-api/get-payment-instruction)    | Creates a payment instruction to append to a transaction for fee payment to the Kora paymaster.                                     |
| [getSupportedTokens](/developers/docs/tools/kora/json-rpc-api/get-supported-tokens)          | Retrieves the list of tokens supported for fee payment.                                                                             |
| [signAndSendTransaction](/developers/docs/tools/kora/json-rpc-api/sign-and-send-transaction) | Signs a transaction and immediately broadcasts it to the Solana network.                                                            |
| [signTransaction](/developers/docs/tools/kora/json-rpc-api/sign-transaction)                 | Signs a transaction with the Kora fee payer if the transaction includes necessary payment to the fee payer without broadcasting it. |
| [transferTransaction](/developers/docs/tools/kora/json-rpc-api/transfer-transaction)         | Creates a token transfer transaction with Kora as the fee payer.                                                                    |

## Request Format

All requests follow the JSON-RPC 2.0 standard:

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "methodName",
  "params": {}
}
```

## Response Format

Successful responses:

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {}
}
```

Errors depend on where the request fails.

**Validation errors** for a known method (for example a missing parameter) are
returned with HTTP 200 and a JSON-RPC error object:

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "error": {
    "code": -32602,
    "message": "missing field `transaction` at line 1 column 2"
  }
}
```

**Application errors** (for example a rejected transaction) are also returned
with HTTP 200, usually with code `-32000`. Some errors include
`data.error_type` identifying the error category:

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "error": {
    "code": -32000,
    "message": "Invalid transaction: Insufficient token payment. Required 11055 lamports"
  }
}
```

**Unknown methods, malformed JSON, and requests without a `method` field** do
not return a JSON-RPC error. Kora responds with HTTP 405 and an empty body, so
check the HTTP status before parsing the response.
