JSON-RPC API Overview

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

TypeScript SDK

The @solana/kora package provides two 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('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 KoraApi type for composition with other plugins.

Protocol

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

Available Methods

MethodDescription
estimateTransactionFeeEstimates the transaction fee in both lamports and the specified token.
getBlockhashGets the latest blockhash from the Solana RPC that the Kora server is connected to.
getConfigRetrieves the current Kora server configuration.
getPayerSignerRetrieves the payer signer and payment destination from the Kora server.
getPaymentInstructionCreates a payment instruction to append to a transaction for fee payment to the Kora paymaster.
getSupportedTokensRetrieves the list of tokens supported for fee payment.
signAndSendTransactionSigns a transaction and immediately broadcasts it to the Solana network.
signTransactionSigns a transaction with the Kora fee payer if the transaction includes necessary payment to the fee payer without broadcasting it.
transferTransactionCreates 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"
  }
}