@solana/kora 0.2.0-beta.6 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,10 +4,10 @@ import { payer } from '@solana/kit-plugin-payer';
4
4
  import { rpc } from '@solana/kit-plugin-rpc';
5
5
  import { estimateAndUpdateProvisoryComputeUnitLimitFactory, estimateComputeUnitLimitFactory, } from '@solana-program/compute-budget';
6
6
  import { KoraClient } from '../client.js';
7
- import { koraPlugin } from '../plugin.js';
8
7
  import { createKoraTransactionPlanExecutor } from './executor.js';
9
8
  import { buildPlaceholderPaymentInstruction, koraPaymentAddress } from './payment.js';
10
9
  import { buildComputeBudgetInstructions, createKoraTransactionPlanner } from './planner.js';
10
+ import { koraPlugin } from './plugin.js';
11
11
  /**
12
12
  * Creates a Kora Kit client composed from Kit plugins.
13
13
  *
@@ -31,14 +31,9 @@ import { buildComputeBudgetInstructions, createKoraTransactionPlanner } from './
31
31
  * const result = await client.sendTransaction([myInstruction]);
32
32
  * ```
33
33
  */
34
- // TODO: Bundle support — the plan/execute pipeline currently handles single transactions only.
35
- // For Jito bundles, users must manually encode transactions and call `client.kora.signAndSendBundle()`.
36
- // A future `createKitKoraBundleClient` (or a bundle-aware executor plugin) could extend this to
37
- // plan multiple transaction messages and submit them as a single bundle.
38
34
  export async function createKitKoraClient(config) {
39
35
  const koraClient = new KoraClient({
40
36
  apiKey: config.apiKey,
41
- getRecaptchaToken: config.getRecaptchaToken,
42
37
  hmacSecret: config.hmacSecret,
43
38
  rpcUrl: config.endpoint,
44
39
  });
@@ -63,10 +58,7 @@ export async function createKitKoraClient(config) {
63
58
  : undefined, resolveProvisoryComputeUnitLimit);
64
59
  return createEmptyClient()
65
60
  .use(rpc(config.rpcUrl))
66
- .use(koraPlugin({
67
- endpoint: config.endpoint,
68
- koraClient,
69
- }))
61
+ .use(koraPlugin({ apiKey: config.apiKey, endpoint: config.endpoint, hmacSecret: config.hmacSecret }))
70
62
  .use(payer(payerSigner))
71
63
  .use(koraPaymentAddress(paymentAddr))
72
64
  .use(transactionPlannerPlugin(koraTransactionPlanner))
@@ -27,7 +27,7 @@ export async function buildPlaceholderPaymentInstruction(feePayerWallet, payment
27
27
  authority: feePayerWallet,
28
28
  destination: destinationTokenAccount,
29
29
  source: sourceTokenAccount,
30
- }, { programAddress: tokenProgram });
30
+ });
31
31
  return { destinationTokenAccount, instruction, sourceTokenAccount };
32
32
  }
33
33
  function isPlaceholderPaymentInstruction(ix, sourceTokenAccount, destinationTokenAccount, feePayerWallet, tokenProgramId) {
@@ -50,13 +50,12 @@ export function updatePaymentInstructionAmount(instructions, feePayerWallet, sou
50
50
  return ix;
51
51
  }
52
52
  replaced = true;
53
- const tokenProgram = tokenProgramId ?? TOKEN_PROGRAM_ADDRESS;
54
53
  return getTransferInstruction({
55
54
  amount,
56
55
  authority: feePayerWallet,
57
56
  destination: destinationTokenAccount,
58
57
  source: sourceTokenAccount,
59
- }, { programAddress: tokenProgram });
58
+ });
60
59
  });
