@solana/kora 0.2.0-beta.3 → 0.2.0
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/README.md +29 -27
- package/dist/src/client.d.ts +6 -198
- package/dist/src/client.js +12 -208
- package/dist/src/index.d.ts +2 -1
- package/dist/src/index.js +2 -1
- package/dist/src/kit/executor.d.ts +7 -0
- package/dist/src/kit/executor.js +55 -0
- package/dist/src/kit/index.d.ts +50 -0
- package/dist/src/kit/index.js +67 -0
- package/dist/src/kit/payment.d.ts +18 -0
- package/dist/src/kit/payment.js +69 -0
- package/dist/src/kit/planner.d.ts +4 -0
- package/dist/src/kit/planner.js +23 -0
- package/dist/src/kit/plugin.d.ts +31 -0
- package/dist/src/{plugin.js → kit/plugin.js} +13 -81
- package/dist/src/types/index.d.ts +89 -145
- package/dist/test/auth-setup.js +4 -4
- package/dist/test/integration.test.js +322 -172
- package/dist/test/kit-client.test.d.ts +1 -0
- package/dist/test/kit-client.test.js +473 -0
- package/dist/test/plugin.test.js +71 -126
- package/dist/test/setup.d.ts +13 -9
- package/dist/test/setup.js +36 -38
- package/dist/test/unit.test.js +141 -147
- package/package.json +31 -13
- package/dist/src/plugin.d.ts +0 -85
|
@@ -1,7 +1,22 @@
|
|
|
1
|
-
import { Instruction } 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
|
|
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
|
*/
|
|
@@ -106,6 +72,21 @@ export interface GetPaymentInstructionRequest {
|
|
|
106
72
|
/**
|
|
107
73
|
* Response Types
|
|
108
74
|
*/
|
|
75
|
+
/**
|
|
76
|
+
* Response from creating a transfer transaction.
|
|
77
|
+
*/
|
|
78
|
+
export interface TransferTransactionResponse {
|
|
79
|
+
/** Recent blockhash used in the transaction */
|
|
80
|
+
blockhash: string;
|
|
81
|
+
/** Parsed instructions from the transaction message */
|
|
82
|
+
instructions: Instruction[];
|
|
83
|
+
/** Base64-encoded message */
|
|
84
|
+
message: string;
|
|
85
|
+
/** Public key of the signer used to send the transaction */
|
|
86
|
+
signer_pubkey: string;
|
|
87
|
+
/** Base64-encoded signed transaction */
|
|
88
|
+
transaction: string;
|
|
89
|
+
}
|
|
109
90
|
/**
|
|
110
91
|
* Response from signing a transaction.
|
|
111
92
|
*/
|
|
@@ -126,26 +107,6 @@ export interface SignAndSendTransactionResponse {
|
|
|
126
107
|
/** Public key of the signer used to send the transaction */
|
|
127
108
|
signer_pubkey: string;
|
|
128
109
|
}
|
|
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
110
|
/**
|
|
150
111
|
* Response containing the latest blockhash.
|
|
151
112
|
*/
|
|
@@ -153,13 +114,6 @@ export interface GetBlockhashResponse {
|
|
|
153
114
|
/** Base58-encoded blockhash */
|
|
154
115
|
blockhash: string;
|
|
155
116
|
}
|
|
156
|
-
/**
|
|
157
|
-
* Response containing the server version.
|
|
158
|
-
*/
|
|
159
|
-
export interface GetVersionResponse {
|
|
160
|
-
/** Server version string */
|
|
161
|
-
version: string;
|
|
162
|
-
}
|
|
163
117
|
/**
|
|
164
118
|
* Response containing supported token mint addresses.
|
|
165
119
|
*/
|
|
@@ -176,22 +130,7 @@ export interface EstimateTransactionFeeResponse {
|
|
|
176
130
|
/**
|
|
177
131
|
* Transaction fee in the requested token (in decimals value of the token, e.g. 10^6 for USDC)
|
|
178
132
|
*/
|
|
179
|
-
fee_in_token
|
|
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;
|
|
133
|
+
fee_in_token: number;
|
|
195
134
|
/** Public key of the payment destination */
|
|
196
135
|
payment_address: string;
|
|
197
136
|
/** Public key of the signer used to estimate the fee */
|
|
@@ -220,6 +159,8 @@ export interface GetPaymentInstructionResponse {
|
|
|
220
159
|
payment_instruction: Instruction;
|
|
221
160
|
/** Mint address of the token used for payment */
|
|
222
161
|
payment_token: string;
|
|
162
|
+
/** NoopSigner for the source wallet authority — reuse this in your transaction to avoid duplicate signer conflicts */
|
|
163
|
+
signer: TransactionSigner;
|
|
223
164
|
/** Public key of the payer signer */
|
|
224
165
|
signer_address: string;
|
|
225
166
|
}
|
|
@@ -283,28 +224,18 @@ export type PriceConfig = PriceModel;
|
|
|
283
224
|
* Enabled status for methods for the Kora server.
|
|
284
225
|
*/
|
|
285
226
|
export interface EnabledMethods {
|
|
286
|
-
/** Whether the estimate_bundle_fee method is enabled (requires bundle.enabled = true) */
|
|
287
|
-
estimate_bundle_fee: boolean;
|
|
288
227
|
/** Whether the estimate_transaction_fee method is enabled */
|
|
289
228
|
estimate_transaction_fee: boolean;
|
|
290
229
|
/** Whether the get_blockhash method is enabled */
|
|
291
230
|
get_blockhash: boolean;
|
|
292
231
|
/** Whether the get_config method is enabled */
|
|
293
232
|
get_config: boolean;
|
|
294
|
-
/** Whether the get_payer_signer method is enabled */
|
|
295
|
-
get_payer_signer: boolean;
|
|
296
233
|
/** Whether the get_supported_tokens method is enabled */
|
|
297
234
|
get_supported_tokens: boolean;
|
|
298
|
-
/** Whether the get_version method is enabled */
|
|
299
|
-
get_version: boolean;
|
|
300
235
|
/** Whether the liveness method is enabled */
|
|
301
236
|
liveness: boolean;
|
|
302
|
-
/** Whether the sign_and_send_bundle method is enabled (requires bundle.enabled = true) */
|
|
303
|
-
sign_and_send_bundle: boolean;
|
|
304
237
|
/** Whether the sign_and_send_transaction method is enabled */
|
|
305
238
|
sign_and_send_transaction: boolean;
|
|
306
|
-
/** Whether the sign_bundle method is enabled (requires bundle.enabled = true) */
|
|
307
|
-
sign_bundle: boolean;
|
|
308
239
|
/** Whether the sign_transaction method is enabled */
|
|
309
240
|
sign_transaction: boolean;
|
|
310
241
|
/** Whether the transfer_transaction method is enabled */
|
|
@@ -361,12 +292,6 @@ export interface SplTokenInstructionPolicy {
|
|
|
361
292
|
allow_close_account: boolean;
|
|
362
293
|
/** Allow fee payer to freeze SPL token accounts */
|
|
363
294
|
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
295
|
/** Allow fee payer to mint SPL tokens */
|
|
371
296
|
allow_mint_to: boolean;
|
|
372
297
|
/** Allow fee payer to revoke SPL token delegates */
|
|
@@ -390,12 +315,6 @@ export interface Token2022InstructionPolicy {
|
|
|
390
315
|
allow_close_account: boolean;
|
|
391
316
|
/** Allow fee payer to freeze Token2022 accounts */
|
|
392
317
|
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
318
|
/** Allow fee payer to mint Token2022 tokens */
|
|
400
319
|
allow_mint_to: boolean;
|
|
401
320
|
/** Allow fee payer to revoke Token2022 delegates */
|
|
@@ -469,7 +388,7 @@ export interface KoraClientOptions {
|
|
|
469
388
|
/**
|
|
470
389
|
* Plugin Types - Kit-typed responses for the Kora plugin
|
|
471
390
|
*/
|
|
472
|
-
import type { Address, Base64EncodedWireTransaction, Blockhash, Instruction as KitInstruction, Signature } from '@solana/kit';
|
|
391
|
+
import type { Address, Base64EncodedWireTransaction, Blockhash, Instruction as KitInstruction, MicroLamports, Signature } from '@solana/kit';
|
|
473
392
|
/** Configuration options for the Kora Kit plugin */
|
|
474
393
|
export interface KoraPluginConfig {
|
|
475
394
|
/** Optional API key for authentication */
|
|
@@ -501,7 +420,7 @@ export interface KitEstimateFeeResponse {
|
|
|
501
420
|
/** Transaction fee in lamports */
|
|
502
421
|
fee_in_lamports: number;
|
|
503
422
|
/** Transaction fee in the requested token */
|
|
504
|
-
fee_in_token
|
|
423
|
+
fee_in_token: number;
|
|
505
424
|
/** Public key of the payment destination */
|
|
506
425
|
payment_address: Address;
|
|
507
426
|
/** Public key of the signer used to estimate the fee */
|
|
@@ -523,6 +442,19 @@ export interface KitSignAndSendTransactionResponse {
|
|
|
523
442
|
/** Public key of the signer used to send the transaction */
|
|
524
443
|
signer_pubkey: Address;
|
|
525
444
|
}
|
|
445
|
+
/** Plugin response for transferTransaction with Kit types */
|
|
446
|
+
export interface KitTransferTransactionResponse {
|
|
447
|
+
/** Recent blockhash used in the transaction */
|
|
448
|
+
blockhash: Blockhash;
|
|
449
|
+
/** Parsed instructions from the transaction message */
|
|
450
|
+
instructions: KitInstruction[];
|
|
451
|
+
/** Base64-encoded message */
|
|
452
|
+
message: string;
|
|
453
|
+
/** Public key of the signer used to send the transaction */
|
|
454
|
+
signer_pubkey: Address;
|
|
455
|
+
/** Base64-encoded signed transaction */
|
|
456
|
+
transaction: Base64EncodedWireTransaction;
|
|
457
|
+
}
|
|
526
458
|
/** Plugin response for getPaymentInstruction with Kit types */
|
|
527
459
|
export interface KitPaymentInstructionResponse {
|
|
528
460
|
/** Base64-encoded original transaction */
|
|
@@ -547,33 +479,6 @@ export interface KitConfigResponse {
|
|
|
547
479
|
/** Validation rules and constraints */
|
|
548
480
|
validation_config: KitValidationConfig;
|
|
549
481
|
}
|
|
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
482
|
/** Plugin validation config with Kit Address types */
|
|
578
483
|
export interface KitValidationConfig {
|
|
579
484
|
/** List of allowed Solana program IDs */
|
|
@@ -597,3 +502,42 @@ export interface KitValidationConfig {
|
|
|
597
502
|
/** Token2022 configuration */
|
|
598
503
|
token2022: Token2022Config;
|
|
599
504
|
}
|
|
505
|
+
/**
|
|
506
|
+
* Configuration for creating a Kora Kit client.
|
|
507
|
+
*
|
|
508
|
+
* @example
|
|
509
|
+
* ```ts
|
|
510
|
+
* const client = await createKitKoraClient({
|
|
511
|
+
* endpoint: 'https://kora.example.com',
|
|
512
|
+
* rpcUrl: 'https://api.mainnet-beta.solana.com',
|
|
513
|
+
* feeToken: address('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'),
|
|
514
|
+
* feePayerWallet: myWalletSigner, // TransactionSigner that authorizes SPL fee payment
|
|
515
|
+
* });
|
|
516
|
+
* ```
|
|
517
|
+
*/
|
|
518
|
+
export interface KoraKitClientConfig {
|
|
519
|
+
/** Optional API key for authentication */
|
|
520
|
+
readonly apiKey?: string;
|
|
521
|
+
/** Optional compute unit limit (uses provisory/simulation if not set) */
|
|
522
|
+
readonly computeUnitLimit?: number;
|
|
523
|
+
/** Optional priority fee in micro-lamports */
|
|
524
|
+
readonly computeUnitPrice?: MicroLamports;
|
|
525
|
+
/** Kora RPC endpoint URL */
|
|
526
|
+
readonly endpoint: string;
|
|
527
|
+
/** Wallet signer paying SPL fees (must be a real signer so the payment transfer is authorized) */
|
|
528
|
+
readonly feePayerWallet: TransactionSigner;
|
|
529
|
+
/** SPL mint address for fee payment */
|
|
530
|
+
readonly feeToken: Address;
|
|
531
|
+
/** Optional HMAC secret for signature-based authentication */
|
|
532
|
+
readonly hmacSecret?: string;
|
|
533
|
+
/**
|
|
534
|
+
* Solana RPC URL used for compute unit estimation and program plugin compatibility.
|
|
535
|
+
* The client simulates transactions against this RPC node to determine optimal
|
|
536
|
+
* compute unit limits (resulting in lower fees), and exposes it as `ClientWithRpc`
|
|
537
|
+
* so Kit program plugins like `tokenProgram()` work out of the box.
|
|
538
|
+
* This must be a direct Solana RPC URL (not the Kora endpoint).
|
|
539
|
+
*/
|
|
540
|
+
readonly rpcUrl: string;
|
|
541
|
+
/** Token program ID for fee payment (defaults to TOKEN_PROGRAM_ADDRESS; use TOKEN_2022_PROGRAM_ADDRESS for Token-2022) */
|
|
542
|
+
readonly tokenProgramId?: Address;
|
|
543
|
+
}
|
package/dist/test/auth-setup.js
CHANGED
|
@@ -5,34 +5,34 @@ export function runAuthenticationTests() {
|
|
|
5
5
|
describe('Authentication', () => {
|
|
6
6
|
it('should fail with incorrect API key', async () => {
|
|
7
7
|
const client = new KoraClient({
|
|
8
|
-
apiKey: 'WRONG-API-KEY',
|
|
9
8
|
rpcUrl: koraRpcUrl,
|
|
9
|
+
apiKey: 'WRONG-API-KEY',
|
|
10
10
|
});
|
|
11
11
|
// Auth failure should result in an error (empty response body causes JSON parse error)
|
|
12
12
|
await expect(client.getConfig()).rejects.toThrow();
|
|
13
13
|
});
|
|
14
14
|
it('should fail with incorrect HMAC secret', async () => {
|
|
15
15
|
const client = new KoraClient({
|
|
16
|
-
hmacSecret: 'WRONG-HMAC-SECRET',
|
|
17
16
|
rpcUrl: koraRpcUrl,
|
|
17
|
+
hmacSecret: 'WRONG-HMAC-SECRET',
|
|
18
18
|
});
|
|
19
19
|
// Auth failure should result in an error
|
|
20
20
|
await expect(client.getConfig()).rejects.toThrow();
|
|
21
21
|
});
|
|
22
22
|
it('should fail with both incorrect credentials', async () => {
|
|
23
23
|
const client = new KoraClient({
|
|
24
|
+
rpcUrl: koraRpcUrl,
|
|
24
25
|
apiKey: 'WRONG-API-KEY',
|
|
25
26
|
hmacSecret: 'WRONG-HMAC-SECRET',
|
|
26
|
-
rpcUrl: koraRpcUrl,
|
|
27
27
|
});
|
|
28
28
|
// Auth failure should result in an error
|
|
29
29
|
await expect(client.getConfig()).rejects.toThrow();
|
|
30
30
|
});
|
|
31
31
|
it('should succeed with correct credentials', async () => {
|
|
32
32
|
const client = new KoraClient({
|
|
33
|
+
rpcUrl: koraRpcUrl,
|
|
33
34
|
apiKey: 'test-api-key-123',
|
|
34
35
|
hmacSecret: 'test-hmac-secret-456',
|
|
35
|
-
rpcUrl: koraRpcUrl,
|
|
36
36
|
});
|
|
37
37
|
const config = await client.getConfig();
|
|
38
38
|
expect(config).toBeDefined();
|