@solana/kora 0.2.0-beta.2 → 0.2.0-beta.3
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.
- package/dist/src/client.d.ts +3 -27
- package/dist/src/client.js +26 -57
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/plugin.d.ts +85 -0
- package/dist/src/plugin.js +175 -0
- package/dist/src/types/index.d.ts +257 -145
- package/dist/src/utils/transaction.js +1 -1
- package/dist/test/auth-setup.js +4 -4
- package/dist/test/integration.test.js +112 -131
- package/dist/test/plugin.test.d.ts +1 -0
- package/dist/test/plugin.test.js +442 -0
- package/dist/test/setup.d.ts +9 -9
- package/dist/test/setup.js +38 -35
- package/dist/test/unit.test.js +123 -140
- package/package.json +4 -3
|
@@ -2,129 +2,110 @@ import { Instruction } from '@solana/kit';
|
|
|
2
2
|
/**
|
|
3
3
|
* Request Types
|
|
4
4
|
*/
|
|
5
|
-
/**
|
|
6
|
-
* Parameters for creating a transfer transaction.
|
|
7
|
-
* @deprecated Use `getPaymentInstruction` instead for fee payment flows.
|
|
8
|
-
*/
|
|
9
|
-
export interface TransferTransactionRequest {
|
|
10
|
-
/** Amount to transfer in the token's smallest unit (e.g., lamports for SOL) */
|
|
11
|
-
amount: number;
|
|
12
|
-
/** Mint address of the token to transfer */
|
|
13
|
-
token: string;
|
|
14
|
-
/** Public key of the source wallet (not token account) */
|
|
15
|
-
source: string;
|
|
16
|
-
/** Public key of the destination wallet (not token account) */
|
|
17
|
-
destination: string;
|
|
18
|
-
/** Optional signer key to select a specific Kora signer */
|
|
19
|
-
signer_key?: string;
|
|
20
|
-
}
|
|
21
5
|
/**
|
|
22
6
|
* Parameters for signing a transaction.
|
|
23
7
|
*/
|
|
24
8
|
export interface SignTransactionRequest {
|
|
25
|
-
/** Base64-encoded transaction to sign */
|
|
26
|
-
transaction: string;
|
|
27
|
-
/** Optional signer address for the transaction */
|
|
28
|
-
signer_key?: string;
|
|
29
9
|
/** Optional signer verification during transaction simulation (defaults to false) */
|
|
30
10
|
sig_verify?: boolean;
|
|
11
|
+
/** Optional signer address for the transaction */
|
|
12
|
+
signer_key?: string;
|
|
13
|
+
/** Base64-encoded transaction to sign */
|
|
14
|
+
transaction: string;
|
|
15
|
+
/** Optional user ID for usage tracking (required when pricing is free and usage tracking is enabled) */
|
|
16
|
+
user_id?: string;
|
|
31
17
|
}
|
|
32
18
|
/**
|
|
33
19
|
* Parameters for signing and sending a transaction.
|
|
34
20
|
*/
|
|
35
21
|
export interface SignAndSendTransactionRequest {
|
|
36
|
-
/** Base64-encoded transaction to sign and send */
|
|
37
|
-
transaction: string;
|
|
38
|
-
/** Optional signer address for the transaction */
|
|
39
|
-
signer_key?: string;
|
|
40
22
|
/** Optional signer verification during transaction simulation (defaults to false) */
|
|
41
23
|
sig_verify?: boolean;
|
|
24
|
+
/** Optional signer address for the transaction */
|
|
25
|
+
signer_key?: string;
|
|
26
|
+
/** Base64-encoded transaction to sign and send */
|
|
27
|
+
transaction: string;
|
|
28
|
+
/** Optional user ID for usage tracking (required when pricing is free and usage tracking is enabled) */
|
|
29
|
+
user_id?: string;
|
|
42
30
|
}
|
|
43
31
|
/**
|
|
44
32
|
* Parameters for signing a bundle of transactions.
|
|
45
33
|
*/
|
|
46
34
|
export interface SignBundleRequest {
|
|
47
|
-
/** Array of base64-encoded transactions to sign */
|
|
48
|
-
transactions: string[];
|
|
49
|
-
/** Optional signer address for the transactions */
|
|
50
|
-
signer_key?: string;
|
|
51
35
|
/** Optional signer verification during transaction simulation (defaults to false) */
|
|
52
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;
|
|
53
45
|
}
|
|
54
46
|
/**
|
|
55
47
|
* Parameters for signing and sending a bundle of transactions via Jito.
|
|
56
48
|
*/
|
|
57
49
|
export interface SignAndSendBundleRequest {
|
|
58
|
-
/** Array of base64-encoded transactions to sign and send */
|
|
59
|
-
transactions: string[];
|
|
60
|
-
/** Optional signer address for the transactions */
|
|
61
|
-
signer_key?: string;
|
|
62
50
|
/** Optional signer verification during transaction simulation (defaults to false) */
|
|
63
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;
|
|
64
60
|
}
|
|
65
61
|
/**
|
|
66
62
|
* Parameters for estimating transaction fees.
|
|
67
63
|
*/
|
|
68
64
|
export interface EstimateTransactionFeeRequest {
|
|
69
|
-
/** Base64-encoded transaction to estimate fees for */
|
|
70
|
-
transaction: string;
|
|
71
65
|
/** Mint address of the token to calculate fees in */
|
|
72
66
|
fee_token?: string;
|
|
73
|
-
/** Optional signer address for the transaction */
|
|
74
|
-
signer_key?: string;
|
|
75
67
|
/** Optional signer verification during transaction simulation (defaults to false) */
|
|
76
68
|
sig_verify?: boolean;
|
|
69
|
+
/** Optional signer address for the transaction */
|
|
70
|
+
signer_key?: string;
|
|
71
|
+
/** Base64-encoded transaction to estimate fees for */
|
|
72
|
+
transaction: string;
|
|
77
73
|
}
|
|
78
74
|
/**
|
|
79
75
|
* Parameters for estimating bundle fees.
|
|
80
76
|
*/
|
|
81
77
|
export interface EstimateBundleFeeRequest {
|
|
82
|
-
/** Array of base64-encoded transactions to estimate fees for */
|
|
83
|
-
transactions: string[];
|
|
84
78
|
/** Mint address of the token to calculate fees in */
|
|
85
79
|
fee_token?: string;
|
|
86
|
-
/** Optional signer address for the transactions */
|
|
87
|
-
signer_key?: string;
|
|
88
80
|
/** Optional signer verification during transaction simulation (defaults to false) */
|
|
89
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[];
|
|
90
88
|
}
|
|
91
89
|
/**
|
|
92
90
|
* Parameters for getting a payment instruction.
|
|
93
91
|
*/
|
|
94
92
|
export interface GetPaymentInstructionRequest {
|
|
95
|
-
/** Base64-encoded transaction to estimate fees for */
|
|
96
|
-
transaction: string;
|
|
97
93
|
/** Mint address of the token to calculate fees in */
|
|
98
94
|
fee_token: string;
|
|
95
|
+
/** Optional signer verification during transaction simulation (defaults to false) */
|
|
96
|
+
sig_verify?: boolean;
|
|
97
|
+
/** Optional signer address for the transaction */
|
|
98
|
+
signer_key?: string;
|
|
99
99
|
/** The wallet owner (not token account) that will be making the token payment */
|
|
100
100
|
source_wallet: string;
|
|
101
101
|
/** The token program id to use for the payment (defaults to TOKEN_PROGRAM_ID) */
|
|
102
102
|
token_program_id?: string;
|
|
103
|
-
/**
|
|
104
|
-
|
|
105
|
-
/** Optional signer verification during transaction simulation (defaults to false) */
|
|
106
|
-
sig_verify?: boolean;
|
|
103
|
+
/** Base64-encoded transaction to estimate fees for */
|
|
104
|
+
transaction: string;
|
|
107
105
|
}
|
|
108
106
|
/**
|
|
109
107
|
* Response Types
|
|
110
108
|
*/
|
|
111
|
-
/**
|
|
112
|
-
* Response from creating a transfer transaction.
|
|
113
|
-
* The transaction is unsigned.
|
|
114
|
-
* @deprecated Use `getPaymentInstruction` instead for fee payment flows.
|
|
115
|
-
*/
|
|
116
|
-
export interface TransferTransactionResponse {
|
|
117
|
-
/** Base64-encoded unsigned transaction */
|
|
118
|
-
transaction: string;
|
|
119
|
-
/** Base64-encoded unsigned message */
|
|
120
|
-
message: string;
|
|
121
|
-
/** Recent blockhash used in the transaction */
|
|
122
|
-
blockhash: string;
|
|
123
|
-
/** Public key of the Kora signer (fee payer) */
|
|
124
|
-
signer_pubkey: string;
|
|
125
|
-
/** Parsed instructions from the transaction message */
|
|
126
|
-
instructions: Instruction[];
|
|
127
|
-
}
|
|
128
109
|
/**
|
|
129
110
|
* Response from signing a transaction.
|
|
130
111
|
*/
|
|
@@ -158,12 +139,12 @@ export interface SignBundleResponse {
|
|
|
158
139
|
* Response from signing and sending a bundle of transactions via Jito.
|
|
159
140
|
*/
|
|
160
141
|
export interface SignAndSendBundleResponse {
|
|
142
|
+
/** UUID of the submitted Jito bundle */
|
|
143
|
+
bundle_uuid: string;
|
|
161
144
|
/** Array of base64-encoded signed transactions */
|
|
162
145
|
signed_transactions: string[];
|
|
163
146
|
/** Public key of the signer used to sign the transactions */
|
|
164
147
|
signer_pubkey: string;
|
|
165
|
-
/** UUID of the submitted Jito bundle */
|
|
166
|
-
bundle_uuid: string;
|
|
167
148
|
}
|
|
168
149
|
/**
|
|
169
150
|
* Response containing the latest blockhash.
|
|
@@ -196,10 +177,10 @@ export interface EstimateTransactionFeeResponse {
|
|
|
196
177
|
* Transaction fee in the requested token (in decimals value of the token, e.g. 10^6 for USDC)
|
|
197
178
|
*/
|
|
198
179
|
fee_in_token?: number;
|
|
199
|
-
/** Public key of the signer used to estimate the fee */
|
|
200
|
-
signer_pubkey: string;
|
|
201
180
|
/** Public key of the payment destination */
|
|
202
181
|
payment_address: string;
|
|
182
|
+
/** Public key of the signer used to estimate the fee */
|
|
183
|
+
signer_pubkey: string;
|
|
203
184
|
}
|
|
204
185
|
/**
|
|
205
186
|
* Response containing estimated bundle fees.
|
|
@@ -211,19 +192,19 @@ export interface EstimateBundleFeeResponse {
|
|
|
211
192
|
* Total bundle fee in the requested token (in decimals value of the token, e.g. 10^6 for USDC)
|
|
212
193
|
*/
|
|
213
194
|
fee_in_token?: number;
|
|
214
|
-
/** Public key of the signer used to estimate the fee */
|
|
215
|
-
signer_pubkey: string;
|
|
216
195
|
/** Public key of the payment destination */
|
|
217
196
|
payment_address: string;
|
|
197
|
+
/** Public key of the signer used to estimate the fee */
|
|
198
|
+
signer_pubkey: string;
|
|
218
199
|
}
|
|
219
200
|
/**
|
|
220
201
|
* Response containing the payer signer and payment destination.
|
|
221
202
|
*/
|
|
222
203
|
export interface GetPayerSignerResponse {
|
|
223
|
-
/** Public key of the payer signer */
|
|
224
|
-
signer_address: string;
|
|
225
204
|
/** Public key of the payment destination */
|
|
226
205
|
payment_address: string;
|
|
206
|
+
/** Public key of the payer signer */
|
|
207
|
+
signer_address: string;
|
|
227
208
|
}
|
|
228
209
|
/**
|
|
229
210
|
* Response containing a payment instruction.
|
|
@@ -231,14 +212,14 @@ export interface GetPayerSignerResponse {
|
|
|
231
212
|
export interface GetPaymentInstructionResponse {
|
|
232
213
|
/** Base64-encoded original transaction */
|
|
233
214
|
original_transaction: string;
|
|
234
|
-
/**
|
|
235
|
-
|
|
215
|
+
/** Public key of the payment destination */
|
|
216
|
+
payment_address: string;
|
|
236
217
|
/** Payment amount in the requested token */
|
|
237
218
|
payment_amount: number;
|
|
219
|
+
/** Base64-encoded payment instruction */
|
|
220
|
+
payment_instruction: Instruction;
|
|
238
221
|
/** Mint address of the token used for payment */
|
|
239
222
|
payment_token: string;
|
|
240
|
-
/** Public key of the payment destination */
|
|
241
|
-
payment_address: string;
|
|
242
223
|
/** Public key of the payer signer */
|
|
243
224
|
signer_address: string;
|
|
244
225
|
}
|
|
@@ -250,24 +231,24 @@ export type PriceSource = 'Jupiter' | 'Mock';
|
|
|
250
231
|
* Validation configuration for the Kora server.
|
|
251
232
|
*/
|
|
252
233
|
export interface ValidationConfig {
|
|
253
|
-
/** Maximum allowed transaction value in lamports */
|
|
254
|
-
max_allowed_lamports: number;
|
|
255
|
-
/** Maximum number of signatures allowed per transaction */
|
|
256
|
-
max_signatures: number;
|
|
257
|
-
/** Price oracle source for token conversions */
|
|
258
|
-
price_source: PriceSource;
|
|
259
234
|
/** List of allowed Solana program IDs */
|
|
260
235
|
allowed_programs: string[];
|
|
261
|
-
/** List of allowed token mint addresses for fee payment */
|
|
262
|
-
allowed_tokens: string[];
|
|
263
236
|
/** List of SPL tokens accepted for paid transactions */
|
|
264
237
|
allowed_spl_paid_tokens: string[];
|
|
238
|
+
/** List of allowed token mint addresses for fee payment */
|
|
239
|
+
allowed_tokens: string[];
|
|
265
240
|
/** List of blocked account addresses */
|
|
266
241
|
disallowed_accounts: string[];
|
|
267
242
|
/** Policy controlling fee payer permissions */
|
|
268
243
|
fee_payer_policy: FeePayerPolicy;
|
|
244
|
+
/** Maximum allowed transaction value in lamports */
|
|
245
|
+
max_allowed_lamports: number;
|
|
246
|
+
/** Maximum number of signatures allowed per transaction */
|
|
247
|
+
max_signatures: number;
|
|
269
248
|
/** Pricing model configuration */
|
|
270
249
|
price: PriceConfig;
|
|
250
|
+
/** Price oracle source for token conversions */
|
|
251
|
+
price_source: PriceSource;
|
|
271
252
|
/** Token2022 configuration */
|
|
272
253
|
token2022: Token2022Config;
|
|
273
254
|
}
|
|
@@ -275,10 +256,10 @@ export interface ValidationConfig {
|
|
|
275
256
|
* Blocked extensions for Token2022.
|
|
276
257
|
*/
|
|
277
258
|
export interface Token2022Config {
|
|
278
|
-
/** List of blocked mint extensions */
|
|
279
|
-
blocked_mint_extensions: string[];
|
|
280
259
|
/** List of blocked account extensions */
|
|
281
260
|
blocked_account_extensions: string[];
|
|
261
|
+
/** List of blocked mint extensions */
|
|
262
|
+
blocked_mint_extensions: string[];
|
|
282
263
|
}
|
|
283
264
|
/**
|
|
284
265
|
* Pricing model for transaction fees.
|
|
@@ -288,12 +269,12 @@ export interface Token2022Config {
|
|
|
288
269
|
* - `free`: No additional fees charged
|
|
289
270
|
*/
|
|
290
271
|
export type PriceModel = {
|
|
291
|
-
type: 'margin';
|
|
292
|
-
margin: number;
|
|
293
|
-
} | {
|
|
294
|
-
type: 'fixed';
|
|
295
272
|
amount: number;
|
|
296
273
|
token: string;
|
|
274
|
+
type: 'fixed';
|
|
275
|
+
} | {
|
|
276
|
+
margin: number;
|
|
277
|
+
type: 'margin';
|
|
297
278
|
} | {
|
|
298
279
|
type: 'free';
|
|
299
280
|
};
|
|
@@ -302,54 +283,54 @@ export type PriceConfig = PriceModel;
|
|
|
302
283
|
* Enabled status for methods for the Kora server.
|
|
303
284
|
*/
|
|
304
285
|
export interface EnabledMethods {
|
|
305
|
-
/** Whether the liveness method is enabled */
|
|
306
|
-
liveness: boolean;
|
|
307
|
-
/** Whether the estimate_transaction_fee method is enabled */
|
|
308
|
-
estimate_transaction_fee: boolean;
|
|
309
286
|
/** Whether the estimate_bundle_fee method is enabled (requires bundle.enabled = true) */
|
|
310
287
|
estimate_bundle_fee: boolean;
|
|
311
|
-
/** Whether the
|
|
312
|
-
|
|
313
|
-
/** Whether the get_payer_signer method is enabled */
|
|
314
|
-
get_payer_signer: boolean;
|
|
315
|
-
/** Whether the sign_transaction method is enabled */
|
|
316
|
-
sign_transaction: boolean;
|
|
317
|
-
/** Whether the sign_and_send_transaction method is enabled */
|
|
318
|
-
sign_and_send_transaction: boolean;
|
|
319
|
-
/** Whether the transfer_transaction method is enabled */
|
|
320
|
-
transfer_transaction: boolean;
|
|
288
|
+
/** Whether the estimate_transaction_fee method is enabled */
|
|
289
|
+
estimate_transaction_fee: boolean;
|
|
321
290
|
/** Whether the get_blockhash method is enabled */
|
|
322
291
|
get_blockhash: boolean;
|
|
323
292
|
/** Whether the get_config method is enabled */
|
|
324
293
|
get_config: boolean;
|
|
294
|
+
/** Whether the get_payer_signer method is enabled */
|
|
295
|
+
get_payer_signer: boolean;
|
|
296
|
+
/** Whether the get_supported_tokens method is enabled */
|
|
297
|
+
get_supported_tokens: boolean;
|
|
325
298
|
/** Whether the get_version method is enabled */
|
|
326
299
|
get_version: boolean;
|
|
300
|
+
/** Whether the liveness method is enabled */
|
|
301
|
+
liveness: boolean;
|
|
327
302
|
/** Whether the sign_and_send_bundle method is enabled (requires bundle.enabled = true) */
|
|
328
303
|
sign_and_send_bundle: boolean;
|
|
304
|
+
/** Whether the sign_and_send_transaction method is enabled */
|
|
305
|
+
sign_and_send_transaction: boolean;
|
|
329
306
|
/** Whether the sign_bundle method is enabled (requires bundle.enabled = true) */
|
|
330
307
|
sign_bundle: boolean;
|
|
308
|
+
/** Whether the sign_transaction method is enabled */
|
|
309
|
+
sign_transaction: boolean;
|
|
310
|
+
/** Whether the transfer_transaction method is enabled */
|
|
311
|
+
transfer_transaction: boolean;
|
|
331
312
|
}
|
|
332
313
|
/**
|
|
333
314
|
* Kora server configuration.
|
|
334
315
|
*/
|
|
335
316
|
export interface Config {
|
|
317
|
+
/** Enabled methods */
|
|
318
|
+
enabled_methods: EnabledMethods;
|
|
336
319
|
/** Array of public keys of the fee payer accounts (signer pool) */
|
|
337
320
|
fee_payers: string[];
|
|
338
321
|
/** Validation rules and constraints */
|
|
339
322
|
validation_config: ValidationConfig;
|
|
340
|
-
/** Enabled methods */
|
|
341
|
-
enabled_methods: EnabledMethods;
|
|
342
323
|
}
|
|
343
324
|
/**
|
|
344
325
|
* Nonce instruction policy
|
|
345
326
|
*/
|
|
346
327
|
export interface NonceInstructionPolicy {
|
|
347
|
-
/** Allow fee payer to initialize nonce accounts */
|
|
348
|
-
allow_initialize: boolean;
|
|
349
328
|
/** Allow fee payer to advance nonce accounts */
|
|
350
329
|
allow_advance: boolean;
|
|
351
330
|
/** Allow fee payer to authorize nonce accounts */
|
|
352
331
|
allow_authorize: boolean;
|
|
332
|
+
/** Allow fee payer to initialize nonce accounts */
|
|
333
|
+
allow_initialize: boolean;
|
|
353
334
|
/** Allow fee payer to withdraw from nonce accounts */
|
|
354
335
|
allow_withdraw: boolean;
|
|
355
336
|
}
|
|
@@ -357,14 +338,14 @@ export interface NonceInstructionPolicy {
|
|
|
357
338
|
* System instruction policy
|
|
358
339
|
*/
|
|
359
340
|
export interface SystemInstructionPolicy {
|
|
360
|
-
/** Allow fee payer to be the
|
|
361
|
-
|
|
341
|
+
/** Allow fee payer to be the account in System Allocate/AllocateWithSeed */
|
|
342
|
+
allow_allocate: boolean;
|
|
362
343
|
/** Allow fee payer to be the authority in System Assign/AssignWithSeed */
|
|
363
344
|
allow_assign: boolean;
|
|
364
345
|
/** Allow fee payer to be the payer in System CreateAccount/CreateAccountWithSeed */
|
|
365
346
|
allow_create_account: boolean;
|
|
366
|
-
/** Allow fee payer to be the
|
|
367
|
-
|
|
347
|
+
/** Allow fee payer to be the sender in System Transfer/TransferWithSeed */
|
|
348
|
+
allow_transfer: boolean;
|
|
368
349
|
/** Nested policy for nonce account operations */
|
|
369
350
|
nonce: NonceInstructionPolicy;
|
|
370
351
|
}
|
|
@@ -372,68 +353,68 @@ export interface SystemInstructionPolicy {
|
|
|
372
353
|
* SPL Token instruction policy
|
|
373
354
|
*/
|
|
374
355
|
export interface SplTokenInstructionPolicy {
|
|
375
|
-
/** Allow fee payer to
|
|
376
|
-
|
|
356
|
+
/** Allow fee payer to approve SPL token delegates */
|
|
357
|
+
allow_approve: boolean;
|
|
377
358
|
/** Allow fee payer to burn SPL tokens */
|
|
378
359
|
allow_burn: boolean;
|
|
379
360
|
/** Allow fee payer to close SPL token accounts */
|
|
380
361
|
allow_close_account: boolean;
|
|
381
|
-
/** Allow fee payer to
|
|
382
|
-
|
|
383
|
-
/** Allow fee payer to revoke SPL token delegates */
|
|
384
|
-
allow_revoke: boolean;
|
|
385
|
-
/** Allow fee payer to set authority on SPL token accounts */
|
|
386
|
-
allow_set_authority: boolean;
|
|
387
|
-
/** Allow fee payer to mint SPL tokens */
|
|
388
|
-
allow_mint_to: boolean;
|
|
389
|
-
/** Allow fee payer to initialize SPL token mints */
|
|
390
|
-
allow_initialize_mint: boolean;
|
|
362
|
+
/** Allow fee payer to freeze SPL token accounts */
|
|
363
|
+
allow_freeze_account: boolean;
|
|
391
364
|
/** Allow fee payer to initialize SPL token accounts */
|
|
392
365
|
allow_initialize_account: boolean;
|
|
366
|
+
/** Allow fee payer to initialize SPL token mints */
|
|
367
|
+
allow_initialize_mint: boolean;
|
|
393
368
|
/** Allow fee payer to initialize SPL multisig accounts */
|
|
394
369
|
allow_initialize_multisig: boolean;
|
|
395
|
-
/** Allow fee payer to
|
|
396
|
-
|
|
370
|
+
/** Allow fee payer to mint SPL tokens */
|
|
371
|
+
allow_mint_to: boolean;
|
|
372
|
+
/** Allow fee payer to revoke SPL token delegates */
|
|
373
|
+
allow_revoke: boolean;
|
|
374
|
+
/** Allow fee payer to set authority on SPL token accounts */
|
|
375
|
+
allow_set_authority: boolean;
|
|
397
376
|
/** Allow fee payer to thaw SPL token accounts */
|
|
398
377
|
allow_thaw_account: boolean;
|
|
378
|
+
/** Allow fee payer to be source in SPL token transfers */
|
|
379
|
+
allow_transfer: boolean;
|
|
399
380
|
}
|
|
400
381
|
/**
|
|
401
382
|
* Token2022 instruction policy
|
|
402
383
|
*/
|
|
403
384
|
export interface Token2022InstructionPolicy {
|
|
404
|
-
/** Allow fee payer to
|
|
405
|
-
|
|
385
|
+
/** Allow fee payer to approve Token2022 delegates */
|
|
386
|
+
allow_approve: boolean;
|
|
406
387
|
/** Allow fee payer to burn Token2022 tokens */
|
|
407
388
|
allow_burn: boolean;
|
|
408
389
|
/** Allow fee payer to close Token2022 accounts */
|
|
409
390
|
allow_close_account: boolean;
|
|
410
|
-
/** Allow fee payer to
|
|
411
|
-
|
|
412
|
-
/** Allow fee payer to revoke Token2022 delegates */
|
|
413
|
-
allow_revoke: boolean;
|
|
414
|
-
/** Allow fee payer to set authority on Token2022 accounts */
|
|
415
|
-
allow_set_authority: boolean;
|
|
416
|
-
/** Allow fee payer to mint Token2022 tokens */
|
|
417
|
-
allow_mint_to: boolean;
|
|
418
|
-
/** Allow fee payer to initialize Token2022 mints */
|
|
419
|
-
allow_initialize_mint: boolean;
|
|
391
|
+
/** Allow fee payer to freeze Token2022 accounts */
|
|
392
|
+
allow_freeze_account: boolean;
|
|
420
393
|
/** Allow fee payer to initialize Token2022 accounts */
|
|
421
394
|
allow_initialize_account: boolean;
|
|
395
|
+
/** Allow fee payer to initialize Token2022 mints */
|
|
396
|
+
allow_initialize_mint: boolean;
|
|
422
397
|
/** Allow fee payer to initialize Token2022 multisig accounts */
|
|
423
398
|
allow_initialize_multisig: boolean;
|
|
424
|
-
/** Allow fee payer to
|
|
425
|
-
|
|
399
|
+
/** Allow fee payer to mint Token2022 tokens */
|
|
400
|
+
allow_mint_to: boolean;
|
|
401
|
+
/** Allow fee payer to revoke Token2022 delegates */
|
|
402
|
+
allow_revoke: boolean;
|
|
403
|
+
/** Allow fee payer to set authority on Token2022 accounts */
|
|
404
|
+
allow_set_authority: boolean;
|
|
426
405
|
/** Allow fee payer to thaw Token2022 accounts */
|
|
427
406
|
allow_thaw_account: boolean;
|
|
407
|
+
/** Allow fee payer to be source in Token2022 transfers */
|
|
408
|
+
allow_transfer: boolean;
|
|
428
409
|
}
|
|
429
410
|
/**
|
|
430
411
|
* Policy controlling what actions the fee payer can perform.
|
|
431
412
|
*/
|
|
432
413
|
export interface FeePayerPolicy {
|
|
433
|
-
/** System program instruction policies */
|
|
434
|
-
system: SystemInstructionPolicy;
|
|
435
414
|
/** SPL Token program instruction policies */
|
|
436
415
|
spl_token: SplTokenInstructionPolicy;
|
|
416
|
+
/** System program instruction policies */
|
|
417
|
+
system: SystemInstructionPolicy;
|
|
437
418
|
/** Token2022 program instruction policies */
|
|
438
419
|
token_2022: Token2022InstructionPolicy;
|
|
439
420
|
}
|
|
@@ -454,10 +435,10 @@ export interface RpcError {
|
|
|
454
435
|
* @typeParam T - Type of the params object
|
|
455
436
|
*/
|
|
456
437
|
export interface RpcRequest<T> {
|
|
457
|
-
/** JSON-RPC version */
|
|
458
|
-
jsonrpc: '2.0';
|
|
459
438
|
/** Request ID */
|
|
460
439
|
id: number;
|
|
440
|
+
/** JSON-RPC version */
|
|
441
|
+
jsonrpc: '2.0';
|
|
461
442
|
/** RPC method name */
|
|
462
443
|
method: string;
|
|
463
444
|
/** Method parameters */
|
|
@@ -469,19 +450,150 @@ export interface RpcRequest<T> {
|
|
|
469
450
|
export interface AuthenticationHeaders {
|
|
470
451
|
/** API key for simple authentication */
|
|
471
452
|
'x-api-key'?: string;
|
|
472
|
-
/** Unix timestamp for HMAC authentication */
|
|
473
|
-
'x-timestamp'?: string;
|
|
474
453
|
/** HMAC SHA256 signature of timestamp + body */
|
|
475
454
|
'x-hmac-signature'?: string;
|
|
455
|
+
/** Unix timestamp for HMAC authentication */
|
|
456
|
+
'x-timestamp'?: string;
|
|
476
457
|
}
|
|
477
458
|
/**
|
|
478
459
|
* Options for initializing a Kora client.
|
|
479
460
|
*/
|
|
480
461
|
export interface KoraClientOptions {
|
|
462
|
+
/** Optional API key for authentication */
|
|
463
|
+
apiKey?: string;
|
|
464
|
+
/** Optional HMAC secret for signature-based authentication */
|
|
465
|
+
hmacSecret?: string;
|
|
481
466
|
/** URL of the Kora RPC server */
|
|
482
467
|
rpcUrl: string;
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* Plugin Types - Kit-typed responses for the Kora plugin
|
|
471
|
+
*/
|
|
472
|
+
import type { Address, Base64EncodedWireTransaction, Blockhash, Instruction as KitInstruction, Signature } from '@solana/kit';
|
|
473
|
+
/** Configuration options for the Kora Kit plugin */
|
|
474
|
+
export interface KoraPluginConfig {
|
|
483
475
|
/** Optional API key for authentication */
|
|
484
476
|
apiKey?: string;
|
|
477
|
+
/** Kora RPC endpoint URL */
|
|
478
|
+
endpoint: string;
|
|
485
479
|
/** Optional HMAC secret for signature-based authentication */
|
|
486
480
|
hmacSecret?: string;
|
|
487
481
|
}
|
|
482
|
+
/** Plugin response for getPayerSigner with Kit Address types */
|
|
483
|
+
export interface KitPayerSignerResponse {
|
|
484
|
+
/** Public key of the payment destination */
|
|
485
|
+
payment_address: Address;
|
|
486
|
+
/** Public key of the payer signer */
|
|
487
|
+
signer_address: Address;
|
|
488
|
+
}
|
|
489
|
+
/** Plugin response for getBlockhash with Kit Blockhash type */
|
|
490
|
+
export interface KitBlockhashResponse {
|
|
491
|
+
/** Base58-encoded blockhash */
|
|
492
|
+
blockhash: Blockhash;
|
|
493
|
+
}
|
|
494
|
+
/** Plugin response for getSupportedTokens with Kit Address types */
|
|
495
|
+
export interface KitSupportedTokensResponse {
|
|
496
|
+
/** Array of supported token mint addresses */
|
|
497
|
+
tokens: Address[];
|
|
498
|
+
}
|
|
499
|
+
/** Plugin response for estimateTransactionFee with Kit Address types */
|
|
500
|
+
export interface KitEstimateFeeResponse {
|
|
501
|
+
/** Transaction fee in lamports */
|
|
502
|
+
fee_in_lamports: number;
|
|
503
|
+
/** Transaction fee in the requested token */
|
|
504
|
+
fee_in_token?: number;
|
|
505
|
+
/** Public key of the payment destination */
|
|
506
|
+
payment_address: Address;
|
|
507
|
+
/** Public key of the signer used to estimate the fee */
|
|
508
|
+
signer_pubkey: Address;
|
|
509
|
+
}
|
|
510
|
+
/** Plugin response for signTransaction with Kit types */
|
|
511
|
+
export interface KitSignTransactionResponse {
|
|
512
|
+
/** Base64-encoded signed transaction */
|
|
513
|
+
signed_transaction: Base64EncodedWireTransaction;
|
|
514
|
+
/** Public key of the signer used to sign the transaction */
|
|
515
|
+
signer_pubkey: Address;
|
|
516
|
+
}
|
|
517
|
+
/** Plugin response for signAndSendTransaction with Kit types */
|
|
518
|
+
export interface KitSignAndSendTransactionResponse {
|
|
519
|
+
/** Transaction signature */
|
|
520
|
+
signature: Signature;
|
|
521
|
+
/** Base64-encoded signed transaction */
|
|
522
|
+
signed_transaction: Base64EncodedWireTransaction;
|
|
523
|
+
/** Public key of the signer used to send the transaction */
|
|
524
|
+
signer_pubkey: Address;
|
|
525
|
+
}
|
|
526
|
+
/** Plugin response for getPaymentInstruction with Kit types */
|
|
527
|
+
export interface KitPaymentInstructionResponse {
|
|
528
|
+
/** Base64-encoded original transaction */
|
|
529
|
+
original_transaction: Base64EncodedWireTransaction;
|
|
530
|
+
/** Public key of the payment destination */
|
|
531
|
+
payment_address: Address;
|
|
532
|
+
/** Payment amount in the requested token */
|
|
533
|
+
payment_amount: number;
|
|
534
|
+
/** Payment instruction */
|
|
535
|
+
payment_instruction: KitInstruction;
|
|
536
|
+
/** Mint address of the token used for payment */
|
|
537
|
+
payment_token: Address;
|
|
538
|
+
/** Public key of the payer signer */
|
|
539
|
+
signer_address: Address;
|
|
540
|
+
}
|
|
541
|
+
/** Plugin response for getConfig with Kit Address types */
|
|
542
|
+
export interface KitConfigResponse {
|
|
543
|
+
/** Enabled methods */
|
|
544
|
+
enabled_methods: EnabledMethods;
|
|
545
|
+
/** Array of public keys of the fee payer accounts (signer pool) */
|
|
546
|
+
fee_payers: Address[];
|
|
547
|
+
/** Validation rules and constraints */
|
|
548
|
+
validation_config: KitValidationConfig;
|
|
549
|
+
}
|
|
550
|
+
/** Plugin response for estimateBundleFee with Kit types */
|
|
551
|
+
export interface KitEstimateBundleFeeResponse {
|
|
552
|
+
/** Total bundle fee in lamports across all transactions */
|
|
553
|
+
fee_in_lamports: number;
|
|
554
|
+
/** Total bundle fee in the requested token */
|
|
555
|
+
fee_in_token?: number;
|
|
556
|
+
/** Public key of the payment destination */
|
|
557
|
+
payment_address: Address;
|
|
558
|
+
/** Public key of the signer used to estimate the fee */
|
|
559
|
+
signer_pubkey: Address;
|
|
560
|
+
}
|
|
561
|
+
/** Plugin response for signBundle with Kit types */
|
|
562
|
+
export interface KitSignBundleResponse {
|
|
563
|
+
/** Array of base64-encoded signed transactions */
|
|
564
|
+
signed_transactions: Base64EncodedWireTransaction[];
|
|
565
|
+
/** Public key of the signer used to sign the transactions */
|
|
566
|
+
signer_pubkey: Address;
|
|
567
|
+
}
|
|
568
|
+
/** Plugin response for signAndSendBundle with Kit types */
|
|
569
|
+
export interface KitSignAndSendBundleResponse {
|
|
570
|
+
/** UUID of the submitted Jito bundle */
|
|
571
|
+
bundle_uuid: string;
|
|
572
|
+
/** Array of base64-encoded signed transactions */
|
|
573
|
+
signed_transactions: Base64EncodedWireTransaction[];
|
|
574
|
+
/** Public key of the signer used to sign the transactions */
|
|
575
|
+
signer_pubkey: Address;
|
|
576
|
+
}
|
|
577
|
+
/** Plugin validation config with Kit Address types */
|
|
578
|
+
export interface KitValidationConfig {
|
|
579
|
+
/** List of allowed Solana program IDs */
|
|
580
|
+
allowed_programs: Address[];
|
|
581
|
+
/** List of SPL tokens accepted for paid transactions */
|
|
582
|
+
allowed_spl_paid_tokens: Address[];
|
|
583
|
+
/** List of allowed token mint addresses for fee payment */
|
|
584
|
+
allowed_tokens: Address[];
|
|
585
|
+
/** List of blocked account addresses */
|
|
586
|
+
disallowed_accounts: Address[];
|
|
587
|
+
/** Policy controlling fee payer permissions */
|
|
588
|
+
fee_payer_policy: FeePayerPolicy;
|
|
589
|
+
/** Maximum allowed transaction value in lamports */
|
|
590
|
+
max_allowed_lamports: number;
|
|
591
|
+
/** Maximum number of signatures allowed per transaction */
|
|
592
|
+
max_signatures: number;
|
|
593
|
+
/** Pricing model configuration */
|
|
594
|
+
price: PriceConfig;
|
|
595
|
+
/** Price oracle source for token conversions */
|
|
596
|
+
price_source: PriceSource;
|
|
597
|
+
/** Token2022 configuration */
|
|
598
|
+
token2022: Token2022Config;
|
|
599
|
+
}
|
|
@@ -25,7 +25,7 @@ export function getInstructionsFromBase64Message(message) {
|
|
|
25
25
|
const decompiledMessage = deserializeBase64Message(message);
|
|
26
26
|
return decompiledMessage.instructions;
|
|
27
27
|
}
|
|
28
|
-
catch
|
|
28
|
+
catch {
|
|
29
29
|
// Silently handle parsing errors and return empty array
|
|
30
30
|
return [];
|
|
31
31
|
}
|