61
60
  if (!replaced) {
62
61
  throw new Error('Failed to update payment instruction: no matching placeholder transfer instruction found. ' +
@@ -0,0 +1,31 @@
1
+ import type { EstimateTransactionFeeRequest, GetPaymentInstructionRequest, KitBlockhashResponse, KitConfigResponse, KitEstimateFeeResponse, KitPayerSignerResponse, KitPaymentInstructionResponse, KitSignAndSendTransactionResponse, KitSignTransactionResponse, KitSupportedTokensResponse, KitTransferTransactionResponse, KoraPluginConfig, SignAndSendTransactionRequest, SignTransactionRequest, TransferTransactionRequest } from '../types/index.js';
2
+ /**
3
+ * Kit plugin that adds `.kora` namespace with all Kora RPC methods.
4
+ * Responses are cast to Kit types (Address, Blockhash, Signature).
5
+ *
6
+ * Requires `@solana/kit` v5.4.0+ for the `createEmptyClient().use()` pattern.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * const client = createEmptyClient()
11
+ * .use(koraPlugin({ endpoint: 'https://kora.example.com' }));
12
+ *
13
+ * const config = await client.kora.getConfig();
14
+ * const { signer_pubkey } = await client.kora.signTransaction({ transaction: tx });
15
+ * ```
16
+ */
17
+ export declare function koraPlugin(config: KoraPluginConfig): <T extends object>(c: T) => T & {
18
+ kora: {
19
+ estimateTransactionFee(request: EstimateTransactionFeeRequest): Promise<KitEstimateFeeResponse>;
20
+ getBlockhash(): Promise<KitBlockhashResponse>;
21
+ getConfig(): Promise<KitConfigResponse>;
22
+ getPayerSigner(): Promise<KitPayerSignerResponse>;
23
+ getPaymentInstruction(request: GetPaymentInstructionRequest): Promise<KitPaymentInstructionResponse>;
24
+ getSupportedTokens(): Promise<KitSupportedTokensResponse>;
25
+ signAndSendTransaction(request: SignAndSendTransactionRequest): Promise<KitSignAndSendTransactionResponse>;
26
+ signTransaction(request: SignTransactionRequest): Promise<KitSignTransactionResponse>;
27
+ transferTransaction(request: TransferTransactionRequest): Promise<KitTransferTransactionResponse>;
28
+ };
29
+ };
30
+ /** Type representing the Kora plugin namespace on the client. */
31
+ export type KoraPlugin = ReturnType<ReturnType<typeof koraPlugin>>['kora'];
@@ -1,61 +1,29 @@
1
1
  import { address, blockhash, signature } from '@solana/kit';
2
- import { KoraClient } from './client.js';
2
+ import { KoraClient } from '../client.js';
3
3
  /**
4
- * Creates a Kora Kit plugin that adds Kora paymaster functionality to a Kit client.
4
+ * Kit plugin that adds `.kora` namespace with all Kora RPC methods.
5
+ * Responses are cast to Kit types (Address, Blockhash, Signature).
5
6
  *
6
- * The plugin exposes all Kora RPC methods with Kit-typed responses (Address, Blockhash).
7
- *
8
- * **Note:** The plugin pattern with `createEmptyClient().use()` requires `@solana/kit` v5.4.0+.
9
- * For older kit versions, use `KoraClient` directly instead.
10
- *
11
- * @param config - Plugin configuration
12
- * @param config.endpoint - Kora RPC endpoint URL
13
- * @param config.apiKey - Optional API key for authentication
14
- * @param config.hmacSecret - Optional HMAC secret for signature-based authentication
15
- * @returns A Kit plugin function that adds `.kora` to the client
7
+ * Requires `@solana/kit` v5.4.0+ for the `createEmptyClient().use()` pattern.
16
8
  *
17
9
  * @example
18
10
  * ```typescript
19
- * import { createEmptyClient } from '@solana/kit';
20
- * import { koraPlugin } from '@solana/kora';
21
- *
22
11
  * const client = createEmptyClient()
23
12
  * .use(koraPlugin({ endpoint: 'https://kora.example.com' }));
24
13
  *
25
- * // All responses have Kit-typed fields
26
14
  * const config = await client.kora.getConfig();
27
- * // config.fee_payers is Address[] not string[]
28
- *
29
15
  * const { signer_pubkey } = await client.kora.signTransaction({ transaction: tx });
30
- * // signer_pubkey is Address not string
31
16
  * ```
32
17
  */
33
18
  export function koraPlugin(config) {
34
- const client = config.koraClient ??
35
- new KoraClient({
36
- apiKey: config.apiKey,
37
- getRecaptchaToken: config.getRecaptchaToken,
38
- hmacSecret: config.hmacSecret,
39
- rpcUrl: config.endpoint,
40
- });
19
+ const client = new KoraClient({
20
+ apiKey: config.apiKey,
21
+ hmacSecret: config.hmacSecret,
22
+ rpcUrl: config.endpoint,
23
+ });
41
24
  return (c) => ({
42
25
  ...c,
43
26
  kora: {
44
- /**
45
- * Estimates the bundle fee with Kit-typed addresses.
46
- */
47
- async estimateBundleFee(request) {
48
- const result = await client.estimateBundleFee(request);
49
- return {
50
- fee_in_lamports: result.fee_in_lamports,
51
- fee_in_token: result.fee_in_token,
52
- payment_address: address(result.payment_address),
53
- signer_pubkey: address(result.signer_pubkey),
54
- };
55
- },
56
- /**
57
- * Estimates the transaction fee with Kit-typed addresses.
58
- */
59
27
  async estimateTransactionFee(request) {
60
28
  const result = await client.estimateTransactionFee(request);
61
29
  return {
@@ -65,18 +33,12 @@ export function koraPlugin(config) {
65
33
  signer_pubkey: address(result.signer_pubkey),
66
34
  };
67
35
  },
68
- /**
69
- * Gets the latest blockhash with Kit Blockhash type.
70
- */
71
36
  async getBlockhash() {
72
37
  const result = await client.getBlockhash();
73
38
  return {
74
39
  blockhash: blockhash(result.blockhash),
75
40
  };
76
41
  },
77
- /**
78
- * Retrieves the current Kora server configuration with Kit-typed addresses.
79
- */
80
42
  async getConfig() {
81
43
  const result = await client.getConfig();
82
44
  return {
@@ -91,9 +53,6 @@ export function koraPlugin(config) {
91
53
  },
92
54
  };
93
55
  },
94
- /**
95
- * Retrieves the payer signer and payment destination with Kit-typed addresses.
96
- */
97
56
  async getPayerSigner() {
98
57
  const result = await client.getPayerSigner();
99
58
  return {
@@ -101,9 +60,6 @@ export function koraPlugin(config) {
101
60
  signer_address: address(result.signer_address),
102
61
  };
103
62
  },
104
- /**
105
- * Creates a payment instruction with Kit-typed response.
106
- */
107
63
  async getPaymentInstruction(request) {
108
64
  const result = await client.getPaymentInstruction(request);
109
65
  return {
@@ -115,35 +71,12 @@ export function koraPlugin(config) {
115
71
  signer_address: address(result.signer_address),
116
72
  };
117
73
  },
118
- /**
119
- * Retrieves the list of tokens supported for fee payment with Kit-typed addresses.
120
- */
121
74
  async getSupportedTokens() {
122
75
  const result = await client.getSupportedTokens();
123
76
  return {
124
77
  tokens: result.tokens.map(addr => address(addr)),
125
78
  };
126
79
  },
127
- /**
128
- * Gets the version of the Kora server.
129
- */
130
- async getVersion() {
131
- return await client.getVersion();
132
- },
133
- /**
134
- * Signs and sends a bundle of transactions via Jito with Kit-typed response.
135
- */
136
- async signAndSendBundle(request) {
137
- const result = await client.signAndSendBundle(request);
138
- return {
139
- bundle_uuid: result.bundle_uuid,
140
- signed_transactions: result.signed_transactions,
141
- signer_pubkey: address(result.signer_pubkey),
142
- };
143
- },
144
- /**
145
- * Signs and sends a transaction with Kit-typed response.
146
- */
147
80
  async signAndSendTransaction(request) {
148
81
  const result = await client.signAndSendTransaction(request);
149
82
  return {
@@ -152,24 +85,21 @@ export function koraPlugin(config) {
152
85
  signer_pubkey: address(result.signer_pubkey),
153
86
  };
154
87
  },
155
- /**
156
- * Signs a bundle of transactions with Kit-typed response.
157
- */
158
- async signBundle(request) {
159
- const result = await client.signBundle(request);
88
+ async signTransaction(request) {
89
+ const result = await client.signTransaction(request);
160
90
  return {
161
- signed_transactions: result.signed_transactions,
91
+ signed_transaction: result.signed_transaction,
162
92
  signer_pubkey: address(result.signer_pubkey),
163
93
  };
164
94
  },
165
- /**
166
- * Signs a transaction with Kit-typed response.
167
- */
168
- async signTransaction(request) {
169
- const result = await client.signTransaction(request);
95
+ async transferTransaction(request) {
96
+ const result = await client.transferTransaction(request);
170
97
  return {
171
- signed_transaction: result.signed_transaction,
98
+ blockhash: blockhash(result.blockhash),
99
+ instructions: result.instructions,
100
+ message: result.message,
172
101
  signer_pubkey: address(result.signer_pubkey),
102
+ transaction: result.transaction,
173
103
  };
174
104
  },
175
105
  },
@@ -1,7 +1,22 @@
1
- import { Instruction, type MicroLamports, type TransactionSigner } from '@solana/kit';
1
+ import { Instruction, TransactionSigner } from '@solana/kit';
2
2
  /**
3
3
  * Request Types
4
4
  */
5
+ /**
6
+ * Parameters for creating a token transfer transaction.
7
+ */
8
+ export interface TransferTransactionRequest {
9
+ /** Amount to transfer in the token's smallest unit (e.g., lamports for SOL) */
10
+ amount: number;
11
+ /** Public key of the destination wallet (not token account) */
12
+ destination: string;
13
+ /** Optional signer address for the transaction */
14
+ signer_key?: string;
15
+ /** Public key of the source wallet (not token account) */
16
+ source: string;
17
+ /** Mint address of the token to transfer */
18
+ token: string;
19
+ }
5
20
  /**
6
21
  * Parameters for signing a transaction.
7
22
  */
@@ -12,8 +27,6 @@ export interface SignTransactionRequest {
12
27
  signer_key?: string;
13
28
  /** Base64-encoded transaction to sign */
14
29
  transaction: string;
15
- /** Optional user ID for usage tracking (required when pricing is free and usage tracking is enabled) */
16
- user_id?: string;
17
30
  }
18
31
  /**
19
32
  * Parameters for signing and sending a transaction.
@@ -25,45 +38,13 @@ export interface SignAndSendTransactionRequest {
25
38
  signer_key?: string;
26
39
  /** Base64-encoded transaction to sign and send */
27
40
  transaction: string;
28
- /** Optional user ID for usage tracking (required when pricing is free and usage tracking is enabled) */
29
- user_id?: string;
30
- }
31
- /**
32
- * Parameters for signing a bundle of transactions.
33
- */
34
- export interface SignBundleRequest {
35
- /** Optional signer verification during transaction simulation (defaults to false) */
36
- sig_verify?: boolean;
37
- /** Optional indices of transactions to sign (defaults to all if not specified) */
38
- sign_only_indices?: number[];
39
- /** Optional signer address for the transactions */
40
- signer_key?: string;
41
- /** Array of base64-encoded transactions to sign */
42
- transactions: string[];
43
- /** Optional user ID for usage tracking (required when pricing is free and usage tracking is enabled) */
44
- user_id?: string;
45
- }
46
- /**
47
- * Parameters for signing and sending a bundle of transactions via Jito.
48
- */
49
- export interface SignAndSendBundleRequest {
50
- /** Optional signer verification during transaction simulation (defaults to false) */
51
- sig_verify?: boolean;
52
- /** Optional indices of transactions to sign (defaults to all if not specified) */
53
- sign_only_indices?: number[];
54
- /** Optional signer address for the transactions */
55
- signer_key?: string;
56
- /** Array of base64-encoded transactions to sign and send */
57
- transactions: string[];
58
- /** Optional user ID for usage tracking (required when pricing is free and usage tracking is enabled) */
59
- user_id?: string;
60
41
  }
61
42
  /**
62
43
  * Parameters for estimating transaction fees.
63
44
  */
64
45
  export interface EstimateTransactionFeeRequest {
65
46
  /** Mint address of the token to calculate fees in */
66
- fee_token?: string;
47
+ fee_token: string;
67
48
  /** Optional signer verification during transaction simulation (defaults to false) */
68
49
  sig_verify?: boolean;
69
50
  /** Optional signer address for the transaction */
@@ -71,21 +52,6 @@ export interface EstimateTransactionFeeRequest {
71
52
  /** Base64-encoded transaction to estimate fees for */
72
53
  transaction: string;
73
54
  }
74
- /**
75
- * Parameters for estimating bundle fees.
76
- */
77
- export interface EstimateBundleFeeRequest {
78
- /** Mint address of the token to calculate fees in */
79
- fee_token?: string;
80
- /** Optional signer verification during transaction simulation (defaults to false) */
81
- sig_verify?: boolean;
82
- /** Optional indices of transactions to estimate fees for (defaults to all if not specified) */
83
- sign_only_indices?: number[];
84
- /** Optional signer address for the transactions */
85
- signer_key?: string;
86
- /** Array of base64-encoded transactions to estimate fees for */
87
- transactions: string[];
88
- }
89
55
  /**
90
56
  * Parameters for getting a payment instruction.
91
57
  */
@@ -96,8 +62,11 @@ export interface GetPaymentInstructionRequest {
96
62
  sig_verify?: boolean;
97
63
  /** Optional signer address for the transaction */
98
64
  signer_key?: string;
99
- /** The wallet owner (not token account) that will be making the token payment */
100
- source_wallet: string;
65
+ /** The wallet owner that will be making the token payment.
66
+ * Accepts a plain address string or a TransactionSigner. When a TransactionSigner is provided,
67
+ * it is used as the transfer authority on the payment instruction, preserving signer identity
68
+ * and avoiding conflicts with other instructions that reference the same address. */
69
+ source_wallet: TransactionSigner | string;
101
70
  /** The token program id to use for the payment (defaults to TOKEN_PROGRAM_ID) */
102
71
  token_program_id?: string;
103
72
  /** Base64-encoded transaction to estimate fees for */
@@ -106,6 +75,21 @@ export interface GetPaymentInstructionRequest {
106
75
  /**
107
76
  * Response Types
108
77
  */
78
+ /**
79
+ * Response from creating a transfer transaction.
80
+ */
81
+ export interface TransferTransactionResponse {
82
+ /** Recent blockhash used in the transaction */
83
+ blockhash: string;
84
+ /** Parsed instructions from the transaction message */
85
+ instructions: Instruction[];
86
+ /** Base64-encoded message */
87
+ message: string;
88
+ /** Public key of the signer used to send the transaction */
89
+ signer_pubkey: string;
90
+ /** Base64-encoded signed transaction */
91
+ transaction: string;
92
+ }
109
93
  /**
110
94
  * Response from signing a transaction.
111
95
  */
@@ -126,26 +110,6 @@ export interface SignAndSendTransactionResponse {
126
110
  /** Public key of the signer used to send the transaction */
127
111
  signer_pubkey: string;
128
112
  }
129
- /**
130
- * Response from signing a bundle of transactions.
131
- */
132
- export interface SignBundleResponse {
133
- /** Array of base64-encoded signed transactions */
134
- signed_transactions: string[];
135
- /** Public key of the signer used to sign the transactions */
136
- signer_pubkey: string;
137
- }
138
- /**
139
- * Response from signing and sending a bundle of transactions via Jito.
140
- */
141
- export interface SignAndSendBundleResponse {
142
- /** UUID of the submitted Jito bundle */
143
- bundle_uuid: string;
144
- /** Array of base64-encoded signed transactions */
145
- signed_transactions: string[];
146
- /** Public key of the signer used to sign the transactions */
147
- signer_pubkey: string;
148
- }
149
113
  /**
150
114
  * Response containing the latest blockhash.
151
115
  */
@@ -153,13 +117,6 @@ export interface GetBlockhashResponse {
153
117
  /** Base58-encoded blockhash */
154
118
  blockhash: string;
155
119
  }
156
- /**
157
- * Response containing the server version.
158
- */
159
- export interface GetVersionResponse {
160
- /** Server version string */
161
- version: string;
162
- }
163
120
  /**
164
121
  * Response containing supported token mint addresses.
165
122
  */
@@ -176,22 +133,7 @@ export interface EstimateTransactionFeeResponse {
176
133
  /**
177
134
  * Transaction fee in the requested token (in decimals value of the token, e.g. 10^6 for USDC)
178
135
  */
179
- fee_in_token?: number;
180
- /** Public key of the payment destination */
181
- payment_address: string;
182
- /** Public key of the signer used to estimate the fee */
183
- signer_pubkey: string;
184
- }
185
- /**
186
- * Response containing estimated bundle fees.
187
- */
188
- export interface EstimateBundleFeeResponse {
189
- /** Total bundle fee in lamports across all transactions */
190
- fee_in_lamports: number;
191
- /**
192
- * Total bundle fee in the requested token (in decimals value of the token, e.g. 10^6 for USDC)
193
- */
194
- fee_in_token?: number;
136
+ fee_in_token: number;
195
137
  /** Public key of the payment destination */
196
138
  payment_address: string;
197
139
  /** Public key of the signer used to estimate the fee */
@@ -283,28 +225,18 @@ export type PriceConfig = PriceModel;
283
225
  * Enabled status for methods for the Kora server.
284
226
  */
285
227
  export interface EnabledMethods {
286
- /** Whether the estimate_bundle_fee method is enabled (requires bundle.enabled = true) */
287
- estimate_bundle_fee: boolean;
288
228
  /** Whether the estimate_transaction_fee method is enabled */
289
229
  estimate_transaction_fee: boolean;
290
230
  /** Whether the get_blockhash method is enabled */
291
231
  get_blockhash: boolean;
292
232
  /** Whether the get_config method is enabled */
293
233
  get_config: boolean;
294
- /** Whether the get_payer_signer method is enabled */
295
- get_payer_signer: boolean;
296
234
  /** Whether the get_supported_tokens method is enabled */
297
235
  get_supported_tokens: boolean;
298
- /** Whether the get_version method is enabled */
299
- get_version: boolean;
300
236
  /** Whether the liveness method is enabled */
301
237
  liveness: boolean;
302
- /** Whether the sign_and_send_bundle method is enabled (requires bundle.enabled = true) */
303
- sign_and_send_bundle: boolean;
304
238
  /** Whether the sign_and_send_transaction method is enabled */
305
239
  sign_and_send_transaction: boolean;
306
- /** Whether the sign_bundle method is enabled (requires bundle.enabled = true) */
307
- sign_bundle: boolean;
308
240
  /** Whether the sign_transaction method is enabled */
309
241
  sign_transaction: boolean;
310
242
  /** Whether the transfer_transaction method is enabled */
@@ -361,12 +293,6 @@ export interface SplTokenInstructionPolicy {
361
293
  allow_close_account: boolean;
362
294
  /** Allow fee payer to freeze SPL token accounts */
363
295
  allow_freeze_account: boolean;
364
- /** Allow fee payer to initialize SPL token accounts */
365
- allow_initialize_account: boolean;
366
- /** Allow fee payer to initialize SPL token mints */
367
- allow_initialize_mint: boolean;
368
- /** Allow fee payer to initialize SPL multisig accounts */
369
- allow_initialize_multisig: boolean;
370
296
  /** Allow fee payer to mint SPL tokens */
371
297
  allow_mint_to: boolean;
372
298
  /** Allow fee payer to revoke SPL token delegates */
@@ -390,12 +316,6 @@ export interface Token2022InstructionPolicy {
390
316
  allow_close_account: boolean;
391
317
  /** Allow fee payer to freeze Token2022 accounts */
392
318
  allow_freeze_account: boolean;
393
- /** Allow fee payer to initialize Token2022 accounts */
394
- allow_initialize_account: boolean;
395
- /** Allow fee payer to initialize Token2022 mints */
396
- allow_initialize_mint: boolean;
397
- /** Allow fee payer to initialize Token2022 multisig accounts */
398
- allow_initialize_multisig: boolean;
399
319
  /** Allow fee payer to mint Token2022 tokens */
400
320
  allow_mint_to: boolean;
401
321
  /** Allow fee payer to revoke Token2022 delegates */
@@ -452,8 +372,6 @@ export interface AuthenticationHeaders {
452
372
  'x-api-key'?: string;
453
373
  /** HMAC SHA256 signature of timestamp + body */
454
374
  'x-hmac-signature'?: string;
455
- /** reCAPTCHA v3 token for bot protection */
456
- 'x-recaptcha-token'?: string;
457
375
  /** Unix timestamp for HMAC authentication */
458
376
  'x-timestamp'?: string;
459
377
  }
@@ -463,13 +381,6 @@ export interface AuthenticationHeaders {
463
381
  export interface KoraClientOptions {
464
382
  /** Optional API key for authentication */
465
383
  apiKey?: string;
466
- /**
467
- * Optional callback to get a reCAPTCHA v3 token for bot protection.
468
- * Called for every request when provided; server determines which methods require it.
469
- * @example Browser: `() => grecaptcha.execute('site-key', { action: 'sign' })`
470
- * @example Testing: `() => 'test-token'`
471
- */
472
- getRecaptchaToken?: () => Promise<string> | string;
473
384
  /** Optional HMAC secret for signature-based authentication */
474
385
  hmacSecret?: string;
475
386
  /** URL of the Kora RPC server */
@@ -478,25 +389,15 @@ export interface KoraClientOptions {
478
389
  /**
479
390
  * Plugin Types - Kit-typed responses for the Kora plugin
480
391
  */
481
- import type { Address, Base64EncodedWireTransaction, Blockhash, Instruction as KitInstruction, Signature } from '@solana/kit';
482
- import { KoraClient } from '../client.js';
392
+ import type { Address, Base64EncodedWireTransaction, Blockhash, Instruction as KitInstruction, MicroLamports, Signature } from '@solana/kit';
483
393
  /** Configuration options for the Kora Kit plugin */
484
394
  export interface KoraPluginConfig {
485
395
  /** Optional API key for authentication */
486
396
  apiKey?: string;
487
397
  /** Kora RPC endpoint URL */
488
398
  endpoint: string;
489
- /**
490
- * Optional callback to get a reCAPTCHA v3 token for bot protection.
491
- * Called for every request when provided; server determines which methods require it.
492
- * @example Browser: `() => grecaptcha.execute('site-key', { action: 'sign' })`
493
- * @example Testing: `() => 'test-token'`
494
- */
495
- getRecaptchaToken?: () => Promise<string> | string;
496
399
  /** Optional HMAC secret for signature-based authentication */
497
400
  hmacSecret?: string;
498
- /** Existing Kora Client for reusing existing instance */
499
- koraClient?: KoraClient;
500
401
  }
501
402
  /** Plugin response for getPayerSigner with Kit Address types */
502
403
  export interface KitPayerSignerResponse {
@@ -520,7 +421,7 @@ export interface KitEstimateFeeResponse {
520
421
  /** Transaction fee in lamports */
521
422
  fee_in_lamports: number;
522
423
  /** Transaction fee in the requested token */
523
- fee_in_token?: number;
424
+ fee_in_token: number;
524
425
  /** Public key of the payment destination */
525
426
  payment_address: Address;
526
427
  /** Public key of the signer used to estimate the fee */
@@ -542,6 +443,19 @@ export interface KitSignAndSendTransactionResponse {
542
443
  /** Public key of the signer used to send the transaction */
543
444
  signer_pubkey: Address;
544
445
  }
446
+ /** Plugin response for transferTransaction with Kit types */
447
+ export interface KitTransferTransactionResponse {
448
+ /** Recent blockhash used in the transaction */
449
+ blockhash: Blockhash;
450
+ /** Parsed instructions from the transaction message */
451
+ instructions: KitInstruction[];
452
+ /** Base64-encoded message */
453
+ message: string;
454
+ /** Public key of the signer used to send the transaction */
455
+ signer_pubkey: Address;
456
+ /** Base64-encoded signed transaction */
457
+ transaction: Base64EncodedWireTransaction;
458
+ }
545
459
  /** Plugin response for getPaymentInstruction with Kit types */
546
460
  export interface KitPaymentInstructionResponse {
547
461
  /** Base64-encoded original transaction */
@@ -566,33 +480,6 @@ export interface KitConfigResponse {
566
480
  /** Validation rules and constraints */
567
481
  validation_config: KitValidationConfig;
568
482
  }
569
- /** Plugin response for estimateBundleFee with Kit types */
570
- export interface KitEstimateBundleFeeResponse {
571
- /** Total bundle fee in lamports across all transactions */
572
- fee_in_lamports: number;
573
- /** Total bundle fee in the requested token */
574
- fee_in_token?: number;
575
- /** Public key of the payment destination */
576
- payment_address: Address;
577
- /** Public key of the signer used to estimate the fee */
578
- signer_pubkey: Address;
579
- }
580
- /** Plugin response for signBundle with Kit types */
581
- export interface KitSignBundleResponse {
582
- /** Array of base64-encoded signed transactions */
583
- signed_transactions: Base64EncodedWireTransaction[];
584
- /** Public key of the signer used to sign the transactions */
585
- signer_pubkey: Address;
586
- }
587
- /** Plugin response for signAndSendBundle with Kit types */
588
- export interface KitSignAndSendBundleResponse {
589
- /** UUID of the submitted Jito bundle */
590
- bundle_uuid: string;
591
- /** Array of base64-encoded signed transactions */
592
- signed_transactions: Base64EncodedWireTransaction[];
593
- /** Public key of the signer used to sign the transactions */
594
- signer_pubkey: Address;
595
- }
596
483
  /** Plugin validation config with Kit Address types */
597
484
  export interface KitValidationConfig {
598
485
  /** List of allowed Solana program IDs */
@@ -617,19 +504,41 @@ export interface KitValidationConfig {
617
504
  token2022: Token2022Config;
618
505
  }
619
506
  /**
620
- * Kit Client Types
507
+ * Configuration for creating a Kora Kit client.
508
+ *
509
+ * @example
510
+ * ```ts
511
+ * const client = await createKitKoraClient({
512
+ * endpoint: 'https://kora.example.com',
513
+ * rpcUrl: 'https://api.mainnet-beta.solana.com',
514
+ * feeToken: address('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'),
515
+ * feePayerWallet: myWalletSigner, // TransactionSigner that authorizes SPL fee payment
516
+ * });
517
+ * ```
621
518
  */
622
- /** Configuration for {@link createKitKoraClient}. */
623
519
  export interface KoraKitClientConfig {
520
+ /** Optional API key for authentication */
624
521
  readonly apiKey?: string;
522
+ /** Optional compute unit limit (uses provisory/simulation if not set) */
625
523
  readonly computeUnitLimit?: number;
524
+ /** Optional priority fee in micro-lamports */
626
525
  readonly computeUnitPrice?: MicroLamports;
526
+ /** Kora RPC endpoint URL */
627
527
  readonly endpoint: string;
528
+ /** Wallet signer paying SPL fees (must be a real signer so the payment transfer is authorized) */
628
529
  readonly feePayerWallet: TransactionSigner;
530
+ /** SPL mint address for fee payment */
629
531
  readonly feeToken: Address;
630
- readonly getRecaptchaToken?: () => Promise<string> | string;
532
+ /** Optional HMAC secret for signature-based authentication */
631
533
  readonly hmacSecret?: string;
534
+ /**
535
+ * Solana RPC URL used for compute unit estimation and program plugin compatibility.
536
+ * The client simulates transactions against this RPC node to determine optimal
537
+ * compute unit limits (resulting in lower fees), and exposes it as `ClientWithRpc`
538
+ * so Kit program plugins like `tokenProgram()` work out of the box.
539
+ * This must be a direct Solana RPC URL (not the Kora endpoint).
540
+ */
632
541
  readonly rpcUrl: string;
542
+ /** Token program ID for fee payment (defaults to TOKEN_PROGRAM_ADDRESS; use TOKEN_2022_PROGRAM_ADDRESS for Token-2022) */
633
543
  readonly tokenProgramId?: Address;
634
- readonly userId?: string;
635
544
  }