@solana/web3.js 1.40.0 → 1.41.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.d.ts ADDED
@@ -0,0 +1,3291 @@
1
+ /// <reference types="node" />
2
+ declare module '@solana/web3.js' {
3
+ import {Buffer} from 'buffer';
4
+ import crossFetch from 'cross-fetch';
5
+
6
+ export class Struct {
7
+ constructor(properties: any);
8
+ encode(): Buffer;
9
+ static decode(data: Buffer): any;
10
+ static decodeUnchecked(data: Buffer): any;
11
+ }
12
+ export class Enum extends Struct {
13
+ enum: string;
14
+ constructor(properties: any);
15
+ }
16
+ export const SOLANA_SCHEMA: Map<Function, any>;
17
+
18
+ /**
19
+ * Maximum length of derived pubkey seed
20
+ */
21
+ export const MAX_SEED_LENGTH = 32;
22
+ /**
23
+ * Value to be converted into public key
24
+ */
25
+ export type PublicKeyInitData =
26
+ | number
27
+ | string
28
+ | Buffer
29
+ | Uint8Array
30
+ | Array<number>
31
+ | PublicKeyData;
32
+ /**
33
+ * JSON object representation of PublicKey class
34
+ */
35
+ export type PublicKeyData = {};
36
+ /**
37
+ * A public key
38
+ */
39
+ export class PublicKey extends Struct {
40
+ /**
41
+ * Create a new PublicKey object
42
+ * @param value ed25519 public key as buffer or base-58 encoded string
43
+ */
44
+ constructor(value: PublicKeyInitData);
45
+ /**
46
+ * Default public key value. (All zeros)
47
+ */
48
+ static default: PublicKey;
49
+ /**
50
+ * Checks if two publicKeys are equal
51
+ */
52
+ equals(publicKey: PublicKey): boolean;
53
+ /**
54
+ * Return the base-58 representation of the public key
55
+ */
56
+ toBase58(): string;
57
+ toJSON(): string;
58
+ /**
59
+ * Return the byte array representation of the public key
60
+ */
61
+ toBytes(): Uint8Array;
62
+ /**
63
+ * Return the Buffer representation of the public key
64
+ */
65
+ toBuffer(): Buffer;
66
+ /**
67
+ * Return the base-58 representation of the public key
68
+ */
69
+ toString(): string;
70
+ /**
71
+ * Derive a public key from another key, a seed, and a program ID.
72
+ * The program ID will also serve as the owner of the public key, giving
73
+ * it permission to write data to the account.
74
+ */
75
+ static createWithSeed(
76
+ fromPublicKey: PublicKey,
77
+ seed: string,
78
+ programId: PublicKey,
79
+ ): Promise<PublicKey>;
80
+ /**
81
+ * Derive a program address from seeds and a program ID.
82
+ */
83
+ static createProgramAddressSync(
84
+ seeds: Array<Buffer | Uint8Array>,
85
+ programId: PublicKey,
86
+ ): PublicKey;
87
+ /**
88
+ * Async version of createProgramAddressSync
89
+ * For backwards compatibility
90
+ */
91
+ static createProgramAddress(
92
+ seeds: Array<Buffer | Uint8Array>,
93
+ programId: PublicKey,
94
+ ): Promise<PublicKey>;
95
+ /**
96
+ * Find a valid program address
97
+ *
98
+ * Valid program addresses must fall off the ed25519 curve. This function
99
+ * iterates a nonce until it finds one that when combined with the seeds
100
+ * results in a valid program address.
101
+ */
102
+ static findProgramAddressSync(
103
+ seeds: Array<Buffer | Uint8Array>,
104
+ programId: PublicKey,
105
+ ): [PublicKey, number];
106
+ /**
107
+ * Async version of findProgramAddressSync
108
+ * For backwards compatibility
109
+ */
110
+ static findProgramAddress(
111
+ seeds: Array<Buffer | Uint8Array>,
112
+ programId: PublicKey,
113
+ ): Promise<[PublicKey, number]>;
114
+ /**
115
+ * Check that a pubkey is on the ed25519 curve.
116
+ */
117
+ static isOnCurve(pubkeyData: PublicKeyInitData): boolean;
118
+ }
119
+
120
+ /**
121
+ * An account key pair (public and secret keys).
122
+ *
123
+ * @deprecated since v1.10.0, please use {@link Keypair} instead.
124
+ */
125
+ export class Account {
126
+ /**
127
+ * Create a new Account object
128
+ *
129
+ * If the secretKey parameter is not provided a new key pair is randomly
130
+ * created for the account
131
+ *
132
+ * @param secretKey Secret key for the account
133
+ */
134
+ constructor(secretKey?: Buffer | Uint8Array | Array<number>);
135
+ /**
136
+ * The public key for this account
137
+ */
138
+ get publicKey(): PublicKey;
139
+ /**
140
+ * The **unencrypted** secret key for this account
141
+ */
142
+ get secretKey(): Buffer;
143
+ }
144
+
145
+ /**
146
+ * Blockhash as Base58 string.
147
+ */
148
+ export type Blockhash = string;
149
+
150
+ export const BPF_LOADER_DEPRECATED_PROGRAM_ID: PublicKey;
151
+
152
+ /**
153
+ * Epoch schedule
154
+ * (see https://docs.solana.com/terminology#epoch)
155
+ * Can be retrieved with the {@link connection.getEpochSchedule} method
156
+ */
157
+ export class EpochSchedule {
158
+ /** The maximum number of slots in each epoch */
159
+ slotsPerEpoch: number;
160
+ /** The number of slots before beginning of an epoch to calculate a leader schedule for that epoch */
161
+ leaderScheduleSlotOffset: number;
162
+ /** Indicates whether epochs start short and grow */
163
+ warmup: boolean;
164
+ /** The first epoch with `slotsPerEpoch` slots */
165
+ firstNormalEpoch: number;
166
+ /** The first slot of `firstNormalEpoch` */
167
+ firstNormalSlot: number;
168
+ constructor(
169
+ slotsPerEpoch: number,
170
+ leaderScheduleSlotOffset: number,
171
+ warmup: boolean,
172
+ firstNormalEpoch: number,
173
+ firstNormalSlot: number,
174
+ );
175
+ getEpoch(slot: number): number;
176
+ getEpochAndSlotIndex(slot: number): [number, number];
177
+ getFirstSlotInEpoch(epoch: number): number;
178
+ getLastSlotInEpoch(epoch: number): number;
179
+ getSlotsInEpoch(epoch: number): number;
180
+ }
181
+
182
+ /**
183
+ * Calculator for transaction fees.
184
+ */
185
+ interface FeeCalculator {
186
+ /** Cost in lamports to validate a signature. */
187
+ lamportsPerSignature: number;
188
+ }
189
+
190
+ export const NONCE_ACCOUNT_LENGTH: number;
191
+ /**
192
+ * NonceAccount class
193
+ */
194
+ export class NonceAccount {
195
+ authorizedPubkey: PublicKey;
196
+ nonce: Blockhash;
197
+ feeCalculator: FeeCalculator;
198
+ /**
199
+ * Deserialize NonceAccount from the account data.
200
+ *
201
+ * @param buffer account data
202
+ * @return NonceAccount
203
+ */
204
+ static fromAccountData(
205
+ buffer: Buffer | Uint8Array | Array<number>,
206
+ ): NonceAccount;
207
+ }
208
+
209
+ /**
210
+ * Keypair signer interface
211
+ */
212
+ interface Signer {
213
+ publicKey: PublicKey;
214
+ secretKey: Uint8Array;
215
+ }
216
+ /**
217
+ * Ed25519 Keypair
218
+ */
219
+ interface Ed25519Keypair {
220
+ publicKey: Uint8Array;
221
+ secretKey: Uint8Array;
222
+ }
223
+ /**
224
+ * An account keypair used for signing transactions.
225
+ */
226
+ export class Keypair {
227
+ private _keypair;
228
+ /**
229
+ * Create a new keypair instance.
230
+ * Generate random keypair if no {@link Ed25519Keypair} is provided.
231
+ *
232
+ * @param keypair ed25519 keypair
233
+ */
234
+ constructor(keypair?: Ed25519Keypair);
235
+ /**
236
+ * Generate a new random keypair
237
+ */
238
+ static generate(): Keypair;
239
+ /**
240
+ * Create a keypair from a raw secret key byte array.
241
+ *
242
+ * This method should only be used to recreate a keypair from a previously
243
+ * generated secret key. Generating keypairs from a random seed should be done
244
+ * with the {@link Keypair.fromSeed} method.
245
+ *
246
+ * @throws error if the provided secret key is invalid and validation is not skipped.
247
+ *
248
+ * @param secretKey secret key byte array
249
+ * @param options: skip secret key validation
250
+ */
251
+ static fromSecretKey(
252
+ secretKey: Uint8Array,
253
+ options?: {
254
+ skipValidation?: boolean;
255
+ },
256
+ ): Keypair;
257
+ /**
258
+ * Generate a keypair from a 32 byte seed.
259
+ *
260
+ * @param seed seed byte array
261
+ */
262
+ static fromSeed(seed: Uint8Array): Keypair;
263
+ /**
264
+ * The public key for this keypair
265
+ */
266
+ get publicKey(): PublicKey;
267
+ /**
268
+ * The raw secret key for this keypair
269
+ */
270
+ get secretKey(): Uint8Array;
271
+ }
272
+
273
+ /**
274
+ * The message header, identifying signed and read-only account
275
+ */
276
+ export type MessageHeader = {
277
+ /**
278
+ * The number of signatures required for this message to be considered valid. The
279
+ * signatures must match the first `numRequiredSignatures` of `accountKeys`.
280
+ */
281
+ numRequiredSignatures: number;
282
+ /** The last `numReadonlySignedAccounts` of the signed keys are read-only accounts */
283
+ numReadonlySignedAccounts: number;
284
+ /** The last `numReadonlySignedAccounts` of the unsigned keys are read-only accounts */
285
+ numReadonlyUnsignedAccounts: number;
286
+ };
287
+ /**
288
+ * An instruction to execute by a program
289
+ *
290
+ * @property {number} programIdIndex
291
+ * @property {number[]} accounts
292
+ * @property {string} data
293
+ */
294
+ export type CompiledInstruction = {
295
+ /** Index into the transaction keys array indicating the program account that executes this instruction */
296
+ programIdIndex: number;
297
+ /** Ordered indices into the transaction keys array indicating which accounts to pass to the program */
298
+ accounts: number[];
299
+ /** The program input data encoded as base 58 */
300
+ data: string;
301
+ };
302
+ /**
303
+ * Message constructor arguments
304
+ */
305
+ export type MessageArgs = {
306
+ /** The message header, identifying signed and read-only `accountKeys` */
307
+ header: MessageHeader;
308
+ /** All the account keys used by this transaction */
309
+ accountKeys: string[];
310
+ /** The hash of a recent ledger block */
311
+ recentBlockhash: Blockhash;
312
+ /** Instructions that will be executed in sequence and committed in one atomic transaction if all succeed. */
313
+ instructions: CompiledInstruction[];
314
+ };
315
+ /**
316
+ * List of instructions to be processed atomically
317
+ */
318
+ export class Message {
319
+ header: MessageHeader;
320
+ accountKeys: PublicKey[];
321
+ recentBlockhash: Blockhash;
322
+ instructions: CompiledInstruction[];
323
+ private indexToProgramIds;
324
+ constructor(args: MessageArgs);
325
+ isAccountSigner(index: number): boolean;
326
+ isAccountWritable(index: number): boolean;
327
+ isProgramId(index: number): boolean;
328
+ programIds(): PublicKey[];
329
+ nonProgramIds(): PublicKey[];
330
+ serialize(): Buffer;
331
+ /**
332
+ * Decode a compiled message into a Message object.
333
+ */
334
+ static from(buffer: Buffer | Uint8Array | Array<number>): Message;
335
+ }
336
+
337
+ /**
338
+ * Transaction signature as base-58 encoded string
339
+ */
340
+ export type TransactionSignature = string;
341
+ /**
342
+ * Account metadata used to define instructions
343
+ */
344
+ export type AccountMeta = {
345
+ /** An account's public key */
346
+ pubkey: PublicKey;
347
+ /** True if an instruction requires a transaction signature matching `pubkey` */
348
+ isSigner: boolean;
349
+ /** True if the `pubkey` can be loaded as a read-write account. */
350
+ isWritable: boolean;
351
+ };
352
+ /**
353
+ * List of TransactionInstruction object fields that may be initialized at construction
354
+ */
355
+ export type TransactionInstructionCtorFields = {
356
+ keys: Array<AccountMeta>;
357
+ programId: PublicKey;
358
+ data?: Buffer;
359
+ };
360
+ /**
361
+ * Configuration object for Transaction.serialize()
362
+ */
363
+ export type SerializeConfig = {
364
+ /** Require all transaction signatures be present (default: true) */
365
+ requireAllSignatures?: boolean;
366
+ /** Verify provided signatures (default: true) */
367
+ verifySignatures?: boolean;
368
+ };
369
+ /**
370
+ * Transaction Instruction class
371
+ */
372
+ export class TransactionInstruction {
373
+ /**
374
+ * Public keys to include in this transaction
375
+ * Boolean represents whether this pubkey needs to sign the transaction
376
+ */
377
+ keys: Array<AccountMeta>;
378
+ /**
379
+ * Program Id to execute
380
+ */
381
+ programId: PublicKey;
382
+ /**
383
+ * Program input
384
+ */
385
+ data: Buffer;
386
+ constructor(opts: TransactionInstructionCtorFields);
387
+ }
388
+ /**
389
+ * Pair of signature and corresponding public key
390
+ */
391
+ export type SignaturePubkeyPair = {
392
+ signature: Buffer | null;
393
+ publicKey: PublicKey;
394
+ };
395
+ /**
396
+ * List of Transaction object fields that may be initialized at construction
397
+ *
398
+ */
399
+ export type TransactionCtorFields = {
400
+ /** A recent blockhash */
401
+ recentBlockhash?: Blockhash | null;
402
+ /** Optional nonce information used for offline nonce'd transactions */
403
+ nonceInfo?: NonceInformation | null;
404
+ /** The transaction fee payer */
405
+ feePayer?: PublicKey | null;
406
+ /** One or more signatures */
407
+ signatures?: Array<SignaturePubkeyPair>;
408
+ };
409
+ /**
410
+ * Nonce information to be used to build an offline Transaction.
411
+ */
412
+ export type NonceInformation = {
413
+ /** The current blockhash stored in the nonce */
414
+ nonce: Blockhash;
415
+ /** AdvanceNonceAccount Instruction */
416
+ nonceInstruction: TransactionInstruction;
417
+ };
418
+ /**
419
+ * Transaction class
420
+ */
421
+ export class Transaction {
422
+ /**
423
+ * Signatures for the transaction. Typically created by invoking the
424
+ * `sign()` method
425
+ */
426
+ signatures: Array<SignaturePubkeyPair>;
427
+ /**
428
+ * The first (payer) Transaction signature
429
+ */
430
+ get signature(): Buffer | null;
431
+ /**
432
+ * The transaction fee payer
433
+ */
434
+ feePayer?: PublicKey;
435
+ /**
436
+ * The instructions to atomically execute
437
+ */
438
+ instructions: Array<TransactionInstruction>;
439
+ /**
440
+ * A recent transaction id. Must be populated by the caller
441
+ */
442
+ recentBlockhash?: Blockhash;
443
+ /**
444
+ * Optional Nonce information. If populated, transaction will use a durable
445
+ * Nonce hash instead of a recentBlockhash. Must be populated by the caller
446
+ */
447
+ nonceInfo?: NonceInformation;
448
+ /**
449
+ * Construct an empty Transaction
450
+ */
451
+ constructor(opts?: TransactionCtorFields);
452
+ /**
453
+ * Add one or more instructions to this Transaction
454
+ */
455
+ add(
456
+ ...items: Array<
457
+ Transaction | TransactionInstruction | TransactionInstructionCtorFields
458
+ >
459
+ ): Transaction;
460
+ /**
461
+ * Compile transaction data
462
+ */
463
+ compileMessage(): Message;
464
+ /**
465
+ * Get a buffer of the Transaction data that need to be covered by signatures
466
+ */
467
+ serializeMessage(): Buffer;
468
+ /**
469
+ * Get the estimated fee associated with a transaction
470
+ */
471
+ getEstimatedFee(connection: Connection): Promise<number>;
472
+ /**
473
+ * Specify the public keys which will be used to sign the Transaction.
474
+ * The first signer will be used as the transaction fee payer account.
475
+ *
476
+ * Signatures can be added with either `partialSign` or `addSignature`
477
+ *
478
+ * @deprecated Deprecated since v0.84.0. Only the fee payer needs to be
479
+ * specified and it can be set in the Transaction constructor or with the
480
+ * `feePayer` property.
481
+ */
482
+ setSigners(...signers: Array<PublicKey>): void;
483
+ /**
484
+ * Sign the Transaction with the specified signers. Multiple signatures may
485
+ * be applied to a Transaction. The first signature is considered "primary"
486
+ * and is used identify and confirm transactions.
487
+ *
488
+ * If the Transaction `feePayer` is not set, the first signer will be used
489
+ * as the transaction fee payer account.
490
+ *
491
+ * Transaction fields should not be modified after the first call to `sign`,
492
+ * as doing so may invalidate the signature and cause the Transaction to be
493
+ * rejected.
494
+ *
495
+ * The Transaction must be assigned a valid `recentBlockhash` before invoking this method
496
+ */
497
+ sign(...signers: Array<Signer>): void;
498
+ /**
499
+ * Partially sign a transaction with the specified accounts. All accounts must
500
+ * correspond to either the fee payer or a signer account in the transaction
501
+ * instructions.
502
+ *
503
+ * All the caveats from the `sign` method apply to `partialSign`
504
+ */
505
+ partialSign(...signers: Array<Signer>): void;
506
+ /**
507
+ * Add an externally created signature to a transaction. The public key
508
+ * must correspond to either the fee payer or a signer account in the transaction
509
+ * instructions.
510
+ */
511
+ addSignature(pubkey: PublicKey, signature: Buffer): void;
512
+ /**
513
+ * Verify signatures of a complete, signed Transaction
514
+ */
515
+ verifySignatures(): boolean;
516
+ /**
517
+ * Serialize the Transaction in the wire format.
518
+ */
519
+ serialize(config?: SerializeConfig): Buffer;
520
+ /**
521
+ * Parse a wire transaction into a Transaction object.
522
+ */
523
+ static from(buffer: Buffer | Uint8Array | Array<number>): Transaction;
524
+ /**
525
+ * Populate Transaction object from message and signatures
526
+ */
527
+ static populate(message: Message, signatures?: Array<string>): Transaction;
528
+ }
529
+
530
+ export type TokenAccountsFilter =
531
+ | {
532
+ mint: PublicKey;
533
+ }
534
+ | {
535
+ programId: PublicKey;
536
+ };
537
+ /**
538
+ * Extra contextual information for RPC responses
539
+ */
540
+ export type Context = {
541
+ slot: number;
542
+ };
543
+ /**
544
+ * Options for sending transactions
545
+ */
546
+ export type SendOptions = {
547
+ /** disable transaction verification step */
548
+ skipPreflight?: boolean;
549
+ /** preflight commitment level */
550
+ preflightCommitment?: Commitment;
551
+ /** Maximum number of times for the RPC node to retry sending the transaction to the leader. */
552
+ maxRetries?: number;
553
+ };
554
+ /**
555
+ * Options for confirming transactions
556
+ */
557
+ export type ConfirmOptions = {
558
+ /** disable transaction verification step */
559
+ skipPreflight?: boolean;
560
+ /** desired commitment level */
561
+ commitment?: Commitment;
562
+ /** preflight commitment level */
563
+ preflightCommitment?: Commitment;
564
+ /** Maximum number of times for the RPC node to retry sending the transaction to the leader. */
565
+ maxRetries?: number;
566
+ };
567
+ /**
568
+ * Options for getConfirmedSignaturesForAddress2
569
+ */
570
+ export type ConfirmedSignaturesForAddress2Options = {
571
+ /**
572
+ * Start searching backwards from this transaction signature.
573
+ * @remark If not provided the search starts from the highest max confirmed block.
574
+ */
575
+ before?: TransactionSignature;
576
+ /** Search until this transaction signature is reached, if found before `limit`. */
577
+ until?: TransactionSignature;
578
+ /** Maximum transaction signatures to return (between 1 and 1,000, default: 1,000). */
579
+ limit?: number;
580
+ };
581
+ /**
582
+ * Options for getSignaturesForAddress
583
+ */
584
+ export type SignaturesForAddressOptions = {
585
+ /**
586
+ * Start searching backwards from this transaction signature.
587
+ * @remark If not provided the search starts from the highest max confirmed block.
588
+ */
589
+ before?: TransactionSignature;
590
+ /** Search until this transaction signature is reached, if found before `limit`. */
591
+ until?: TransactionSignature;
592
+ /** Maximum transaction signatures to return (between 1 and 1,000, default: 1,000). */
593
+ limit?: number;
594
+ };
595
+ /**
596
+ * RPC Response with extra contextual information
597
+ */
598
+ export type RpcResponseAndContext<T> = {
599
+ /** response context */
600
+ context: Context;
601
+ /** response value */
602
+ value: T;
603
+ };
604
+ /**
605
+ * The level of commitment desired when querying state
606
+ * <pre>
607
+ * 'processed': Query the most recent block which has reached 1 confirmation by the connected node
608
+ * 'confirmed': Query the most recent block which has reached 1 confirmation by the cluster
609
+ * 'finalized': Query the most recent block which has been finalized by the cluster
610
+ * </pre>
611
+ */
612
+ export type Commitment =
613
+ | 'processed'
614
+ | 'confirmed'
615
+ | 'finalized'
616
+ | 'recent'
617
+ | 'single'
618
+ | 'singleGossip'
619
+ | 'root'
620
+ | 'max';
621
+ /**
622
+ * A subset of Commitment levels, which are at least optimistically confirmed
623
+ * <pre>
624
+ * 'confirmed': Query the most recent block which has reached 1 confirmation by the cluster
625
+ * 'finalized': Query the most recent block which has been finalized by the cluster
626
+ * </pre>
627
+ */
628
+ export type Finality = 'confirmed' | 'finalized';
629
+ /**
630
+ * Filter for largest accounts query
631
+ * <pre>
632
+ * 'circulating': Return the largest accounts that are part of the circulating supply
633
+ * 'nonCirculating': Return the largest accounts that are not part of the circulating supply
634
+ * </pre>
635
+ */
636
+ export type LargestAccountsFilter = 'circulating' | 'nonCirculating';
637
+ /**
638
+ * Configuration object for changing `getLargestAccounts` query behavior
639
+ */
640
+ export type GetLargestAccountsConfig = {
641
+ /** The level of commitment desired */
642
+ commitment?: Commitment;
643
+ /** Filter largest accounts by whether they are part of the circulating supply */
644
+ filter?: LargestAccountsFilter;
645
+ };
646
+ /**
647
+ * Configuration object for changing `getSupply` request behavior
648
+ */
649
+ export type GetSupplyConfig = {
650
+ /** The level of commitment desired */
651
+ commitment?: Commitment;
652
+ /** Exclude non circulating accounts list from response */
653
+ excludeNonCirculatingAccountsList?: boolean;
654
+ };
655
+ /**
656
+ * Configuration object for changing query behavior
657
+ */
658
+ export type SignatureStatusConfig = {
659
+ /** enable searching status history, not needed for recent transactions */
660
+ searchTransactionHistory: boolean;
661
+ };
662
+ /**
663
+ * Information describing a cluster node
664
+ */
665
+ export type ContactInfo = {
666
+ /** Identity public key of the node */
667
+ pubkey: string;
668
+ /** Gossip network address for the node */
669
+ gossip: string | null;
670
+ /** TPU network address for the node (null if not available) */
671
+ tpu: string | null;
672
+ /** JSON RPC network address for the node (null if not available) */
673
+ rpc: string | null;
674
+ /** Software version of the node (null if not available) */
675
+ version: string | null;
676
+ };
677
+ /**
678
+ * Information describing a vote account
679
+ */
680
+ export type VoteAccountInfo = {
681
+ /** Public key of the vote account */
682
+ votePubkey: string;
683
+ /** Identity public key of the node voting with this account */
684
+ nodePubkey: string;
685
+ /** The stake, in lamports, delegated to this vote account and activated */
686
+ activatedStake: number;
687
+ /** Whether the vote account is staked for this epoch */
688
+ epochVoteAccount: boolean;
689
+ /** Recent epoch voting credit history for this voter */
690
+ epochCredits: Array<[number, number, number]>;
691
+ /** A percentage (0-100) of rewards payout owed to the voter */
692
+ commission: number;
693
+ /** Most recent slot voted on by this vote account */
694
+ lastVote: number;
695
+ };
696
+ /**
697
+ * A collection of cluster vote accounts
698
+ */
699
+ export type VoteAccountStatus = {
700
+ /** Active vote accounts */
701
+ current: Array<VoteAccountInfo>;
702
+ /** Inactive vote accounts */
703
+ delinquent: Array<VoteAccountInfo>;
704
+ };
705
+ /**
706
+ * Network Inflation
707
+ * (see https://docs.solana.com/implemented-proposals/ed_overview)
708
+ */
709
+ export type InflationGovernor = {
710
+ foundation: number;
711
+ foundationTerm: number;
712
+ initial: number;
713
+ taper: number;
714
+ terminal: number;
715
+ };
716
+ /**
717
+ * The inflation reward for an epoch
718
+ */
719
+ export type InflationReward = {
720
+ /** epoch for which the reward occurs */
721
+ epoch: number;
722
+ /** the slot in which the rewards are effective */
723
+ effectiveSlot: number;
724
+ /** reward amount in lamports */
725
+ amount: number;
726
+ /** post balance of the account in lamports */
727
+ postBalance: number;
728
+ };
729
+ /**
730
+ * Information about the current epoch
731
+ */
732
+ export type EpochInfo = {
733
+ epoch: number;
734
+ slotIndex: number;
735
+ slotsInEpoch: number;
736
+ absoluteSlot: number;
737
+ blockHeight?: number;
738
+ transactionCount?: number;
739
+ };
740
+ /**
741
+ * Leader schedule
742
+ * (see https://docs.solana.com/terminology#leader-schedule)
743
+ */
744
+ export type LeaderSchedule = {
745
+ [address: string]: number[];
746
+ };
747
+ /**
748
+ * Version info for a node
749
+ */
750
+ export type Version = {
751
+ /** Version of solana-core */
752
+ 'solana-core': string;
753
+ 'feature-set'?: number;
754
+ };
755
+ export type SimulatedTransactionAccountInfo = {
756
+ /** `true` if this account's data contains a loaded program */
757
+ executable: boolean;
758
+ /** Identifier of the program that owns the account */
759
+ owner: string;
760
+ /** Number of lamports assigned to the account */
761
+ lamports: number;
762
+ /** Optional data assigned to the account */
763
+ data: string[];
764
+ /** Optional rent epoch info for account */
765
+ rentEpoch?: number;
766
+ };
767
+ export type SimulatedTransactionResponse = {
768
+ err: TransactionError | string | null;
769
+ logs: Array<string> | null;
770
+ accounts?: (SimulatedTransactionAccountInfo | null)[] | null;
771
+ unitsConsumed?: number;
772
+ };
773
+ export type ParsedInnerInstruction = {
774
+ index: number;
775
+ instructions: (ParsedInstruction | PartiallyDecodedInstruction)[];
776
+ };
777
+ export type TokenBalance = {
778
+ accountIndex: number;
779
+ mint: string;
780
+ owner?: string;
781
+ uiTokenAmount: TokenAmount;
782
+ };
783
+ /**
784
+ * Metadata for a parsed confirmed transaction on the ledger
785
+ *
786
+ * @deprecated Deprecated since Solana v1.8.0. Please use {@link ParsedTransactionMeta} instead.
787
+ */
788
+ export type ParsedConfirmedTransactionMeta = ParsedTransactionMeta;
789
+ /**
790
+ * Metadata for a parsed transaction on the ledger
791
+ */
792
+ export type ParsedTransactionMeta = {
793
+ /** The fee charged for processing the transaction */
794
+ fee: number;
795
+ /** An array of cross program invoked parsed instructions */
796
+ innerInstructions?: ParsedInnerInstruction[] | null;
797
+ /** The balances of the transaction accounts before processing */
798
+ preBalances: Array<number>;
799
+ /** The balances of the transaction accounts after processing */
800
+ postBalances: Array<number>;
801
+ /** An array of program log messages emitted during a transaction */
802
+ logMessages?: Array<string> | null;
803
+ /** The token balances of the transaction accounts before processing */
804
+ preTokenBalances?: Array<TokenBalance> | null;
805
+ /** The token balances of the transaction accounts after processing */
806
+ postTokenBalances?: Array<TokenBalance> | null;
807
+ /** The error result of transaction processing */
808
+ err: TransactionError | null;
809
+ };
810
+ export type CompiledInnerInstruction = {
811
+ index: number;
812
+ instructions: CompiledInstruction[];
813
+ };
814
+ /**
815
+ * Metadata for a confirmed transaction on the ledger
816
+ */
817
+ export type ConfirmedTransactionMeta = {
818
+ /** The fee charged for processing the transaction */
819
+ fee: number;
820
+ /** An array of cross program invoked instructions */
821
+ innerInstructions?: CompiledInnerInstruction[] | null;
822
+ /** The balances of the transaction accounts before processing */
823
+ preBalances: Array<number>;
824
+ /** The balances of the transaction accounts after processing */
825
+ postBalances: Array<number>;
826
+ /** An array of program log messages emitted during a transaction */
827
+ logMessages?: Array<string> | null;
828
+ /** The token balances of the transaction accounts before processing */
829
+ preTokenBalances?: Array<TokenBalance> | null;
830
+ /** The token balances of the transaction accounts after processing */
831
+ postTokenBalances?: Array<TokenBalance> | null;
832
+ /** The error result of transaction processing */
833
+ err: TransactionError | null;
834
+ };
835
+ /**
836
+ * A processed transaction from the RPC API
837
+ */
838
+ export type TransactionResponse = {
839
+ /** The slot during which the transaction was processed */
840
+ slot: number;
841
+ /** The transaction */
842
+ transaction: {
843
+ /** The transaction message */
844
+ message: Message;
845
+ /** The transaction signatures */
846
+ signatures: string[];
847
+ };
848
+ /** Metadata produced from the transaction */
849
+ meta: ConfirmedTransactionMeta | null;
850
+ /** The unix timestamp of when the transaction was processed */
851
+ blockTime?: number | null;
852
+ };
853
+ /**
854
+ * A confirmed transaction on the ledger
855
+ */
856
+ export type ConfirmedTransaction = {
857
+ /** The slot during which the transaction was processed */
858
+ slot: number;
859
+ /** The details of the transaction */
860
+ transaction: Transaction;
861
+ /** Metadata produced from the transaction */
862
+ meta: ConfirmedTransactionMeta | null;
863
+ /** The unix timestamp of when the transaction was processed */
864
+ blockTime?: number | null;
865
+ };
866
+ /**
867
+ * A partially decoded transaction instruction
868
+ */
869
+ export type PartiallyDecodedInstruction = {
870
+ /** Program id called by this instruction */
871
+ programId: PublicKey;
872
+ /** Public keys of accounts passed to this instruction */
873
+ accounts: Array<PublicKey>;
874
+ /** Raw base-58 instruction data */
875
+ data: string;
876
+ };
877
+ /**
878
+ * A parsed transaction message account
879
+ */
880
+ export type ParsedMessageAccount = {
881
+ /** Public key of the account */
882
+ pubkey: PublicKey;
883
+ /** Indicates if the account signed the transaction */
884
+ signer: boolean;
885
+ /** Indicates if the account is writable for this transaction */
886
+ writable: boolean;
887
+ };
888
+ /**
889
+ * A parsed transaction instruction
890
+ */
891
+ export type ParsedInstruction = {
892
+ /** Name of the program for this instruction */
893
+ program: string;
894
+ /** ID of the program for this instruction */
895
+ programId: PublicKey;
896
+ /** Parsed instruction info */
897
+ parsed: any;
898
+ };
899
+ /**
900
+ * A parsed transaction message
901
+ */
902
+ export type ParsedMessage = {
903
+ /** Accounts used in the instructions */
904
+ accountKeys: ParsedMessageAccount[];
905
+ /** The atomically executed instructions for the transaction */
906
+ instructions: (ParsedInstruction | PartiallyDecodedInstruction)[];
907
+ /** Recent blockhash */
908
+ recentBlockhash: string;
909
+ };
910
+ /**
911
+ * A parsed transaction
912
+ */
913
+ export type ParsedTransaction = {
914
+ /** Signatures for the transaction */
915
+ signatures: Array<string>;
916
+ /** Message of the transaction */
917
+ message: ParsedMessage;
918
+ };
919
+ /**
920
+ * A parsed and confirmed transaction on the ledger
921
+ *
922
+ * @deprecated Deprecated since Solana v1.8.0. Please use {@link ParsedTransactionWithMeta} instead.
923
+ */
924
+ export type ParsedConfirmedTransaction = ParsedTransactionWithMeta;
925
+ /**
926
+ * A parsed transaction on the ledger with meta
927
+ */
928
+ export type ParsedTransactionWithMeta = {
929
+ /** The slot during which the transaction was processed */
930
+ slot: number;
931
+ /** The details of the transaction */
932
+ transaction: ParsedTransaction;
933
+ /** Metadata produced from the transaction */
934
+ meta: ParsedTransactionMeta | null;
935
+ /** The unix timestamp of when the transaction was processed */
936
+ blockTime?: number | null;
937
+ };
938
+ /**
939
+ * A processed block fetched from the RPC API
940
+ */
941
+ export type BlockResponse = {
942
+ /** Blockhash of this block */
943
+ blockhash: Blockhash;
944
+ /** Blockhash of this block's parent */
945
+ previousBlockhash: Blockhash;
946
+ /** Slot index of this block's parent */
947
+ parentSlot: number;
948
+ /** Vector of transactions with status meta and original message */
949
+ transactions: Array<{
950
+ /** The transaction */
951
+ transaction: {
952
+ /** The transaction message */
953
+ message: Message;
954
+ /** The transaction signatures */
955
+ signatures: string[];
956
+ };
957
+ /** Metadata produced from the transaction */
958
+ meta: ConfirmedTransactionMeta | null;
959
+ }>;
960
+ /** Vector of block rewards */
961
+ rewards?: Array<{
962
+ /** Public key of reward recipient */
963
+ pubkey: string;
964
+ /** Reward value in lamports */
965
+ lamports: number;
966
+ /** Account balance after reward is applied */
967
+ postBalance: number | null;
968
+ /** Type of reward received */
969
+ rewardType: string | null;
970
+ }>;
971
+ /** The unix timestamp of when the block was processed */
972
+ blockTime: number | null;
973
+ };
974
+ /**
975
+ * A ConfirmedBlock on the ledger
976
+ */
977
+ export type ConfirmedBlock = {
978
+ /** Blockhash of this block */
979
+ blockhash: Blockhash;
980
+ /** Blockhash of this block's parent */
981
+ previousBlockhash: Blockhash;
982
+ /** Slot index of this block's parent */
983
+ parentSlot: number;
984
+ /** Vector of transactions and status metas */
985
+ transactions: Array<{
986
+ transaction: Transaction;
987
+ meta: ConfirmedTransactionMeta | null;
988
+ }>;
989
+ /** Vector of block rewards */
990
+ rewards?: Array<{
991
+ pubkey: string;
992
+ lamports: number;
993
+ postBalance: number | null;
994
+ rewardType: string | null;
995
+ }>;
996
+ /** The unix timestamp of when the block was processed */
997
+ blockTime: number | null;
998
+ };
999
+ /**
1000
+ * A Block on the ledger with signatures only
1001
+ */
1002
+ export type BlockSignatures = {
1003
+ /** Blockhash of this block */
1004
+ blockhash: Blockhash;
1005
+ /** Blockhash of this block's parent */
1006
+ previousBlockhash: Blockhash;
1007
+ /** Slot index of this block's parent */
1008
+ parentSlot: number;
1009
+ /** Vector of signatures */
1010
+ signatures: Array<string>;
1011
+ /** The unix timestamp of when the block was processed */
1012
+ blockTime: number | null;
1013
+ };
1014
+ /**
1015
+ * recent block production information
1016
+ */
1017
+ export type BlockProduction = Readonly<{
1018
+ /** a dictionary of validator identities, as base-58 encoded strings. Value is a two element array containing the number of leader slots and the number of blocks produced */
1019
+ byIdentity: Readonly<Record<string, ReadonlyArray<number>>>;
1020
+ /** Block production slot range */
1021
+ range: Readonly<{
1022
+ /** first slot of the block production information (inclusive) */
1023
+ firstSlot: number;
1024
+ /** last slot of block production information (inclusive) */
1025
+ lastSlot: number;
1026
+ }>;
1027
+ }>;
1028
+ export type GetBlockProductionConfig = {
1029
+ /** Optional commitment level */
1030
+ commitment?: Commitment;
1031
+ /** Slot range to return block production for. If parameter not provided, defaults to current epoch. */
1032
+ range?: {
1033
+ /** first slot to return block production information for (inclusive) */
1034
+ firstSlot: number;
1035
+ /** last slot to return block production information for (inclusive). If parameter not provided, defaults to the highest slot */
1036
+ lastSlot?: number;
1037
+ };
1038
+ /** Only return results for this validator identity (base-58 encoded) */
1039
+ identity?: string;
1040
+ };
1041
+ /**
1042
+ * A performance sample
1043
+ */
1044
+ export type PerfSample = {
1045
+ /** Slot number of sample */
1046
+ slot: number;
1047
+ /** Number of transactions in a sample window */
1048
+ numTransactions: number;
1049
+ /** Number of slots in a sample window */
1050
+ numSlots: number;
1051
+ /** Sample window in seconds */
1052
+ samplePeriodSecs: number;
1053
+ };
1054
+ /**
1055
+ * Supply
1056
+ */
1057
+ export type Supply = {
1058
+ /** Total supply in lamports */
1059
+ total: number;
1060
+ /** Circulating supply in lamports */
1061
+ circulating: number;
1062
+ /** Non-circulating supply in lamports */
1063
+ nonCirculating: number;
1064
+ /** List of non-circulating account addresses */
1065
+ nonCirculatingAccounts: Array<PublicKey>;
1066
+ };
1067
+ /**
1068
+ * Token amount object which returns a token amount in different formats
1069
+ * for various client use cases.
1070
+ */
1071
+ export type TokenAmount = {
1072
+ /** Raw amount of tokens as string ignoring decimals */
1073
+ amount: string;
1074
+ /** Number of decimals configured for token's mint */
1075
+ decimals: number;
1076
+ /** Token amount as float, accounts for decimals */
1077
+ uiAmount: number | null;
1078
+ /** Token amount as string, accounts for decimals */
1079
+ uiAmountString?: string;
1080
+ };
1081
+ /**
1082
+ * Token address and balance.
1083
+ */
1084
+ export type TokenAccountBalancePair = {
1085
+ /** Address of the token account */
1086
+ address: PublicKey;
1087
+ /** Raw amount of tokens as string ignoring decimals */
1088
+ amount: string;
1089
+ /** Number of decimals configured for token's mint */
1090
+ decimals: number;
1091
+ /** Token amount as float, accounts for decimals */
1092
+ uiAmount: number | null;
1093
+ /** Token amount as string, accounts for decimals */
1094
+ uiAmountString?: string;
1095
+ };
1096
+ /**
1097
+ * Pair of an account address and its balance
1098
+ */
1099
+ export type AccountBalancePair = {
1100
+ address: PublicKey;
1101
+ lamports: number;
1102
+ };
1103
+ /**
1104
+ * Slot updates which can be used for tracking the live progress of a cluster.
1105
+ * - `"firstShredReceived"`: connected node received the first shred of a block.
1106
+ * Indicates that a new block that is being produced.
1107
+ * - `"completed"`: connected node has received all shreds of a block. Indicates
1108
+ * a block was recently produced.
1109
+ * - `"optimisticConfirmation"`: block was optimistically confirmed by the
1110
+ * cluster. It is not guaranteed that an optimistic confirmation notification
1111
+ * will be sent for every finalized blocks.
1112
+ * - `"root"`: the connected node rooted this block.
1113
+ * - `"createdBank"`: the connected node has started validating this block.
1114
+ * - `"frozen"`: the connected node has validated this block.
1115
+ * - `"dead"`: the connected node failed to validate this block.
1116
+ */
1117
+ export type SlotUpdate =
1118
+ | {
1119
+ type: 'firstShredReceived';
1120
+ slot: number;
1121
+ timestamp: number;
1122
+ }
1123
+ | {
1124
+ type: 'completed';
1125
+ slot: number;
1126
+ timestamp: number;
1127
+ }
1128
+ | {
1129
+ type: 'createdBank';
1130
+ slot: number;
1131
+ timestamp: number;
1132
+ parent: number;
1133
+ }
1134
+ | {
1135
+ type: 'frozen';
1136
+ slot: number;
1137
+ timestamp: number;
1138
+ stats: {
1139
+ numTransactionEntries: number;
1140
+ numSuccessfulTransactions: number;
1141
+ numFailedTransactions: number;
1142
+ maxTransactionsPerEntry: number;
1143
+ };
1144
+ }
1145
+ | {
1146
+ type: 'dead';
1147
+ slot: number;
1148
+ timestamp: number;
1149
+ err: string;
1150
+ }
1151
+ | {
1152
+ type: 'optimisticConfirmation';
1153
+ slot: number;
1154
+ timestamp: number;
1155
+ }
1156
+ | {
1157
+ type: 'root';
1158
+ slot: number;
1159
+ timestamp: number;
1160
+ };
1161
+ /**
1162
+ * Information about the latest slot being processed by a node
1163
+ */
1164
+ export type SlotInfo = {
1165
+ /** Currently processing slot */
1166
+ slot: number;
1167
+ /** Parent of the current slot */
1168
+ parent: number;
1169
+ /** The root block of the current slot's fork */
1170
+ root: number;
1171
+ };
1172
+ /**
1173
+ * Parsed account data
1174
+ */
1175
+ export type ParsedAccountData = {
1176
+ /** Name of the program that owns this account */
1177
+ program: string;
1178
+ /** Parsed account data */
1179
+ parsed: any;
1180
+ /** Space used by account data */
1181
+ space: number;
1182
+ };
1183
+ /**
1184
+ * Stake Activation data
1185
+ */
1186
+ export type StakeActivationData = {
1187
+ /** the stake account's activation state */
1188
+ state: 'active' | 'inactive' | 'activating' | 'deactivating';
1189
+ /** stake active during the epoch */
1190
+ active: number;
1191
+ /** stake inactive during the epoch */
1192
+ inactive: number;
1193
+ };
1194
+ /**
1195
+ * Data slice argument for getProgramAccounts
1196
+ */
1197
+ export type DataSlice = {
1198
+ /** offset of data slice */
1199
+ offset: number;
1200
+ /** length of data slice */
1201
+ length: number;
1202
+ };
1203
+ /**
1204
+ * Memory comparison filter for getProgramAccounts
1205
+ */
1206
+ export type MemcmpFilter = {
1207
+ memcmp: {
1208
+ /** offset into program account data to start comparison */
1209
+ offset: number;
1210
+ /** data to match, as base-58 encoded string and limited to less than 129 bytes */
1211
+ bytes: string;
1212
+ };
1213
+ };
1214
+ /**
1215
+ * Data size comparison filter for getProgramAccounts
1216
+ */
1217
+ export type DataSizeFilter = {
1218
+ /** Size of data for program account data length comparison */
1219
+ dataSize: number;
1220
+ };
1221
+ /**
1222
+ * A filter object for getProgramAccounts
1223
+ */
1224
+ export type GetProgramAccountsFilter = MemcmpFilter | DataSizeFilter;
1225
+ /**
1226
+ * Configuration object for getProgramAccounts requests
1227
+ */
1228
+ export type GetProgramAccountsConfig = {
1229
+ /** Optional commitment level */
1230
+ commitment?: Commitment;
1231
+ /** Optional encoding for account data (default base64)
1232
+ * To use "jsonParsed" encoding, please refer to `getParsedProgramAccounts` in connection.ts
1233
+ * */
1234
+ encoding?: 'base64';
1235
+ /** Optional data slice to limit the returned account data */
1236
+ dataSlice?: DataSlice;
1237
+ /** Optional array of filters to apply to accounts */
1238
+ filters?: GetProgramAccountsFilter[];
1239
+ };
1240
+ /**
1241
+ * Configuration object for getParsedProgramAccounts
1242
+ */
1243
+ export type GetParsedProgramAccountsConfig = {
1244
+ /** Optional commitment level */
1245
+ commitment?: Commitment;
1246
+ /** Optional array of filters to apply to accounts */
1247
+ filters?: GetProgramAccountsFilter[];
1248
+ };
1249
+ /**
1250
+ * Configuration object for getMultipleAccounts
1251
+ */
1252
+ export type GetMultipleAccountsConfig = {
1253
+ /** Optional commitment level */
1254
+ commitment?: Commitment;
1255
+ /** Optional encoding for account data (default base64) */
1256
+ encoding?: 'base64' | 'jsonParsed';
1257
+ };
1258
+ /**
1259
+ * Information describing an account
1260
+ */
1261
+ export type AccountInfo<T> = {
1262
+ /** `true` if this account's data contains a loaded program */
1263
+ executable: boolean;
1264
+ /** Identifier of the program that owns the account */
1265
+ owner: PublicKey;
1266
+ /** Number of lamports assigned to the account */
1267
+ lamports: number;
1268
+ /** Optional data assigned to the account */
1269
+ data: T;
1270
+ /** Optional rent epoch info for account */
1271
+ rentEpoch?: number;
1272
+ };
1273
+ /**
1274
+ * Account information identified by pubkey
1275
+ */
1276
+ export type KeyedAccountInfo = {
1277
+ accountId: PublicKey;
1278
+ accountInfo: AccountInfo<Buffer>;
1279
+ };
1280
+ /**
1281
+ * Callback function for account change notifications
1282
+ */
1283
+ export type AccountChangeCallback = (
1284
+ accountInfo: AccountInfo<Buffer>,
1285
+ context: Context,
1286
+ ) => void;
1287
+ /**
1288
+ * Callback function for program account change notifications
1289
+ */
1290
+ export type ProgramAccountChangeCallback = (
1291
+ keyedAccountInfo: KeyedAccountInfo,
1292
+ context: Context,
1293
+ ) => void;
1294
+ /**
1295
+ * Callback function for slot change notifications
1296
+ */
1297
+ export type SlotChangeCallback = (slotInfo: SlotInfo) => void;
1298
+ /**
1299
+ * Callback function for slot update notifications
1300
+ */
1301
+ export type SlotUpdateCallback = (slotUpdate: SlotUpdate) => void;
1302
+ /**
1303
+ * Callback function for signature status notifications
1304
+ */
1305
+ export type SignatureResultCallback = (
1306
+ signatureResult: SignatureResult,
1307
+ context: Context,
1308
+ ) => void;
1309
+ /**
1310
+ * Signature status notification with transaction result
1311
+ */
1312
+ export type SignatureStatusNotification = {
1313
+ type: 'status';
1314
+ result: SignatureResult;
1315
+ };
1316
+ /**
1317
+ * Signature received notification
1318
+ */
1319
+ export type SignatureReceivedNotification = {
1320
+ type: 'received';
1321
+ };
1322
+ /**
1323
+ * Callback function for signature notifications
1324
+ */
1325
+ export type SignatureSubscriptionCallback = (
1326
+ notification: SignatureStatusNotification | SignatureReceivedNotification,
1327
+ context: Context,
1328
+ ) => void;
1329
+ /**
1330
+ * Signature subscription options
1331
+ */
1332
+ export type SignatureSubscriptionOptions = {
1333
+ commitment?: Commitment;
1334
+ enableReceivedNotification?: boolean;
1335
+ };
1336
+ /**
1337
+ * Callback function for root change notifications
1338
+ */
1339
+ export type RootChangeCallback = (root: number) => void;
1340
+ /**
1341
+ * Logs result.
1342
+ */
1343
+ export type Logs = {
1344
+ err: TransactionError | null;
1345
+ logs: string[];
1346
+ signature: string;
1347
+ };
1348
+ /**
1349
+ * Filter for log subscriptions.
1350
+ */
1351
+ export type LogsFilter = PublicKey | 'all' | 'allWithVotes';
1352
+ /**
1353
+ * Callback function for log notifications.
1354
+ */
1355
+ export type LogsCallback = (logs: Logs, ctx: Context) => void;
1356
+ /**
1357
+ * Signature result
1358
+ */
1359
+ export type SignatureResult = {
1360
+ err: TransactionError | null;
1361
+ };
1362
+ /**
1363
+ * Transaction error
1364
+ */
1365
+ export type TransactionError = {} | string;
1366
+ /**
1367
+ * Transaction confirmation status
1368
+ * <pre>
1369
+ * 'processed': Transaction landed in a block which has reached 1 confirmation by the connected node
1370
+ * 'confirmed': Transaction landed in a block which has reached 1 confirmation by the cluster
1371
+ * 'finalized': Transaction landed in a block which has been finalized by the cluster
1372
+ * </pre>
1373
+ */
1374
+ export type TransactionConfirmationStatus =
1375
+ | 'processed'
1376
+ | 'confirmed'
1377
+ | 'finalized';
1378
+ /**
1379
+ * Signature status
1380
+ */
1381
+ export type SignatureStatus = {
1382
+ /** when the transaction was processed */
1383
+ slot: number;
1384
+ /** the number of blocks that have been confirmed and voted on in the fork containing `slot` */
1385
+ confirmations: number | null;
1386
+ /** transaction error, if any */
1387
+ err: TransactionError | null;
1388
+ /** cluster confirmation status, if data available. Possible responses: `processed`, `confirmed`, `finalized` */
1389
+ confirmationStatus?: TransactionConfirmationStatus;
1390
+ };
1391
+ /**
1392
+ * A confirmed signature with its status
1393
+ */
1394
+ export type ConfirmedSignatureInfo = {
1395
+ /** the transaction signature */
1396
+ signature: string;
1397
+ /** when the transaction was processed */
1398
+ slot: number;
1399
+ /** error, if any */
1400
+ err: TransactionError | null;
1401
+ /** memo associated with the transaction, if any */
1402
+ memo: string | null;
1403
+ /** The unix timestamp of when the transaction was processed */
1404
+ blockTime?: number | null;
1405
+ };
1406
+ /**
1407
+ * An object defining headers to be passed to the RPC server
1408
+ */
1409
+ export type HttpHeaders = {
1410
+ [header: string]: string;
1411
+ };
1412
+ /**
1413
+ * A callback used to augment the outgoing HTTP request
1414
+ */
1415
+ export type FetchMiddleware = (
1416
+ url: string,
1417
+ options: any,
1418
+ fetch: (modifiedUrl: string, modifiedOptions: any) => void,
1419
+ ) => void;
1420
+ /**
1421
+ * Configuration for instantiating a Connection
1422
+ */
1423
+ export type ConnectionConfig = {
1424
+ /** Optional commitment level */
1425
+ commitment?: Commitment;
1426
+ /** Optional endpoint URL to the fullnode JSON RPC PubSub WebSocket Endpoint */
1427
+ wsEndpoint?: string;
1428
+ /** Optional HTTP headers object */
1429
+ httpHeaders?: HttpHeaders;
1430
+ /** Optional custom fetch function */
1431
+ fetch?: typeof crossFetch;
1432
+ /** Optional fetch middleware callback */
1433
+ fetchMiddleware?: FetchMiddleware;
1434
+ /** Optional Disable retrying calls when server responds with HTTP 429 (Too Many Requests) */
1435
+ disableRetryOnRateLimit?: boolean;
1436
+ /** time to allow for the server to initially process a transaction (in milliseconds) */
1437
+ confirmTransactionInitialTimeout?: number;
1438
+ };
1439
+ /**
1440
+ * A connection to a fullnode JSON RPC endpoint
1441
+ */
1442
+ export class Connection {
1443
+ /**
1444
+ * Establish a JSON RPC connection
1445
+ *
1446
+ * @param endpoint URL to the fullnode JSON RPC endpoint
1447
+ * @param commitmentOrConfig optional default commitment level or optional ConnectionConfig configuration object
1448
+ */
1449
+ constructor(
1450
+ endpoint: string,
1451
+ commitmentOrConfig?: Commitment | ConnectionConfig,
1452
+ );
1453
+ /**
1454
+ * The default commitment used for requests
1455
+ */
1456
+ get commitment(): Commitment | undefined;
1457
+ /**
1458
+ * The RPC endpoint
1459
+ */
1460
+ get rpcEndpoint(): string;
1461
+ /**
1462
+ * Fetch the balance for the specified public key, return with context
1463
+ */
1464
+ getBalanceAndContext(
1465
+ publicKey: PublicKey,
1466
+ commitment?: Commitment,
1467
+ ): Promise<RpcResponseAndContext<number>>;
1468
+ /**
1469
+ * Fetch the balance for the specified public key
1470
+ */
1471
+ getBalance(publicKey: PublicKey, commitment?: Commitment): Promise<number>;
1472
+ /**
1473
+ * Fetch the estimated production time of a block
1474
+ */
1475
+ getBlockTime(slot: number): Promise<number | null>;
1476
+ /**
1477
+ * Fetch the lowest slot that the node has information about in its ledger.
1478
+ * This value may increase over time if the node is configured to purge older ledger data
1479
+ */
1480
+ getMinimumLedgerSlot(): Promise<number>;
1481
+ /**
1482
+ * Fetch the slot of the lowest confirmed block that has not been purged from the ledger
1483
+ */
1484
+ getFirstAvailableBlock(): Promise<number>;
1485
+ /**
1486
+ * Fetch information about the current supply
1487
+ */
1488
+ getSupply(
1489
+ config?: GetSupplyConfig | Commitment,
1490
+ ): Promise<RpcResponseAndContext<Supply>>;
1491
+ /**
1492
+ * Fetch the current supply of a token mint
1493
+ */
1494
+ getTokenSupply(
1495
+ tokenMintAddress: PublicKey,
1496
+ commitment?: Commitment,
1497
+ ): Promise<RpcResponseAndContext<TokenAmount>>;
1498
+ /**
1499
+ * Fetch the current balance of a token account
1500
+ */
1501
+ getTokenAccountBalance(
1502
+ tokenAddress: PublicKey,
1503
+ commitment?: Commitment,
1504
+ ): Promise<RpcResponseAndContext<TokenAmount>>;
1505
+ /**
1506
+ * Fetch all the token accounts owned by the specified account
1507
+ *
1508
+ * @return {Promise<RpcResponseAndContext<Array<{pubkey: PublicKey, account: AccountInfo<Buffer>}>>>}
1509
+ */
1510
+ getTokenAccountsByOwner(
1511
+ ownerAddress: PublicKey,
1512
+ filter: TokenAccountsFilter,
1513
+ commitment?: Commitment,
1514
+ ): Promise<
1515
+ RpcResponseAndContext<
1516
+ Array<{
1517
+ pubkey: PublicKey;
1518
+ account: AccountInfo<Buffer>;
1519
+ }>
1520
+ >
1521
+ >;
1522
+ /**
1523
+ * Fetch parsed token accounts owned by the specified account
1524
+ *
1525
+ * @return {Promise<RpcResponseAndContext<Array<{pubkey: PublicKey, account: AccountInfo<ParsedAccountData>}>>>}
1526
+ */
1527
+ getParsedTokenAccountsByOwner(
1528
+ ownerAddress: PublicKey,
1529
+ filter: TokenAccountsFilter,
1530
+ commitment?: Commitment,
1531
+ ): Promise<
1532
+ RpcResponseAndContext<
1533
+ Array<{
1534
+ pubkey: PublicKey;
1535
+ account: AccountInfo<ParsedAccountData>;
1536
+ }>
1537
+ >
1538
+ >;
1539
+ /**
1540
+ * Fetch the 20 largest accounts with their current balances
1541
+ */
1542
+ getLargestAccounts(
1543
+ config?: GetLargestAccountsConfig,
1544
+ ): Promise<RpcResponseAndContext<Array<AccountBalancePair>>>;
1545
+ /**
1546
+ * Fetch the 20 largest token accounts with their current balances
1547
+ * for a given mint.
1548
+ */
1549
+ getTokenLargestAccounts(
1550
+ mintAddress: PublicKey,
1551
+ commitment?: Commitment,
1552
+ ): Promise<RpcResponseAndContext<Array<TokenAccountBalancePair>>>;
1553
+ /**
1554
+ * Fetch all the account info for the specified public key, return with context
1555
+ */
1556
+ getAccountInfoAndContext(
1557
+ publicKey: PublicKey,
1558
+ commitment?: Commitment,
1559
+ ): Promise<RpcResponseAndContext<AccountInfo<Buffer> | null>>;
1560
+ /**
1561
+ * Fetch parsed account info for the specified public key
1562
+ */
1563
+ getParsedAccountInfo(
1564
+ publicKey: PublicKey,
1565
+ commitment?: Commitment,
1566
+ ): Promise<
1567
+ RpcResponseAndContext<AccountInfo<Buffer | ParsedAccountData> | null>
1568
+ >;
1569
+ /**
1570
+ * Fetch all the account info for the specified public key
1571
+ */
1572
+ getAccountInfo(
1573
+ publicKey: PublicKey,
1574
+ commitment?: Commitment,
1575
+ ): Promise<AccountInfo<Buffer> | null>;
1576
+ /**
1577
+ * Fetch all the account info for multiple accounts specified by an array of public keys, return with context
1578
+ */
1579
+ getMultipleAccountsInfoAndContext(
1580
+ publicKeys: PublicKey[],
1581
+ commitment?: Commitment,
1582
+ ): Promise<RpcResponseAndContext<(AccountInfo<Buffer> | null)[]>>;
1583
+ /**
1584
+ * Fetch all the account info for multiple accounts specified by an array of public keys
1585
+ */
1586
+ getMultipleAccountsInfo(
1587
+ publicKeys: PublicKey[],
1588
+ commitment?: Commitment,
1589
+ ): Promise<(AccountInfo<Buffer> | null)[]>;
1590
+ /**
1591
+ * Returns epoch activation information for a stake account that has been delegated
1592
+ */
1593
+ getStakeActivation(
1594
+ publicKey: PublicKey,
1595
+ commitment?: Commitment,
1596
+ epoch?: number,
1597
+ ): Promise<StakeActivationData>;
1598
+ /**
1599
+ * Fetch all the accounts owned by the specified program id
1600
+ *
1601
+ * @return {Promise<Array<{pubkey: PublicKey, account: AccountInfo<Buffer>}>>}
1602
+ */
1603
+ getProgramAccounts(
1604
+ programId: PublicKey,
1605
+ configOrCommitment?: GetProgramAccountsConfig | Commitment,
1606
+ ): Promise<
1607
+ Array<{
1608
+ pubkey: PublicKey;
1609
+ account: AccountInfo<Buffer>;
1610
+ }>
1611
+ >;
1612
+ /**
1613
+ * Fetch and parse all the accounts owned by the specified program id
1614
+ *
1615
+ * @return {Promise<Array<{pubkey: PublicKey, account: AccountInfo<Buffer | ParsedAccountData>}>>}
1616
+ */
1617
+ getParsedProgramAccounts(
1618
+ programId: PublicKey,
1619
+ configOrCommitment?: GetParsedProgramAccountsConfig | Commitment,
1620
+ ): Promise<
1621
+ Array<{
1622
+ pubkey: PublicKey;
1623
+ account: AccountInfo<Buffer | ParsedAccountData>;
1624
+ }>
1625
+ >;
1626
+ /**
1627
+ * Confirm the transaction identified by the specified signature.
1628
+ */
1629
+ confirmTransaction(
1630
+ signature: TransactionSignature,
1631
+ commitment?: Commitment,
1632
+ ): Promise<RpcResponseAndContext<SignatureResult>>;
1633
+ /**
1634
+ * Return the list of nodes that are currently participating in the cluster
1635
+ */
1636
+ getClusterNodes(): Promise<Array<ContactInfo>>;
1637
+ /**
1638
+ * Return the list of nodes that are currently participating in the cluster
1639
+ */
1640
+ getVoteAccounts(commitment?: Commitment): Promise<VoteAccountStatus>;
1641
+ /**
1642
+ * Fetch the current slot that the node is processing
1643
+ */
1644
+ getSlot(commitment?: Commitment): Promise<number>;
1645
+ /**
1646
+ * Fetch the current slot leader of the cluster
1647
+ */
1648
+ getSlotLeader(commitment?: Commitment): Promise<string>;
1649
+ /**
1650
+ * Fetch `limit` number of slot leaders starting from `startSlot`
1651
+ *
1652
+ * @param startSlot fetch slot leaders starting from this slot
1653
+ * @param limit number of slot leaders to return
1654
+ */
1655
+ getSlotLeaders(startSlot: number, limit: number): Promise<Array<PublicKey>>;
1656
+ /**
1657
+ * Fetch the current status of a signature
1658
+ */
1659
+ getSignatureStatus(
1660
+ signature: TransactionSignature,
1661
+ config?: SignatureStatusConfig,
1662
+ ): Promise<RpcResponseAndContext<SignatureStatus | null>>;
1663
+ /**
1664
+ * Fetch the current statuses of a batch of signatures
1665
+ */
1666
+ getSignatureStatuses(
1667
+ signatures: Array<TransactionSignature>,
1668
+ config?: SignatureStatusConfig,
1669
+ ): Promise<RpcResponseAndContext<Array<SignatureStatus | null>>>;
1670
+ /**
1671
+ * Fetch the current transaction count of the cluster
1672
+ */
1673
+ getTransactionCount(commitment?: Commitment): Promise<number>;
1674
+ /**
1675
+ * Fetch the current total currency supply of the cluster in lamports
1676
+ *
1677
+ * @deprecated Deprecated since v1.2.8. Please use {@link getSupply} instead.
1678
+ */
1679
+ getTotalSupply(commitment?: Commitment): Promise<number>;
1680
+ /**
1681
+ * Fetch the cluster InflationGovernor parameters
1682
+ */
1683
+ getInflationGovernor(commitment?: Commitment): Promise<InflationGovernor>;
1684
+ /**
1685
+ * Fetch the inflation reward for a list of addresses for an epoch
1686
+ */
1687
+ getInflationReward(
1688
+ addresses: PublicKey[],
1689
+ epoch?: number,
1690
+ commitment?: Commitment,
1691
+ ): Promise<(InflationReward | null)[]>;
1692
+ /**
1693
+ * Fetch the Epoch Info parameters
1694
+ */
1695
+ getEpochInfo(commitment?: Commitment): Promise<EpochInfo>;
1696
+ /**
1697
+ * Fetch the Epoch Schedule parameters
1698
+ */
1699
+ getEpochSchedule(): Promise<EpochSchedule>;
1700
+ /**
1701
+ * Fetch the leader schedule for the current epoch
1702
+ * @return {Promise<RpcResponseAndContext<LeaderSchedule>>}
1703
+ */
1704
+ getLeaderSchedule(): Promise<LeaderSchedule>;
1705
+ /**
1706
+ * Fetch the minimum balance needed to exempt an account of `dataLength`
1707
+ * size from rent
1708
+ */
1709
+ getMinimumBalanceForRentExemption(
1710
+ dataLength: number,
1711
+ commitment?: Commitment,
1712
+ ): Promise<number>;
1713
+ /**
1714
+ * Fetch a recent blockhash from the cluster, return with context
1715
+ * @return {Promise<RpcResponseAndContext<{blockhash: Blockhash, feeCalculator: FeeCalculator}>>}
1716
+ *
1717
+ * @deprecated Deprecated since Solana v1.8.0. Please use {@link getLatestBlockhash} instead.
1718
+ */
1719
+ getRecentBlockhashAndContext(commitment?: Commitment): Promise<
1720
+ RpcResponseAndContext<{
1721
+ blockhash: Blockhash;
1722
+ feeCalculator: FeeCalculator;
1723
+ }>
1724
+ >;
1725
+ /**
1726
+ * Fetch recent performance samples
1727
+ * @return {Promise<Array<PerfSample>>}
1728
+ */
1729
+ getRecentPerformanceSamples(limit?: number): Promise<Array<PerfSample>>;
1730
+ /**
1731
+ * Fetch the fee calculator for a recent blockhash from the cluster, return with context
1732
+ *
1733
+ * @deprecated Deprecated since Solana v1.8.0. Please use {@link getFeeForMessage} instead.
1734
+ */
1735
+ getFeeCalculatorForBlockhash(
1736
+ blockhash: Blockhash,
1737
+ commitment?: Commitment,
1738
+ ): Promise<RpcResponseAndContext<FeeCalculator | null>>;
1739
+ /**
1740
+ * Fetch the fee for a message from the cluster, return with context
1741
+ */
1742
+ getFeeForMessage(
1743
+ message: Message,
1744
+ commitment?: Commitment,
1745
+ ): Promise<RpcResponseAndContext<number>>;
1746
+ /**
1747
+ * Fetch a recent blockhash from the cluster
1748
+ * @return {Promise<{blockhash: Blockhash, feeCalculator: FeeCalculator}>}
1749
+ *
1750
+ * @deprecated Deprecated since Solana v1.8.0. Please use {@link getLatestBlockhash} instead.
1751
+ */
1752
+ getRecentBlockhash(commitment?: Commitment): Promise<{
1753
+ blockhash: Blockhash;
1754
+ feeCalculator: FeeCalculator;
1755
+ }>;
1756
+ /**
1757
+ * Fetch the latest blockhash from the cluster
1758
+ * @return {Promise<{blockhash: Blockhash, lastValidBlockHeight: number}>}
1759
+ */
1760
+ getLatestBlockhash(commitment?: Commitment): Promise<{
1761
+ blockhash: Blockhash;
1762
+ lastValidBlockHeight: number;
1763
+ }>;
1764
+ /**
1765
+ * Fetch the latest blockhash from the cluster
1766
+ * @return {Promise<{blockhash: Blockhash, lastValidBlockHeight: number}>}
1767
+ */
1768
+ getLatestBlockhashAndContext(commitment?: Commitment): Promise<
1769
+ RpcResponseAndContext<{
1770
+ blockhash: Blockhash;
1771
+ lastValidBlockHeight: number;
1772
+ }>
1773
+ >;
1774
+ /**
1775
+ * Fetch the node version
1776
+ */
1777
+ getVersion(): Promise<Version>;
1778
+ /**
1779
+ * Fetch the genesis hash
1780
+ */
1781
+ getGenesisHash(): Promise<string>;
1782
+ /**
1783
+ * Fetch a processed block from the cluster.
1784
+ */
1785
+ getBlock(
1786
+ slot: number,
1787
+ opts?: {
1788
+ commitment?: Finality;
1789
+ },
1790
+ ): Promise<BlockResponse | null>;
1791
+ getBlockHeight(commitment?: Commitment): Promise<number>;
1792
+ getBlockProduction(
1793
+ configOrCommitment?: GetBlockProductionConfig | Commitment,
1794
+ ): Promise<RpcResponseAndContext<BlockProduction>>;
1795
+ /**
1796
+ * Fetch a confirmed or finalized transaction from the cluster.
1797
+ */
1798
+ getTransaction(
1799
+ signature: string,
1800
+ opts?: {
1801
+ commitment?: Finality;
1802
+ },
1803
+ ): Promise<TransactionResponse | null>;
1804
+ /**
1805
+ * Fetch parsed transaction details for a confirmed or finalized transaction
1806
+ */
1807
+ getParsedTransaction(
1808
+ signature: TransactionSignature,
1809
+ commitment?: Finality,
1810
+ ): Promise<ParsedConfirmedTransaction | null>;
1811
+ /**
1812
+ * Fetch parsed transaction details for a batch of confirmed transactions
1813
+ */
1814
+ getParsedTransactions(
1815
+ signatures: TransactionSignature[],
1816
+ commitment?: Finality,
1817
+ ): Promise<(ParsedConfirmedTransaction | null)[]>;
1818
+ /**
1819
+ * Fetch transaction details for a batch of confirmed transactions.
1820
+ * Similar to {@link getParsedTransactions} but returns a {@link TransactionResponse}.
1821
+ */
1822
+ getTransactions(
1823
+ signatures: TransactionSignature[],
1824
+ commitment?: Finality,
1825
+ ): Promise<(TransactionResponse | null)[]>;
1826
+ /**
1827
+ * Fetch a list of Transactions and transaction statuses from the cluster
1828
+ * for a confirmed block.
1829
+ *
1830
+ * @deprecated Deprecated since v1.13.0. Please use {@link getBlock} instead.
1831
+ */
1832
+ getConfirmedBlock(
1833
+ slot: number,
1834
+ commitment?: Finality,
1835
+ ): Promise<ConfirmedBlock>;
1836
+ /**
1837
+ * Fetch confirmed blocks between two slots
1838
+ */
1839
+ getBlocks(
1840
+ startSlot: number,
1841
+ endSlot?: number,
1842
+ commitment?: Finality,
1843
+ ): Promise<Array<number>>;
1844
+ /**
1845
+ * Fetch a list of Signatures from the cluster for a block, excluding rewards
1846
+ */
1847
+ getBlockSignatures(
1848
+ slot: number,
1849
+ commitment?: Finality,
1850
+ ): Promise<BlockSignatures>;
1851
+ /**
1852
+ * Fetch a list of Signatures from the cluster for a confirmed block, excluding rewards
1853
+ *
1854
+ * @deprecated Deprecated since Solana v1.8.0. Please use {@link getBlockSignatures} instead.
1855
+ */
1856
+ getConfirmedBlockSignatures(
1857
+ slot: number,
1858
+ commitment?: Finality,
1859
+ ): Promise<BlockSignatures>;
1860
+ /**
1861
+ * Fetch a transaction details for a confirmed transaction
1862
+ *
1863
+ * @deprecated Deprecated since Solana v1.8.0. Please use {@link getTransaction} instead.
1864
+ */
1865
+ getConfirmedTransaction(
1866
+ signature: TransactionSignature,
1867
+ commitment?: Finality,
1868
+ ): Promise<ConfirmedTransaction | null>;
1869
+ /**
1870
+ * Fetch parsed transaction details for a confirmed transaction
1871
+ *
1872
+ * @deprecated Deprecated since Solana v1.8.0. Please use {@link getParsedTransaction} instead.
1873
+ */
1874
+ getParsedConfirmedTransaction(
1875
+ signature: TransactionSignature,
1876
+ commitment?: Finality,
1877
+ ): Promise<ParsedConfirmedTransaction | null>;
1878
+ /**
1879
+ * Fetch parsed transaction details for a batch of confirmed transactions
1880
+ *
1881
+ * @deprecated Deprecated since Solana v1.8.0. Please use {@link getParsedTransactions} instead.
1882
+ */
1883
+ getParsedConfirmedTransactions(
1884
+ signatures: TransactionSignature[],
1885
+ commitment?: Finality,
1886
+ ): Promise<(ParsedConfirmedTransaction | null)[]>;
1887
+ /**
1888
+ * Fetch a list of all the confirmed signatures for transactions involving an address
1889
+ * within a specified slot range. Max range allowed is 10,000 slots.
1890
+ *
1891
+ * @deprecated Deprecated since v1.3. Please use {@link getConfirmedSignaturesForAddress2} instead.
1892
+ *
1893
+ * @param address queried address
1894
+ * @param startSlot start slot, inclusive
1895
+ * @param endSlot end slot, inclusive
1896
+ */
1897
+ getConfirmedSignaturesForAddress(
1898
+ address: PublicKey,
1899
+ startSlot: number,
1900
+ endSlot: number,
1901
+ ): Promise<Array<TransactionSignature>>;
1902
+ /**
1903
+ * Returns confirmed signatures for transactions involving an
1904
+ * address backwards in time from the provided signature or most recent confirmed block
1905
+ *
1906
+ *
1907
+ * @param address queried address
1908
+ * @param options
1909
+ */
1910
+ getConfirmedSignaturesForAddress2(
1911
+ address: PublicKey,
1912
+ options?: ConfirmedSignaturesForAddress2Options,
1913
+ commitment?: Finality,
1914
+ ): Promise<Array<ConfirmedSignatureInfo>>;
1915
+ /**
1916
+ * Returns confirmed signatures for transactions involving an
1917
+ * address backwards in time from the provided signature or most recent confirmed block
1918
+ *
1919
+ *
1920
+ * @param address queried address
1921
+ * @param options
1922
+ */
1923
+ getSignaturesForAddress(
1924
+ address: PublicKey,
1925
+ options?: SignaturesForAddressOptions,
1926
+ commitment?: Finality,
1927
+ ): Promise<Array<ConfirmedSignatureInfo>>;
1928
+ /**
1929
+ * Fetch the contents of a Nonce account from the cluster, return with context
1930
+ */
1931
+ getNonceAndContext(
1932
+ nonceAccount: PublicKey,
1933
+ commitment?: Commitment,
1934
+ ): Promise<RpcResponseAndContext<NonceAccount | null>>;
1935
+ /**
1936
+ * Fetch the contents of a Nonce account from the cluster
1937
+ */
1938
+ getNonce(
1939
+ nonceAccount: PublicKey,
1940
+ commitment?: Commitment,
1941
+ ): Promise<NonceAccount | null>;
1942
+ /**
1943
+ * Request an allocation of lamports to the specified address
1944
+ *
1945
+ * ```typescript
1946
+ * import { Connection, PublicKey, LAMPORTS_PER_SOL } from "@solana/web3.js";
1947
+ *
1948
+ * (async () => {
1949
+ * const connection = new Connection("https://api.testnet.solana.com", "confirmed");
1950
+ * const myAddress = new PublicKey("2nr1bHFT86W9tGnyvmYW4vcHKsQB3sVQfnddasz4kExM");
1951
+ * const signature = await connection.requestAirdrop(myAddress, LAMPORTS_PER_SOL);
1952
+ * await connection.confirmTransaction(signature);
1953
+ * })();
1954
+ * ```
1955
+ */
1956
+ requestAirdrop(
1957
+ to: PublicKey,
1958
+ lamports: number,
1959
+ ): Promise<TransactionSignature>;
1960
+ /**
1961
+ * Simulate a transaction
1962
+ */
1963
+ simulateTransaction(
1964
+ transactionOrMessage: Transaction | Message,
1965
+ signers?: Array<Signer>,
1966
+ includeAccounts?: boolean | Array<PublicKey>,
1967
+ ): Promise<RpcResponseAndContext<SimulatedTransactionResponse>>;
1968
+ /**
1969
+ * Sign and send a transaction
1970
+ */
1971
+ sendTransaction(
1972
+ transaction: Transaction,
1973
+ signers: Array<Signer>,
1974
+ options?: SendOptions,
1975
+ ): Promise<TransactionSignature>;
1976
+ /**
1977
+ * Send a transaction that has already been signed and serialized into the
1978
+ * wire format
1979
+ */
1980
+ sendRawTransaction(
1981
+ rawTransaction: Buffer | Uint8Array | Array<number>,
1982
+ options?: SendOptions,
1983
+ ): Promise<TransactionSignature>;
1984
+ /**
1985
+ * Send a transaction that has already been signed, serialized into the
1986
+ * wire format, and encoded as a base64 string
1987
+ */
1988
+ sendEncodedTransaction(
1989
+ encodedTransaction: string,
1990
+ options?: SendOptions,
1991
+ ): Promise<TransactionSignature>;
1992
+ /**
1993
+ * Register a callback to be invoked whenever the specified account changes
1994
+ *
1995
+ * @param publicKey Public key of the account to monitor
1996
+ * @param callback Function to invoke whenever the account is changed
1997
+ * @param commitment Specify the commitment level account changes must reach before notification
1998
+ * @return subscription id
1999
+ */
2000
+ onAccountChange(
2001
+ publicKey: PublicKey,
2002
+ callback: AccountChangeCallback,
2003
+ commitment?: Commitment,
2004
+ ): number;
2005
+ /**
2006
+ * Deregister an account notification callback
2007
+ *
2008
+ * @param id subscription id to deregister
2009
+ */
2010
+ removeAccountChangeListener(id: number): 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
+ ): number;
2027
+ /**
2028
+ * Deregister an account notification callback
2029
+ *
2030
+ * @param id subscription id to deregister
2031
+ */
2032
+ removeProgramAccountChangeListener(id: number): Promise<void>;
2033
+ /**
2034
+ * Registers a callback to be invoked whenever logs are emitted.
2035
+ */
2036
+ onLogs(
2037
+ filter: LogsFilter,
2038
+ callback: LogsCallback,
2039
+ commitment?: Commitment,
2040
+ ): number;
2041
+ /**
2042
+ * Deregister a logs callback.
2043
+ *
2044
+ * @param id subscription id to deregister.
2045
+ */
2046
+ removeOnLogsListener(id: number): Promise<void>;
2047
+ /**
2048
+ * Register a callback to be invoked upon slot changes
2049
+ *
2050
+ * @param callback Function to invoke whenever the slot changes
2051
+ * @return subscription id
2052
+ */
2053
+ onSlotChange(callback: SlotChangeCallback): number;
2054
+ /**
2055
+ * Deregister a slot notification callback
2056
+ *
2057
+ * @param id subscription id to deregister
2058
+ */
2059
+ removeSlotChangeListener(id: number): Promise<void>;
2060
+ /**
2061
+ * Register a callback to be invoked upon slot updates. {@link SlotUpdate}'s
2062
+ * may be useful to track live progress of a cluster.
2063
+ *
2064
+ * @param callback Function to invoke whenever the slot updates
2065
+ * @return subscription id
2066
+ */
2067
+ onSlotUpdate(callback: SlotUpdateCallback): number;
2068
+ /**
2069
+ * Deregister a slot update notification callback
2070
+ *
2071
+ * @param id subscription id to deregister
2072
+ */
2073
+ removeSlotUpdateListener(id: number): Promise<void>;
2074
+ _buildArgs(
2075
+ args: Array<any>,
2076
+ override?: Commitment,
2077
+ encoding?: 'jsonParsed' | 'base64',
2078
+ extra?: any,
2079
+ ): Array<any>;
2080
+ /**
2081
+ * Register a callback to be invoked upon signature updates
2082
+ *
2083
+ * @param signature Transaction signature string in base 58
2084
+ * @param callback Function to invoke on signature notifications
2085
+ * @param commitment Specify the commitment level signature must reach before notification
2086
+ * @return subscription id
2087
+ */
2088
+ onSignature(
2089
+ signature: TransactionSignature,
2090
+ callback: SignatureResultCallback,
2091
+ commitment?: Commitment,
2092
+ ): number;
2093
+ /**
2094
+ * Register a callback to be invoked when a transaction is
2095
+ * received and/or processed.
2096
+ *
2097
+ * @param signature Transaction signature string in base 58
2098
+ * @param callback Function to invoke on signature notifications
2099
+ * @param options Enable received notifications and set the commitment
2100
+ * level that signature must reach before notification
2101
+ * @return subscription id
2102
+ */
2103
+ onSignatureWithOptions(
2104
+ signature: TransactionSignature,
2105
+ callback: SignatureSubscriptionCallback,
2106
+ options?: SignatureSubscriptionOptions,
2107
+ ): number;
2108
+ /**
2109
+ * Deregister a signature notification callback
2110
+ *
2111
+ * @param id subscription id to deregister
2112
+ */
2113
+ removeSignatureListener(id: number): Promise<void>;
2114
+ /**
2115
+ * Register a callback to be invoked upon root changes
2116
+ *
2117
+ * @param callback Function to invoke whenever the root changes
2118
+ * @return subscription id
2119
+ */
2120
+ onRootChange(callback: RootChangeCallback): number;
2121
+ /**
2122
+ * Deregister a root notification callback
2123
+ *
2124
+ * @param id subscription id to deregister
2125
+ */
2126
+ removeRootChangeListener(id: number): Promise<void>;
2127
+ }
2128
+
2129
+ export const BPF_LOADER_PROGRAM_ID: PublicKey;
2130
+ /**
2131
+ * Factory class for transactions to interact with a program loader
2132
+ */
2133
+ export class BpfLoader {
2134
+ /**
2135
+ * Minimum number of signatures required to load a program not including
2136
+ * retries
2137
+ *
2138
+ * Can be used to calculate transaction fees
2139
+ */
2140
+ static getMinNumSignatures(dataLength: number): number;
2141
+ /**
2142
+ * Load a BPF program
2143
+ *
2144
+ * @param connection The connection to use
2145
+ * @param payer Account that will pay program loading fees
2146
+ * @param program Account to load the program into
2147
+ * @param elf The entire ELF containing the BPF program
2148
+ * @param loaderProgramId The program id of the BPF loader to use
2149
+ * @return true if program was loaded successfully, false if program was already loaded
2150
+ */
2151
+ static load(
2152
+ connection: Connection,
2153
+ payer: Signer,
2154
+ program: Signer,
2155
+ elf: Buffer | Uint8Array | Array<number>,
2156
+ loaderProgramId: PublicKey,
2157
+ ): Promise<boolean>;
2158
+ }
2159
+
2160
+ /**
2161
+ * Compute Budget Instruction class
2162
+ */
2163
+ export class ComputeBudgetInstruction {
2164
+ /**
2165
+ * Decode a compute budget instruction and retrieve the instruction type.
2166
+ */
2167
+ static decodeInstructionType(
2168
+ instruction: TransactionInstruction,
2169
+ ): ComputeBudgetInstructionType;
2170
+ /**
2171
+ * Decode request units compute budget instruction and retrieve the instruction params.
2172
+ */
2173
+ static decodeRequestUnits(
2174
+ instruction: TransactionInstruction,
2175
+ ): RequestUnitsParams;
2176
+ /**
2177
+ * Decode request heap frame compute budget instruction and retrieve the instruction params.
2178
+ */
2179
+ static decodeRequestHeapFrame(
2180
+ instruction: TransactionInstruction,
2181
+ ): RequestHeapFrameParams;
2182
+ }
2183
+ /**
2184
+ * An enumeration of valid ComputeBudgetInstructionType's
2185
+ */
2186
+ export type ComputeBudgetInstructionType =
2187
+ | 'RequestUnits'
2188
+ | 'RequestHeapFrame';
2189
+ /**
2190
+ * Request units instruction params
2191
+ */
2192
+ interface RequestUnitsParams {
2193
+ /** Units to request for transaction-wide compute */
2194
+ units: number;
2195
+ /** Additional fee to pay */
2196
+ additionalFee: number;
2197
+ }
2198
+ /**
2199
+ * Request heap frame instruction params
2200
+ */
2201
+ export type RequestHeapFrameParams = {
2202
+ /** Requested transaction-wide program heap size in bytes. Must be multiple of 1024. Applies to each program, including CPIs. */
2203
+ bytes: number;
2204
+ };
2205
+ /**
2206
+ * Factory class for transaction instructions to interact with the Compute Budget program
2207
+ */
2208
+ export class ComputeBudgetProgram {
2209
+ /**
2210
+ * Public key that identifies the Compute Budget program
2211
+ */
2212
+ static programId: PublicKey;
2213
+ static requestUnits(params: RequestUnitsParams): TransactionInstruction;
2214
+ static requestHeapFrame(
2215
+ params: RequestHeapFrameParams,
2216
+ ): TransactionInstruction;
2217
+ }
2218
+
2219
+ /**
2220
+ * Params for creating an ed25519 instruction using a public key
2221
+ */
2222
+ export type CreateEd25519InstructionWithPublicKeyParams = {
2223
+ publicKey: Uint8Array;
2224
+ message: Uint8Array;
2225
+ signature: Uint8Array;
2226
+ instructionIndex?: number;
2227
+ };
2228
+ /**
2229
+ * Params for creating an ed25519 instruction using a private key
2230
+ */
2231
+ export type CreateEd25519InstructionWithPrivateKeyParams = {
2232
+ privateKey: Uint8Array;
2233
+ message: Uint8Array;
2234
+ instructionIndex?: number;
2235
+ };
2236
+ export class Ed25519Program {
2237
+ /**
2238
+ * Public key that identifies the ed25519 program
2239
+ */
2240
+ static programId: PublicKey;
2241
+ /**
2242
+ * Create an ed25519 instruction with a public key and signature. The
2243
+ * public key must be a buffer that is 32 bytes long, and the signature
2244
+ * must be a buffer of 64 bytes.
2245
+ */
2246
+ static createInstructionWithPublicKey(
2247
+ params: CreateEd25519InstructionWithPublicKeyParams,
2248
+ ): TransactionInstruction;
2249
+ /**
2250
+ * Create an ed25519 instruction with a private key. The private key
2251
+ * must be a buffer that is 64 bytes long.
2252
+ */
2253
+ static createInstructionWithPrivateKey(
2254
+ params: CreateEd25519InstructionWithPrivateKeyParams,
2255
+ ): TransactionInstruction;
2256
+ }
2257
+
2258
+ /**
2259
+ * Program loader interface
2260
+ */
2261
+ export class Loader {
2262
+ /**
2263
+ * Amount of program data placed in each load Transaction
2264
+ */
2265
+ static chunkSize: number;
2266
+ /**
2267
+ * Minimum number of signatures required to load a program not including
2268
+ * retries
2269
+ *
2270
+ * Can be used to calculate transaction fees
2271
+ */
2272
+ static getMinNumSignatures(dataLength: number): number;
2273
+ /**
2274
+ * Loads a generic program
2275
+ *
2276
+ * @param connection The connection to use
2277
+ * @param payer System account that pays to load the program
2278
+ * @param program Account to load the program into
2279
+ * @param programId Public key that identifies the loader
2280
+ * @param data Program octets
2281
+ * @return true if program was loaded successfully, false if program was already loaded
2282
+ */
2283
+ static load(
2284
+ connection: Connection,
2285
+ payer: Signer,
2286
+ program: Signer,
2287
+ programId: PublicKey,
2288
+ data: Buffer | Uint8Array | Array<number>,
2289
+ ): Promise<boolean>;
2290
+ }
2291
+
2292
+ /**
2293
+ * Address of the stake config account which configures the rate
2294
+ * of stake warmup and cooldown as well as the slashing penalty.
2295
+ */
2296
+ export const STAKE_CONFIG_ID: PublicKey;
2297
+ /**
2298
+ * Stake account authority info
2299
+ */
2300
+ export class Authorized {
2301
+ /** stake authority */
2302
+ staker: PublicKey;
2303
+ /** withdraw authority */
2304
+ withdrawer: PublicKey;
2305
+ /**
2306
+ * Create a new Authorized object
2307
+ * @param staker the stake authority
2308
+ * @param withdrawer the withdraw authority
2309
+ */
2310
+ constructor(staker: PublicKey, withdrawer: PublicKey);
2311
+ }
2312
+ /**
2313
+ * Stake account lockup info
2314
+ */
2315
+ export class Lockup {
2316
+ /** Unix timestamp of lockup expiration */
2317
+ unixTimestamp: number;
2318
+ /** Epoch of lockup expiration */
2319
+ epoch: number;
2320
+ /** Lockup custodian authority */
2321
+ custodian: PublicKey;
2322
+ /**
2323
+ * Create a new Lockup object
2324
+ */
2325
+ constructor(unixTimestamp: number, epoch: number, custodian: PublicKey);
2326
+ /**
2327
+ * Default, inactive Lockup value
2328
+ */
2329
+ static default: Lockup;
2330
+ }
2331
+ /**
2332
+ * Create stake account transaction params
2333
+ */
2334
+ export type CreateStakeAccountParams = {
2335
+ /** Address of the account which will fund creation */
2336
+ fromPubkey: PublicKey;
2337
+ /** Address of the new stake account */
2338
+ stakePubkey: PublicKey;
2339
+ /** Authorities of the new stake account */
2340
+ authorized: Authorized;
2341
+ /** Lockup of the new stake account */
2342
+ lockup?: Lockup;
2343
+ /** Funding amount */
2344
+ lamports: number;
2345
+ };
2346
+ /**
2347
+ * Create stake account with seed transaction params
2348
+ */
2349
+ export type CreateStakeAccountWithSeedParams = {
2350
+ fromPubkey: PublicKey;
2351
+ stakePubkey: PublicKey;
2352
+ basePubkey: PublicKey;
2353
+ seed: string;
2354
+ authorized: Authorized;
2355
+ lockup?: Lockup;
2356
+ lamports: number;
2357
+ };
2358
+ /**
2359
+ * Initialize stake instruction params
2360
+ */
2361
+ export type InitializeStakeParams = {
2362
+ stakePubkey: PublicKey;
2363
+ authorized: Authorized;
2364
+ lockup?: Lockup;
2365
+ };
2366
+ /**
2367
+ * Delegate stake instruction params
2368
+ */
2369
+ export type DelegateStakeParams = {
2370
+ stakePubkey: PublicKey;
2371
+ authorizedPubkey: PublicKey;
2372
+ votePubkey: PublicKey;
2373
+ };
2374
+ /**
2375
+ * Authorize stake instruction params
2376
+ */
2377
+ export type AuthorizeStakeParams = {
2378
+ stakePubkey: PublicKey;
2379
+ authorizedPubkey: PublicKey;
2380
+ newAuthorizedPubkey: PublicKey;
2381
+ stakeAuthorizationType: StakeAuthorizationType;
2382
+ custodianPubkey?: PublicKey;
2383
+ };
2384
+ /**
2385
+ * Authorize stake instruction params using a derived key
2386
+ */
2387
+ export type AuthorizeWithSeedStakeParams = {
2388
+ stakePubkey: PublicKey;
2389
+ authorityBase: PublicKey;
2390
+ authoritySeed: string;
2391
+ authorityOwner: PublicKey;
2392
+ newAuthorizedPubkey: PublicKey;
2393
+ stakeAuthorizationType: StakeAuthorizationType;
2394
+ custodianPubkey?: PublicKey;
2395
+ };
2396
+ /**
2397
+ * Split stake instruction params
2398
+ */
2399
+ export type SplitStakeParams = {
2400
+ stakePubkey: PublicKey;
2401
+ authorizedPubkey: PublicKey;
2402
+ splitStakePubkey: PublicKey;
2403
+ lamports: number;
2404
+ };
2405
+ /**
2406
+ * Split with seed transaction params
2407
+ */
2408
+ export type SplitStakeWithSeedParams = {
2409
+ stakePubkey: PublicKey;
2410
+ authorizedPubkey: PublicKey;
2411
+ splitStakePubkey: PublicKey;
2412
+ basePubkey: PublicKey;
2413
+ seed: string;
2414
+ lamports: number;
2415
+ };
2416
+ /**
2417
+ * Withdraw stake instruction params
2418
+ */
2419
+ export type WithdrawStakeParams = {
2420
+ stakePubkey: PublicKey;
2421
+ authorizedPubkey: PublicKey;
2422
+ toPubkey: PublicKey;
2423
+ lamports: number;
2424
+ custodianPubkey?: PublicKey;
2425
+ };
2426
+ /**
2427
+ * Deactivate stake instruction params
2428
+ */
2429
+ export type DeactivateStakeParams = {
2430
+ stakePubkey: PublicKey;
2431
+ authorizedPubkey: PublicKey;
2432
+ };
2433
+ /**
2434
+ * Merge stake instruction params
2435
+ */
2436
+ export type MergeStakeParams = {
2437
+ stakePubkey: PublicKey;
2438
+ sourceStakePubKey: PublicKey;
2439
+ authorizedPubkey: PublicKey;
2440
+ };
2441
+ /**
2442
+ * Stake Instruction class
2443
+ */
2444
+ export class StakeInstruction {
2445
+ /**
2446
+ * Decode a stake instruction and retrieve the instruction type.
2447
+ */
2448
+ static decodeInstructionType(
2449
+ instruction: TransactionInstruction,
2450
+ ): StakeInstructionType;
2451
+ /**
2452
+ * Decode a initialize stake instruction and retrieve the instruction params.
2453
+ */
2454
+ static decodeInitialize(
2455
+ instruction: TransactionInstruction,
2456
+ ): InitializeStakeParams;
2457
+ /**
2458
+ * Decode a delegate stake instruction and retrieve the instruction params.
2459
+ */
2460
+ static decodeDelegate(
2461
+ instruction: TransactionInstruction,
2462
+ ): DelegateStakeParams;
2463
+ /**
2464
+ * Decode an authorize stake instruction and retrieve the instruction params.
2465
+ */
2466
+ static decodeAuthorize(
2467
+ instruction: TransactionInstruction,
2468
+ ): AuthorizeStakeParams;
2469
+ /**
2470
+ * Decode an authorize-with-seed stake instruction and retrieve the instruction params.
2471
+ */
2472
+ static decodeAuthorizeWithSeed(
2473
+ instruction: TransactionInstruction,
2474
+ ): AuthorizeWithSeedStakeParams;
2475
+ /**
2476
+ * Decode a split stake instruction and retrieve the instruction params.
2477
+ */
2478
+ static decodeSplit(instruction: TransactionInstruction): SplitStakeParams;
2479
+ /**
2480
+ * Decode a merge stake instruction and retrieve the instruction params.
2481
+ */
2482
+ static decodeMerge(instruction: TransactionInstruction): MergeStakeParams;
2483
+ /**
2484
+ * Decode a withdraw stake instruction and retrieve the instruction params.
2485
+ */
2486
+ static decodeWithdraw(
2487
+ instruction: TransactionInstruction,
2488
+ ): WithdrawStakeParams;
2489
+ /**
2490
+ * Decode a deactivate stake instruction and retrieve the instruction params.
2491
+ */
2492
+ static decodeDeactivate(
2493
+ instruction: TransactionInstruction,
2494
+ ): DeactivateStakeParams;
2495
+ }
2496
+ /**
2497
+ * An enumeration of valid StakeInstructionType's
2498
+ */
2499
+ export type StakeInstructionType =
2500
+ | 'Authorize'
2501
+ | 'AuthorizeWithSeed'
2502
+ | 'Deactivate'
2503
+ | 'Delegate'
2504
+ | 'Initialize'
2505
+ | 'Merge'
2506
+ | 'Split'
2507
+ | 'Withdraw';
2508
+ /**
2509
+ * Stake authorization type
2510
+ */
2511
+ export type StakeAuthorizationType = {
2512
+ /** The Stake Authorization index (from solana-stake-program) */
2513
+ index: number;
2514
+ };
2515
+ /**
2516
+ * An enumeration of valid StakeAuthorizationLayout's
2517
+ */
2518
+ export const StakeAuthorizationLayout: Readonly<{
2519
+ Staker: {
2520
+ index: number;
2521
+ };
2522
+ Withdrawer: {
2523
+ index: number;
2524
+ };
2525
+ }>;
2526
+ /**
2527
+ * Factory class for transactions to interact with the Stake program
2528
+ */
2529
+ export class StakeProgram {
2530
+ /**
2531
+ * Public key that identifies the Stake program
2532
+ */
2533
+ static programId: PublicKey;
2534
+ /**
2535
+ * Max space of a Stake account
2536
+ *
2537
+ * This is generated from the solana-stake-program StakeState struct as
2538
+ * `StakeState::size_of()`:
2539
+ * https://docs.rs/solana-stake-program/latest/solana_stake_program/stake_state/enum.StakeState.html
2540
+ */
2541
+ static space: number;
2542
+ /**
2543
+ * Generate an Initialize instruction to add to a Stake Create transaction
2544
+ */
2545
+ static initialize(params: InitializeStakeParams): TransactionInstruction;
2546
+ /**
2547
+ * Generate a Transaction that creates a new Stake account at
2548
+ * an address generated with `from`, a seed, and the Stake programId
2549
+ */
2550
+ static createAccountWithSeed(
2551
+ params: CreateStakeAccountWithSeedParams,
2552
+ ): Transaction;
2553
+ /**
2554
+ * Generate a Transaction that creates a new Stake account
2555
+ */
2556
+ static createAccount(params: CreateStakeAccountParams): Transaction;
2557
+ /**
2558
+ * Generate a Transaction that delegates Stake tokens to a validator
2559
+ * Vote PublicKey. This transaction can also be used to redelegate Stake
2560
+ * to a new validator Vote PublicKey.
2561
+ */
2562
+ static delegate(params: DelegateStakeParams): Transaction;
2563
+ /**
2564
+ * Generate a Transaction that authorizes a new PublicKey as Staker
2565
+ * or Withdrawer on the Stake account.
2566
+ */
2567
+ static authorize(params: AuthorizeStakeParams): Transaction;
2568
+ /**
2569
+ * Generate a Transaction that authorizes a new PublicKey as Staker
2570
+ * or Withdrawer on the Stake account.
2571
+ */
2572
+ static authorizeWithSeed(params: AuthorizeWithSeedStakeParams): Transaction;
2573
+ /**
2574
+ * Generate a Transaction that splits Stake tokens into another stake account
2575
+ */
2576
+ static split(params: SplitStakeParams): Transaction;
2577
+ /**
2578
+ * Generate a Transaction that splits Stake tokens into another account
2579
+ * derived from a base public key and seed
2580
+ */
2581
+ static splitWithSeed(params: SplitStakeWithSeedParams): Transaction;
2582
+ /**
2583
+ * Generate a Transaction that merges Stake accounts.
2584
+ */
2585
+ static merge(params: MergeStakeParams): Transaction;
2586
+ /**
2587
+ * Generate a Transaction that withdraws deactivated Stake tokens.
2588
+ */
2589
+ static withdraw(params: WithdrawStakeParams): Transaction;
2590
+ /**
2591
+ * Generate a Transaction that deactivates Stake tokens.
2592
+ */
2593
+ static deactivate(params: DeactivateStakeParams): Transaction;
2594
+ }
2595
+
2596
+ /**
2597
+ * Create account system transaction params
2598
+ */
2599
+ export type CreateAccountParams = {
2600
+ /** The account that will transfer lamports to the created account */
2601
+ fromPubkey: PublicKey;
2602
+ /** Public key of the created account */
2603
+ newAccountPubkey: PublicKey;
2604
+ /** Amount of lamports to transfer to the created account */
2605
+ lamports: number;
2606
+ /** Amount of space in bytes to allocate to the created account */
2607
+ space: number;
2608
+ /** Public key of the program to assign as the owner of the created account */
2609
+ programId: PublicKey;
2610
+ };
2611
+ /**
2612
+ * Transfer system transaction params
2613
+ */
2614
+ export type TransferParams = {
2615
+ /** Account that will transfer lamports */
2616
+ fromPubkey: PublicKey;
2617
+ /** Account that will receive transferred lamports */
2618
+ toPubkey: PublicKey;
2619
+ /** Amount of lamports to transfer */
2620
+ lamports: number;
2621
+ };
2622
+ /**
2623
+ * Assign system transaction params
2624
+ */
2625
+ export type AssignParams = {
2626
+ /** Public key of the account which will be assigned a new owner */
2627
+ accountPubkey: PublicKey;
2628
+ /** Public key of the program to assign as the owner */
2629
+ programId: PublicKey;
2630
+ };
2631
+ /**
2632
+ * Create account with seed system transaction params
2633
+ */
2634
+ export type CreateAccountWithSeedParams = {
2635
+ /** The account that will transfer lamports to the created account */
2636
+ fromPubkey: PublicKey;
2637
+ /** Public key of the created account. Must be pre-calculated with PublicKey.createWithSeed() */
2638
+ newAccountPubkey: PublicKey;
2639
+ /** Base public key to use to derive the address of the created account. Must be the same as the base key used to create `newAccountPubkey` */
2640
+ basePubkey: PublicKey;
2641
+ /** Seed to use to derive the address of the created account. Must be the same as the seed used to create `newAccountPubkey` */
2642
+ seed: string;
2643
+ /** Amount of lamports to transfer to the created account */
2644
+ lamports: number;
2645
+ /** Amount of space in bytes to allocate to the created account */
2646
+ space: number;
2647
+ /** Public key of the program to assign as the owner of the created account */
2648
+ programId: PublicKey;
2649
+ };
2650
+ /**
2651
+ * Create nonce account system transaction params
2652
+ */
2653
+ export type CreateNonceAccountParams = {
2654
+ /** The account that will transfer lamports to the created nonce account */
2655
+ fromPubkey: PublicKey;
2656
+ /** Public key of the created nonce account */
2657
+ noncePubkey: PublicKey;
2658
+ /** Public key to set as authority of the created nonce account */
2659
+ authorizedPubkey: PublicKey;
2660
+ /** Amount of lamports to transfer to the created nonce account */
2661
+ lamports: number;
2662
+ };
2663
+ /**
2664
+ * Create nonce account with seed system transaction params
2665
+ */
2666
+ export type CreateNonceAccountWithSeedParams = {
2667
+ /** The account that will transfer lamports to the created nonce account */
2668
+ fromPubkey: PublicKey;
2669
+ /** Public key of the created nonce account */
2670
+ noncePubkey: PublicKey;
2671
+ /** Public key to set as authority of the created nonce account */
2672
+ authorizedPubkey: PublicKey;
2673
+ /** Amount of lamports to transfer to the created nonce account */
2674
+ lamports: number;
2675
+ /** Base public key to use to derive the address of the nonce account */
2676
+ basePubkey: PublicKey;
2677
+ /** Seed to use to derive the address of the nonce account */
2678
+ seed: string;
2679
+ };
2680
+ /**
2681
+ * Initialize nonce account system instruction params
2682
+ */
2683
+ export type InitializeNonceParams = {
2684
+ /** Nonce account which will be initialized */
2685
+ noncePubkey: PublicKey;
2686
+ /** Public key to set as authority of the initialized nonce account */
2687
+ authorizedPubkey: PublicKey;
2688
+ };
2689
+ /**
2690
+ * Advance nonce account system instruction params
2691
+ */
2692
+ export type AdvanceNonceParams = {
2693
+ /** Nonce account */
2694
+ noncePubkey: PublicKey;
2695
+ /** Public key of the nonce authority */
2696
+ authorizedPubkey: PublicKey;
2697
+ };
2698
+ /**
2699
+ * Withdraw nonce account system transaction params
2700
+ */
2701
+ export type WithdrawNonceParams = {
2702
+ /** Nonce account */
2703
+ noncePubkey: PublicKey;
2704
+ /** Public key of the nonce authority */
2705
+ authorizedPubkey: PublicKey;
2706
+ /** Public key of the account which will receive the withdrawn nonce account balance */
2707
+ toPubkey: PublicKey;
2708
+ /** Amount of lamports to withdraw from the nonce account */
2709
+ lamports: number;
2710
+ };
2711
+ /**
2712
+ * Authorize nonce account system transaction params
2713
+ */
2714
+ export type AuthorizeNonceParams = {
2715
+ /** Nonce account */
2716
+ noncePubkey: PublicKey;
2717
+ /** Public key of the current nonce authority */
2718
+ authorizedPubkey: PublicKey;
2719
+ /** Public key to set as the new nonce authority */
2720
+ newAuthorizedPubkey: PublicKey;
2721
+ };
2722
+ /**
2723
+ * Allocate account system transaction params
2724
+ */
2725
+ export type AllocateParams = {
2726
+ /** Account to allocate */
2727
+ accountPubkey: PublicKey;
2728
+ /** Amount of space in bytes to allocate */
2729
+ space: number;
2730
+ };
2731
+ /**
2732
+ * Allocate account with seed system transaction params
2733
+ */
2734
+ export type AllocateWithSeedParams = {
2735
+ /** Account to allocate */
2736
+ accountPubkey: PublicKey;
2737
+ /** Base public key to use to derive the address of the allocated account */
2738
+ basePubkey: PublicKey;
2739
+ /** Seed to use to derive the address of the allocated account */
2740
+ seed: string;
2741
+ /** Amount of space in bytes to allocate */
2742
+ space: number;
2743
+ /** Public key of the program to assign as the owner of the allocated account */
2744
+ programId: PublicKey;
2745
+ };
2746
+ /**
2747
+ * Assign account with seed system transaction params
2748
+ */
2749
+ export type AssignWithSeedParams = {
2750
+ /** Public key of the account which will be assigned a new owner */
2751
+ accountPubkey: PublicKey;
2752
+ /** Base public key to use to derive the address of the assigned account */
2753
+ basePubkey: PublicKey;
2754
+ /** Seed to use to derive the address of the assigned account */
2755
+ seed: string;
2756
+ /** Public key of the program to assign as the owner */
2757
+ programId: PublicKey;
2758
+ };
2759
+ /**
2760
+ * Transfer with seed system transaction params
2761
+ */
2762
+ export type TransferWithSeedParams = {
2763
+ /** Account that will transfer lamports */
2764
+ fromPubkey: PublicKey;
2765
+ /** Base public key to use to derive the funding account address */
2766
+ basePubkey: PublicKey;
2767
+ /** Account that will receive transferred lamports */
2768
+ toPubkey: PublicKey;
2769
+ /** Amount of lamports to transfer */
2770
+ lamports: number;
2771
+ /** Seed to use to derive the funding account address */
2772
+ seed: string;
2773
+ /** Program id to use to derive the funding account address */
2774
+ programId: PublicKey;
2775
+ };
2776
+ /**
2777
+ * System Instruction class
2778
+ */
2779
+ export class SystemInstruction {
2780
+ /**
2781
+ * Decode a system instruction and retrieve the instruction type.
2782
+ */
2783
+ static decodeInstructionType(
2784
+ instruction: TransactionInstruction,
2785
+ ): SystemInstructionType;
2786
+ /**
2787
+ * Decode a create account system instruction and retrieve the instruction params.
2788
+ */
2789
+ static decodeCreateAccount(
2790
+ instruction: TransactionInstruction,
2791
+ ): CreateAccountParams;
2792
+ /**
2793
+ * Decode a transfer system instruction and retrieve the instruction params.
2794
+ */
2795
+ static decodeTransfer(instruction: TransactionInstruction): TransferParams;
2796
+ /**
2797
+ * Decode a transfer with seed system instruction and retrieve the instruction params.
2798
+ */
2799
+ static decodeTransferWithSeed(
2800
+ instruction: TransactionInstruction,
2801
+ ): TransferWithSeedParams;
2802
+ /**
2803
+ * Decode an allocate system instruction and retrieve the instruction params.
2804
+ */
2805
+ static decodeAllocate(instruction: TransactionInstruction): AllocateParams;
2806
+ /**
2807
+ * Decode an allocate with seed system instruction and retrieve the instruction params.
2808
+ */
2809
+ static decodeAllocateWithSeed(
2810
+ instruction: TransactionInstruction,
2811
+ ): AllocateWithSeedParams;
2812
+ /**
2813
+ * Decode an assign system instruction and retrieve the instruction params.
2814
+ */
2815
+ static decodeAssign(instruction: TransactionInstruction): AssignParams;
2816
+ /**
2817
+ * Decode an assign with seed system instruction and retrieve the instruction params.
2818
+ */
2819
+ static decodeAssignWithSeed(
2820
+ instruction: TransactionInstruction,
2821
+ ): AssignWithSeedParams;
2822
+ /**
2823
+ * Decode a create account with seed system instruction and retrieve the instruction params.
2824
+ */
2825
+ static decodeCreateWithSeed(
2826
+ instruction: TransactionInstruction,
2827
+ ): CreateAccountWithSeedParams;
2828
+ /**
2829
+ * Decode a nonce initialize system instruction and retrieve the instruction params.
2830
+ */
2831
+ static decodeNonceInitialize(
2832
+ instruction: TransactionInstruction,
2833
+ ): InitializeNonceParams;
2834
+ /**
2835
+ * Decode a nonce advance system instruction and retrieve the instruction params.
2836
+ */
2837
+ static decodeNonceAdvance(
2838
+ instruction: TransactionInstruction,
2839
+ ): AdvanceNonceParams;
2840
+ /**
2841
+ * Decode a nonce withdraw system instruction and retrieve the instruction params.
2842
+ */
2843
+ static decodeNonceWithdraw(
2844
+ instruction: TransactionInstruction,
2845
+ ): WithdrawNonceParams;
2846
+ /**
2847
+ * Decode a nonce authorize system instruction and retrieve the instruction params.
2848
+ */
2849
+ static decodeNonceAuthorize(
2850
+ instruction: TransactionInstruction,
2851
+ ): AuthorizeNonceParams;
2852
+ }
2853
+ /**
2854
+ * An enumeration of valid SystemInstructionType's
2855
+ */
2856
+ export type SystemInstructionType =
2857
+ | 'AdvanceNonceAccount'
2858
+ | 'Allocate'
2859
+ | 'AllocateWithSeed'
2860
+ | 'Assign'
2861
+ | 'AssignWithSeed'
2862
+ | 'AuthorizeNonceAccount'
2863
+ | 'Create'
2864
+ | 'CreateWithSeed'
2865
+ | 'InitializeNonceAccount'
2866
+ | 'Transfer'
2867
+ | 'TransferWithSeed'
2868
+ | 'WithdrawNonceAccount';
2869
+ /**
2870
+ * Factory class for transactions to interact with the System program
2871
+ */
2872
+ export class SystemProgram {
2873
+ /**
2874
+ * Public key that identifies the System program
2875
+ */
2876
+ static programId: PublicKey;
2877
+ /**
2878
+ * Generate a transaction instruction that creates a new account
2879
+ */
2880
+ static createAccount(params: CreateAccountParams): TransactionInstruction;
2881
+ /**
2882
+ * Generate a transaction instruction that transfers lamports from one account to another
2883
+ */
2884
+ static transfer(
2885
+ params: TransferParams | TransferWithSeedParams,
2886
+ ): TransactionInstruction;
2887
+ /**
2888
+ * Generate a transaction instruction that assigns an account to a program
2889
+ */
2890
+ static assign(
2891
+ params: AssignParams | AssignWithSeedParams,
2892
+ ): TransactionInstruction;
2893
+ /**
2894
+ * Generate a transaction instruction that creates a new account at
2895
+ * an address generated with `from`, a seed, and programId
2896
+ */
2897
+ static createAccountWithSeed(
2898
+ params: CreateAccountWithSeedParams,
2899
+ ): TransactionInstruction;
2900
+ /**
2901
+ * Generate a transaction that creates a new Nonce account
2902
+ */
2903
+ static createNonceAccount(
2904
+ params: CreateNonceAccountParams | CreateNonceAccountWithSeedParams,
2905
+ ): Transaction;
2906
+ /**
2907
+ * Generate an instruction to initialize a Nonce account
2908
+ */
2909
+ static nonceInitialize(
2910
+ params: InitializeNonceParams,
2911
+ ): TransactionInstruction;
2912
+ /**
2913
+ * Generate an instruction to advance the nonce in a Nonce account
2914
+ */
2915
+ static nonceAdvance(params: AdvanceNonceParams): TransactionInstruction;
2916
+ /**
2917
+ * Generate a transaction instruction that withdraws lamports from a Nonce account
2918
+ */
2919
+ static nonceWithdraw(params: WithdrawNonceParams): TransactionInstruction;
2920
+ /**
2921
+ * Generate a transaction instruction that authorizes a new PublicKey as the authority
2922
+ * on a Nonce account.
2923
+ */
2924
+ static nonceAuthorize(params: AuthorizeNonceParams): TransactionInstruction;
2925
+ /**
2926
+ * Generate a transaction instruction that allocates space in an account without funding
2927
+ */
2928
+ static allocate(
2929
+ params: AllocateParams | AllocateWithSeedParams,
2930
+ ): TransactionInstruction;
2931
+ }
2932
+
2933
+ /**
2934
+ * Params for creating an secp256k1 instruction using a public key
2935
+ */
2936
+ export type CreateSecp256k1InstructionWithPublicKeyParams = {
2937
+ publicKey: Buffer | Uint8Array | Array<number>;
2938
+ message: Buffer | Uint8Array | Array<number>;
2939
+ signature: Buffer | Uint8Array | Array<number>;
2940
+ recoveryId: number;
2941
+ instructionIndex?: number;
2942
+ };
2943
+ /**
2944
+ * Params for creating an secp256k1 instruction using an Ethereum address
2945
+ */
2946
+ export type CreateSecp256k1InstructionWithEthAddressParams = {
2947
+ ethAddress: Buffer | Uint8Array | Array<number> | string;
2948
+ message: Buffer | Uint8Array | Array<number>;
2949
+ signature: Buffer | Uint8Array | Array<number>;
2950
+ recoveryId: number;
2951
+ instructionIndex?: number;
2952
+ };
2953
+ /**
2954
+ * Params for creating an secp256k1 instruction using a private key
2955
+ */
2956
+ export type CreateSecp256k1InstructionWithPrivateKeyParams = {
2957
+ privateKey: Buffer | Uint8Array | Array<number>;
2958
+ message: Buffer | Uint8Array | Array<number>;
2959
+ instructionIndex?: number;
2960
+ };
2961
+ export class Secp256k1Program {
2962
+ /**
2963
+ * Public key that identifies the secp256k1 program
2964
+ */
2965
+ static programId: PublicKey;
2966
+ /**
2967
+ * Construct an Ethereum address from a secp256k1 public key buffer.
2968
+ * @param {Buffer} publicKey a 64 byte secp256k1 public key buffer
2969
+ */
2970
+ static publicKeyToEthAddress(
2971
+ publicKey: Buffer | Uint8Array | Array<number>,
2972
+ ): Buffer;
2973
+ /**
2974
+ * Create an secp256k1 instruction with a public key. The public key
2975
+ * must be a buffer that is 64 bytes long.
2976
+ */
2977
+ static createInstructionWithPublicKey(
2978
+ params: CreateSecp256k1InstructionWithPublicKeyParams,
2979
+ ): TransactionInstruction;
2980
+ /**
2981
+ * Create an secp256k1 instruction with an Ethereum address. The address
2982
+ * must be a hex string or a buffer that is 20 bytes long.
2983
+ */
2984
+ static createInstructionWithEthAddress(
2985
+ params: CreateSecp256k1InstructionWithEthAddressParams,
2986
+ ): TransactionInstruction;
2987
+ /**
2988
+ * Create an secp256k1 instruction with a private key. The private key
2989
+ * must be a buffer that is 32 bytes long.
2990
+ */
2991
+ static createInstructionWithPrivateKey(
2992
+ params: CreateSecp256k1InstructionWithPrivateKeyParams,
2993
+ ): TransactionInstruction;
2994
+ }
2995
+
2996
+ export const VALIDATOR_INFO_KEY: PublicKey;
2997
+ /**
2998
+ * Info used to identity validators.
2999
+ */
3000
+ export type Info = {
3001
+ /** validator name */
3002
+ name: string;
3003
+ /** optional, validator website */
3004
+ website?: string;
3005
+ /** optional, extra information the validator chose to share */
3006
+ details?: string;
3007
+ /** optional, used to identify validators on keybase.io */
3008
+ keybaseUsername?: string;
3009
+ };
3010
+ /**
3011
+ * ValidatorInfo class
3012
+ */
3013
+ export class ValidatorInfo {
3014
+ /**
3015
+ * validator public key
3016
+ */
3017
+ key: PublicKey;
3018
+ /**
3019
+ * validator information
3020
+ */
3021
+ info: Info;
3022
+ /**
3023
+ * Construct a valid ValidatorInfo
3024
+ *
3025
+ * @param key validator public key
3026
+ * @param info validator information
3027
+ */
3028
+ constructor(key: PublicKey, info: Info);
3029
+ /**
3030
+ * Deserialize ValidatorInfo from the config account data. Exactly two config
3031
+ * keys are required in the data.
3032
+ *
3033
+ * @param buffer config account data
3034
+ * @return null if info was not found
3035
+ */
3036
+ static fromConfigData(
3037
+ buffer: Buffer | Uint8Array | Array<number>,
3038
+ ): ValidatorInfo | null;
3039
+ }
3040
+
3041
+ export const VOTE_PROGRAM_ID: PublicKey;
3042
+ export type Lockout = {
3043
+ slot: number;
3044
+ confirmationCount: number;
3045
+ };
3046
+ /**
3047
+ * History of how many credits earned by the end of each epoch
3048
+ */
3049
+ export type EpochCredits = Readonly<{
3050
+ epoch: number;
3051
+ credits: number;
3052
+ prevCredits: number;
3053
+ }>;
3054
+ export type AuthorizedVoter = Readonly<{
3055
+ epoch: number;
3056
+ authorizedVoter: PublicKey;
3057
+ }>;
3058
+ export type PriorVoter = Readonly<{
3059
+ authorizedPubkey: PublicKey;
3060
+ epochOfLastAuthorizedSwitch: number;
3061
+ targetEpoch: number;
3062
+ }>;
3063
+ export type BlockTimestamp = Readonly<{
3064
+ slot: number;
3065
+ timestamp: number;
3066
+ }>;
3067
+ /**
3068
+ * VoteAccount class
3069
+ */
3070
+ export class VoteAccount {
3071
+ nodePubkey: PublicKey;
3072
+ authorizedWithdrawer: PublicKey;
3073
+ commission: number;
3074
+ rootSlot: number | null;
3075
+ votes: Lockout[];
3076
+ authorizedVoters: AuthorizedVoter[];
3077
+ priorVoters: PriorVoter[];
3078
+ epochCredits: EpochCredits[];
3079
+ lastTimestamp: BlockTimestamp;
3080
+ /**
3081
+ * Deserialize VoteAccount from the account data.
3082
+ *
3083
+ * @param buffer account data
3084
+ * @return VoteAccount
3085
+ */
3086
+ static fromAccountData(
3087
+ buffer: Buffer | Uint8Array | Array<number>,
3088
+ ): VoteAccount;
3089
+ }
3090
+
3091
+ /**
3092
+ * Vote account info
3093
+ */
3094
+ export class VoteInit {
3095
+ nodePubkey: PublicKey;
3096
+ authorizedVoter: PublicKey;
3097
+ authorizedWithdrawer: PublicKey;
3098
+ commission: number; /** [0, 100] */
3099
+ constructor(
3100
+ nodePubkey: PublicKey,
3101
+ authorizedVoter: PublicKey,
3102
+ authorizedWithdrawer: PublicKey,
3103
+ commission: number,
3104
+ );
3105
+ }
3106
+ /**
3107
+ * Create vote account transaction params
3108
+ */
3109
+ export type CreateVoteAccountParams = {
3110
+ fromPubkey: PublicKey;
3111
+ votePubkey: PublicKey;
3112
+ voteInit: VoteInit;
3113
+ lamports: number;
3114
+ };
3115
+ /**
3116
+ * InitializeAccount instruction params
3117
+ */
3118
+ export type InitializeAccountParams = {
3119
+ votePubkey: PublicKey;
3120
+ nodePubkey: PublicKey;
3121
+ voteInit: VoteInit;
3122
+ };
3123
+ /**
3124
+ * Authorize instruction params
3125
+ */
3126
+ export type AuthorizeVoteParams = {
3127
+ votePubkey: PublicKey;
3128
+ /** Current vote or withdraw authority, depending on `voteAuthorizationType` */
3129
+ authorizedPubkey: PublicKey;
3130
+ newAuthorizedPubkey: PublicKey;
3131
+ voteAuthorizationType: VoteAuthorizationType;
3132
+ };
3133
+ /**
3134
+ * Withdraw from vote account transaction params
3135
+ */
3136
+ export type WithdrawFromVoteAccountParams = {
3137
+ votePubkey: PublicKey;
3138
+ authorizedWithdrawerPubkey: PublicKey;
3139
+ lamports: number;
3140
+ toPubkey: PublicKey;
3141
+ };
3142
+ /**
3143
+ * Vote Instruction class
3144
+ */
3145
+ export class VoteInstruction {
3146
+ /**
3147
+ * Decode a vote instruction and retrieve the instruction type.
3148
+ */
3149
+ static decodeInstructionType(
3150
+ instruction: TransactionInstruction,
3151
+ ): VoteInstructionType;
3152
+ /**
3153
+ * Decode an initialize vote instruction and retrieve the instruction params.
3154
+ */
3155
+ static decodeInitializeAccount(
3156
+ instruction: TransactionInstruction,
3157
+ ): InitializeAccountParams;
3158
+ /**
3159
+ * Decode an authorize instruction and retrieve the instruction params.
3160
+ */
3161
+ static decodeAuthorize(
3162
+ instruction: TransactionInstruction,
3163
+ ): AuthorizeVoteParams;
3164
+ /**
3165
+ * Decode a withdraw instruction and retrieve the instruction params.
3166
+ */
3167
+ static decodeWithdraw(
3168
+ instruction: TransactionInstruction,
3169
+ ): WithdrawFromVoteAccountParams;
3170
+ }
3171
+ /**
3172
+ * An enumeration of valid VoteInstructionType's
3173
+ */
3174
+ export type VoteInstructionType =
3175
+ | 'Authorize'
3176
+ | 'InitializeAccount'
3177
+ | 'Withdraw';
3178
+ /**
3179
+ * VoteAuthorize type
3180
+ */
3181
+ export type VoteAuthorizationType = {
3182
+ /** The VoteAuthorize index (from solana-vote-program) */
3183
+ index: number;
3184
+ };
3185
+ /**
3186
+ * An enumeration of valid VoteAuthorization layouts.
3187
+ */
3188
+ export const VoteAuthorizationLayout: Readonly<{
3189
+ Voter: {
3190
+ index: number;
3191
+ };
3192
+ Withdrawer: {
3193
+ index: number;
3194
+ };
3195
+ }>;
3196
+ /**
3197
+ * Factory class for transactions to interact with the Vote program
3198
+ */
3199
+ export class VoteProgram {
3200
+ /**
3201
+ * Public key that identifies the Vote program
3202
+ */
3203
+ static programId: PublicKey;
3204
+ /**
3205
+ * Max space of a Vote account
3206
+ *
3207
+ * This is generated from the solana-vote-program VoteState struct as
3208
+ * `VoteState::size_of()`:
3209
+ * https://docs.rs/solana-vote-program/1.9.5/solana_vote_program/vote_state/struct.VoteState.html#method.size_of
3210
+ */
3211
+ static space: number;
3212
+ /**
3213
+ * Generate an Initialize instruction.
3214
+ */
3215
+ static initializeAccount(
3216
+ params: InitializeAccountParams,
3217
+ ): TransactionInstruction;
3218
+ /**
3219
+ * Generate a transaction that creates a new Vote account.
3220
+ */
3221
+ static createAccount(params: CreateVoteAccountParams): Transaction;
3222
+ /**
3223
+ * Generate a transaction that authorizes a new Voter or Withdrawer on the Vote account.
3224
+ */
3225
+ static authorize(params: AuthorizeVoteParams): Transaction;
3226
+ /**
3227
+ * Generate a transaction to withdraw from a Vote account.
3228
+ */
3229
+ static withdraw(params: WithdrawFromVoteAccountParams): Transaction;
3230
+ }
3231
+
3232
+ export const SYSVAR_CLOCK_PUBKEY: PublicKey;
3233
+ export const SYSVAR_EPOCH_SCHEDULE_PUBKEY: PublicKey;
3234
+ export const SYSVAR_INSTRUCTIONS_PUBKEY: PublicKey;
3235
+ export const SYSVAR_RECENT_BLOCKHASHES_PUBKEY: PublicKey;
3236
+ export const SYSVAR_RENT_PUBKEY: PublicKey;
3237
+ export const SYSVAR_REWARDS_PUBKEY: PublicKey;
3238
+ export const SYSVAR_SLOT_HASHES_PUBKEY: PublicKey;
3239
+ export const SYSVAR_SLOT_HISTORY_PUBKEY: PublicKey;
3240
+ export const SYSVAR_STAKE_HISTORY_PUBKEY: PublicKey;
3241
+
3242
+ export class SendTransactionError extends Error {
3243
+ logs: string[] | undefined;
3244
+ constructor(message: string, logs?: string[]);
3245
+ }
3246
+
3247
+ /**
3248
+ * Sign, send and confirm a transaction.
3249
+ *
3250
+ * If `commitment` option is not specified, defaults to 'max' commitment.
3251
+ *
3252
+ * @param {Connection} connection
3253
+ * @param {Transaction} transaction
3254
+ * @param {Array<Signer>} signers
3255
+ * @param {ConfirmOptions} [options]
3256
+ * @returns {Promise<TransactionSignature>}
3257
+ */
3258
+ export function sendAndConfirmTransaction(
3259
+ connection: Connection,
3260
+ transaction: Transaction,
3261
+ signers: Array<Signer>,
3262
+ options?: ConfirmOptions,
3263
+ ): Promise<TransactionSignature>;
3264
+
3265
+ /**
3266
+ * Send and confirm a raw transaction
3267
+ *
3268
+ * If `commitment` option is not specified, defaults to 'max' commitment.
3269
+ *
3270
+ * @param {Connection} connection
3271
+ * @param {Buffer} rawTransaction
3272
+ * @param {ConfirmOptions} [options]
3273
+ * @returns {Promise<TransactionSignature>}
3274
+ */
3275
+ export function sendAndConfirmRawTransaction(
3276
+ connection: Connection,
3277
+ rawTransaction: Buffer,
3278
+ options?: ConfirmOptions,
3279
+ ): Promise<TransactionSignature>;
3280
+
3281
+ export type Cluster = 'devnet' | 'testnet' | 'mainnet-beta';
3282
+ /**
3283
+ * Retrieves the RPC API URL for the specified cluster
3284
+ */
3285
+ export function clusterApiUrl(cluster?: Cluster, tls?: boolean): string;
3286
+
3287
+ /**
3288
+ * There are 1-billion lamports in one SOL
3289
+ */
3290
+ export const LAMPORTS_PER_SOL = 1000000000;
3291
+ }