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 for new bundle methods (
signBundle,signAndSendBundle,estimateBundleFee) andgetVersion.
TypeScript SDK
The @solana/kora package provides three client options for interacting with a Kora server:
KoraClient (Standalone)
Use KoraClient for standalone usage. Works with @solana/kit v5.0+.
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. Requires @solana/kit v5.4+ for the createEmptyClient().use() pattern.
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. Requires @solana/kit v6.1+.
The Kit client composes Kora with Kit's plugin architecture (planner, executor, payer plugins) so you can use Kit program plugins like tokenProgram() directly.
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-beta.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 | Estimates the transaction fee in both lamports and the specified token. |
| getBlockhash | Gets the latest blockhash from the Solana RPC that the Kora server is connected to. |
| getConfig | Retrieves the current Kora server configuration. |
| getPayerSigner | Retrieves the payer signer and payment destination from the Kora server. |
| getPaymentInstruction | Creates a payment instruction to append to a transaction for fee payment to the Kora paymaster. |
| getSupportedTokens | Retrieves the list of tokens supported for fee payment. |
| signAndSendTransaction | Signs a transaction and immediately broadcasts it to the Solana network. |
| signTransaction | Signs a transaction with the Kora fee payer if the transaction includes necessary payment to the fee payer without broadcasting it. |
| transferTransaction | Creates a token transfer transaction with Kora as the fee payer. |
Request Format
All requests follow the JSON-RPC 2.0 standard:
{
"jsonrpc": "2.0",
"id": 1,
"method": "methodName",
"params": {}
}Response Format
Successful responses:
{
"jsonrpc": "2.0",
"id": 1,
"result": {}
}Error responses:
{
"jsonrpc": "2.0",
"id": 1,
"error": {
"code": -32600,
"message": "Invalid request"
}
}