@solana/web3.js 1.40.0 → 1.40.2

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