@solana/web3.js 1.50.1 → 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/README.md +4 -0
- package/lib/index.browser.cjs.js +2903 -2809
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +2903 -2810
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +2903 -2809
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +870 -831
- package/lib/index.esm.js +2903 -2810
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +3631 -3537
- 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 +2905 -2811
- package/lib/index.native.js.map +1 -1
- package/package.json +2 -2
- package/src/account-data.ts +39 -0
- package/src/account.ts +1 -1
- package/src/connection.ts +56 -8
- package/src/fee-calculator.ts +2 -0
- 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,13 +184,10 @@ 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.
|
|
189
|
+
*
|
|
190
|
+
* @deprecated Deprecated since Solana v1.8.0.
|
|
187
191
|
*/
|
|
188
192
|
interface FeeCalculator {
|
|
189
193
|
/** Cost in lamports to validate a signature. */
|
|
@@ -274,34 +278,24 @@ declare module '@solana/web3.js' {
|
|
|
274
278
|
}
|
|
275
279
|
|
|
276
280
|
/**
|
|
277
|
-
*
|
|
278
|
-
*/
|
|
279
|
-
export type MessageHeader = {
|
|
280
|
-
/**
|
|
281
|
-
* The number of signatures required for this message to be considered valid. The
|
|
282
|
-
* signatures must match the first `numRequiredSignatures` of `accountKeys`.
|
|
283
|
-
*/
|
|
284
|
-
numRequiredSignatures: number;
|
|
285
|
-
/** The last `numReadonlySignedAccounts` of the signed keys are read-only accounts */
|
|
286
|
-
numReadonlySignedAccounts: number;
|
|
287
|
-
/** The last `numReadonlySignedAccounts` of the unsigned keys are read-only accounts */
|
|
288
|
-
numReadonlyUnsignedAccounts: number;
|
|
289
|
-
};
|
|
290
|
-
/**
|
|
291
|
-
* An instruction to execute by a program
|
|
281
|
+
* Maximum over-the-wire size of a Transaction
|
|
292
282
|
*
|
|
293
|
-
*
|
|
294
|
-
*
|
|
295
|
-
*
|
|
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
|
|
296
286
|
*/
|
|
297
|
-
export
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
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
|
+
|
|
305
299
|
/**
|
|
306
300
|
* Message constructor arguments
|
|
307
301
|
*/
|
|
@@ -337,231 +331,497 @@ declare module '@solana/web3.js' {
|
|
|
337
331
|
static from(buffer: Buffer | Uint8Array | Array<number>): Message;
|
|
338
332
|
}
|
|
339
333
|
|
|
340
|
-
export type ClientSubscriptionId = number;
|
|
341
|
-
export type TokenAccountsFilter =
|
|
342
|
-
| {
|
|
343
|
-
mint: PublicKey;
|
|
344
|
-
}
|
|
345
|
-
| {
|
|
346
|
-
programId: PublicKey;
|
|
347
|
-
};
|
|
348
334
|
/**
|
|
349
|
-
*
|
|
335
|
+
* The message header, identifying signed and read-only account
|
|
350
336
|
*/
|
|
351
|
-
export type
|
|
352
|
-
|
|
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;
|
|
353
347
|
};
|
|
354
348
|
/**
|
|
355
|
-
*
|
|
349
|
+
* An instruction to execute by a program
|
|
350
|
+
*
|
|
351
|
+
* @property {number} programIdIndex
|
|
352
|
+
* @property {number[]} accounts
|
|
353
|
+
* @property {string} data
|
|
356
354
|
*/
|
|
357
|
-
export type
|
|
358
|
-
/**
|
|
359
|
-
|
|
360
|
-
/**
|
|
361
|
-
|
|
362
|
-
/**
|
|
363
|
-
|
|
364
|
-
/** The minimum slot that the request can be evaluated at */
|
|
365
|
-
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;
|
|
366
362
|
};
|
|
363
|
+
|
|
367
364
|
/**
|
|
368
|
-
*
|
|
365
|
+
* Transaction signature as base-58 encoded string
|
|
369
366
|
*/
|
|
370
|
-
export type
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
preflightCommitment?: Commitment;
|
|
377
|
-
/** Maximum number of times for the RPC node to retry sending the transaction to the leader. */
|
|
378
|
-
maxRetries?: number;
|
|
379
|
-
/** The minimum slot that the request can be evaluated at */
|
|
380
|
-
minContextSlot?: number;
|
|
381
|
-
};
|
|
367
|
+
export type TransactionSignature = string;
|
|
368
|
+
export const enum TransactionStatus {
|
|
369
|
+
BLOCKHEIGHT_EXCEEDED = 0,
|
|
370
|
+
PROCESSED = 1,
|
|
371
|
+
TIMED_OUT = 2,
|
|
372
|
+
}
|
|
382
373
|
/**
|
|
383
|
-
*
|
|
374
|
+
* Account metadata used to define instructions
|
|
384
375
|
*/
|
|
385
|
-
export type
|
|
386
|
-
/**
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
until?: TransactionSignature;
|
|
393
|
-
/** Maximum transaction signatures to return (between 1 and 1,000, default: 1,000). */
|
|
394
|
-
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;
|
|
395
383
|
};
|
|
396
384
|
/**
|
|
397
|
-
*
|
|
385
|
+
* List of TransactionInstruction object fields that may be initialized at construction
|
|
398
386
|
*/
|
|
399
|
-
export type
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
*/
|
|
404
|
-
before?: TransactionSignature;
|
|
405
|
-
/** Search until this transaction signature is reached, if found before `limit`. */
|
|
406
|
-
until?: TransactionSignature;
|
|
407
|
-
/** Maximum transaction signatures to return (between 1 and 1,000, default: 1,000). */
|
|
408
|
-
limit?: number;
|
|
409
|
-
/** The minimum slot that the request can be evaluated at */
|
|
410
|
-
minContextSlot?: number;
|
|
387
|
+
export type TransactionInstructionCtorFields = {
|
|
388
|
+
keys: Array<AccountMeta>;
|
|
389
|
+
programId: PublicKey;
|
|
390
|
+
data?: Buffer;
|
|
411
391
|
};
|
|
412
392
|
/**
|
|
413
|
-
*
|
|
393
|
+
* Configuration object for Transaction.serialize()
|
|
414
394
|
*/
|
|
415
|
-
export type
|
|
416
|
-
/**
|
|
417
|
-
|
|
418
|
-
/**
|
|
419
|
-
|
|
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;
|
|
420
400
|
};
|
|
421
|
-
export type BlockhashWithExpiryBlockHeight = Readonly<{
|
|
422
|
-
blockhash: Blockhash;
|
|
423
|
-
lastValidBlockHeight: number;
|
|
424
|
-
}>;
|
|
425
401
|
/**
|
|
426
|
-
*
|
|
427
|
-
* block height for a given blockhash to check for transaction expiration.
|
|
402
|
+
* Transaction Instruction class
|
|
428
403
|
*/
|
|
429
|
-
export
|
|
430
|
-
|
|
431
|
-
|
|
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
|
+
}
|
|
432
420
|
/**
|
|
433
|
-
*
|
|
434
|
-
* <pre>
|
|
435
|
-
* 'processed': Query the most recent block which has reached 1 confirmation by the connected node
|
|
436
|
-
* 'confirmed': Query the most recent block which has reached 1 confirmation by the cluster
|
|
437
|
-
* 'finalized': Query the most recent block which has been finalized by the cluster
|
|
438
|
-
* </pre>
|
|
421
|
+
* Pair of signature and corresponding public key
|
|
439
422
|
*/
|
|
440
|
-
export type
|
|
441
|
-
|
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
| 'recent'
|
|
445
|
-
| 'single'
|
|
446
|
-
| 'singleGossip'
|
|
447
|
-
| 'root'
|
|
448
|
-
| 'max';
|
|
423
|
+
export type SignaturePubkeyPair = {
|
|
424
|
+
signature: Buffer | null;
|
|
425
|
+
publicKey: PublicKey;
|
|
426
|
+
};
|
|
449
427
|
/**
|
|
450
|
-
*
|
|
451
|
-
* <pre>
|
|
452
|
-
* 'confirmed': Query the most recent block which has reached 1 confirmation by the cluster
|
|
453
|
-
* 'finalized': Query the most recent block which has been finalized by the cluster
|
|
454
|
-
* </pre>
|
|
428
|
+
* List of Transaction object fields that may be initialized at construction
|
|
455
429
|
*/
|
|
456
|
-
export type
|
|
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;
|
|
439
|
+
};
|
|
440
|
+
export type TransactionCtorFields = TransactionCtorFields_DEPRECATED;
|
|
457
441
|
/**
|
|
458
|
-
*
|
|
459
|
-
* <pre>
|
|
460
|
-
* 'circulating': Return the largest accounts that are part of the circulating supply
|
|
461
|
-
* 'nonCirculating': Return the largest accounts that are not part of the circulating supply
|
|
462
|
-
* </pre>
|
|
442
|
+
* List of Transaction object fields that may be initialized at construction
|
|
463
443
|
*/
|
|
464
|
-
export type
|
|
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;
|
|
453
|
+
};
|
|
465
454
|
/**
|
|
466
|
-
*
|
|
455
|
+
* Nonce information to be used to build an offline Transaction.
|
|
467
456
|
*/
|
|
468
|
-
export type
|
|
469
|
-
/** The
|
|
470
|
-
|
|
471
|
-
/**
|
|
472
|
-
|
|
457
|
+
export type NonceInformation = {
|
|
458
|
+
/** The current blockhash stored in the nonce */
|
|
459
|
+
nonce: Blockhash;
|
|
460
|
+
/** AdvanceNonceAccount Instruction */
|
|
461
|
+
nonceInstruction: TransactionInstruction;
|
|
473
462
|
};
|
|
474
463
|
/**
|
|
475
|
-
*
|
|
464
|
+
* Transaction class
|
|
476
465
|
*/
|
|
477
|
-
export
|
|
478
|
-
/**
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
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>;
|
|
482
587
|
};
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
export type GetBlockConfig = {
|
|
487
|
-
/** The level of finality desired */
|
|
488
|
-
commitment?: Finality;
|
|
489
|
-
/** The max transaction version to return in responses. If the requested transaction is a higher version, an error will be returned */
|
|
490
|
-
maxSupportedTransactionVersion?: number;
|
|
588
|
+
export type AddressLookupTableAccountArgs = {
|
|
589
|
+
key: PublicKey;
|
|
590
|
+
state: AddressLookupTableState;
|
|
491
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
|
+
};
|
|
492
608
|
/**
|
|
493
|
-
*
|
|
609
|
+
* Extra contextual information for RPC responses
|
|
494
610
|
*/
|
|
495
|
-
export type
|
|
496
|
-
|
|
497
|
-
commitment?: Commitment;
|
|
611
|
+
export type Context = {
|
|
612
|
+
slot: number;
|
|
498
613
|
};
|
|
499
614
|
/**
|
|
500
|
-
*
|
|
615
|
+
* Options for sending transactions
|
|
501
616
|
*/
|
|
502
|
-
export type
|
|
503
|
-
/**
|
|
504
|
-
|
|
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;
|
|
505
624
|
/** The minimum slot that the request can be evaluated at */
|
|
506
625
|
minContextSlot?: number;
|
|
507
626
|
};
|
|
508
627
|
/**
|
|
509
|
-
*
|
|
628
|
+
* Options for confirming transactions
|
|
510
629
|
*/
|
|
511
|
-
export type
|
|
512
|
-
/**
|
|
630
|
+
export type ConfirmOptions = {
|
|
631
|
+
/** disable transaction verification step */
|
|
632
|
+
skipPreflight?: boolean;
|
|
633
|
+
/** desired commitment level */
|
|
513
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;
|
|
514
639
|
/** The minimum slot that the request can be evaluated at */
|
|
515
640
|
minContextSlot?: number;
|
|
516
641
|
};
|
|
517
642
|
/**
|
|
518
|
-
*
|
|
643
|
+
* Options for getConfirmedSignaturesForAddress2
|
|
519
644
|
*/
|
|
520
|
-
export type
|
|
521
|
-
/**
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
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;
|
|
527
655
|
};
|
|
528
656
|
/**
|
|
529
|
-
*
|
|
657
|
+
* Options for getSignaturesForAddress
|
|
530
658
|
*/
|
|
531
|
-
export type
|
|
532
|
-
/**
|
|
533
|
-
|
|
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;
|
|
534
669
|
/** The minimum slot that the request can be evaluated at */
|
|
535
670
|
minContextSlot?: number;
|
|
536
671
|
};
|
|
537
672
|
/**
|
|
538
|
-
*
|
|
673
|
+
* RPC Response with extra contextual information
|
|
539
674
|
*/
|
|
540
|
-
export type
|
|
541
|
-
/**
|
|
542
|
-
|
|
543
|
-
/**
|
|
544
|
-
|
|
675
|
+
export type RpcResponseAndContext<T> = {
|
|
676
|
+
/** response context */
|
|
677
|
+
context: Context;
|
|
678
|
+
/** response value */
|
|
679
|
+
value: T;
|
|
545
680
|
};
|
|
681
|
+
export type BlockhashWithExpiryBlockHeight = Readonly<{
|
|
682
|
+
blockhash: Blockhash;
|
|
683
|
+
lastValidBlockHeight: number;
|
|
684
|
+
}>;
|
|
546
685
|
/**
|
|
547
|
-
*
|
|
686
|
+
* A strategy for confirming transactions that uses the last valid
|
|
687
|
+
* block height for a given blockhash to check for transaction expiration.
|
|
548
688
|
*/
|
|
549
|
-
export type
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
/** The minimum slot that the request can be evaluated at */
|
|
553
|
-
minContextSlot?: number;
|
|
554
|
-
};
|
|
689
|
+
export type BlockheightBasedTransactionConfirmationStrategy = {
|
|
690
|
+
signature: TransactionSignature;
|
|
691
|
+
} & BlockhashWithExpiryBlockHeight;
|
|
555
692
|
/**
|
|
556
|
-
*
|
|
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>
|
|
557
699
|
*/
|
|
558
|
-
export type
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
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
|
+
/**
|
|
565
825
|
* Configuration object for changing `getLargestAccounts` query behavior
|
|
566
826
|
*/
|
|
567
827
|
export type GetLargestAccountsConfig = {
|
|
@@ -719,6 +979,13 @@ declare module '@solana/web3.js' {
|
|
|
719
979
|
* @deprecated Deprecated since Solana v1.8.0. Please use {@link ParsedTransactionMeta} instead.
|
|
720
980
|
*/
|
|
721
981
|
export type ParsedConfirmedTransactionMeta = ParsedTransactionMeta;
|
|
982
|
+
/**
|
|
983
|
+
* Collection of addresses loaded by a transaction using address table lookups
|
|
984
|
+
*/
|
|
985
|
+
export type LoadedAddresses = {
|
|
986
|
+
writable: Array<PublicKey>;
|
|
987
|
+
readonly: Array<PublicKey>;
|
|
988
|
+
};
|
|
722
989
|
/**
|
|
723
990
|
* Metadata for a parsed transaction on the ledger
|
|
724
991
|
*/
|
|
@@ -739,6 +1006,8 @@ declare module '@solana/web3.js' {
|
|
|
739
1006
|
postTokenBalances?: Array<TokenBalance> | null;
|
|
740
1007
|
/** The error result of transaction processing */
|
|
741
1008
|
err: TransactionError | null;
|
|
1009
|
+
/** The collection of addresses loaded using address lookup tables */
|
|
1010
|
+
loadedAddresses?: LoadedAddresses;
|
|
742
1011
|
};
|
|
743
1012
|
export type CompiledInnerInstruction = {
|
|
744
1013
|
index: number;
|
|
@@ -785,6 +1054,8 @@ declare module '@solana/web3.js' {
|
|
|
785
1054
|
};
|
|
786
1055
|
/**
|
|
787
1056
|
* A confirmed transaction on the ledger
|
|
1057
|
+
*
|
|
1058
|
+
* @deprecated Deprecated since Solana v1.8.0.
|
|
788
1059
|
*/
|
|
789
1060
|
export type ConfirmedTransaction = {
|
|
790
1061
|
/** The slot during which the transaction was processed */
|
|
@@ -905,7 +1176,9 @@ declare module '@solana/web3.js' {
|
|
|
905
1176
|
blockTime: number | null;
|
|
906
1177
|
};
|
|
907
1178
|
/**
|
|
908
|
-
* A
|
|
1179
|
+
* A confirmed block on the ledger
|
|
1180
|
+
*
|
|
1181
|
+
* @deprecated Deprecated since Solana v1.8.0.
|
|
909
1182
|
*/
|
|
910
1183
|
export type ConfirmedBlock = {
|
|
911
1184
|
/** Blockhash of this block */
|
|
@@ -1537,7 +1810,7 @@ declare module '@solana/web3.js' {
|
|
|
1537
1810
|
*/
|
|
1538
1811
|
getParsedAccountInfo(
|
|
1539
1812
|
publicKey: PublicKey,
|
|
1540
|
-
|
|
1813
|
+
commitmentOrConfig?: Commitment | GetAccountInfoConfig,
|
|
1541
1814
|
): Promise<
|
|
1542
1815
|
RpcResponseAndContext<AccountInfo<Buffer | ParsedAccountData> | null>
|
|
1543
1816
|
>;
|
|
@@ -1902,6 +2175,10 @@ declare module '@solana/web3.js' {
|
|
|
1902
2175
|
options?: SignaturesForAddressOptions,
|
|
1903
2176
|
commitment?: Finality,
|
|
1904
2177
|
): Promise<Array<ConfirmedSignatureInfo>>;
|
|
2178
|
+
getAddressLookupTable(
|
|
2179
|
+
accountKey: PublicKey,
|
|
2180
|
+
config?: GetAccountInfoConfig,
|
|
2181
|
+
): Promise<RpcResponseAndContext<AddressLookupTableAccount | null>>;
|
|
1905
2182
|
/**
|
|
1906
2183
|
* Fetch the contents of a Nonce account from the cluster, return with context
|
|
1907
2184
|
*/
|
|
@@ -1968,376 +2245,265 @@ declare module '@solana/web3.js' {
|
|
|
1968
2245
|
* Send a transaction that has already been signed, serialized into the
|
|
1969
2246
|
* wire format, and encoded as a base64 string
|
|
1970
2247
|
*/
|
|
1971
|
-
sendEncodedTransaction(
|
|
1972
|
-
encodedTransaction: string,
|
|
1973
|
-
options?: SendOptions,
|
|
1974
|
-
): Promise<TransactionSignature>;
|
|
1975
|
-
/**
|
|
1976
|
-
* Register a callback to be invoked whenever the specified account changes
|
|
1977
|
-
*
|
|
1978
|
-
* @param publicKey Public key of the account to monitor
|
|
1979
|
-
* @param callback Function to invoke whenever the account is changed
|
|
1980
|
-
* @param commitment Specify the commitment level account changes must reach before notification
|
|
1981
|
-
* @return subscription id
|
|
1982
|
-
*/
|
|
1983
|
-
onAccountChange(
|
|
1984
|
-
publicKey: PublicKey,
|
|
1985
|
-
callback: AccountChangeCallback,
|
|
1986
|
-
commitment?: Commitment,
|
|
1987
|
-
): ClientSubscriptionId;
|
|
1988
|
-
/**
|
|
1989
|
-
* Deregister an account notification callback
|
|
1990
|
-
*
|
|
1991
|
-
* @param id client subscription id to deregister
|
|
1992
|
-
*/
|
|
1993
|
-
removeAccountChangeListener(
|
|
1994
|
-
clientSubscriptionId: ClientSubscriptionId,
|
|
1995
|
-
): Promise<void>;
|
|
1996
|
-
/**
|
|
1997
|
-
* Register a callback to be invoked whenever accounts owned by the
|
|
1998
|
-
* specified program change
|
|
1999
|
-
*
|
|
2000
|
-
* @param programId Public key of the program to monitor
|
|
2001
|
-
* @param callback Function to invoke whenever the account is changed
|
|
2002
|
-
* @param commitment Specify the commitment level account changes must reach before notification
|
|
2003
|
-
* @param filters The program account filters to pass into the RPC method
|
|
2004
|
-
* @return subscription id
|
|
2005
|
-
*/
|
|
2006
|
-
onProgramAccountChange(
|
|
2007
|
-
programId: PublicKey,
|
|
2008
|
-
callback: ProgramAccountChangeCallback,
|
|
2009
|
-
commitment?: Commitment,
|
|
2010
|
-
filters?: GetProgramAccountsFilter[],
|
|
2011
|
-
): ClientSubscriptionId;
|
|
2012
|
-
/**
|
|
2013
|
-
* Deregister an account notification callback
|
|
2014
|
-
*
|
|
2015
|
-
* @param id client subscription id to deregister
|
|
2016
|
-
*/
|
|
2017
|
-
removeProgramAccountChangeListener(
|
|
2018
|
-
clientSubscriptionId: ClientSubscriptionId,
|
|
2019
|
-
): Promise<void>;
|
|
2020
|
-
/**
|
|
2021
|
-
* Registers a callback to be invoked whenever logs are emitted.
|
|
2022
|
-
*/
|
|
2023
|
-
onLogs(
|
|
2024
|
-
filter: LogsFilter,
|
|
2025
|
-
callback: LogsCallback,
|
|
2026
|
-
commitment?: Commitment,
|
|
2027
|
-
): ClientSubscriptionId;
|
|
2028
|
-
/**
|
|
2029
|
-
* Deregister a logs callback.
|
|
2030
|
-
*
|
|
2031
|
-
* @param id client subscription id to deregister.
|
|
2032
|
-
*/
|
|
2033
|
-
removeOnLogsListener(
|
|
2034
|
-
clientSubscriptionId: ClientSubscriptionId,
|
|
2035
|
-
): Promise<void>;
|
|
2036
|
-
/**
|
|
2037
|
-
* Register a callback to be invoked upon slot changes
|
|
2038
|
-
*
|
|
2039
|
-
* @param callback Function to invoke whenever the slot changes
|
|
2040
|
-
* @return subscription id
|
|
2041
|
-
*/
|
|
2042
|
-
onSlotChange(callback: SlotChangeCallback): ClientSubscriptionId;
|
|
2043
|
-
/**
|
|
2044
|
-
* Deregister a slot notification callback
|
|
2045
|
-
*
|
|
2046
|
-
* @param id client subscription id to deregister
|
|
2047
|
-
*/
|
|
2048
|
-
removeSlotChangeListener(
|
|
2049
|
-
clientSubscriptionId: ClientSubscriptionId,
|
|
2050
|
-
): Promise<void>;
|
|
2051
|
-
/**
|
|
2052
|
-
* Register a callback to be invoked upon slot updates. {@link SlotUpdate}'s
|
|
2053
|
-
* may be useful to track live progress of a cluster.
|
|
2054
|
-
*
|
|
2055
|
-
* @param callback Function to invoke whenever the slot updates
|
|
2056
|
-
* @return subscription id
|
|
2057
|
-
*/
|
|
2058
|
-
onSlotUpdate(callback: SlotUpdateCallback): ClientSubscriptionId;
|
|
2059
|
-
/**
|
|
2060
|
-
* Deregister a slot update notification callback
|
|
2061
|
-
*
|
|
2062
|
-
* @param id client subscription id to deregister
|
|
2063
|
-
*/
|
|
2064
|
-
removeSlotUpdateListener(
|
|
2065
|
-
clientSubscriptionId: ClientSubscriptionId,
|
|
2066
|
-
): Promise<void>;
|
|
2067
|
-
_buildArgs(
|
|
2068
|
-
args: Array<any>,
|
|
2069
|
-
override?: Commitment,
|
|
2070
|
-
encoding?: 'jsonParsed' | 'base64',
|
|
2071
|
-
extra?: any,
|
|
2072
|
-
): Array<any>;
|
|
2073
|
-
/**
|
|
2074
|
-
* Register a callback to be invoked upon signature updates
|
|
2075
|
-
*
|
|
2076
|
-
* @param signature Transaction signature string in base 58
|
|
2077
|
-
* @param callback Function to invoke on signature notifications
|
|
2078
|
-
* @param commitment Specify the commitment level signature must reach before notification
|
|
2079
|
-
* @return subscription id
|
|
2080
|
-
*/
|
|
2081
|
-
onSignature(
|
|
2082
|
-
signature: TransactionSignature,
|
|
2083
|
-
callback: SignatureResultCallback,
|
|
2084
|
-
commitment?: Commitment,
|
|
2085
|
-
): ClientSubscriptionId;
|
|
2086
|
-
/**
|
|
2087
|
-
* Register a callback to be invoked when a transaction is
|
|
2088
|
-
* received and/or processed.
|
|
2089
|
-
*
|
|
2090
|
-
* @param signature Transaction signature string in base 58
|
|
2091
|
-
* @param callback Function to invoke on signature notifications
|
|
2092
|
-
* @param options Enable received notifications and set the commitment
|
|
2093
|
-
* level that signature must reach before notification
|
|
2094
|
-
* @return subscription id
|
|
2095
|
-
*/
|
|
2096
|
-
onSignatureWithOptions(
|
|
2097
|
-
signature: TransactionSignature,
|
|
2098
|
-
callback: SignatureSubscriptionCallback,
|
|
2099
|
-
options?: SignatureSubscriptionOptions,
|
|
2100
|
-
): ClientSubscriptionId;
|
|
2101
|
-
/**
|
|
2102
|
-
* Deregister a signature notification callback
|
|
2103
|
-
*
|
|
2104
|
-
* @param id client subscription id to deregister
|
|
2105
|
-
*/
|
|
2106
|
-
removeSignatureListener(
|
|
2107
|
-
clientSubscriptionId: ClientSubscriptionId,
|
|
2108
|
-
): Promise<void>;
|
|
2109
|
-
/**
|
|
2110
|
-
* Register a callback to be invoked upon root changes
|
|
2111
|
-
*
|
|
2112
|
-
* @param callback Function to invoke whenever the root changes
|
|
2113
|
-
* @return subscription id
|
|
2114
|
-
*/
|
|
2115
|
-
onRootChange(callback: RootChangeCallback): ClientSubscriptionId;
|
|
2116
|
-
/**
|
|
2117
|
-
* Deregister a root notification callback
|
|
2118
|
-
*
|
|
2119
|
-
* @param id client subscription id to deregister
|
|
2120
|
-
*/
|
|
2121
|
-
removeRootChangeListener(
|
|
2122
|
-
clientSubscriptionId: ClientSubscriptionId,
|
|
2123
|
-
): Promise<void>;
|
|
2124
|
-
}
|
|
2125
|
-
|
|
2126
|
-
/**
|
|
2127
|
-
* Transaction signature as base-58 encoded string
|
|
2128
|
-
*/
|
|
2129
|
-
export type TransactionSignature = string;
|
|
2130
|
-
export const enum TransactionStatus {
|
|
2131
|
-
BLOCKHEIGHT_EXCEEDED = 0,
|
|
2132
|
-
PROCESSED = 1,
|
|
2133
|
-
TIMED_OUT = 2,
|
|
2134
|
-
}
|
|
2135
|
-
/**
|
|
2136
|
-
* Account metadata used to define instructions
|
|
2137
|
-
*/
|
|
2138
|
-
export type AccountMeta = {
|
|
2139
|
-
/** An account's public key */
|
|
2140
|
-
pubkey: PublicKey;
|
|
2141
|
-
/** True if an instruction requires a transaction signature matching `pubkey` */
|
|
2142
|
-
isSigner: boolean;
|
|
2143
|
-
/** True if the `pubkey` can be loaded as a read-write account. */
|
|
2144
|
-
isWritable: boolean;
|
|
2145
|
-
};
|
|
2146
|
-
/**
|
|
2147
|
-
* List of TransactionInstruction object fields that may be initialized at construction
|
|
2148
|
-
*/
|
|
2149
|
-
export type TransactionInstructionCtorFields = {
|
|
2150
|
-
keys: Array<AccountMeta>;
|
|
2151
|
-
programId: PublicKey;
|
|
2152
|
-
data?: Buffer;
|
|
2153
|
-
};
|
|
2154
|
-
/**
|
|
2155
|
-
* Configuration object for Transaction.serialize()
|
|
2156
|
-
*/
|
|
2157
|
-
export type SerializeConfig = {
|
|
2158
|
-
/** Require all transaction signatures be present (default: true) */
|
|
2159
|
-
requireAllSignatures?: boolean;
|
|
2160
|
-
/** Verify provided signatures (default: true) */
|
|
2161
|
-
verifySignatures?: boolean;
|
|
2162
|
-
};
|
|
2163
|
-
/**
|
|
2164
|
-
* Transaction Instruction class
|
|
2165
|
-
*/
|
|
2166
|
-
export class TransactionInstruction {
|
|
2167
|
-
/**
|
|
2168
|
-
* Public keys to include in this transaction
|
|
2169
|
-
* Boolean represents whether this pubkey needs to sign the transaction
|
|
2170
|
-
*/
|
|
2171
|
-
keys: Array<AccountMeta>;
|
|
2172
|
-
/**
|
|
2173
|
-
* Program Id to execute
|
|
2174
|
-
*/
|
|
2175
|
-
programId: PublicKey;
|
|
2176
|
-
/**
|
|
2177
|
-
* Program input
|
|
2178
|
-
*/
|
|
2179
|
-
data: Buffer;
|
|
2180
|
-
constructor(opts: TransactionInstructionCtorFields);
|
|
2181
|
-
}
|
|
2182
|
-
/**
|
|
2183
|
-
* Pair of signature and corresponding public key
|
|
2184
|
-
*/
|
|
2185
|
-
export type SignaturePubkeyPair = {
|
|
2186
|
-
signature: Buffer | null;
|
|
2187
|
-
publicKey: PublicKey;
|
|
2188
|
-
};
|
|
2189
|
-
/**
|
|
2190
|
-
* List of Transaction object fields that may be initialized at construction
|
|
2191
|
-
*/
|
|
2192
|
-
export type TransactionCtorFields_DEPRECATED = {
|
|
2193
|
-
/** Optional nonce information used for offline nonce'd transactions */
|
|
2194
|
-
nonceInfo?: NonceInformation | null;
|
|
2195
|
-
/** The transaction fee payer */
|
|
2196
|
-
feePayer?: PublicKey | null;
|
|
2197
|
-
/** One or more signatures */
|
|
2198
|
-
signatures?: Array<SignaturePubkeyPair>;
|
|
2199
|
-
/** A recent blockhash */
|
|
2200
|
-
recentBlockhash?: Blockhash;
|
|
2201
|
-
};
|
|
2202
|
-
export type TransactionCtorFields = TransactionCtorFields_DEPRECATED;
|
|
2203
|
-
/**
|
|
2204
|
-
* List of Transaction object fields that may be initialized at construction
|
|
2205
|
-
*/
|
|
2206
|
-
export type TransactionBlockhashCtor = {
|
|
2207
|
-
/** The transaction fee payer */
|
|
2208
|
-
feePayer?: PublicKey | null;
|
|
2209
|
-
/** One or more signatures */
|
|
2210
|
-
signatures?: Array<SignaturePubkeyPair>;
|
|
2211
|
-
/** A recent blockhash */
|
|
2212
|
-
blockhash: Blockhash;
|
|
2213
|
-
/** the last block chain can advance to before tx is exportd expired */
|
|
2214
|
-
lastValidBlockHeight: number;
|
|
2215
|
-
};
|
|
2216
|
-
/**
|
|
2217
|
-
* Nonce information to be used to build an offline Transaction.
|
|
2218
|
-
*/
|
|
2219
|
-
export type NonceInformation = {
|
|
2220
|
-
/** The current blockhash stored in the nonce */
|
|
2221
|
-
nonce: Blockhash;
|
|
2222
|
-
/** AdvanceNonceAccount Instruction */
|
|
2223
|
-
nonceInstruction: TransactionInstruction;
|
|
2224
|
-
};
|
|
2225
|
-
/**
|
|
2226
|
-
* Transaction class
|
|
2227
|
-
*/
|
|
2228
|
-
export class Transaction {
|
|
2229
|
-
/**
|
|
2230
|
-
* Signatures for the transaction. Typically created by invoking the
|
|
2231
|
-
* `sign()` method
|
|
2232
|
-
*/
|
|
2233
|
-
signatures: Array<SignaturePubkeyPair>;
|
|
2248
|
+
sendEncodedTransaction(
|
|
2249
|
+
encodedTransaction: string,
|
|
2250
|
+
options?: SendOptions,
|
|
2251
|
+
): Promise<TransactionSignature>;
|
|
2234
2252
|
/**
|
|
2235
|
-
*
|
|
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
|
|
2236
2259
|
*/
|
|
2237
|
-
|
|
2260
|
+
onAccountChange(
|
|
2261
|
+
publicKey: PublicKey,
|
|
2262
|
+
callback: AccountChangeCallback,
|
|
2263
|
+
commitment?: Commitment,
|
|
2264
|
+
): ClientSubscriptionId;
|
|
2238
2265
|
/**
|
|
2239
|
-
*
|
|
2266
|
+
* Deregister an account notification callback
|
|
2267
|
+
*
|
|
2268
|
+
* @param id client subscription id to deregister
|
|
2240
2269
|
*/
|
|
2241
|
-
|
|
2270
|
+
removeAccountChangeListener(
|
|
2271
|
+
clientSubscriptionId: ClientSubscriptionId,
|
|
2272
|
+
): Promise<void>;
|
|
2242
2273
|
/**
|
|
2243
|
-
*
|
|
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
|
|
2244
2282
|
*/
|
|
2245
|
-
|
|
2283
|
+
onProgramAccountChange(
|
|
2284
|
+
programId: PublicKey,
|
|
2285
|
+
callback: ProgramAccountChangeCallback,
|
|
2286
|
+
commitment?: Commitment,
|
|
2287
|
+
filters?: GetProgramAccountsFilter[],
|
|
2288
|
+
): ClientSubscriptionId;
|
|
2246
2289
|
/**
|
|
2247
|
-
*
|
|
2290
|
+
* Deregister an account notification callback
|
|
2291
|
+
*
|
|
2292
|
+
* @param id client subscription id to deregister
|
|
2248
2293
|
*/
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
* */
|
|
2253
|
-
lastValidBlockHeight?: number;
|
|
2294
|
+
removeProgramAccountChangeListener(
|
|
2295
|
+
clientSubscriptionId: ClientSubscriptionId,
|
|
2296
|
+
): Promise<void>;
|
|
2254
2297
|
/**
|
|
2255
|
-
*
|
|
2256
|
-
* Nonce hash instead of a recentBlockhash. Must be populated by the caller
|
|
2298
|
+
* Registers a callback to be invoked whenever logs are emitted.
|
|
2257
2299
|
*/
|
|
2258
|
-
|
|
2259
|
-
|
|
2300
|
+
onLogs(
|
|
2301
|
+
filter: LogsFilter,
|
|
2302
|
+
callback: LogsCallback,
|
|
2303
|
+
commitment?: Commitment,
|
|
2304
|
+
): ClientSubscriptionId;
|
|
2260
2305
|
/**
|
|
2261
|
-
*
|
|
2262
|
-
*
|
|
2306
|
+
* Deregister a logs callback.
|
|
2307
|
+
*
|
|
2308
|
+
* @param id client subscription id to deregister.
|
|
2263
2309
|
*/
|
|
2264
|
-
|
|
2310
|
+
removeOnLogsListener(
|
|
2311
|
+
clientSubscriptionId: ClientSubscriptionId,
|
|
2312
|
+
): Promise<void>;
|
|
2265
2313
|
/**
|
|
2266
|
-
*
|
|
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
|
|
2267
2318
|
*/
|
|
2268
|
-
|
|
2269
|
-
...items: Array<
|
|
2270
|
-
Transaction | TransactionInstruction | TransactionInstructionCtorFields
|
|
2271
|
-
>
|
|
2272
|
-
): Transaction;
|
|
2319
|
+
onSlotChange(callback: SlotChangeCallback): ClientSubscriptionId;
|
|
2273
2320
|
/**
|
|
2274
|
-
*
|
|
2321
|
+
* Deregister a slot notification callback
|
|
2322
|
+
*
|
|
2323
|
+
* @param id client subscription id to deregister
|
|
2275
2324
|
*/
|
|
2276
|
-
|
|
2325
|
+
removeSlotChangeListener(
|
|
2326
|
+
clientSubscriptionId: ClientSubscriptionId,
|
|
2327
|
+
): Promise<void>;
|
|
2277
2328
|
/**
|
|
2278
|
-
*
|
|
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
|
|
2279
2334
|
*/
|
|
2280
|
-
|
|
2335
|
+
onSlotUpdate(callback: SlotUpdateCallback): ClientSubscriptionId;
|
|
2281
2336
|
/**
|
|
2282
|
-
*
|
|
2337
|
+
* Deregister a slot update notification callback
|
|
2338
|
+
*
|
|
2339
|
+
* @param id client subscription id to deregister
|
|
2283
2340
|
*/
|
|
2284
|
-
|
|
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>;
|
|
2285
2350
|
/**
|
|
2286
|
-
*
|
|
2287
|
-
* The first signer will be used as the transaction fee payer account.
|
|
2288
|
-
*
|
|
2289
|
-
* Signatures can be added with either `partialSign` or `addSignature`
|
|
2351
|
+
* Register a callback to be invoked upon signature updates
|
|
2290
2352
|
*
|
|
2291
|
-
* @
|
|
2292
|
-
*
|
|
2293
|
-
*
|
|
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
|
|
2294
2357
|
*/
|
|
2295
|
-
|
|
2358
|
+
onSignature(
|
|
2359
|
+
signature: TransactionSignature,
|
|
2360
|
+
callback: SignatureResultCallback,
|
|
2361
|
+
commitment?: Commitment,
|
|
2362
|
+
): ClientSubscriptionId;
|
|
2296
2363
|
/**
|
|
2297
|
-
*
|
|
2298
|
-
*
|
|
2299
|
-
* and is used identify and confirm transactions.
|
|
2364
|
+
* Register a callback to be invoked when a transaction is
|
|
2365
|
+
* received and/or processed.
|
|
2300
2366
|
*
|
|
2301
|
-
*
|
|
2302
|
-
*
|
|
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
|
|
2303
2380
|
*
|
|
2304
|
-
*
|
|
2305
|
-
|
|
2306
|
-
|
|
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
|
|
2307
2388
|
*
|
|
2308
|
-
*
|
|
2389
|
+
* @param callback Function to invoke whenever the root changes
|
|
2390
|
+
* @return subscription id
|
|
2309
2391
|
*/
|
|
2310
|
-
|
|
2392
|
+
onRootChange(callback: RootChangeCallback): ClientSubscriptionId;
|
|
2311
2393
|
/**
|
|
2312
|
-
*
|
|
2313
|
-
* correspond to either the fee payer or a signer account in the transaction
|
|
2314
|
-
* instructions.
|
|
2394
|
+
* Deregister a root notification callback
|
|
2315
2395
|
*
|
|
2316
|
-
*
|
|
2396
|
+
* @param id client subscription id to deregister
|
|
2317
2397
|
*/
|
|
2318
|
-
|
|
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 {
|
|
2319
2408
|
/**
|
|
2320
|
-
*
|
|
2321
|
-
*
|
|
2322
|
-
*
|
|
2409
|
+
* Minimum number of signatures required to load a program not including
|
|
2410
|
+
* retries
|
|
2411
|
+
*
|
|
2412
|
+
* Can be used to calculate transaction fees
|
|
2323
2413
|
*/
|
|
2324
|
-
|
|
2414
|
+
static getMinNumSignatures(dataLength: number): number;
|
|
2325
2415
|
/**
|
|
2326
|
-
*
|
|
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
|
|
2327
2424
|
*/
|
|
2328
|
-
|
|
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 {
|
|
2329
2479
|
/**
|
|
2330
|
-
*
|
|
2480
|
+
* Amount of program data placed in each load Transaction
|
|
2331
2481
|
*/
|
|
2332
|
-
|
|
2482
|
+
static chunkSize: number;
|
|
2333
2483
|
/**
|
|
2334
|
-
*
|
|
2484
|
+
* Minimum number of signatures required to load a program not including
|
|
2485
|
+
* retries
|
|
2486
|
+
*
|
|
2487
|
+
* Can be used to calculate transaction fees
|
|
2335
2488
|
*/
|
|
2336
|
-
static
|
|
2489
|
+
static getMinNumSignatures(dataLength: number): number;
|
|
2337
2490
|
/**
|
|
2338
|
-
*
|
|
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
|
|
2339
2499
|
*/
|
|
2340
|
-
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>;
|
|
2341
2507
|
}
|
|
2342
2508
|
|
|
2343
2509
|
export type CreateLookupTableParams = {
|
|
@@ -2427,39 +2593,6 @@ declare module '@solana/web3.js' {
|
|
|
2427
2593
|
): TransactionInstruction;
|
|
2428
2594
|
}
|
|
2429
2595
|
|
|
2430
|
-
export const BPF_LOADER_DEPRECATED_PROGRAM_ID: PublicKey;
|
|
2431
|
-
|
|
2432
|
-
export const BPF_LOADER_PROGRAM_ID: PublicKey;
|
|
2433
|
-
/**
|
|
2434
|
-
* Factory class for transactions to interact with a program loader
|
|
2435
|
-
*/
|
|
2436
|
-
export class BpfLoader {
|
|
2437
|
-
/**
|
|
2438
|
-
* Minimum number of signatures required to load a program not including
|
|
2439
|
-
* retries
|
|
2440
|
-
*
|
|
2441
|
-
* Can be used to calculate transaction fees
|
|
2442
|
-
*/
|
|
2443
|
-
static getMinNumSignatures(dataLength: number): number;
|
|
2444
|
-
/**
|
|
2445
|
-
* Load a BPF program
|
|
2446
|
-
*
|
|
2447
|
-
* @param connection The connection to use
|
|
2448
|
-
* @param payer Account that will pay program loading fees
|
|
2449
|
-
* @param program Account to load the program into
|
|
2450
|
-
* @param elf The entire ELF containing the BPF program
|
|
2451
|
-
* @param loaderProgramId The program id of the BPF loader to use
|
|
2452
|
-
* @return true if program was loaded successfully, false if program was already loaded
|
|
2453
|
-
*/
|
|
2454
|
-
static load(
|
|
2455
|
-
connection: Connection,
|
|
2456
|
-
payer: Signer,
|
|
2457
|
-
program: Signer,
|
|
2458
|
-
elf: Buffer | Uint8Array | Array<number>,
|
|
2459
|
-
loaderProgramId: PublicKey,
|
|
2460
|
-
): Promise<boolean>;
|
|
2461
|
-
}
|
|
2462
|
-
|
|
2463
2596
|
/**
|
|
2464
2597
|
* Compute Budget Instruction class
|
|
2465
2598
|
*/
|
|
@@ -2593,37 +2726,66 @@ declare module '@solana/web3.js' {
|
|
|
2593
2726
|
}
|
|
2594
2727
|
|
|
2595
2728
|
/**
|
|
2596
|
-
*
|
|
2729
|
+
* Params for creating an secp256k1 instruction using a public key
|
|
2597
2730
|
*/
|
|
2598
|
-
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 {
|
|
2599
2757
|
/**
|
|
2600
|
-
*
|
|
2758
|
+
* Public key that identifies the secp256k1 program
|
|
2601
2759
|
*/
|
|
2602
|
-
static
|
|
2760
|
+
static programId: PublicKey;
|
|
2603
2761
|
/**
|
|
2604
|
-
*
|
|
2605
|
-
*
|
|
2606
|
-
*
|
|
2607
|
-
* 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
|
|
2608
2764
|
*/
|
|
2609
|
-
static
|
|
2765
|
+
static publicKeyToEthAddress(
|
|
2766
|
+
publicKey: Buffer | Uint8Array | Array<number>,
|
|
2767
|
+
): Buffer;
|
|
2610
2768
|
/**
|
|
2611
|
-
*
|
|
2612
|
-
*
|
|
2613
|
-
* @param connection The connection to use
|
|
2614
|
-
* @param payer System account that pays to load the program
|
|
2615
|
-
* @param program Account to load the program into
|
|
2616
|
-
* @param programId Public key that identifies the loader
|
|
2617
|
-
* @param data Program octets
|
|
2618
|
-
* @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.
|
|
2619
2771
|
*/
|
|
2620
|
-
static
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
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;
|
|
2627
2789
|
}
|
|
2628
2790
|
|
|
2629
2791
|
/**
|
|
@@ -3272,194 +3434,26 @@ declare module '@solana/web3.js' {
|
|
|
3272
3434
|
*/
|
|
3273
3435
|
static nonceInitialize(
|
|
3274
3436
|
params: InitializeNonceParams,
|
|
3275
|
-
): TransactionInstruction;
|
|
3276
|
-
/**
|
|
3277
|
-
* Generate an instruction to advance the nonce in a Nonce account
|
|
3278
|
-
*/
|
|
3279
|
-
static nonceAdvance(params: AdvanceNonceParams): TransactionInstruction;
|
|
3280
|
-
/**
|
|
3281
|
-
* Generate a transaction instruction that withdraws lamports from a Nonce account
|
|
3282
|
-
*/
|
|
3283
|
-
static nonceWithdraw(params: WithdrawNonceParams): TransactionInstruction;
|
|
3284
|
-
/**
|
|
3285
|
-
* Generate a transaction instruction that authorizes a new PublicKey as the authority
|
|
3286
|
-
* on a Nonce account.
|
|
3287
|
-
*/
|
|
3288
|
-
static nonceAuthorize(params: AuthorizeNonceParams): TransactionInstruction;
|
|
3289
|
-
/**
|
|
3290
|
-
* Generate a transaction instruction that allocates space in an account without funding
|
|
3291
|
-
*/
|
|
3292
|
-
static allocate(
|
|
3293
|
-
params: AllocateParams | AllocateWithSeedParams,
|
|
3294
|
-
): TransactionInstruction;
|
|
3295
|
-
}
|
|
3296
|
-
|
|
3297
|
-
/**
|
|
3298
|
-
* Params for creating an secp256k1 instruction using a public key
|
|
3299
|
-
*/
|
|
3300
|
-
export type CreateSecp256k1InstructionWithPublicKeyParams = {
|
|
3301
|
-
publicKey: Buffer | Uint8Array | Array<number>;
|
|
3302
|
-
message: Buffer | Uint8Array | Array<number>;
|
|
3303
|
-
signature: Buffer | Uint8Array | Array<number>;
|
|
3304
|
-
recoveryId: number;
|
|
3305
|
-
instructionIndex?: number;
|
|
3306
|
-
};
|
|
3307
|
-
/**
|
|
3308
|
-
* Params for creating an secp256k1 instruction using an Ethereum address
|
|
3309
|
-
*/
|
|
3310
|
-
export type CreateSecp256k1InstructionWithEthAddressParams = {
|
|
3311
|
-
ethAddress: Buffer | Uint8Array | Array<number> | string;
|
|
3312
|
-
message: Buffer | Uint8Array | Array<number>;
|
|
3313
|
-
signature: Buffer | Uint8Array | Array<number>;
|
|
3314
|
-
recoveryId: number;
|
|
3315
|
-
instructionIndex?: number;
|
|
3316
|
-
};
|
|
3317
|
-
/**
|
|
3318
|
-
* Params for creating an secp256k1 instruction using a private key
|
|
3319
|
-
*/
|
|
3320
|
-
export type CreateSecp256k1InstructionWithPrivateKeyParams = {
|
|
3321
|
-
privateKey: Buffer | Uint8Array | Array<number>;
|
|
3322
|
-
message: Buffer | Uint8Array | Array<number>;
|
|
3323
|
-
instructionIndex?: number;
|
|
3324
|
-
};
|
|
3325
|
-
export class Secp256k1Program {
|
|
3326
|
-
/**
|
|
3327
|
-
* Public key that identifies the secp256k1 program
|
|
3328
|
-
*/
|
|
3329
|
-
static programId: PublicKey;
|
|
3330
|
-
/**
|
|
3331
|
-
* Construct an Ethereum address from a secp256k1 public key buffer.
|
|
3332
|
-
* @param {Buffer} publicKey a 64 byte secp256k1 public key buffer
|
|
3333
|
-
*/
|
|
3334
|
-
static publicKeyToEthAddress(
|
|
3335
|
-
publicKey: Buffer | Uint8Array | Array<number>,
|
|
3336
|
-
): Buffer;
|
|
3337
|
-
/**
|
|
3338
|
-
* Create an secp256k1 instruction with a public key. The public key
|
|
3339
|
-
* must be a buffer that is 64 bytes long.
|
|
3340
|
-
*/
|
|
3341
|
-
static createInstructionWithPublicKey(
|
|
3342
|
-
params: CreateSecp256k1InstructionWithPublicKeyParams,
|
|
3343
|
-
): TransactionInstruction;
|
|
3344
|
-
/**
|
|
3345
|
-
* Create an secp256k1 instruction with an Ethereum address. The address
|
|
3346
|
-
* must be a hex string or a buffer that is 20 bytes long.
|
|
3347
|
-
*/
|
|
3348
|
-
static createInstructionWithEthAddress(
|
|
3349
|
-
params: CreateSecp256k1InstructionWithEthAddressParams,
|
|
3350
|
-
): TransactionInstruction;
|
|
3351
|
-
/**
|
|
3352
|
-
* Create an secp256k1 instruction with a private key. The private key
|
|
3353
|
-
* must be a buffer that is 32 bytes long.
|
|
3354
|
-
*/
|
|
3355
|
-
static createInstructionWithPrivateKey(
|
|
3356
|
-
params: CreateSecp256k1InstructionWithPrivateKeyParams,
|
|
3357
|
-
): TransactionInstruction;
|
|
3358
|
-
}
|
|
3359
|
-
|
|
3360
|
-
/**
|
|
3361
|
-
* Maximum over-the-wire size of a Transaction
|
|
3362
|
-
*
|
|
3363
|
-
* 1280 is IPv6 minimum MTU
|
|
3364
|
-
* 40 bytes is the size of the IPv6 header
|
|
3365
|
-
* 8 bytes is the size of the fragment header
|
|
3366
|
-
*/
|
|
3367
|
-
export const PACKET_DATA_SIZE: number;
|
|
3368
|
-
export const SIGNATURE_LENGTH_IN_BYTES = 64;
|
|
3369
|
-
|
|
3370
|
-
export const VALIDATOR_INFO_KEY: PublicKey;
|
|
3371
|
-
/**
|
|
3372
|
-
* Info used to identity validators.
|
|
3373
|
-
*/
|
|
3374
|
-
export type Info = {
|
|
3375
|
-
/** validator name */
|
|
3376
|
-
name: string;
|
|
3377
|
-
/** optional, validator website */
|
|
3378
|
-
website?: string;
|
|
3379
|
-
/** optional, extra information the validator chose to share */
|
|
3380
|
-
details?: string;
|
|
3381
|
-
/** optional, used to identify validators on keybase.io */
|
|
3382
|
-
keybaseUsername?: string;
|
|
3383
|
-
};
|
|
3384
|
-
/**
|
|
3385
|
-
* ValidatorInfo class
|
|
3386
|
-
*/
|
|
3387
|
-
export class ValidatorInfo {
|
|
3388
|
-
/**
|
|
3389
|
-
* validator public key
|
|
3390
|
-
*/
|
|
3391
|
-
key: PublicKey;
|
|
3437
|
+
): TransactionInstruction;
|
|
3392
3438
|
/**
|
|
3393
|
-
*
|
|
3439
|
+
* Generate an instruction to advance the nonce in a Nonce account
|
|
3394
3440
|
*/
|
|
3395
|
-
|
|
3441
|
+
static nonceAdvance(params: AdvanceNonceParams): TransactionInstruction;
|
|
3396
3442
|
/**
|
|
3397
|
-
*
|
|
3398
|
-
*
|
|
3399
|
-
* @param key validator public key
|
|
3400
|
-
* @param info validator information
|
|
3443
|
+
* Generate a transaction instruction that withdraws lamports from a Nonce account
|
|
3401
3444
|
*/
|
|
3402
|
-
|
|
3445
|
+
static nonceWithdraw(params: WithdrawNonceParams): TransactionInstruction;
|
|
3403
3446
|
/**
|
|
3404
|
-
*
|
|
3405
|
-
*
|
|
3406
|
-
*
|
|
3407
|
-
* @param buffer config account data
|
|
3408
|
-
* @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.
|
|
3409
3449
|
*/
|
|
3410
|
-
static
|
|
3411
|
-
buffer: Buffer | Uint8Array | Array<number>,
|
|
3412
|
-
): ValidatorInfo | null;
|
|
3413
|
-
}
|
|
3414
|
-
|
|
3415
|
-
export const VOTE_PROGRAM_ID: PublicKey;
|
|
3416
|
-
export type Lockout = {
|
|
3417
|
-
slot: number;
|
|
3418
|
-
confirmationCount: number;
|
|
3419
|
-
};
|
|
3420
|
-
/**
|
|
3421
|
-
* History of how many credits earned by the end of each epoch
|
|
3422
|
-
*/
|
|
3423
|
-
export type EpochCredits = Readonly<{
|
|
3424
|
-
epoch: number;
|
|
3425
|
-
credits: number;
|
|
3426
|
-
prevCredits: number;
|
|
3427
|
-
}>;
|
|
3428
|
-
export type AuthorizedVoter = Readonly<{
|
|
3429
|
-
epoch: number;
|
|
3430
|
-
authorizedVoter: PublicKey;
|
|
3431
|
-
}>;
|
|
3432
|
-
export type PriorVoter = Readonly<{
|
|
3433
|
-
authorizedPubkey: PublicKey;
|
|
3434
|
-
epochOfLastAuthorizedSwitch: number;
|
|
3435
|
-
targetEpoch: number;
|
|
3436
|
-
}>;
|
|
3437
|
-
export type BlockTimestamp = Readonly<{
|
|
3438
|
-
slot: number;
|
|
3439
|
-
timestamp: number;
|
|
3440
|
-
}>;
|
|
3441
|
-
/**
|
|
3442
|
-
* VoteAccount class
|
|
3443
|
-
*/
|
|
3444
|
-
export class VoteAccount {
|
|
3445
|
-
nodePubkey: PublicKey;
|
|
3446
|
-
authorizedWithdrawer: PublicKey;
|
|
3447
|
-
commission: number;
|
|
3448
|
-
rootSlot: number | null;
|
|
3449
|
-
votes: Lockout[];
|
|
3450
|
-
authorizedVoters: AuthorizedVoter[];
|
|
3451
|
-
priorVoters: PriorVoter[];
|
|
3452
|
-
epochCredits: EpochCredits[];
|
|
3453
|
-
lastTimestamp: BlockTimestamp;
|
|
3450
|
+
static nonceAuthorize(params: AuthorizeNonceParams): TransactionInstruction;
|
|
3454
3451
|
/**
|
|
3455
|
-
*
|
|
3456
|
-
*
|
|
3457
|
-
* @param buffer account data
|
|
3458
|
-
* @return VoteAccount
|
|
3452
|
+
* Generate a transaction instruction that allocates space in an account without funding
|
|
3459
3453
|
*/
|
|
3460
|
-
static
|
|
3461
|
-
|
|
3462
|
-
):
|
|
3454
|
+
static allocate(
|
|
3455
|
+
params: AllocateParams | AllocateWithSeedParams,
|
|
3456
|
+
): TransactionInstruction;
|
|
3463
3457
|
}
|
|
3464
3458
|
|
|
3465
3459
|
/**
|
|
@@ -3603,6 +3597,101 @@ declare module '@solana/web3.js' {
|
|
|
3603
3597
|
static withdraw(params: WithdrawFromVoteAccountParams): Transaction;
|
|
3604
3598
|
}
|
|
3605
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
|
+
|
|
3606
3695
|
export const SYSVAR_CLOCK_PUBKEY: PublicKey;
|
|
3607
3696
|
export const SYSVAR_EPOCH_SCHEDULE_PUBKEY: PublicKey;
|
|
3608
3697
|
export const SYSVAR_INSTRUCTIONS_PUBKEY: PublicKey;
|
|
@@ -3613,64 +3702,11 @@ declare module '@solana/web3.js' {
|
|
|
3613
3702
|
export const SYSVAR_SLOT_HISTORY_PUBKEY: PublicKey;
|
|
3614
3703
|
export const SYSVAR_STAKE_HISTORY_PUBKEY: PublicKey;
|
|
3615
3704
|
|
|
3616
|
-
export
|
|
3617
|
-
logs: string[] | undefined;
|
|
3618
|
-
constructor(message: string, logs?: string[]);
|
|
3619
|
-
}
|
|
3620
|
-
export const SolanaJSONRPCErrorCode: {
|
|
3621
|
-
readonly JSON_RPC_SERVER_ERROR_BLOCK_CLEANED_UP: -32001;
|
|
3622
|
-
readonly JSON_RPC_SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE: -32002;
|
|
3623
|
-
readonly JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_VERIFICATION_FAILURE: -32003;
|
|
3624
|
-
readonly JSON_RPC_SERVER_ERROR_BLOCK_NOT_AVAILABLE: -32004;
|
|
3625
|
-
readonly JSON_RPC_SERVER_ERROR_NODE_UNHEALTHY: -32005;
|
|
3626
|
-
readonly JSON_RPC_SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE: -32006;
|
|
3627
|
-
readonly JSON_RPC_SERVER_ERROR_SLOT_SKIPPED: -32007;
|
|
3628
|
-
readonly JSON_RPC_SERVER_ERROR_NO_SNAPSHOT: -32008;
|
|
3629
|
-
readonly JSON_RPC_SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED: -32009;
|
|
3630
|
-
readonly JSON_RPC_SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX: -32010;
|
|
3631
|
-
readonly JSON_RPC_SERVER_ERROR_TRANSACTION_HISTORY_NOT_AVAILABLE: -32011;
|
|
3632
|
-
readonly JSON_RPC_SCAN_ERROR: -32012;
|
|
3633
|
-
readonly JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_LEN_MISMATCH: -32013;
|
|
3634
|
-
readonly JSON_RPC_SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET: -32014;
|
|
3635
|
-
readonly JSON_RPC_SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION: -32015;
|
|
3636
|
-
readonly JSON_RPC_SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED: -32016;
|
|
3637
|
-
};
|
|
3638
|
-
export type SolanaJSONRPCErrorCodeEnum =
|
|
3639
|
-
typeof SolanaJSONRPCErrorCode[keyof typeof SolanaJSONRPCErrorCode];
|
|
3640
|
-
export class SolanaJSONRPCError extends Error {
|
|
3641
|
-
code: SolanaJSONRPCErrorCodeEnum | unknown;
|
|
3642
|
-
data?: any;
|
|
3643
|
-
constructor(
|
|
3644
|
-
{
|
|
3645
|
-
code,
|
|
3646
|
-
message,
|
|
3647
|
-
data,
|
|
3648
|
-
}: Readonly<{
|
|
3649
|
-
code: unknown;
|
|
3650
|
-
message: string;
|
|
3651
|
-
data?: any;
|
|
3652
|
-
}>,
|
|
3653
|
-
customMessage?: string,
|
|
3654
|
-
);
|
|
3655
|
-
}
|
|
3656
|
-
|
|
3705
|
+
export type Cluster = 'devnet' | 'testnet' | 'mainnet-beta';
|
|
3657
3706
|
/**
|
|
3658
|
-
*
|
|
3659
|
-
*
|
|
3660
|
-
* If `commitment` option is not specified, defaults to 'max' commitment.
|
|
3661
|
-
*
|
|
3662
|
-
* @param {Connection} connection
|
|
3663
|
-
* @param {Transaction} transaction
|
|
3664
|
-
* @param {Array<Signer>} signers
|
|
3665
|
-
* @param {ConfirmOptions} [options]
|
|
3666
|
-
* @returns {Promise<TransactionSignature>}
|
|
3707
|
+
* Retrieves the RPC API URL for the specified cluster
|
|
3667
3708
|
*/
|
|
3668
|
-
export function
|
|
3669
|
-
connection: Connection,
|
|
3670
|
-
transaction: Transaction,
|
|
3671
|
-
signers: Array<Signer>,
|
|
3672
|
-
options?: ConfirmOptions,
|
|
3673
|
-
): Promise<TransactionSignature>;
|
|
3709
|
+
export function clusterApiUrl(cluster?: Cluster, tls?: boolean): string;
|
|
3674
3710
|
|
|
3675
3711
|
/**
|
|
3676
3712
|
* Send and confirm a raw transaction
|
|
@@ -3699,20 +3735,23 @@ declare module '@solana/web3.js' {
|
|
|
3699
3735
|
options?: ConfirmOptions,
|
|
3700
3736
|
): Promise<TransactionSignature>;
|
|
3701
3737
|
|
|
3702
|
-
export class TransactionExpiredBlockheightExceededError extends Error {
|
|
3703
|
-
signature: string;
|
|
3704
|
-
constructor(signature: string);
|
|
3705
|
-
}
|
|
3706
|
-
export class TransactionExpiredTimeoutError extends Error {
|
|
3707
|
-
signature: string;
|
|
3708
|
-
constructor(signature: string, timeoutSeconds: number);
|
|
3709
|
-
}
|
|
3710
|
-
|
|
3711
|
-
export type Cluster = 'devnet' | 'testnet' | 'mainnet-beta';
|
|
3712
3738
|
/**
|
|
3713
|
-
*
|
|
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>}
|
|
3714
3748
|
*/
|
|
3715
|
-
export function
|
|
3749
|
+
export function sendAndConfirmTransaction(
|
|
3750
|
+
connection: Connection,
|
|
3751
|
+
transaction: Transaction,
|
|
3752
|
+
signers: Array<Signer>,
|
|
3753
|
+
options?: ConfirmOptions,
|
|
3754
|
+
): Promise<TransactionSignature>;
|
|
3716
3755
|
|
|
3717
3756
|
/**
|
|
3718
3757
|
* There are 1-billion lamports in one SOL
|