@solana/web3.js 1.52.0 → 1.53.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/lib/index.browser.cjs.js +2892 -2811
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +2892 -2812
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +2892 -2811
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +862 -838
- package/lib/index.esm.js +2892 -2812
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +3072 -2991
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +3 -3
- package/lib/index.iife.min.js.map +1 -1
- package/lib/index.native.js +2894 -2813
- package/lib/index.native.js.map +1 -1
- package/package.json +1 -1
- package/src/account-data.ts +39 -0
- package/src/account.ts +1 -1
- package/src/connection.ts +30 -6
- package/src/index.ts +3 -14
- package/src/loader.ts +4 -5
- package/src/message/index.ts +32 -0
- package/src/{message.ts → message/legacy.ts} +7 -37
- package/src/nonce-account.ts +1 -1
- package/src/{address-lookup-table-program.ts → programs/address-lookup-table/index.ts} +8 -6
- package/src/programs/address-lookup-table/state.ts +84 -0
- package/src/{compute-budget.ts → programs/compute-budget.ts} +4 -4
- package/src/{ed25519-program.ts → programs/ed25519.ts} +4 -4
- package/src/programs/index.ts +7 -0
- package/src/{secp256k1-program.ts → programs/secp256k1.ts} +4 -4
- package/src/{stake-program.ts → programs/stake.ts} +7 -7
- package/src/{system-program.ts → programs/system.ts} +8 -8
- package/src/{vote-program.ts → programs/vote.ts} +7 -7
- package/src/publickey.ts +2 -2
- package/src/{transaction-constants.ts → transaction/constants.ts} +0 -0
- package/src/{util/tx-expiry-custom-errors.ts → transaction/expiry-custom-errors.ts} +0 -0
- package/src/transaction/index.ts +3 -0
- package/src/{transaction.ts → transaction/legacy.ts} +10 -13
- package/src/{util → utils}/__forks__/react-native/url-impl.ts +0 -0
- package/src/{util → utils}/assert.ts +0 -0
- package/src/{util → utils}/bigint.ts +0 -0
- package/src/{util → utils}/borsh-schema.ts +0 -0
- package/src/{util → utils}/cluster.ts +0 -0
- package/src/utils/index.ts +4 -0
- package/src/{util → utils}/makeWebsocketUrl.ts +0 -0
- package/src/{util → utils}/promise-timeout.ts +0 -0
- package/src/{util → utils}/send-and-confirm-raw-transaction.ts +0 -0
- package/src/{util → utils}/send-and-confirm-transaction.ts +0 -0
- package/src/{util → utils}/shortvec-encoding.ts +0 -0
- package/src/{util → utils}/sleep.ts +0 -0
- package/src/{util → utils}/to-buffer.ts +0 -0
- package/src/{util → utils}/url-impl.ts +0 -0
- package/src/validator-info.ts +1 -1
- package/src/vote-account.ts +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -142,6 +142,13 @@ declare module '@solana/web3.js' {
|
|
|
142
142
|
get secretKey(): Buffer;
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
+
/**
|
|
146
|
+
* Blockhash as Base58 string.
|
|
147
|
+
*/
|
|
148
|
+
export type Blockhash = string;
|
|
149
|
+
|
|
150
|
+
export const BPF_LOADER_DEPRECATED_PROGRAM_ID: PublicKey;
|
|
151
|
+
|
|
145
152
|
/**
|
|
146
153
|
* Epoch schedule
|
|
147
154
|
* (see https://docs.solana.com/terminology#epoch)
|
|
@@ -177,11 +184,6 @@ declare module '@solana/web3.js' {
|
|
|
177
184
|
init?: nodeFetch.RequestInit,
|
|
178
185
|
): Promise<nodeFetch.Response>;
|
|
179
186
|
|
|
180
|
-
/**
|
|
181
|
-
* Blockhash as Base58 string.
|
|
182
|
-
*/
|
|
183
|
-
export type Blockhash = string;
|
|
184
|
-
|
|
185
187
|
/**
|
|
186
188
|
* Calculator for transaction fees.
|
|
187
189
|
*
|
|
@@ -276,34 +278,24 @@ declare module '@solana/web3.js' {
|
|
|
276
278
|
}
|
|
277
279
|
|
|
278
280
|
/**
|
|
279
|
-
*
|
|
280
|
-
*/
|
|
281
|
-
export type MessageHeader = {
|
|
282
|
-
/**
|
|
283
|
-
* The number of signatures required for this message to be considered valid. The
|
|
284
|
-
* signatures must match the first `numRequiredSignatures` of `accountKeys`.
|
|
285
|
-
*/
|
|
286
|
-
numRequiredSignatures: number;
|
|
287
|
-
/** The last `numReadonlySignedAccounts` of the signed keys are read-only accounts */
|
|
288
|
-
numReadonlySignedAccounts: number;
|
|
289
|
-
/** The last `numReadonlySignedAccounts` of the unsigned keys are read-only accounts */
|
|
290
|
-
numReadonlyUnsignedAccounts: number;
|
|
291
|
-
};
|
|
292
|
-
/**
|
|
293
|
-
* An instruction to execute by a program
|
|
281
|
+
* Maximum over-the-wire size of a Transaction
|
|
294
282
|
*
|
|
295
|
-
*
|
|
296
|
-
*
|
|
297
|
-
*
|
|
283
|
+
* 1280 is IPv6 minimum MTU
|
|
284
|
+
* 40 bytes is the size of the IPv6 header
|
|
285
|
+
* 8 bytes is the size of the fragment header
|
|
298
286
|
*/
|
|
299
|
-
export
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
287
|
+
export const PACKET_DATA_SIZE: number;
|
|
288
|
+
export const SIGNATURE_LENGTH_IN_BYTES = 64;
|
|
289
|
+
|
|
290
|
+
export class TransactionExpiredBlockheightExceededError extends Error {
|
|
291
|
+
signature: string;
|
|
292
|
+
constructor(signature: string);
|
|
293
|
+
}
|
|
294
|
+
export class TransactionExpiredTimeoutError extends Error {
|
|
295
|
+
signature: string;
|
|
296
|
+
constructor(signature: string, timeoutSeconds: number);
|
|
297
|
+
}
|
|
298
|
+
|
|
307
299
|
/**
|
|
308
300
|
* Message constructor arguments
|
|
309
301
|
*/
|
|
@@ -339,241 +331,507 @@ declare module '@solana/web3.js' {
|
|
|
339
331
|
static from(buffer: Buffer | Uint8Array | Array<number>): Message;
|
|
340
332
|
}
|
|
341
333
|
|
|
342
|
-
export type ClientSubscriptionId = number;
|
|
343
|
-
export type TokenAccountsFilter =
|
|
344
|
-
| {
|
|
345
|
-
mint: PublicKey;
|
|
346
|
-
}
|
|
347
|
-
| {
|
|
348
|
-
programId: PublicKey;
|
|
349
|
-
};
|
|
350
334
|
/**
|
|
351
|
-
*
|
|
335
|
+
* The message header, identifying signed and read-only account
|
|
352
336
|
*/
|
|
353
|
-
export type
|
|
354
|
-
|
|
337
|
+
export type MessageHeader = {
|
|
338
|
+
/**
|
|
339
|
+
* The number of signatures required for this message to be considered valid. The
|
|
340
|
+
* signatures must match the first `numRequiredSignatures` of `accountKeys`.
|
|
341
|
+
*/
|
|
342
|
+
numRequiredSignatures: number;
|
|
343
|
+
/** The last `numReadonlySignedAccounts` of the signed keys are read-only accounts */
|
|
344
|
+
numReadonlySignedAccounts: number;
|
|
345
|
+
/** The last `numReadonlySignedAccounts` of the unsigned keys are read-only accounts */
|
|
346
|
+
numReadonlyUnsignedAccounts: number;
|
|
355
347
|
};
|
|
356
348
|
/**
|
|
357
|
-
*
|
|
349
|
+
* An instruction to execute by a program
|
|
350
|
+
*
|
|
351
|
+
* @property {number} programIdIndex
|
|
352
|
+
* @property {number[]} accounts
|
|
353
|
+
* @property {string} data
|
|
358
354
|
*/
|
|
359
|
-
export type
|
|
360
|
-
/**
|
|
361
|
-
|
|
362
|
-
/**
|
|
363
|
-
|
|
364
|
-
/**
|
|
365
|
-
|
|
366
|
-
/** The minimum slot that the request can be evaluated at */
|
|
367
|
-
minContextSlot?: number;
|
|
355
|
+
export type CompiledInstruction = {
|
|
356
|
+
/** Index into the transaction keys array indicating the program account that executes this instruction */
|
|
357
|
+
programIdIndex: number;
|
|
358
|
+
/** Ordered indices into the transaction keys array indicating which accounts to pass to the program */
|
|
359
|
+
accounts: number[];
|
|
360
|
+
/** The program input data encoded as base 58 */
|
|
361
|
+
data: string;
|
|
368
362
|
};
|
|
363
|
+
|
|
369
364
|
/**
|
|
370
|
-
*
|
|
365
|
+
* Transaction signature as base-58 encoded string
|
|
371
366
|
*/
|
|
372
|
-
export type
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
preflightCommitment?: Commitment;
|
|
379
|
-
/** Maximum number of times for the RPC node to retry sending the transaction to the leader. */
|
|
380
|
-
maxRetries?: number;
|
|
381
|
-
/** The minimum slot that the request can be evaluated at */
|
|
382
|
-
minContextSlot?: number;
|
|
383
|
-
};
|
|
367
|
+
export type TransactionSignature = string;
|
|
368
|
+
export const enum TransactionStatus {
|
|
369
|
+
BLOCKHEIGHT_EXCEEDED = 0,
|
|
370
|
+
PROCESSED = 1,
|
|
371
|
+
TIMED_OUT = 2,
|
|
372
|
+
}
|
|
384
373
|
/**
|
|
385
|
-
*
|
|
374
|
+
* Account metadata used to define instructions
|
|
386
375
|
*/
|
|
387
|
-
export type
|
|
388
|
-
/**
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
until?: TransactionSignature;
|
|
395
|
-
/** Maximum transaction signatures to return (between 1 and 1,000, default: 1,000). */
|
|
396
|
-
limit?: number;
|
|
376
|
+
export type AccountMeta = {
|
|
377
|
+
/** An account's public key */
|
|
378
|
+
pubkey: PublicKey;
|
|
379
|
+
/** True if an instruction requires a transaction signature matching `pubkey` */
|
|
380
|
+
isSigner: boolean;
|
|
381
|
+
/** True if the `pubkey` can be loaded as a read-write account. */
|
|
382
|
+
isWritable: boolean;
|
|
397
383
|
};
|
|
398
384
|
/**
|
|
399
|
-
*
|
|
385
|
+
* List of TransactionInstruction object fields that may be initialized at construction
|
|
400
386
|
*/
|
|
401
|
-
export type
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
*/
|
|
406
|
-
before?: TransactionSignature;
|
|
407
|
-
/** Search until this transaction signature is reached, if found before `limit`. */
|
|
408
|
-
until?: TransactionSignature;
|
|
409
|
-
/** Maximum transaction signatures to return (between 1 and 1,000, default: 1,000). */
|
|
410
|
-
limit?: number;
|
|
411
|
-
/** The minimum slot that the request can be evaluated at */
|
|
412
|
-
minContextSlot?: number;
|
|
387
|
+
export type TransactionInstructionCtorFields = {
|
|
388
|
+
keys: Array<AccountMeta>;
|
|
389
|
+
programId: PublicKey;
|
|
390
|
+
data?: Buffer;
|
|
413
391
|
};
|
|
414
392
|
/**
|
|
415
|
-
*
|
|
393
|
+
* Configuration object for Transaction.serialize()
|
|
416
394
|
*/
|
|
417
|
-
export type
|
|
418
|
-
/**
|
|
419
|
-
|
|
420
|
-
/**
|
|
421
|
-
|
|
395
|
+
export type SerializeConfig = {
|
|
396
|
+
/** Require all transaction signatures be present (default: true) */
|
|
397
|
+
requireAllSignatures?: boolean;
|
|
398
|
+
/** Verify provided signatures (default: true) */
|
|
399
|
+
verifySignatures?: boolean;
|
|
422
400
|
};
|
|
423
|
-
export type BlockhashWithExpiryBlockHeight = Readonly<{
|
|
424
|
-
blockhash: Blockhash;
|
|
425
|
-
lastValidBlockHeight: number;
|
|
426
|
-
}>;
|
|
427
|
-
/**
|
|
428
|
-
* A strategy for confirming transactions that uses the last valid
|
|
429
|
-
* block height for a given blockhash to check for transaction expiration.
|
|
430
|
-
*/
|
|
431
|
-
export type BlockheightBasedTransactionConfirmationStrategy = {
|
|
432
|
-
signature: TransactionSignature;
|
|
433
|
-
} & BlockhashWithExpiryBlockHeight;
|
|
434
|
-
/**
|
|
435
|
-
* The level of commitment desired when querying state
|
|
436
|
-
* <pre>
|
|
437
|
-
* 'processed': Query the most recent block which has reached 1 confirmation by the connected node
|
|
438
|
-
* 'confirmed': Query the most recent block which has reached 1 confirmation by the cluster
|
|
439
|
-
* 'finalized': Query the most recent block which has been finalized by the cluster
|
|
440
|
-
* </pre>
|
|
441
|
-
*/
|
|
442
|
-
export type Commitment =
|
|
443
|
-
| 'processed'
|
|
444
|
-
| 'confirmed'
|
|
445
|
-
| 'finalized'
|
|
446
|
-
| 'recent'
|
|
447
|
-
| 'single'
|
|
448
|
-
| 'singleGossip'
|
|
449
|
-
| 'root'
|
|
450
|
-
| 'max';
|
|
451
|
-
/**
|
|
452
|
-
* A subset of Commitment levels, which are at least optimistically confirmed
|
|
453
|
-
* <pre>
|
|
454
|
-
* 'confirmed': Query the most recent block which has reached 1 confirmation by the cluster
|
|
455
|
-
* 'finalized': Query the most recent block which has been finalized by the cluster
|
|
456
|
-
* </pre>
|
|
457
|
-
*/
|
|
458
|
-
export type Finality = 'confirmed' | 'finalized';
|
|
459
401
|
/**
|
|
460
|
-
*
|
|
461
|
-
* <pre>
|
|
462
|
-
* 'circulating': Return the largest accounts that are part of the circulating supply
|
|
463
|
-
* 'nonCirculating': Return the largest accounts that are not part of the circulating supply
|
|
464
|
-
* </pre>
|
|
402
|
+
* Transaction Instruction class
|
|
465
403
|
*/
|
|
466
|
-
export
|
|
404
|
+
export class TransactionInstruction {
|
|
405
|
+
/**
|
|
406
|
+
* Public keys to include in this transaction
|
|
407
|
+
* Boolean represents whether this pubkey needs to sign the transaction
|
|
408
|
+
*/
|
|
409
|
+
keys: Array<AccountMeta>;
|
|
410
|
+
/**
|
|
411
|
+
* Program Id to execute
|
|
412
|
+
*/
|
|
413
|
+
programId: PublicKey;
|
|
414
|
+
/**
|
|
415
|
+
* Program input
|
|
416
|
+
*/
|
|
417
|
+
data: Buffer;
|
|
418
|
+
constructor(opts: TransactionInstructionCtorFields);
|
|
419
|
+
}
|
|
467
420
|
/**
|
|
468
|
-
*
|
|
421
|
+
* Pair of signature and corresponding public key
|
|
469
422
|
*/
|
|
470
|
-
export type
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
/** The minimum slot that the request can be evaluated at */
|
|
474
|
-
minContextSlot?: number;
|
|
423
|
+
export type SignaturePubkeyPair = {
|
|
424
|
+
signature: Buffer | null;
|
|
425
|
+
publicKey: PublicKey;
|
|
475
426
|
};
|
|
476
427
|
/**
|
|
477
|
-
*
|
|
428
|
+
* List of Transaction object fields that may be initialized at construction
|
|
478
429
|
*/
|
|
479
|
-
export type
|
|
480
|
-
/**
|
|
481
|
-
|
|
482
|
-
/** The
|
|
483
|
-
|
|
430
|
+
export type TransactionCtorFields_DEPRECATED = {
|
|
431
|
+
/** Optional nonce information used for offline nonce'd transactions */
|
|
432
|
+
nonceInfo?: NonceInformation | null;
|
|
433
|
+
/** The transaction fee payer */
|
|
434
|
+
feePayer?: PublicKey | null;
|
|
435
|
+
/** One or more signatures */
|
|
436
|
+
signatures?: Array<SignaturePubkeyPair>;
|
|
437
|
+
/** A recent blockhash */
|
|
438
|
+
recentBlockhash?: Blockhash;
|
|
484
439
|
};
|
|
440
|
+
export type TransactionCtorFields = TransactionCtorFields_DEPRECATED;
|
|
485
441
|
/**
|
|
486
|
-
*
|
|
442
|
+
* List of Transaction object fields that may be initialized at construction
|
|
487
443
|
*/
|
|
488
|
-
export type
|
|
489
|
-
/** The
|
|
490
|
-
|
|
491
|
-
/**
|
|
492
|
-
|
|
444
|
+
export type TransactionBlockhashCtor = {
|
|
445
|
+
/** The transaction fee payer */
|
|
446
|
+
feePayer?: PublicKey | null;
|
|
447
|
+
/** One or more signatures */
|
|
448
|
+
signatures?: Array<SignaturePubkeyPair>;
|
|
449
|
+
/** A recent blockhash */
|
|
450
|
+
blockhash: Blockhash;
|
|
451
|
+
/** the last block chain can advance to before tx is exportd expired */
|
|
452
|
+
lastValidBlockHeight: number;
|
|
493
453
|
};
|
|
494
454
|
/**
|
|
495
|
-
*
|
|
455
|
+
* Nonce information to be used to build an offline Transaction.
|
|
496
456
|
*/
|
|
497
|
-
export type
|
|
498
|
-
/** The
|
|
499
|
-
|
|
457
|
+
export type NonceInformation = {
|
|
458
|
+
/** The current blockhash stored in the nonce */
|
|
459
|
+
nonce: Blockhash;
|
|
460
|
+
/** AdvanceNonceAccount Instruction */
|
|
461
|
+
nonceInstruction: TransactionInstruction;
|
|
500
462
|
};
|
|
501
463
|
/**
|
|
502
|
-
*
|
|
464
|
+
* Transaction class
|
|
503
465
|
*/
|
|
504
|
-
export
|
|
505
|
-
/**
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
466
|
+
export class Transaction {
|
|
467
|
+
/**
|
|
468
|
+
* Signatures for the transaction. Typically created by invoking the
|
|
469
|
+
* `sign()` method
|
|
470
|
+
*/
|
|
471
|
+
signatures: Array<SignaturePubkeyPair>;
|
|
472
|
+
/**
|
|
473
|
+
* The first (payer) Transaction signature
|
|
474
|
+
*/
|
|
475
|
+
get signature(): Buffer | null;
|
|
476
|
+
/**
|
|
477
|
+
* The transaction fee payer
|
|
478
|
+
*/
|
|
479
|
+
feePayer?: PublicKey;
|
|
480
|
+
/**
|
|
481
|
+
* The instructions to atomically execute
|
|
482
|
+
*/
|
|
483
|
+
instructions: Array<TransactionInstruction>;
|
|
484
|
+
/**
|
|
485
|
+
* A recent transaction id. Must be populated by the caller
|
|
486
|
+
*/
|
|
487
|
+
recentBlockhash?: Blockhash;
|
|
488
|
+
/**
|
|
489
|
+
* the last block chain can advance to before tx is exportd expired
|
|
490
|
+
* */
|
|
491
|
+
lastValidBlockHeight?: number;
|
|
492
|
+
/**
|
|
493
|
+
* Optional Nonce information. If populated, transaction will use a durable
|
|
494
|
+
* Nonce hash instead of a recentBlockhash. Must be populated by the caller
|
|
495
|
+
*/
|
|
496
|
+
nonceInfo?: NonceInformation;
|
|
497
|
+
constructor(opts?: TransactionBlockhashCtor);
|
|
498
|
+
/**
|
|
499
|
+
* @deprecated `TransactionCtorFields` has been deprecated and will be removed in a future version.
|
|
500
|
+
* Please supply a `TransactionBlockhashCtor` instead.
|
|
501
|
+
*/
|
|
502
|
+
constructor(opts?: TransactionCtorFields_DEPRECATED);
|
|
503
|
+
/**
|
|
504
|
+
* Add one or more instructions to this Transaction
|
|
505
|
+
*/
|
|
506
|
+
add(
|
|
507
|
+
...items: Array<
|
|
508
|
+
Transaction | TransactionInstruction | TransactionInstructionCtorFields
|
|
509
|
+
>
|
|
510
|
+
): Transaction;
|
|
511
|
+
/**
|
|
512
|
+
* Compile transaction data
|
|
513
|
+
*/
|
|
514
|
+
compileMessage(): Message;
|
|
515
|
+
/**
|
|
516
|
+
* Get a buffer of the Transaction data that need to be covered by signatures
|
|
517
|
+
*/
|
|
518
|
+
serializeMessage(): Buffer;
|
|
519
|
+
/**
|
|
520
|
+
* Get the estimated fee associated with a transaction
|
|
521
|
+
*/
|
|
522
|
+
getEstimatedFee(connection: Connection): Promise<number>;
|
|
523
|
+
/**
|
|
524
|
+
* Specify the public keys which will be used to sign the Transaction.
|
|
525
|
+
* The first signer will be used as the transaction fee payer account.
|
|
526
|
+
*
|
|
527
|
+
* Signatures can be added with either `partialSign` or `addSignature`
|
|
528
|
+
*
|
|
529
|
+
* @deprecated Deprecated since v0.84.0. Only the fee payer needs to be
|
|
530
|
+
* specified and it can be set in the Transaction constructor or with the
|
|
531
|
+
* `feePayer` property.
|
|
532
|
+
*/
|
|
533
|
+
setSigners(...signers: Array<PublicKey>): void;
|
|
534
|
+
/**
|
|
535
|
+
* Sign the Transaction with the specified signers. Multiple signatures may
|
|
536
|
+
* be applied to a Transaction. The first signature is considered "primary"
|
|
537
|
+
* and is used identify and confirm transactions.
|
|
538
|
+
*
|
|
539
|
+
* If the Transaction `feePayer` is not set, the first signer will be used
|
|
540
|
+
* as the transaction fee payer account.
|
|
541
|
+
*
|
|
542
|
+
* Transaction fields should not be modified after the first call to `sign`,
|
|
543
|
+
* as doing so may invalidate the signature and cause the Transaction to be
|
|
544
|
+
* rejected.
|
|
545
|
+
*
|
|
546
|
+
* The Transaction must be assigned a valid `recentBlockhash` before invoking this method
|
|
547
|
+
*/
|
|
548
|
+
sign(...signers: Array<Signer>): void;
|
|
549
|
+
/**
|
|
550
|
+
* Partially sign a transaction with the specified accounts. All accounts must
|
|
551
|
+
* correspond to either the fee payer or a signer account in the transaction
|
|
552
|
+
* instructions.
|
|
553
|
+
*
|
|
554
|
+
* All the caveats from the `sign` method apply to `partialSign`
|
|
555
|
+
*/
|
|
556
|
+
partialSign(...signers: Array<Signer>): void;
|
|
557
|
+
/**
|
|
558
|
+
* Add an externally created signature to a transaction. The public key
|
|
559
|
+
* must correspond to either the fee payer or a signer account in the transaction
|
|
560
|
+
* instructions.
|
|
561
|
+
*/
|
|
562
|
+
addSignature(pubkey: PublicKey, signature: Buffer): void;
|
|
563
|
+
/**
|
|
564
|
+
* Verify signatures of a complete, signed Transaction
|
|
565
|
+
*/
|
|
566
|
+
verifySignatures(): boolean;
|
|
567
|
+
/**
|
|
568
|
+
* Serialize the Transaction in the wire format.
|
|
569
|
+
*/
|
|
570
|
+
serialize(config?: SerializeConfig): Buffer;
|
|
571
|
+
/**
|
|
572
|
+
* Parse a wire transaction into a Transaction object.
|
|
573
|
+
*/
|
|
574
|
+
static from(buffer: Buffer | Uint8Array | Array<number>): Transaction;
|
|
575
|
+
/**
|
|
576
|
+
* Populate Transaction object from message and signatures
|
|
577
|
+
*/
|
|
578
|
+
static populate(message: Message, signatures?: Array<string>): Transaction;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
export type AddressLookupTableState = {
|
|
582
|
+
deactivationSlot: bigint;
|
|
583
|
+
lastExtendedSlot: number;
|
|
584
|
+
lastExtendedSlotStartIndex: number;
|
|
585
|
+
authority?: PublicKey;
|
|
586
|
+
addresses: Array<PublicKey>;
|
|
587
|
+
};
|
|
588
|
+
export type AddressLookupTableAccountArgs = {
|
|
589
|
+
key: PublicKey;
|
|
590
|
+
state: AddressLookupTableState;
|
|
509
591
|
};
|
|
592
|
+
export class AddressLookupTableAccount {
|
|
593
|
+
key: PublicKey;
|
|
594
|
+
state: AddressLookupTableState;
|
|
595
|
+
constructor(args: AddressLookupTableAccountArgs);
|
|
596
|
+
isActive(): boolean;
|
|
597
|
+
static deserialize(accountData: Uint8Array): AddressLookupTableState;
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
export type ClientSubscriptionId = number;
|
|
601
|
+
export type TokenAccountsFilter =
|
|
602
|
+
| {
|
|
603
|
+
mint: PublicKey;
|
|
604
|
+
}
|
|
605
|
+
| {
|
|
606
|
+
programId: PublicKey;
|
|
607
|
+
};
|
|
510
608
|
/**
|
|
511
|
-
*
|
|
609
|
+
* Extra contextual information for RPC responses
|
|
512
610
|
*/
|
|
513
|
-
export type
|
|
514
|
-
|
|
515
|
-
commitment?: Commitment;
|
|
516
|
-
/** The minimum slot that the request can be evaluated at */
|
|
517
|
-
minContextSlot?: number;
|
|
611
|
+
export type Context = {
|
|
612
|
+
slot: number;
|
|
518
613
|
};
|
|
519
614
|
/**
|
|
520
|
-
*
|
|
615
|
+
* Options for sending transactions
|
|
521
616
|
*/
|
|
522
|
-
export type
|
|
523
|
-
/**
|
|
524
|
-
|
|
525
|
-
/**
|
|
526
|
-
|
|
617
|
+
export type SendOptions = {
|
|
618
|
+
/** disable transaction verification step */
|
|
619
|
+
skipPreflight?: boolean;
|
|
620
|
+
/** preflight commitment level */
|
|
621
|
+
preflightCommitment?: Commitment;
|
|
622
|
+
/** Maximum number of times for the RPC node to retry sending the transaction to the leader. */
|
|
623
|
+
maxRetries?: number;
|
|
527
624
|
/** The minimum slot that the request can be evaluated at */
|
|
528
625
|
minContextSlot?: number;
|
|
529
626
|
};
|
|
530
627
|
/**
|
|
531
|
-
*
|
|
628
|
+
* Options for confirming transactions
|
|
532
629
|
*/
|
|
533
|
-
export type
|
|
534
|
-
/**
|
|
630
|
+
export type ConfirmOptions = {
|
|
631
|
+
/** disable transaction verification step */
|
|
632
|
+
skipPreflight?: boolean;
|
|
633
|
+
/** desired commitment level */
|
|
535
634
|
commitment?: Commitment;
|
|
635
|
+
/** preflight commitment level */
|
|
636
|
+
preflightCommitment?: Commitment;
|
|
637
|
+
/** Maximum number of times for the RPC node to retry sending the transaction to the leader. */
|
|
638
|
+
maxRetries?: number;
|
|
536
639
|
/** The minimum slot that the request can be evaluated at */
|
|
537
640
|
minContextSlot?: number;
|
|
538
641
|
};
|
|
539
642
|
/**
|
|
540
|
-
*
|
|
643
|
+
* Options for getConfirmedSignaturesForAddress2
|
|
541
644
|
*/
|
|
542
|
-
export type
|
|
543
|
-
/**
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
645
|
+
export type ConfirmedSignaturesForAddress2Options = {
|
|
646
|
+
/**
|
|
647
|
+
* Start searching backwards from this transaction signature.
|
|
648
|
+
* @remark If not provided the search starts from the highest max confirmed block.
|
|
649
|
+
*/
|
|
650
|
+
before?: TransactionSignature;
|
|
651
|
+
/** Search until this transaction signature is reached, if found before `limit`. */
|
|
652
|
+
until?: TransactionSignature;
|
|
653
|
+
/** Maximum transaction signatures to return (between 1 and 1,000, default: 1,000). */
|
|
654
|
+
limit?: number;
|
|
547
655
|
};
|
|
548
656
|
/**
|
|
549
|
-
*
|
|
657
|
+
* Options for getSignaturesForAddress
|
|
550
658
|
*/
|
|
551
|
-
export type
|
|
552
|
-
/**
|
|
553
|
-
|
|
659
|
+
export type SignaturesForAddressOptions = {
|
|
660
|
+
/**
|
|
661
|
+
* Start searching backwards from this transaction signature.
|
|
662
|
+
* @remark If not provided the search starts from the highest max confirmed block.
|
|
663
|
+
*/
|
|
664
|
+
before?: TransactionSignature;
|
|
665
|
+
/** Search until this transaction signature is reached, if found before `limit`. */
|
|
666
|
+
until?: TransactionSignature;
|
|
667
|
+
/** Maximum transaction signatures to return (between 1 and 1,000, default: 1,000). */
|
|
668
|
+
limit?: number;
|
|
554
669
|
/** The minimum slot that the request can be evaluated at */
|
|
555
670
|
minContextSlot?: number;
|
|
556
671
|
};
|
|
557
672
|
/**
|
|
558
|
-
*
|
|
673
|
+
* RPC Response with extra contextual information
|
|
559
674
|
*/
|
|
560
|
-
export type
|
|
561
|
-
/**
|
|
562
|
-
|
|
563
|
-
/**
|
|
564
|
-
|
|
675
|
+
export type RpcResponseAndContext<T> = {
|
|
676
|
+
/** response context */
|
|
677
|
+
context: Context;
|
|
678
|
+
/** response value */
|
|
679
|
+
value: T;
|
|
565
680
|
};
|
|
681
|
+
export type BlockhashWithExpiryBlockHeight = Readonly<{
|
|
682
|
+
blockhash: Blockhash;
|
|
683
|
+
lastValidBlockHeight: number;
|
|
684
|
+
}>;
|
|
566
685
|
/**
|
|
567
|
-
*
|
|
686
|
+
* A strategy for confirming transactions that uses the last valid
|
|
687
|
+
* block height for a given blockhash to check for transaction expiration.
|
|
568
688
|
*/
|
|
569
|
-
export type
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
/** Filter largest accounts by whether they are part of the circulating supply */
|
|
573
|
-
filter?: LargestAccountsFilter;
|
|
574
|
-
};
|
|
689
|
+
export type BlockheightBasedTransactionConfirmationStrategy = {
|
|
690
|
+
signature: TransactionSignature;
|
|
691
|
+
} & BlockhashWithExpiryBlockHeight;
|
|
575
692
|
/**
|
|
576
|
-
*
|
|
693
|
+
* The level of commitment desired when querying state
|
|
694
|
+
* <pre>
|
|
695
|
+
* 'processed': Query the most recent block which has reached 1 confirmation by the connected node
|
|
696
|
+
* 'confirmed': Query the most recent block which has reached 1 confirmation by the cluster
|
|
697
|
+
* 'finalized': Query the most recent block which has been finalized by the cluster
|
|
698
|
+
* </pre>
|
|
699
|
+
*/
|
|
700
|
+
export type Commitment =
|
|
701
|
+
| 'processed'
|
|
702
|
+
| 'confirmed'
|
|
703
|
+
| 'finalized'
|
|
704
|
+
| 'recent'
|
|
705
|
+
| 'single'
|
|
706
|
+
| 'singleGossip'
|
|
707
|
+
| 'root'
|
|
708
|
+
| 'max';
|
|
709
|
+
/**
|
|
710
|
+
* A subset of Commitment levels, which are at least optimistically confirmed
|
|
711
|
+
* <pre>
|
|
712
|
+
* 'confirmed': Query the most recent block which has reached 1 confirmation by the cluster
|
|
713
|
+
* 'finalized': Query the most recent block which has been finalized by the cluster
|
|
714
|
+
* </pre>
|
|
715
|
+
*/
|
|
716
|
+
export type Finality = 'confirmed' | 'finalized';
|
|
717
|
+
/**
|
|
718
|
+
* Filter for largest accounts query
|
|
719
|
+
* <pre>
|
|
720
|
+
* 'circulating': Return the largest accounts that are part of the circulating supply
|
|
721
|
+
* 'nonCirculating': Return the largest accounts that are not part of the circulating supply
|
|
722
|
+
* </pre>
|
|
723
|
+
*/
|
|
724
|
+
export type LargestAccountsFilter = 'circulating' | 'nonCirculating';
|
|
725
|
+
/**
|
|
726
|
+
* Configuration object for changing `getAccountInfo` query behavior
|
|
727
|
+
*/
|
|
728
|
+
export type GetAccountInfoConfig = {
|
|
729
|
+
/** The level of commitment desired */
|
|
730
|
+
commitment?: Commitment;
|
|
731
|
+
/** The minimum slot that the request can be evaluated at */
|
|
732
|
+
minContextSlot?: number;
|
|
733
|
+
};
|
|
734
|
+
/**
|
|
735
|
+
* Configuration object for changing `getBalance` query behavior
|
|
736
|
+
*/
|
|
737
|
+
export type GetBalanceConfig = {
|
|
738
|
+
/** The level of commitment desired */
|
|
739
|
+
commitment?: Commitment;
|
|
740
|
+
/** The minimum slot that the request can be evaluated at */
|
|
741
|
+
minContextSlot?: number;
|
|
742
|
+
};
|
|
743
|
+
/**
|
|
744
|
+
* Configuration object for changing `getBlock` query behavior
|
|
745
|
+
*/
|
|
746
|
+
export type GetBlockConfig = {
|
|
747
|
+
/** The level of finality desired */
|
|
748
|
+
commitment?: Finality;
|
|
749
|
+
/** The max transaction version to return in responses. If the requested transaction is a higher version, an error will be returned */
|
|
750
|
+
maxSupportedTransactionVersion?: number;
|
|
751
|
+
};
|
|
752
|
+
/**
|
|
753
|
+
* Configuration object for changing `getStakeMinimumDelegation` query behavior
|
|
754
|
+
*/
|
|
755
|
+
export type GetStakeMinimumDelegationConfig = {
|
|
756
|
+
/** The level of commitment desired */
|
|
757
|
+
commitment?: Commitment;
|
|
758
|
+
};
|
|
759
|
+
/**
|
|
760
|
+
* Configuration object for changing `getBlockHeight` query behavior
|
|
761
|
+
*/
|
|
762
|
+
export type GetBlockHeightConfig = {
|
|
763
|
+
/** The level of commitment desired */
|
|
764
|
+
commitment?: Commitment;
|
|
765
|
+
/** The minimum slot that the request can be evaluated at */
|
|
766
|
+
minContextSlot?: number;
|
|
767
|
+
};
|
|
768
|
+
/**
|
|
769
|
+
* Configuration object for changing `getEpochInfo` query behavior
|
|
770
|
+
*/
|
|
771
|
+
export type GetEpochInfoConfig = {
|
|
772
|
+
/** The level of commitment desired */
|
|
773
|
+
commitment?: Commitment;
|
|
774
|
+
/** The minimum slot that the request can be evaluated at */
|
|
775
|
+
minContextSlot?: number;
|
|
776
|
+
};
|
|
777
|
+
/**
|
|
778
|
+
* Configuration object for changing `getInflationReward` query behavior
|
|
779
|
+
*/
|
|
780
|
+
export type GetInflationRewardConfig = {
|
|
781
|
+
/** The level of commitment desired */
|
|
782
|
+
commitment?: Commitment;
|
|
783
|
+
/** An epoch for which the reward occurs. If omitted, the previous epoch will be used */
|
|
784
|
+
epoch?: number;
|
|
785
|
+
/** The minimum slot that the request can be evaluated at */
|
|
786
|
+
minContextSlot?: number;
|
|
787
|
+
};
|
|
788
|
+
/**
|
|
789
|
+
* Configuration object for changing `getLatestBlockhash` query behavior
|
|
790
|
+
*/
|
|
791
|
+
export type GetLatestBlockhashConfig = {
|
|
792
|
+
/** The level of commitment desired */
|
|
793
|
+
commitment?: Commitment;
|
|
794
|
+
/** The minimum slot that the request can be evaluated at */
|
|
795
|
+
minContextSlot?: number;
|
|
796
|
+
};
|
|
797
|
+
/**
|
|
798
|
+
* Configuration object for changing `getSlot` query behavior
|
|
799
|
+
*/
|
|
800
|
+
export type GetSlotConfig = {
|
|
801
|
+
/** The level of commitment desired */
|
|
802
|
+
commitment?: Commitment;
|
|
803
|
+
/** The minimum slot that the request can be evaluated at */
|
|
804
|
+
minContextSlot?: number;
|
|
805
|
+
};
|
|
806
|
+
/**
|
|
807
|
+
* Configuration object for changing `getSlotLeader` query behavior
|
|
808
|
+
*/
|
|
809
|
+
export type GetSlotLeaderConfig = {
|
|
810
|
+
/** The level of commitment desired */
|
|
811
|
+
commitment?: Commitment;
|
|
812
|
+
/** The minimum slot that the request can be evaluated at */
|
|
813
|
+
minContextSlot?: number;
|
|
814
|
+
};
|
|
815
|
+
/**
|
|
816
|
+
* Configuration object for changing `getTransaction` query behavior
|
|
817
|
+
*/
|
|
818
|
+
export type GetTransactionConfig = {
|
|
819
|
+
/** The level of finality desired */
|
|
820
|
+
commitment?: Finality;
|
|
821
|
+
/** The max transaction version to return in responses. If the requested transaction is a higher version, an error will be returned */
|
|
822
|
+
maxSupportedTransactionVersion?: number;
|
|
823
|
+
};
|
|
824
|
+
/**
|
|
825
|
+
* Configuration object for changing `getLargestAccounts` query behavior
|
|
826
|
+
*/
|
|
827
|
+
export type GetLargestAccountsConfig = {
|
|
828
|
+
/** The level of commitment desired */
|
|
829
|
+
commitment?: Commitment;
|
|
830
|
+
/** Filter largest accounts by whether they are part of the circulating supply */
|
|
831
|
+
filter?: LargestAccountsFilter;
|
|
832
|
+
};
|
|
833
|
+
/**
|
|
834
|
+
* Configuration object for changing `getSupply` request behavior
|
|
577
835
|
*/
|
|
578
836
|
export type GetSupplyConfig = {
|
|
579
837
|
/** The level of commitment desired */
|
|
@@ -1917,6 +2175,10 @@ declare module '@solana/web3.js' {
|
|
|
1917
2175
|
options?: SignaturesForAddressOptions,
|
|
1918
2176
|
commitment?: Finality,
|
|
1919
2177
|
): Promise<Array<ConfirmedSignatureInfo>>;
|
|
2178
|
+
getAddressLookupTable(
|
|
2179
|
+
accountKey: PublicKey,
|
|
2180
|
+
config?: GetAccountInfoConfig,
|
|
2181
|
+
): Promise<RpcResponseAndContext<AddressLookupTableAccount | null>>;
|
|
1920
2182
|
/**
|
|
1921
2183
|
* Fetch the contents of a Nonce account from the cluster, return with context
|
|
1922
2184
|
*/
|
|
@@ -1983,376 +2245,265 @@ declare module '@solana/web3.js' {
|
|
|
1983
2245
|
* Send a transaction that has already been signed, serialized into the
|
|
1984
2246
|
* wire format, and encoded as a base64 string
|
|
1985
2247
|
*/
|
|
1986
|
-
sendEncodedTransaction(
|
|
1987
|
-
encodedTransaction: string,
|
|
1988
|
-
options?: SendOptions,
|
|
1989
|
-
): Promise<TransactionSignature>;
|
|
1990
|
-
/**
|
|
1991
|
-
* Register a callback to be invoked whenever the specified account changes
|
|
1992
|
-
*
|
|
1993
|
-
* @param publicKey Public key of the account to monitor
|
|
1994
|
-
* @param callback Function to invoke whenever the account is changed
|
|
1995
|
-
* @param commitment Specify the commitment level account changes must reach before notification
|
|
1996
|
-
* @return subscription id
|
|
1997
|
-
*/
|
|
1998
|
-
onAccountChange(
|
|
1999
|
-
publicKey: PublicKey,
|
|
2000
|
-
callback: AccountChangeCallback,
|
|
2001
|
-
commitment?: Commitment,
|
|
2002
|
-
): ClientSubscriptionId;
|
|
2003
|
-
/**
|
|
2004
|
-
* Deregister an account notification callback
|
|
2005
|
-
*
|
|
2006
|
-
* @param id client subscription id to deregister
|
|
2007
|
-
*/
|
|
2008
|
-
removeAccountChangeListener(
|
|
2009
|
-
clientSubscriptionId: ClientSubscriptionId,
|
|
2010
|
-
): Promise<void>;
|
|
2011
|
-
/**
|
|
2012
|
-
* Register a callback to be invoked whenever accounts owned by the
|
|
2013
|
-
* specified program change
|
|
2014
|
-
*
|
|
2015
|
-
* @param programId Public key of the program to monitor
|
|
2016
|
-
* @param callback Function to invoke whenever the account is changed
|
|
2017
|
-
* @param commitment Specify the commitment level account changes must reach before notification
|
|
2018
|
-
* @param filters The program account filters to pass into the RPC method
|
|
2019
|
-
* @return subscription id
|
|
2020
|
-
*/
|
|
2021
|
-
onProgramAccountChange(
|
|
2022
|
-
programId: PublicKey,
|
|
2023
|
-
callback: ProgramAccountChangeCallback,
|
|
2024
|
-
commitment?: Commitment,
|
|
2025
|
-
filters?: GetProgramAccountsFilter[],
|
|
2026
|
-
): ClientSubscriptionId;
|
|
2027
|
-
/**
|
|
2028
|
-
* Deregister an account notification callback
|
|
2029
|
-
*
|
|
2030
|
-
* @param id client subscription id to deregister
|
|
2031
|
-
*/
|
|
2032
|
-
removeProgramAccountChangeListener(
|
|
2033
|
-
clientSubscriptionId: ClientSubscriptionId,
|
|
2034
|
-
): Promise<void>;
|
|
2035
|
-
/**
|
|
2036
|
-
* Registers a callback to be invoked whenever logs are emitted.
|
|
2037
|
-
*/
|
|
2038
|
-
onLogs(
|
|
2039
|
-
filter: LogsFilter,
|
|
2040
|
-
callback: LogsCallback,
|
|
2041
|
-
commitment?: Commitment,
|
|
2042
|
-
): ClientSubscriptionId;
|
|
2043
|
-
/**
|
|
2044
|
-
* Deregister a logs callback.
|
|
2045
|
-
*
|
|
2046
|
-
* @param id client subscription id to deregister.
|
|
2047
|
-
*/
|
|
2048
|
-
removeOnLogsListener(
|
|
2049
|
-
clientSubscriptionId: ClientSubscriptionId,
|
|
2050
|
-
): Promise<void>;
|
|
2051
|
-
/**
|
|
2052
|
-
* Register a callback to be invoked upon slot changes
|
|
2053
|
-
*
|
|
2054
|
-
* @param callback Function to invoke whenever the slot changes
|
|
2055
|
-
* @return subscription id
|
|
2056
|
-
*/
|
|
2057
|
-
onSlotChange(callback: SlotChangeCallback): ClientSubscriptionId;
|
|
2058
|
-
/**
|
|
2059
|
-
* Deregister a slot notification callback
|
|
2060
|
-
*
|
|
2061
|
-
* @param id client subscription id to deregister
|
|
2062
|
-
*/
|
|
2063
|
-
removeSlotChangeListener(
|
|
2064
|
-
clientSubscriptionId: ClientSubscriptionId,
|
|
2065
|
-
): Promise<void>;
|
|
2066
|
-
/**
|
|
2067
|
-
* Register a callback to be invoked upon slot updates. {@link SlotUpdate}'s
|
|
2068
|
-
* may be useful to track live progress of a cluster.
|
|
2069
|
-
*
|
|
2070
|
-
* @param callback Function to invoke whenever the slot updates
|
|
2071
|
-
* @return subscription id
|
|
2072
|
-
*/
|
|
2073
|
-
onSlotUpdate(callback: SlotUpdateCallback): ClientSubscriptionId;
|
|
2074
|
-
/**
|
|
2075
|
-
* Deregister a slot update notification callback
|
|
2076
|
-
*
|
|
2077
|
-
* @param id client subscription id to deregister
|
|
2078
|
-
*/
|
|
2079
|
-
removeSlotUpdateListener(
|
|
2080
|
-
clientSubscriptionId: ClientSubscriptionId,
|
|
2081
|
-
): Promise<void>;
|
|
2082
|
-
_buildArgs(
|
|
2083
|
-
args: Array<any>,
|
|
2084
|
-
override?: Commitment,
|
|
2085
|
-
encoding?: 'jsonParsed' | 'base64',
|
|
2086
|
-
extra?: any,
|
|
2087
|
-
): Array<any>;
|
|
2088
|
-
/**
|
|
2089
|
-
* Register a callback to be invoked upon signature updates
|
|
2090
|
-
*
|
|
2091
|
-
* @param signature Transaction signature string in base 58
|
|
2092
|
-
* @param callback Function to invoke on signature notifications
|
|
2093
|
-
* @param commitment Specify the commitment level signature must reach before notification
|
|
2094
|
-
* @return subscription id
|
|
2095
|
-
*/
|
|
2096
|
-
onSignature(
|
|
2097
|
-
signature: TransactionSignature,
|
|
2098
|
-
callback: SignatureResultCallback,
|
|
2099
|
-
commitment?: Commitment,
|
|
2100
|
-
): ClientSubscriptionId;
|
|
2101
|
-
/**
|
|
2102
|
-
* Register a callback to be invoked when a transaction is
|
|
2103
|
-
* received and/or processed.
|
|
2104
|
-
*
|
|
2105
|
-
* @param signature Transaction signature string in base 58
|
|
2106
|
-
* @param callback Function to invoke on signature notifications
|
|
2107
|
-
* @param options Enable received notifications and set the commitment
|
|
2108
|
-
* level that signature must reach before notification
|
|
2109
|
-
* @return subscription id
|
|
2110
|
-
*/
|
|
2111
|
-
onSignatureWithOptions(
|
|
2112
|
-
signature: TransactionSignature,
|
|
2113
|
-
callback: SignatureSubscriptionCallback,
|
|
2114
|
-
options?: SignatureSubscriptionOptions,
|
|
2115
|
-
): ClientSubscriptionId;
|
|
2116
|
-
/**
|
|
2117
|
-
* Deregister a signature notification callback
|
|
2118
|
-
*
|
|
2119
|
-
* @param id client subscription id to deregister
|
|
2120
|
-
*/
|
|
2121
|
-
removeSignatureListener(
|
|
2122
|
-
clientSubscriptionId: ClientSubscriptionId,
|
|
2123
|
-
): Promise<void>;
|
|
2124
|
-
/**
|
|
2125
|
-
* Register a callback to be invoked upon root changes
|
|
2126
|
-
*
|
|
2127
|
-
* @param callback Function to invoke whenever the root changes
|
|
2128
|
-
* @return subscription id
|
|
2129
|
-
*/
|
|
2130
|
-
onRootChange(callback: RootChangeCallback): ClientSubscriptionId;
|
|
2131
|
-
/**
|
|
2132
|
-
* Deregister a root notification callback
|
|
2133
|
-
*
|
|
2134
|
-
* @param id client subscription id to deregister
|
|
2135
|
-
*/
|
|
2136
|
-
removeRootChangeListener(
|
|
2137
|
-
clientSubscriptionId: ClientSubscriptionId,
|
|
2138
|
-
): Promise<void>;
|
|
2139
|
-
}
|
|
2140
|
-
|
|
2141
|
-
/**
|
|
2142
|
-
* Transaction signature as base-58 encoded string
|
|
2143
|
-
*/
|
|
2144
|
-
export type TransactionSignature = string;
|
|
2145
|
-
export const enum TransactionStatus {
|
|
2146
|
-
BLOCKHEIGHT_EXCEEDED = 0,
|
|
2147
|
-
PROCESSED = 1,
|
|
2148
|
-
TIMED_OUT = 2,
|
|
2149
|
-
}
|
|
2150
|
-
/**
|
|
2151
|
-
* Account metadata used to define instructions
|
|
2152
|
-
*/
|
|
2153
|
-
export type AccountMeta = {
|
|
2154
|
-
/** An account's public key */
|
|
2155
|
-
pubkey: PublicKey;
|
|
2156
|
-
/** True if an instruction requires a transaction signature matching `pubkey` */
|
|
2157
|
-
isSigner: boolean;
|
|
2158
|
-
/** True if the `pubkey` can be loaded as a read-write account. */
|
|
2159
|
-
isWritable: boolean;
|
|
2160
|
-
};
|
|
2161
|
-
/**
|
|
2162
|
-
* List of TransactionInstruction object fields that may be initialized at construction
|
|
2163
|
-
*/
|
|
2164
|
-
export type TransactionInstructionCtorFields = {
|
|
2165
|
-
keys: Array<AccountMeta>;
|
|
2166
|
-
programId: PublicKey;
|
|
2167
|
-
data?: Buffer;
|
|
2168
|
-
};
|
|
2169
|
-
/**
|
|
2170
|
-
* Configuration object for Transaction.serialize()
|
|
2171
|
-
*/
|
|
2172
|
-
export type SerializeConfig = {
|
|
2173
|
-
/** Require all transaction signatures be present (default: true) */
|
|
2174
|
-
requireAllSignatures?: boolean;
|
|
2175
|
-
/** Verify provided signatures (default: true) */
|
|
2176
|
-
verifySignatures?: boolean;
|
|
2177
|
-
};
|
|
2178
|
-
/**
|
|
2179
|
-
* Transaction Instruction class
|
|
2180
|
-
*/
|
|
2181
|
-
export class TransactionInstruction {
|
|
2182
|
-
/**
|
|
2183
|
-
* Public keys to include in this transaction
|
|
2184
|
-
* Boolean represents whether this pubkey needs to sign the transaction
|
|
2185
|
-
*/
|
|
2186
|
-
keys: Array<AccountMeta>;
|
|
2187
|
-
/**
|
|
2188
|
-
* Program Id to execute
|
|
2189
|
-
*/
|
|
2190
|
-
programId: PublicKey;
|
|
2191
|
-
/**
|
|
2192
|
-
* Program input
|
|
2193
|
-
*/
|
|
2194
|
-
data: Buffer;
|
|
2195
|
-
constructor(opts: TransactionInstructionCtorFields);
|
|
2196
|
-
}
|
|
2197
|
-
/**
|
|
2198
|
-
* Pair of signature and corresponding public key
|
|
2199
|
-
*/
|
|
2200
|
-
export type SignaturePubkeyPair = {
|
|
2201
|
-
signature: Buffer | null;
|
|
2202
|
-
publicKey: PublicKey;
|
|
2203
|
-
};
|
|
2204
|
-
/**
|
|
2205
|
-
* List of Transaction object fields that may be initialized at construction
|
|
2206
|
-
*/
|
|
2207
|
-
export type TransactionCtorFields_DEPRECATED = {
|
|
2208
|
-
/** Optional nonce information used for offline nonce'd transactions */
|
|
2209
|
-
nonceInfo?: NonceInformation | null;
|
|
2210
|
-
/** The transaction fee payer */
|
|
2211
|
-
feePayer?: PublicKey | null;
|
|
2212
|
-
/** One or more signatures */
|
|
2213
|
-
signatures?: Array<SignaturePubkeyPair>;
|
|
2214
|
-
/** A recent blockhash */
|
|
2215
|
-
recentBlockhash?: Blockhash;
|
|
2216
|
-
};
|
|
2217
|
-
export type TransactionCtorFields = TransactionCtorFields_DEPRECATED;
|
|
2218
|
-
/**
|
|
2219
|
-
* List of Transaction object fields that may be initialized at construction
|
|
2220
|
-
*/
|
|
2221
|
-
export type TransactionBlockhashCtor = {
|
|
2222
|
-
/** The transaction fee payer */
|
|
2223
|
-
feePayer?: PublicKey | null;
|
|
2224
|
-
/** One or more signatures */
|
|
2225
|
-
signatures?: Array<SignaturePubkeyPair>;
|
|
2226
|
-
/** A recent blockhash */
|
|
2227
|
-
blockhash: Blockhash;
|
|
2228
|
-
/** the last block chain can advance to before tx is exportd expired */
|
|
2229
|
-
lastValidBlockHeight: number;
|
|
2230
|
-
};
|
|
2231
|
-
/**
|
|
2232
|
-
* Nonce information to be used to build an offline Transaction.
|
|
2233
|
-
*/
|
|
2234
|
-
export type NonceInformation = {
|
|
2235
|
-
/** The current blockhash stored in the nonce */
|
|
2236
|
-
nonce: Blockhash;
|
|
2237
|
-
/** AdvanceNonceAccount Instruction */
|
|
2238
|
-
nonceInstruction: TransactionInstruction;
|
|
2239
|
-
};
|
|
2240
|
-
/**
|
|
2241
|
-
* Transaction class
|
|
2242
|
-
*/
|
|
2243
|
-
export class Transaction {
|
|
2244
|
-
/**
|
|
2245
|
-
* Signatures for the transaction. Typically created by invoking the
|
|
2246
|
-
* `sign()` method
|
|
2247
|
-
*/
|
|
2248
|
-
signatures: Array<SignaturePubkeyPair>;
|
|
2248
|
+
sendEncodedTransaction(
|
|
2249
|
+
encodedTransaction: string,
|
|
2250
|
+
options?: SendOptions,
|
|
2251
|
+
): Promise<TransactionSignature>;
|
|
2249
2252
|
/**
|
|
2250
|
-
*
|
|
2253
|
+
* Register a callback to be invoked whenever the specified account changes
|
|
2254
|
+
*
|
|
2255
|
+
* @param publicKey Public key of the account to monitor
|
|
2256
|
+
* @param callback Function to invoke whenever the account is changed
|
|
2257
|
+
* @param commitment Specify the commitment level account changes must reach before notification
|
|
2258
|
+
* @return subscription id
|
|
2251
2259
|
*/
|
|
2252
|
-
|
|
2260
|
+
onAccountChange(
|
|
2261
|
+
publicKey: PublicKey,
|
|
2262
|
+
callback: AccountChangeCallback,
|
|
2263
|
+
commitment?: Commitment,
|
|
2264
|
+
): ClientSubscriptionId;
|
|
2253
2265
|
/**
|
|
2254
|
-
*
|
|
2266
|
+
* Deregister an account notification callback
|
|
2267
|
+
*
|
|
2268
|
+
* @param id client subscription id to deregister
|
|
2255
2269
|
*/
|
|
2256
|
-
|
|
2270
|
+
removeAccountChangeListener(
|
|
2271
|
+
clientSubscriptionId: ClientSubscriptionId,
|
|
2272
|
+
): Promise<void>;
|
|
2257
2273
|
/**
|
|
2258
|
-
*
|
|
2274
|
+
* Register a callback to be invoked whenever accounts owned by the
|
|
2275
|
+
* specified program change
|
|
2276
|
+
*
|
|
2277
|
+
* @param programId Public key of the program to monitor
|
|
2278
|
+
* @param callback Function to invoke whenever the account is changed
|
|
2279
|
+
* @param commitment Specify the commitment level account changes must reach before notification
|
|
2280
|
+
* @param filters The program account filters to pass into the RPC method
|
|
2281
|
+
* @return subscription id
|
|
2259
2282
|
*/
|
|
2260
|
-
|
|
2283
|
+
onProgramAccountChange(
|
|
2284
|
+
programId: PublicKey,
|
|
2285
|
+
callback: ProgramAccountChangeCallback,
|
|
2286
|
+
commitment?: Commitment,
|
|
2287
|
+
filters?: GetProgramAccountsFilter[],
|
|
2288
|
+
): ClientSubscriptionId;
|
|
2261
2289
|
/**
|
|
2262
|
-
*
|
|
2290
|
+
* Deregister an account notification callback
|
|
2291
|
+
*
|
|
2292
|
+
* @param id client subscription id to deregister
|
|
2263
2293
|
*/
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
* */
|
|
2268
|
-
lastValidBlockHeight?: number;
|
|
2294
|
+
removeProgramAccountChangeListener(
|
|
2295
|
+
clientSubscriptionId: ClientSubscriptionId,
|
|
2296
|
+
): Promise<void>;
|
|
2269
2297
|
/**
|
|
2270
|
-
*
|
|
2271
|
-
* Nonce hash instead of a recentBlockhash. Must be populated by the caller
|
|
2298
|
+
* Registers a callback to be invoked whenever logs are emitted.
|
|
2272
2299
|
*/
|
|
2273
|
-
|
|
2274
|
-
|
|
2300
|
+
onLogs(
|
|
2301
|
+
filter: LogsFilter,
|
|
2302
|
+
callback: LogsCallback,
|
|
2303
|
+
commitment?: Commitment,
|
|
2304
|
+
): ClientSubscriptionId;
|
|
2275
2305
|
/**
|
|
2276
|
-
*
|
|
2277
|
-
*
|
|
2306
|
+
* Deregister a logs callback.
|
|
2307
|
+
*
|
|
2308
|
+
* @param id client subscription id to deregister.
|
|
2278
2309
|
*/
|
|
2279
|
-
|
|
2310
|
+
removeOnLogsListener(
|
|
2311
|
+
clientSubscriptionId: ClientSubscriptionId,
|
|
2312
|
+
): Promise<void>;
|
|
2280
2313
|
/**
|
|
2281
|
-
*
|
|
2314
|
+
* Register a callback to be invoked upon slot changes
|
|
2315
|
+
*
|
|
2316
|
+
* @param callback Function to invoke whenever the slot changes
|
|
2317
|
+
* @return subscription id
|
|
2282
2318
|
*/
|
|
2283
|
-
|
|
2284
|
-
...items: Array<
|
|
2285
|
-
Transaction | TransactionInstruction | TransactionInstructionCtorFields
|
|
2286
|
-
>
|
|
2287
|
-
): Transaction;
|
|
2319
|
+
onSlotChange(callback: SlotChangeCallback): ClientSubscriptionId;
|
|
2288
2320
|
/**
|
|
2289
|
-
*
|
|
2321
|
+
* Deregister a slot notification callback
|
|
2322
|
+
*
|
|
2323
|
+
* @param id client subscription id to deregister
|
|
2290
2324
|
*/
|
|
2291
|
-
|
|
2325
|
+
removeSlotChangeListener(
|
|
2326
|
+
clientSubscriptionId: ClientSubscriptionId,
|
|
2327
|
+
): Promise<void>;
|
|
2292
2328
|
/**
|
|
2293
|
-
*
|
|
2329
|
+
* Register a callback to be invoked upon slot updates. {@link SlotUpdate}'s
|
|
2330
|
+
* may be useful to track live progress of a cluster.
|
|
2331
|
+
*
|
|
2332
|
+
* @param callback Function to invoke whenever the slot updates
|
|
2333
|
+
* @return subscription id
|
|
2294
2334
|
*/
|
|
2295
|
-
|
|
2335
|
+
onSlotUpdate(callback: SlotUpdateCallback): ClientSubscriptionId;
|
|
2296
2336
|
/**
|
|
2297
|
-
*
|
|
2337
|
+
* Deregister a slot update notification callback
|
|
2338
|
+
*
|
|
2339
|
+
* @param id client subscription id to deregister
|
|
2298
2340
|
*/
|
|
2299
|
-
|
|
2341
|
+
removeSlotUpdateListener(
|
|
2342
|
+
clientSubscriptionId: ClientSubscriptionId,
|
|
2343
|
+
): Promise<void>;
|
|
2344
|
+
_buildArgs(
|
|
2345
|
+
args: Array<any>,
|
|
2346
|
+
override?: Commitment,
|
|
2347
|
+
encoding?: 'jsonParsed' | 'base64',
|
|
2348
|
+
extra?: any,
|
|
2349
|
+
): Array<any>;
|
|
2300
2350
|
/**
|
|
2301
|
-
*
|
|
2302
|
-
* The first signer will be used as the transaction fee payer account.
|
|
2303
|
-
*
|
|
2304
|
-
* Signatures can be added with either `partialSign` or `addSignature`
|
|
2351
|
+
* Register a callback to be invoked upon signature updates
|
|
2305
2352
|
*
|
|
2306
|
-
* @
|
|
2307
|
-
*
|
|
2308
|
-
*
|
|
2353
|
+
* @param signature Transaction signature string in base 58
|
|
2354
|
+
* @param callback Function to invoke on signature notifications
|
|
2355
|
+
* @param commitment Specify the commitment level signature must reach before notification
|
|
2356
|
+
* @return subscription id
|
|
2309
2357
|
*/
|
|
2310
|
-
|
|
2358
|
+
onSignature(
|
|
2359
|
+
signature: TransactionSignature,
|
|
2360
|
+
callback: SignatureResultCallback,
|
|
2361
|
+
commitment?: Commitment,
|
|
2362
|
+
): ClientSubscriptionId;
|
|
2311
2363
|
/**
|
|
2312
|
-
*
|
|
2313
|
-
*
|
|
2314
|
-
* and is used identify and confirm transactions.
|
|
2364
|
+
* Register a callback to be invoked when a transaction is
|
|
2365
|
+
* received and/or processed.
|
|
2315
2366
|
*
|
|
2316
|
-
*
|
|
2317
|
-
*
|
|
2367
|
+
* @param signature Transaction signature string in base 58
|
|
2368
|
+
* @param callback Function to invoke on signature notifications
|
|
2369
|
+
* @param options Enable received notifications and set the commitment
|
|
2370
|
+
* level that signature must reach before notification
|
|
2371
|
+
* @return subscription id
|
|
2372
|
+
*/
|
|
2373
|
+
onSignatureWithOptions(
|
|
2374
|
+
signature: TransactionSignature,
|
|
2375
|
+
callback: SignatureSubscriptionCallback,
|
|
2376
|
+
options?: SignatureSubscriptionOptions,
|
|
2377
|
+
): ClientSubscriptionId;
|
|
2378
|
+
/**
|
|
2379
|
+
* Deregister a signature notification callback
|
|
2318
2380
|
*
|
|
2319
|
-
*
|
|
2320
|
-
|
|
2321
|
-
|
|
2381
|
+
* @param id client subscription id to deregister
|
|
2382
|
+
*/
|
|
2383
|
+
removeSignatureListener(
|
|
2384
|
+
clientSubscriptionId: ClientSubscriptionId,
|
|
2385
|
+
): Promise<void>;
|
|
2386
|
+
/**
|
|
2387
|
+
* Register a callback to be invoked upon root changes
|
|
2322
2388
|
*
|
|
2323
|
-
*
|
|
2389
|
+
* @param callback Function to invoke whenever the root changes
|
|
2390
|
+
* @return subscription id
|
|
2324
2391
|
*/
|
|
2325
|
-
|
|
2392
|
+
onRootChange(callback: RootChangeCallback): ClientSubscriptionId;
|
|
2326
2393
|
/**
|
|
2327
|
-
*
|
|
2328
|
-
* correspond to either the fee payer or a signer account in the transaction
|
|
2329
|
-
* instructions.
|
|
2394
|
+
* Deregister a root notification callback
|
|
2330
2395
|
*
|
|
2331
|
-
*
|
|
2396
|
+
* @param id client subscription id to deregister
|
|
2332
2397
|
*/
|
|
2333
|
-
|
|
2398
|
+
removeRootChangeListener(
|
|
2399
|
+
clientSubscriptionId: ClientSubscriptionId,
|
|
2400
|
+
): Promise<void>;
|
|
2401
|
+
}
|
|
2402
|
+
|
|
2403
|
+
export const BPF_LOADER_PROGRAM_ID: PublicKey;
|
|
2404
|
+
/**
|
|
2405
|
+
* Factory class for transactions to interact with a program loader
|
|
2406
|
+
*/
|
|
2407
|
+
export class BpfLoader {
|
|
2334
2408
|
/**
|
|
2335
|
-
*
|
|
2336
|
-
*
|
|
2337
|
-
*
|
|
2409
|
+
* Minimum number of signatures required to load a program not including
|
|
2410
|
+
* retries
|
|
2411
|
+
*
|
|
2412
|
+
* Can be used to calculate transaction fees
|
|
2338
2413
|
*/
|
|
2339
|
-
|
|
2414
|
+
static getMinNumSignatures(dataLength: number): number;
|
|
2340
2415
|
/**
|
|
2341
|
-
*
|
|
2416
|
+
* Load a BPF program
|
|
2417
|
+
*
|
|
2418
|
+
* @param connection The connection to use
|
|
2419
|
+
* @param payer Account that will pay program loading fees
|
|
2420
|
+
* @param program Account to load the program into
|
|
2421
|
+
* @param elf The entire ELF containing the BPF program
|
|
2422
|
+
* @param loaderProgramId The program id of the BPF loader to use
|
|
2423
|
+
* @return true if program was loaded successfully, false if program was already loaded
|
|
2342
2424
|
*/
|
|
2343
|
-
|
|
2425
|
+
static load(
|
|
2426
|
+
connection: Connection,
|
|
2427
|
+
payer: Signer,
|
|
2428
|
+
program: Signer,
|
|
2429
|
+
elf: Buffer | Uint8Array | Array<number>,
|
|
2430
|
+
loaderProgramId: PublicKey,
|
|
2431
|
+
): Promise<boolean>;
|
|
2432
|
+
}
|
|
2433
|
+
|
|
2434
|
+
export class SendTransactionError extends Error {
|
|
2435
|
+
logs: string[] | undefined;
|
|
2436
|
+
constructor(message: string, logs?: string[]);
|
|
2437
|
+
}
|
|
2438
|
+
export const SolanaJSONRPCErrorCode: {
|
|
2439
|
+
readonly JSON_RPC_SERVER_ERROR_BLOCK_CLEANED_UP: -32001;
|
|
2440
|
+
readonly JSON_RPC_SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE: -32002;
|
|
2441
|
+
readonly JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_VERIFICATION_FAILURE: -32003;
|
|
2442
|
+
readonly JSON_RPC_SERVER_ERROR_BLOCK_NOT_AVAILABLE: -32004;
|
|
2443
|
+
readonly JSON_RPC_SERVER_ERROR_NODE_UNHEALTHY: -32005;
|
|
2444
|
+
readonly JSON_RPC_SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE: -32006;
|
|
2445
|
+
readonly JSON_RPC_SERVER_ERROR_SLOT_SKIPPED: -32007;
|
|
2446
|
+
readonly JSON_RPC_SERVER_ERROR_NO_SNAPSHOT: -32008;
|
|
2447
|
+
readonly JSON_RPC_SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED: -32009;
|
|
2448
|
+
readonly JSON_RPC_SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX: -32010;
|
|
2449
|
+
readonly JSON_RPC_SERVER_ERROR_TRANSACTION_HISTORY_NOT_AVAILABLE: -32011;
|
|
2450
|
+
readonly JSON_RPC_SCAN_ERROR: -32012;
|
|
2451
|
+
readonly JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_LEN_MISMATCH: -32013;
|
|
2452
|
+
readonly JSON_RPC_SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET: -32014;
|
|
2453
|
+
readonly JSON_RPC_SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION: -32015;
|
|
2454
|
+
readonly JSON_RPC_SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED: -32016;
|
|
2455
|
+
};
|
|
2456
|
+
export type SolanaJSONRPCErrorCodeEnum =
|
|
2457
|
+
typeof SolanaJSONRPCErrorCode[keyof typeof SolanaJSONRPCErrorCode];
|
|
2458
|
+
export class SolanaJSONRPCError extends Error {
|
|
2459
|
+
code: SolanaJSONRPCErrorCodeEnum | unknown;
|
|
2460
|
+
data?: any;
|
|
2461
|
+
constructor(
|
|
2462
|
+
{
|
|
2463
|
+
code,
|
|
2464
|
+
message,
|
|
2465
|
+
data,
|
|
2466
|
+
}: Readonly<{
|
|
2467
|
+
code: unknown;
|
|
2468
|
+
message: string;
|
|
2469
|
+
data?: any;
|
|
2470
|
+
}>,
|
|
2471
|
+
customMessage?: string,
|
|
2472
|
+
);
|
|
2473
|
+
}
|
|
2474
|
+
|
|
2475
|
+
/**
|
|
2476
|
+
* Program loader interface
|
|
2477
|
+
*/
|
|
2478
|
+
export class Loader {
|
|
2344
2479
|
/**
|
|
2345
|
-
*
|
|
2480
|
+
* Amount of program data placed in each load Transaction
|
|
2346
2481
|
*/
|
|
2347
|
-
|
|
2482
|
+
static chunkSize: number;
|
|
2348
2483
|
/**
|
|
2349
|
-
*
|
|
2484
|
+
* Minimum number of signatures required to load a program not including
|
|
2485
|
+
* retries
|
|
2486
|
+
*
|
|
2487
|
+
* Can be used to calculate transaction fees
|
|
2350
2488
|
*/
|
|
2351
|
-
static
|
|
2489
|
+
static getMinNumSignatures(dataLength: number): number;
|
|
2352
2490
|
/**
|
|
2353
|
-
*
|
|
2491
|
+
* Loads a generic program
|
|
2492
|
+
*
|
|
2493
|
+
* @param connection The connection to use
|
|
2494
|
+
* @param payer System account that pays to load the program
|
|
2495
|
+
* @param program Account to load the program into
|
|
2496
|
+
* @param programId Public key that identifies the loader
|
|
2497
|
+
* @param data Program octets
|
|
2498
|
+
* @return true if program was loaded successfully, false if program was already loaded
|
|
2354
2499
|
*/
|
|
2355
|
-
static
|
|
2500
|
+
static load(
|
|
2501
|
+
connection: Connection,
|
|
2502
|
+
payer: Signer,
|
|
2503
|
+
program: Signer,
|
|
2504
|
+
programId: PublicKey,
|
|
2505
|
+
data: Buffer | Uint8Array | Array<number>,
|
|
2506
|
+
): Promise<boolean>;
|
|
2356
2507
|
}
|
|
2357
2508
|
|
|
2358
2509
|
export type CreateLookupTableParams = {
|
|
@@ -2442,39 +2593,6 @@ declare module '@solana/web3.js' {
|
|
|
2442
2593
|
): TransactionInstruction;
|
|
2443
2594
|
}
|
|
2444
2595
|
|
|
2445
|
-
export const BPF_LOADER_DEPRECATED_PROGRAM_ID: PublicKey;
|
|
2446
|
-
|
|
2447
|
-
export const BPF_LOADER_PROGRAM_ID: PublicKey;
|
|
2448
|
-
/**
|
|
2449
|
-
* Factory class for transactions to interact with a program loader
|
|
2450
|
-
*/
|
|
2451
|
-
export class BpfLoader {
|
|
2452
|
-
/**
|
|
2453
|
-
* Minimum number of signatures required to load a program not including
|
|
2454
|
-
* retries
|
|
2455
|
-
*
|
|
2456
|
-
* Can be used to calculate transaction fees
|
|
2457
|
-
*/
|
|
2458
|
-
static getMinNumSignatures(dataLength: number): number;
|
|
2459
|
-
/**
|
|
2460
|
-
* Load a BPF program
|
|
2461
|
-
*
|
|
2462
|
-
* @param connection The connection to use
|
|
2463
|
-
* @param payer Account that will pay program loading fees
|
|
2464
|
-
* @param program Account to load the program into
|
|
2465
|
-
* @param elf The entire ELF containing the BPF program
|
|
2466
|
-
* @param loaderProgramId The program id of the BPF loader to use
|
|
2467
|
-
* @return true if program was loaded successfully, false if program was already loaded
|
|
2468
|
-
*/
|
|
2469
|
-
static load(
|
|
2470
|
-
connection: Connection,
|
|
2471
|
-
payer: Signer,
|
|
2472
|
-
program: Signer,
|
|
2473
|
-
elf: Buffer | Uint8Array | Array<number>,
|
|
2474
|
-
loaderProgramId: PublicKey,
|
|
2475
|
-
): Promise<boolean>;
|
|
2476
|
-
}
|
|
2477
|
-
|
|
2478
2596
|
/**
|
|
2479
2597
|
* Compute Budget Instruction class
|
|
2480
2598
|
*/
|
|
@@ -2608,37 +2726,66 @@ declare module '@solana/web3.js' {
|
|
|
2608
2726
|
}
|
|
2609
2727
|
|
|
2610
2728
|
/**
|
|
2611
|
-
*
|
|
2729
|
+
* Params for creating an secp256k1 instruction using a public key
|
|
2612
2730
|
*/
|
|
2613
|
-
export
|
|
2731
|
+
export type CreateSecp256k1InstructionWithPublicKeyParams = {
|
|
2732
|
+
publicKey: Buffer | Uint8Array | Array<number>;
|
|
2733
|
+
message: Buffer | Uint8Array | Array<number>;
|
|
2734
|
+
signature: Buffer | Uint8Array | Array<number>;
|
|
2735
|
+
recoveryId: number;
|
|
2736
|
+
instructionIndex?: number;
|
|
2737
|
+
};
|
|
2738
|
+
/**
|
|
2739
|
+
* Params for creating an secp256k1 instruction using an Ethereum address
|
|
2740
|
+
*/
|
|
2741
|
+
export type CreateSecp256k1InstructionWithEthAddressParams = {
|
|
2742
|
+
ethAddress: Buffer | Uint8Array | Array<number> | string;
|
|
2743
|
+
message: Buffer | Uint8Array | Array<number>;
|
|
2744
|
+
signature: Buffer | Uint8Array | Array<number>;
|
|
2745
|
+
recoveryId: number;
|
|
2746
|
+
instructionIndex?: number;
|
|
2747
|
+
};
|
|
2748
|
+
/**
|
|
2749
|
+
* Params for creating an secp256k1 instruction using a private key
|
|
2750
|
+
*/
|
|
2751
|
+
export type CreateSecp256k1InstructionWithPrivateKeyParams = {
|
|
2752
|
+
privateKey: Buffer | Uint8Array | Array<number>;
|
|
2753
|
+
message: Buffer | Uint8Array | Array<number>;
|
|
2754
|
+
instructionIndex?: number;
|
|
2755
|
+
};
|
|
2756
|
+
export class Secp256k1Program {
|
|
2614
2757
|
/**
|
|
2615
|
-
*
|
|
2758
|
+
* Public key that identifies the secp256k1 program
|
|
2616
2759
|
*/
|
|
2617
|
-
static
|
|
2760
|
+
static programId: PublicKey;
|
|
2618
2761
|
/**
|
|
2619
|
-
*
|
|
2620
|
-
*
|
|
2621
|
-
*
|
|
2622
|
-
* Can be used to calculate transaction fees
|
|
2762
|
+
* Construct an Ethereum address from a secp256k1 public key buffer.
|
|
2763
|
+
* @param {Buffer} publicKey a 64 byte secp256k1 public key buffer
|
|
2623
2764
|
*/
|
|
2624
|
-
static
|
|
2765
|
+
static publicKeyToEthAddress(
|
|
2766
|
+
publicKey: Buffer | Uint8Array | Array<number>,
|
|
2767
|
+
): Buffer;
|
|
2625
2768
|
/**
|
|
2626
|
-
*
|
|
2627
|
-
*
|
|
2628
|
-
* @param connection The connection to use
|
|
2629
|
-
* @param payer System account that pays to load the program
|
|
2630
|
-
* @param program Account to load the program into
|
|
2631
|
-
* @param programId Public key that identifies the loader
|
|
2632
|
-
* @param data Program octets
|
|
2633
|
-
* @return true if program was loaded successfully, false if program was already loaded
|
|
2769
|
+
* Create an secp256k1 instruction with a public key. The public key
|
|
2770
|
+
* must be a buffer that is 64 bytes long.
|
|
2634
2771
|
*/
|
|
2635
|
-
static
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2772
|
+
static createInstructionWithPublicKey(
|
|
2773
|
+
params: CreateSecp256k1InstructionWithPublicKeyParams,
|
|
2774
|
+
): TransactionInstruction;
|
|
2775
|
+
/**
|
|
2776
|
+
* Create an secp256k1 instruction with an Ethereum address. The address
|
|
2777
|
+
* must be a hex string or a buffer that is 20 bytes long.
|
|
2778
|
+
*/
|
|
2779
|
+
static createInstructionWithEthAddress(
|
|
2780
|
+
params: CreateSecp256k1InstructionWithEthAddressParams,
|
|
2781
|
+
): TransactionInstruction;
|
|
2782
|
+
/**
|
|
2783
|
+
* Create an secp256k1 instruction with a private key. The private key
|
|
2784
|
+
* must be a buffer that is 32 bytes long.
|
|
2785
|
+
*/
|
|
2786
|
+
static createInstructionWithPrivateKey(
|
|
2787
|
+
params: CreateSecp256k1InstructionWithPrivateKeyParams,
|
|
2788
|
+
): TransactionInstruction;
|
|
2642
2789
|
}
|
|
2643
2790
|
|
|
2644
2791
|
/**
|
|
@@ -3287,194 +3434,26 @@ declare module '@solana/web3.js' {
|
|
|
3287
3434
|
*/
|
|
3288
3435
|
static nonceInitialize(
|
|
3289
3436
|
params: InitializeNonceParams,
|
|
3290
|
-
): TransactionInstruction;
|
|
3291
|
-
/**
|
|
3292
|
-
* Generate an instruction to advance the nonce in a Nonce account
|
|
3293
|
-
*/
|
|
3294
|
-
static nonceAdvance(params: AdvanceNonceParams): TransactionInstruction;
|
|
3295
|
-
/**
|
|
3296
|
-
* Generate a transaction instruction that withdraws lamports from a Nonce account
|
|
3297
|
-
*/
|
|
3298
|
-
static nonceWithdraw(params: WithdrawNonceParams): TransactionInstruction;
|
|
3299
|
-
/**
|
|
3300
|
-
* Generate a transaction instruction that authorizes a new PublicKey as the authority
|
|
3301
|
-
* on a Nonce account.
|
|
3302
|
-
*/
|
|
3303
|
-
static nonceAuthorize(params: AuthorizeNonceParams): TransactionInstruction;
|
|
3304
|
-
/**
|
|
3305
|
-
* Generate a transaction instruction that allocates space in an account without funding
|
|
3306
|
-
*/
|
|
3307
|
-
static allocate(
|
|
3308
|
-
params: AllocateParams | AllocateWithSeedParams,
|
|
3309
|
-
): TransactionInstruction;
|
|
3310
|
-
}
|
|
3311
|
-
|
|
3312
|
-
/**
|
|
3313
|
-
* Params for creating an secp256k1 instruction using a public key
|
|
3314
|
-
*/
|
|
3315
|
-
export type CreateSecp256k1InstructionWithPublicKeyParams = {
|
|
3316
|
-
publicKey: Buffer | Uint8Array | Array<number>;
|
|
3317
|
-
message: Buffer | Uint8Array | Array<number>;
|
|
3318
|
-
signature: Buffer | Uint8Array | Array<number>;
|
|
3319
|
-
recoveryId: number;
|
|
3320
|
-
instructionIndex?: number;
|
|
3321
|
-
};
|
|
3322
|
-
/**
|
|
3323
|
-
* Params for creating an secp256k1 instruction using an Ethereum address
|
|
3324
|
-
*/
|
|
3325
|
-
export type CreateSecp256k1InstructionWithEthAddressParams = {
|
|
3326
|
-
ethAddress: Buffer | Uint8Array | Array<number> | string;
|
|
3327
|
-
message: Buffer | Uint8Array | Array<number>;
|
|
3328
|
-
signature: Buffer | Uint8Array | Array<number>;
|
|
3329
|
-
recoveryId: number;
|
|
3330
|
-
instructionIndex?: number;
|
|
3331
|
-
};
|
|
3332
|
-
/**
|
|
3333
|
-
* Params for creating an secp256k1 instruction using a private key
|
|
3334
|
-
*/
|
|
3335
|
-
export type CreateSecp256k1InstructionWithPrivateKeyParams = {
|
|
3336
|
-
privateKey: Buffer | Uint8Array | Array<number>;
|
|
3337
|
-
message: Buffer | Uint8Array | Array<number>;
|
|
3338
|
-
instructionIndex?: number;
|
|
3339
|
-
};
|
|
3340
|
-
export class Secp256k1Program {
|
|
3341
|
-
/**
|
|
3342
|
-
* Public key that identifies the secp256k1 program
|
|
3343
|
-
*/
|
|
3344
|
-
static programId: PublicKey;
|
|
3345
|
-
/**
|
|
3346
|
-
* Construct an Ethereum address from a secp256k1 public key buffer.
|
|
3347
|
-
* @param {Buffer} publicKey a 64 byte secp256k1 public key buffer
|
|
3348
|
-
*/
|
|
3349
|
-
static publicKeyToEthAddress(
|
|
3350
|
-
publicKey: Buffer | Uint8Array | Array<number>,
|
|
3351
|
-
): Buffer;
|
|
3352
|
-
/**
|
|
3353
|
-
* Create an secp256k1 instruction with a public key. The public key
|
|
3354
|
-
* must be a buffer that is 64 bytes long.
|
|
3355
|
-
*/
|
|
3356
|
-
static createInstructionWithPublicKey(
|
|
3357
|
-
params: CreateSecp256k1InstructionWithPublicKeyParams,
|
|
3358
|
-
): TransactionInstruction;
|
|
3359
|
-
/**
|
|
3360
|
-
* Create an secp256k1 instruction with an Ethereum address. The address
|
|
3361
|
-
* must be a hex string or a buffer that is 20 bytes long.
|
|
3362
|
-
*/
|
|
3363
|
-
static createInstructionWithEthAddress(
|
|
3364
|
-
params: CreateSecp256k1InstructionWithEthAddressParams,
|
|
3365
|
-
): TransactionInstruction;
|
|
3366
|
-
/**
|
|
3367
|
-
* Create an secp256k1 instruction with a private key. The private key
|
|
3368
|
-
* must be a buffer that is 32 bytes long.
|
|
3369
|
-
*/
|
|
3370
|
-
static createInstructionWithPrivateKey(
|
|
3371
|
-
params: CreateSecp256k1InstructionWithPrivateKeyParams,
|
|
3372
|
-
): TransactionInstruction;
|
|
3373
|
-
}
|
|
3374
|
-
|
|
3375
|
-
/**
|
|
3376
|
-
* Maximum over-the-wire size of a Transaction
|
|
3377
|
-
*
|
|
3378
|
-
* 1280 is IPv6 minimum MTU
|
|
3379
|
-
* 40 bytes is the size of the IPv6 header
|
|
3380
|
-
* 8 bytes is the size of the fragment header
|
|
3381
|
-
*/
|
|
3382
|
-
export const PACKET_DATA_SIZE: number;
|
|
3383
|
-
export const SIGNATURE_LENGTH_IN_BYTES = 64;
|
|
3384
|
-
|
|
3385
|
-
export const VALIDATOR_INFO_KEY: PublicKey;
|
|
3386
|
-
/**
|
|
3387
|
-
* Info used to identity validators.
|
|
3388
|
-
*/
|
|
3389
|
-
export type Info = {
|
|
3390
|
-
/** validator name */
|
|
3391
|
-
name: string;
|
|
3392
|
-
/** optional, validator website */
|
|
3393
|
-
website?: string;
|
|
3394
|
-
/** optional, extra information the validator chose to share */
|
|
3395
|
-
details?: string;
|
|
3396
|
-
/** optional, used to identify validators on keybase.io */
|
|
3397
|
-
keybaseUsername?: string;
|
|
3398
|
-
};
|
|
3399
|
-
/**
|
|
3400
|
-
* ValidatorInfo class
|
|
3401
|
-
*/
|
|
3402
|
-
export class ValidatorInfo {
|
|
3403
|
-
/**
|
|
3404
|
-
* validator public key
|
|
3405
|
-
*/
|
|
3406
|
-
key: PublicKey;
|
|
3437
|
+
): TransactionInstruction;
|
|
3407
3438
|
/**
|
|
3408
|
-
*
|
|
3439
|
+
* Generate an instruction to advance the nonce in a Nonce account
|
|
3409
3440
|
*/
|
|
3410
|
-
|
|
3441
|
+
static nonceAdvance(params: AdvanceNonceParams): TransactionInstruction;
|
|
3411
3442
|
/**
|
|
3412
|
-
*
|
|
3413
|
-
*
|
|
3414
|
-
* @param key validator public key
|
|
3415
|
-
* @param info validator information
|
|
3443
|
+
* Generate a transaction instruction that withdraws lamports from a Nonce account
|
|
3416
3444
|
*/
|
|
3417
|
-
|
|
3445
|
+
static nonceWithdraw(params: WithdrawNonceParams): TransactionInstruction;
|
|
3418
3446
|
/**
|
|
3419
|
-
*
|
|
3420
|
-
*
|
|
3421
|
-
*
|
|
3422
|
-
* @param buffer config account data
|
|
3423
|
-
* @return null if info was not found
|
|
3447
|
+
* Generate a transaction instruction that authorizes a new PublicKey as the authority
|
|
3448
|
+
* on a Nonce account.
|
|
3424
3449
|
*/
|
|
3425
|
-
static
|
|
3426
|
-
buffer: Buffer | Uint8Array | Array<number>,
|
|
3427
|
-
): ValidatorInfo | null;
|
|
3428
|
-
}
|
|
3429
|
-
|
|
3430
|
-
export const VOTE_PROGRAM_ID: PublicKey;
|
|
3431
|
-
export type Lockout = {
|
|
3432
|
-
slot: number;
|
|
3433
|
-
confirmationCount: number;
|
|
3434
|
-
};
|
|
3435
|
-
/**
|
|
3436
|
-
* History of how many credits earned by the end of each epoch
|
|
3437
|
-
*/
|
|
3438
|
-
export type EpochCredits = Readonly<{
|
|
3439
|
-
epoch: number;
|
|
3440
|
-
credits: number;
|
|
3441
|
-
prevCredits: number;
|
|
3442
|
-
}>;
|
|
3443
|
-
export type AuthorizedVoter = Readonly<{
|
|
3444
|
-
epoch: number;
|
|
3445
|
-
authorizedVoter: PublicKey;
|
|
3446
|
-
}>;
|
|
3447
|
-
export type PriorVoter = Readonly<{
|
|
3448
|
-
authorizedPubkey: PublicKey;
|
|
3449
|
-
epochOfLastAuthorizedSwitch: number;
|
|
3450
|
-
targetEpoch: number;
|
|
3451
|
-
}>;
|
|
3452
|
-
export type BlockTimestamp = Readonly<{
|
|
3453
|
-
slot: number;
|
|
3454
|
-
timestamp: number;
|
|
3455
|
-
}>;
|
|
3456
|
-
/**
|
|
3457
|
-
* VoteAccount class
|
|
3458
|
-
*/
|
|
3459
|
-
export class VoteAccount {
|
|
3460
|
-
nodePubkey: PublicKey;
|
|
3461
|
-
authorizedWithdrawer: PublicKey;
|
|
3462
|
-
commission: number;
|
|
3463
|
-
rootSlot: number | null;
|
|
3464
|
-
votes: Lockout[];
|
|
3465
|
-
authorizedVoters: AuthorizedVoter[];
|
|
3466
|
-
priorVoters: PriorVoter[];
|
|
3467
|
-
epochCredits: EpochCredits[];
|
|
3468
|
-
lastTimestamp: BlockTimestamp;
|
|
3450
|
+
static nonceAuthorize(params: AuthorizeNonceParams): TransactionInstruction;
|
|
3469
3451
|
/**
|
|
3470
|
-
*
|
|
3471
|
-
*
|
|
3472
|
-
* @param buffer account data
|
|
3473
|
-
* @return VoteAccount
|
|
3452
|
+
* Generate a transaction instruction that allocates space in an account without funding
|
|
3474
3453
|
*/
|
|
3475
|
-
static
|
|
3476
|
-
|
|
3477
|
-
):
|
|
3454
|
+
static allocate(
|
|
3455
|
+
params: AllocateParams | AllocateWithSeedParams,
|
|
3456
|
+
): TransactionInstruction;
|
|
3478
3457
|
}
|
|
3479
3458
|
|
|
3480
3459
|
/**
|
|
@@ -3618,6 +3597,101 @@ declare module '@solana/web3.js' {
|
|
|
3618
3597
|
static withdraw(params: WithdrawFromVoteAccountParams): Transaction;
|
|
3619
3598
|
}
|
|
3620
3599
|
|
|
3600
|
+
export const VALIDATOR_INFO_KEY: PublicKey;
|
|
3601
|
+
/**
|
|
3602
|
+
* Info used to identity validators.
|
|
3603
|
+
*/
|
|
3604
|
+
export type Info = {
|
|
3605
|
+
/** validator name */
|
|
3606
|
+
name: string;
|
|
3607
|
+
/** optional, validator website */
|
|
3608
|
+
website?: string;
|
|
3609
|
+
/** optional, extra information the validator chose to share */
|
|
3610
|
+
details?: string;
|
|
3611
|
+
/** optional, used to identify validators on keybase.io */
|
|
3612
|
+
keybaseUsername?: string;
|
|
3613
|
+
};
|
|
3614
|
+
/**
|
|
3615
|
+
* ValidatorInfo class
|
|
3616
|
+
*/
|
|
3617
|
+
export class ValidatorInfo {
|
|
3618
|
+
/**
|
|
3619
|
+
* validator public key
|
|
3620
|
+
*/
|
|
3621
|
+
key: PublicKey;
|
|
3622
|
+
/**
|
|
3623
|
+
* validator information
|
|
3624
|
+
*/
|
|
3625
|
+
info: Info;
|
|
3626
|
+
/**
|
|
3627
|
+
* Construct a valid ValidatorInfo
|
|
3628
|
+
*
|
|
3629
|
+
* @param key validator public key
|
|
3630
|
+
* @param info validator information
|
|
3631
|
+
*/
|
|
3632
|
+
constructor(key: PublicKey, info: Info);
|
|
3633
|
+
/**
|
|
3634
|
+
* Deserialize ValidatorInfo from the config account data. Exactly two config
|
|
3635
|
+
* keys are required in the data.
|
|
3636
|
+
*
|
|
3637
|
+
* @param buffer config account data
|
|
3638
|
+
* @return null if info was not found
|
|
3639
|
+
*/
|
|
3640
|
+
static fromConfigData(
|
|
3641
|
+
buffer: Buffer | Uint8Array | Array<number>,
|
|
3642
|
+
): ValidatorInfo | null;
|
|
3643
|
+
}
|
|
3644
|
+
|
|
3645
|
+
export const VOTE_PROGRAM_ID: PublicKey;
|
|
3646
|
+
export type Lockout = {
|
|
3647
|
+
slot: number;
|
|
3648
|
+
confirmationCount: number;
|
|
3649
|
+
};
|
|
3650
|
+
/**
|
|
3651
|
+
* History of how many credits earned by the end of each epoch
|
|
3652
|
+
*/
|
|
3653
|
+
export type EpochCredits = Readonly<{
|
|
3654
|
+
epoch: number;
|
|
3655
|
+
credits: number;
|
|
3656
|
+
prevCredits: number;
|
|
3657
|
+
}>;
|
|
3658
|
+
export type AuthorizedVoter = Readonly<{
|
|
3659
|
+
epoch: number;
|
|
3660
|
+
authorizedVoter: PublicKey;
|
|
3661
|
+
}>;
|
|
3662
|
+
export type PriorVoter = Readonly<{
|
|
3663
|
+
authorizedPubkey: PublicKey;
|
|
3664
|
+
epochOfLastAuthorizedSwitch: number;
|
|
3665
|
+
targetEpoch: number;
|
|
3666
|
+
}>;
|
|
3667
|
+
export type BlockTimestamp = Readonly<{
|
|
3668
|
+
slot: number;
|
|
3669
|
+
timestamp: number;
|
|
3670
|
+
}>;
|
|
3671
|
+
/**
|
|
3672
|
+
* VoteAccount class
|
|
3673
|
+
*/
|
|
3674
|
+
export class VoteAccount {
|
|
3675
|
+
nodePubkey: PublicKey;
|
|
3676
|
+
authorizedWithdrawer: PublicKey;
|
|
3677
|
+
commission: number;
|
|
3678
|
+
rootSlot: number | null;
|
|
3679
|
+
votes: Lockout[];
|
|
3680
|
+
authorizedVoters: AuthorizedVoter[];
|
|
3681
|
+
priorVoters: PriorVoter[];
|
|
3682
|
+
epochCredits: EpochCredits[];
|
|
3683
|
+
lastTimestamp: BlockTimestamp;
|
|
3684
|
+
/**
|
|
3685
|
+
* Deserialize VoteAccount from the account data.
|
|
3686
|
+
*
|
|
3687
|
+
* @param buffer account data
|
|
3688
|
+
* @return VoteAccount
|
|
3689
|
+
*/
|
|
3690
|
+
static fromAccountData(
|
|
3691
|
+
buffer: Buffer | Uint8Array | Array<number>,
|
|
3692
|
+
): VoteAccount;
|
|
3693
|
+
}
|
|
3694
|
+
|
|
3621
3695
|
export const SYSVAR_CLOCK_PUBKEY: PublicKey;
|
|
3622
3696
|
export const SYSVAR_EPOCH_SCHEDULE_PUBKEY: PublicKey;
|
|
3623
3697
|
export const SYSVAR_INSTRUCTIONS_PUBKEY: PublicKey;
|
|
@@ -3628,64 +3702,11 @@ declare module '@solana/web3.js' {
|
|
|
3628
3702
|
export const SYSVAR_SLOT_HISTORY_PUBKEY: PublicKey;
|
|
3629
3703
|
export const SYSVAR_STAKE_HISTORY_PUBKEY: PublicKey;
|
|
3630
3704
|
|
|
3631
|
-
export
|
|
3632
|
-
logs: string[] | undefined;
|
|
3633
|
-
constructor(message: string, logs?: string[]);
|
|
3634
|
-
}
|
|
3635
|
-
export const SolanaJSONRPCErrorCode: {
|
|
3636
|
-
readonly JSON_RPC_SERVER_ERROR_BLOCK_CLEANED_UP: -32001;
|
|
3637
|
-
readonly JSON_RPC_SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE: -32002;
|
|
3638
|
-
readonly JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_VERIFICATION_FAILURE: -32003;
|
|
3639
|
-
readonly JSON_RPC_SERVER_ERROR_BLOCK_NOT_AVAILABLE: -32004;
|
|
3640
|
-
readonly JSON_RPC_SERVER_ERROR_NODE_UNHEALTHY: -32005;
|
|
3641
|
-
readonly JSON_RPC_SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE: -32006;
|
|
3642
|
-
readonly JSON_RPC_SERVER_ERROR_SLOT_SKIPPED: -32007;
|
|
3643
|
-
readonly JSON_RPC_SERVER_ERROR_NO_SNAPSHOT: -32008;
|
|
3644
|
-
readonly JSON_RPC_SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED: -32009;
|
|
3645
|
-
readonly JSON_RPC_SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX: -32010;
|
|
3646
|
-
readonly JSON_RPC_SERVER_ERROR_TRANSACTION_HISTORY_NOT_AVAILABLE: -32011;
|
|
3647
|
-
readonly JSON_RPC_SCAN_ERROR: -32012;
|
|
3648
|
-
readonly JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_LEN_MISMATCH: -32013;
|
|
3649
|
-
readonly JSON_RPC_SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET: -32014;
|
|
3650
|
-
readonly JSON_RPC_SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION: -32015;
|
|
3651
|
-
readonly JSON_RPC_SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED: -32016;
|
|
3652
|
-
};
|
|
3653
|
-
export type SolanaJSONRPCErrorCodeEnum =
|
|
3654
|
-
typeof SolanaJSONRPCErrorCode[keyof typeof SolanaJSONRPCErrorCode];
|
|
3655
|
-
export class SolanaJSONRPCError extends Error {
|
|
3656
|
-
code: SolanaJSONRPCErrorCodeEnum | unknown;
|
|
3657
|
-
data?: any;
|
|
3658
|
-
constructor(
|
|
3659
|
-
{
|
|
3660
|
-
code,
|
|
3661
|
-
message,
|
|
3662
|
-
data,
|
|
3663
|
-
}: Readonly<{
|
|
3664
|
-
code: unknown;
|
|
3665
|
-
message: string;
|
|
3666
|
-
data?: any;
|
|
3667
|
-
}>,
|
|
3668
|
-
customMessage?: string,
|
|
3669
|
-
);
|
|
3670
|
-
}
|
|
3671
|
-
|
|
3705
|
+
export type Cluster = 'devnet' | 'testnet' | 'mainnet-beta';
|
|
3672
3706
|
/**
|
|
3673
|
-
*
|
|
3674
|
-
*
|
|
3675
|
-
* If `commitment` option is not specified, defaults to 'max' commitment.
|
|
3676
|
-
*
|
|
3677
|
-
* @param {Connection} connection
|
|
3678
|
-
* @param {Transaction} transaction
|
|
3679
|
-
* @param {Array<Signer>} signers
|
|
3680
|
-
* @param {ConfirmOptions} [options]
|
|
3681
|
-
* @returns {Promise<TransactionSignature>}
|
|
3707
|
+
* Retrieves the RPC API URL for the specified cluster
|
|
3682
3708
|
*/
|
|
3683
|
-
export function
|
|
3684
|
-
connection: Connection,
|
|
3685
|
-
transaction: Transaction,
|
|
3686
|
-
signers: Array<Signer>,
|
|
3687
|
-
options?: ConfirmOptions,
|
|
3688
|
-
): Promise<TransactionSignature>;
|
|
3709
|
+
export function clusterApiUrl(cluster?: Cluster, tls?: boolean): string;
|
|
3689
3710
|
|
|
3690
3711
|
/**
|
|
3691
3712
|
* Send and confirm a raw transaction
|
|
@@ -3714,20 +3735,23 @@ declare module '@solana/web3.js' {
|
|
|
3714
3735
|
options?: ConfirmOptions,
|
|
3715
3736
|
): Promise<TransactionSignature>;
|
|
3716
3737
|
|
|
3717
|
-
export class TransactionExpiredBlockheightExceededError extends Error {
|
|
3718
|
-
signature: string;
|
|
3719
|
-
constructor(signature: string);
|
|
3720
|
-
}
|
|
3721
|
-
export class TransactionExpiredTimeoutError extends Error {
|
|
3722
|
-
signature: string;
|
|
3723
|
-
constructor(signature: string, timeoutSeconds: number);
|
|
3724
|
-
}
|
|
3725
|
-
|
|
3726
|
-
export type Cluster = 'devnet' | 'testnet' | 'mainnet-beta';
|
|
3727
3738
|
/**
|
|
3728
|
-
*
|
|
3739
|
+
* Sign, send and confirm a transaction.
|
|
3740
|
+
*
|
|
3741
|
+
* If `commitment` option is not specified, defaults to 'max' commitment.
|
|
3742
|
+
*
|
|
3743
|
+
* @param {Connection} connection
|
|
3744
|
+
* @param {Transaction} transaction
|
|
3745
|
+
* @param {Array<Signer>} signers
|
|
3746
|
+
* @param {ConfirmOptions} [options]
|
|
3747
|
+
* @returns {Promise<TransactionSignature>}
|
|
3729
3748
|
*/
|
|
3730
|
-
export function
|
|
3749
|
+
export function sendAndConfirmTransaction(
|
|
3750
|
+
connection: Connection,
|
|
3751
|
+
transaction: Transaction,
|
|
3752
|
+
signers: Array<Signer>,
|
|
3753
|
+
options?: ConfirmOptions,
|
|
3754
|
+
): Promise<TransactionSignature>;
|
|
3731
3755
|
|
|
3732
3756
|
/**
|
|
3733
3757
|
* There are 1-billion lamports in one SOL
|