@solana/web3.js 1.87.3 → 2.0.0-experimental.0099b2a

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.
Files changed (113) hide show
  1. package/README.md +56 -112
  2. package/dist/index.browser.cjs +927 -0
  3. package/dist/index.browser.cjs.map +1 -0
  4. package/dist/index.browser.js +876 -0
  5. package/dist/index.browser.js.map +1 -0
  6. package/dist/index.development.js +4180 -0
  7. package/dist/index.development.js.map +1 -0
  8. package/dist/index.native.js +865 -0
  9. package/dist/index.native.js.map +1 -0
  10. package/dist/index.node.cjs +916 -0
  11. package/dist/index.node.cjs.map +1 -0
  12. package/dist/index.node.js +865 -0
  13. package/dist/index.node.js.map +1 -0
  14. package/dist/index.production.min.js +87 -0
  15. package/dist/types/airdrop-confirmer.d.ts +20 -0
  16. package/dist/types/airdrop.d.ts +23 -0
  17. package/dist/types/cached-abortable-iterable.d.ts +11 -0
  18. package/dist/types/index.d.ts +15 -0
  19. package/dist/types/rpc-default-config.d.ts +3 -0
  20. package/dist/types/rpc-integer-overflow-error.d.ts +8 -0
  21. package/dist/types/rpc-request-coalescer.d.ts +5 -0
  22. package/dist/types/rpc-request-deduplication.d.ts +2 -0
  23. package/dist/types/rpc-subscription-coalescer.d.ts +10 -0
  24. package/dist/types/rpc-transport.d.ts +4 -0
  25. package/dist/types/rpc-websocket-autopinger.d.ts +8 -0
  26. package/dist/types/rpc-websocket-connection-sharding.d.ts +13 -0
  27. package/dist/types/rpc-websocket-transport.d.ts +13 -0
  28. package/dist/types/rpc.d.ts +7 -0
  29. package/dist/types/send-transaction.d.ts +37 -0
  30. package/dist/types/transaction-confirmation-strategy-blockheight.d.ts +10 -0
  31. package/dist/types/transaction-confirmation-strategy-nonce.d.ts +15 -0
  32. package/dist/types/transaction-confirmation-strategy-racer.d.ts +14 -0
  33. package/dist/types/transaction-confirmation-strategy-recent-signature.d.ts +13 -0
  34. package/dist/types/transaction-confirmation-strategy-timeout.d.ts +8 -0
  35. package/dist/types/transaction-confirmation.d.ts +37 -0
  36. package/package.json +85 -109
  37. package/lib/index.browser.cjs.js +0 -10296
  38. package/lib/index.browser.cjs.js.map +0 -1
  39. package/lib/index.browser.esm.js +0 -10193
  40. package/lib/index.browser.esm.js.map +0 -1
  41. package/lib/index.cjs.js +0 -12589
  42. package/lib/index.cjs.js.map +0 -1
  43. package/lib/index.d.ts +0 -3947
  44. package/lib/index.esm.js +0 -12480
  45. package/lib/index.esm.js.map +0 -1
  46. package/lib/index.iife.js +0 -26233
  47. package/lib/index.iife.js.map +0 -1
  48. package/lib/index.iife.min.js +0 -20
  49. package/lib/index.iife.min.js.map +0 -1
  50. package/lib/index.native.js +0 -10296
  51. package/lib/index.native.js.map +0 -1
  52. package/src/__forks__/browser/fetch-impl.ts +0 -4
  53. package/src/__forks__/browser/rpc-websocket-factory.ts +0 -1
  54. package/src/__forks__/react-native/fetch-impl.ts +0 -4
  55. package/src/__forks__/react-native/rpc-websocket-factory.ts +0 -1
  56. package/src/account-data.ts +0 -39
  57. package/src/account.ts +0 -55
  58. package/src/blockhash.ts +0 -4
  59. package/src/bpf-loader-deprecated.ts +0 -5
  60. package/src/bpf-loader.ts +0 -45
  61. package/src/connection.ts +0 -6796
  62. package/src/epoch-schedule.ts +0 -102
  63. package/src/errors.ts +0 -50
  64. package/src/fee-calculator.ts +0 -18
  65. package/src/fetch-impl.ts +0 -16
  66. package/src/index.ts +0 -24
  67. package/src/instruction.ts +0 -58
  68. package/src/keypair.ts +0 -102
  69. package/src/layout.ts +0 -188
  70. package/src/loader.ts +0 -267
  71. package/src/message/account-keys.ts +0 -79
  72. package/src/message/compiled-keys.ts +0 -165
  73. package/src/message/index.ts +0 -47
  74. package/src/message/legacy.ts +0 -326
  75. package/src/message/v0.ts +0 -496
  76. package/src/message/versioned.ts +0 -36
  77. package/src/nonce-account.ts +0 -82
  78. package/src/programs/address-lookup-table/index.ts +0 -435
  79. package/src/programs/address-lookup-table/state.ts +0 -84
  80. package/src/programs/compute-budget.ts +0 -281
  81. package/src/programs/ed25519.ts +0 -157
  82. package/src/programs/index.ts +0 -7
  83. package/src/programs/secp256k1.ts +0 -228
  84. package/src/programs/stake.ts +0 -935
  85. package/src/programs/system.ts +0 -1048
  86. package/src/programs/vote.ts +0 -543
  87. package/src/publickey.ts +0 -259
  88. package/src/rpc-websocket-factory.ts +0 -4
  89. package/src/rpc-websocket.ts +0 -79
  90. package/src/sysvar.ts +0 -37
  91. package/src/timing.ts +0 -23
  92. package/src/transaction/constants.ts +0 -12
  93. package/src/transaction/expiry-custom-errors.ts +0 -48
  94. package/src/transaction/index.ts +0 -5
  95. package/src/transaction/legacy.ts +0 -948
  96. package/src/transaction/message.ts +0 -140
  97. package/src/transaction/versioned.ts +0 -126
  98. package/src/utils/assert.ts +0 -8
  99. package/src/utils/bigint.ts +0 -43
  100. package/src/utils/borsh-schema.ts +0 -38
  101. package/src/utils/cluster.ts +0 -35
  102. package/src/utils/ed25519.ts +0 -43
  103. package/src/utils/index.ts +0 -5
  104. package/src/utils/makeWebsocketUrl.ts +0 -26
  105. package/src/utils/promise-timeout.ts +0 -14
  106. package/src/utils/secp256k1.ts +0 -11
  107. package/src/utils/send-and-confirm-raw-transaction.ts +0 -102
  108. package/src/utils/send-and-confirm-transaction.ts +0 -98
  109. package/src/utils/shortvec-encoding.ts +0 -28
  110. package/src/utils/sleep.ts +0 -4
  111. package/src/utils/to-buffer.ts +0 -11
  112. package/src/validator-info.ts +0 -104
  113. package/src/vote-account.ts +0 -236
package/lib/index.d.ts DELETED
@@ -1,3947 +0,0 @@
1
- /// <reference types="node" />
2
- declare module "@solana/web3.js" {
3
- import { Buffer } from 'buffer';
4
- import { Agent } from 'http';
5
- import { Agent as Agent$1 } from 'https';
6
-
7
- export class Struct {
8
- constructor(properties: any);
9
- encode(): Buffer;
10
- static decode(data: Buffer): any;
11
- static decodeUnchecked(data: Buffer): any;
12
- }
13
- export class Enum extends Struct {
14
- enum: string;
15
- constructor(properties: any);
16
- }
17
- export const SOLANA_SCHEMA: Map<Function, any>;
18
-
19
- /**
20
- * Maximum length of derived pubkey seed
21
- */
22
- export const MAX_SEED_LENGTH = 32;
23
- /**
24
- * Size of public key in bytes
25
- */
26
- export const PUBLIC_KEY_LENGTH = 32;
27
- /**
28
- * Value to be converted into public key
29
- */
30
- type PublicKeyInitData = number | string | Uint8Array | Array<number> | PublicKeyData;
31
- /**
32
- * JSON object representation of PublicKey class
33
- */
34
- type PublicKeyData = {};
35
- /**
36
- * A public key
37
- */
38
- export class PublicKey extends Struct {
39
- /**
40
- * Create a new PublicKey object
41
- * @param value ed25519 public key as buffer or base-58 encoded string
42
- */
43
- constructor(value: PublicKeyInitData);
44
- /**
45
- * Returns a unique PublicKey for tests and benchmarks using a counter
46
- */
47
- static unique(): PublicKey;
48
- /**
49
- * Default public key value. The base58-encoded string representation is all ones (as seen below)
50
- * The underlying BN number is 32 bytes that are all zeros
51
- */
52
- static default: PublicKey;
53
- /**
54
- * Checks if two publicKeys are equal
55
- */
56
- equals(publicKey: PublicKey): boolean;
57
- /**
58
- * Return the base-58 representation of the public key
59
- */
60
- toBase58(): string;
61
- toJSON(): string;
62
- /**
63
- * Return the byte array representation of the public key in big endian
64
- */
65
- toBytes(): Uint8Array;
66
- /**
67
- * Return the Buffer representation of the public key in big endian
68
- */
69
- toBuffer(): Buffer;
70
- get [Symbol.toStringTag](): string;
71
- /**
72
- * Return the base-58 representation of the public key
73
- */
74
- toString(): string;
75
- /**
76
- * Derive a public key from another key, a seed, and a program ID.
77
- * The program ID will also serve as the owner of the public key, giving
78
- * it permission to write data to the account.
79
- */
80
- static createWithSeed(fromPublicKey: PublicKey, seed: string, programId: PublicKey): Promise<PublicKey>;
81
- /**
82
- * Derive a program address from seeds and a program ID.
83
- */
84
- static createProgramAddressSync(seeds: Array<Buffer | Uint8Array>, programId: PublicKey): PublicKey;
85
- /**
86
- * Async version of createProgramAddressSync
87
- * For backwards compatibility
88
- *
89
- * @deprecated Use {@link createProgramAddressSync} instead
90
- */
91
- static createProgramAddress(seeds: Array<Buffer | Uint8Array>, programId: PublicKey): Promise<PublicKey>;
92
- /**
93
- * Find a valid program address
94
- *
95
- * Valid program addresses must fall off the ed25519 curve. This function
96
- * iterates a nonce until it finds one that when combined with the seeds
97
- * results in a valid program address.
98
- */
99
- static findProgramAddressSync(seeds: Array<Buffer | Uint8Array>, programId: PublicKey): [PublicKey, number];
100
- /**
101
- * Async version of findProgramAddressSync
102
- * For backwards compatibility
103
- *
104
- * @deprecated Use {@link findProgramAddressSync} instead
105
- */
106
- static findProgramAddress(seeds: Array<Buffer | Uint8Array>, programId: PublicKey): Promise<[PublicKey, number]>;
107
- /**
108
- * Check that a pubkey is on the ed25519 curve.
109
- */
110
- static isOnCurve(pubkeyData: PublicKeyInitData): boolean;
111
- }
112
-
113
- /**
114
- * An account key pair (public and secret keys).
115
- *
116
- * @deprecated since v1.10.0, please use {@link Keypair} instead.
117
- */
118
- export class Account {
119
- /**
120
- * Create a new Account object
121
- *
122
- * If the secretKey parameter is not provided a new key pair is randomly
123
- * created for the account
124
- *
125
- * @param secretKey Secret key for the account
126
- */
127
- constructor(secretKey?: Uint8Array | Array<number>);
128
- /**
129
- * The public key for this account
130
- */
131
- get publicKey(): PublicKey;
132
- /**
133
- * The **unencrypted** secret key for this account. The first 32 bytes
134
- * is the private scalar and the last 32 bytes is the public key.
135
- * Read more: https://blog.mozilla.org/warner/2011/11/29/ed25519-keys/
136
- */
137
- get secretKey(): Buffer;
138
- }
139
-
140
- /**
141
- * Blockhash as Base58 string.
142
- */
143
- type Blockhash = string;
144
-
145
- export const BPF_LOADER_DEPRECATED_PROGRAM_ID: PublicKey;
146
-
147
- /**
148
- * Epoch schedule
149
- * (see https://docs.solana.com/terminology#epoch)
150
- * Can be retrieved with the {@link Connection.getEpochSchedule} method
151
- */
152
- export class EpochSchedule {
153
- /** The maximum number of slots in each epoch */
154
- slotsPerEpoch: number;
155
- /** The number of slots before beginning of an epoch to calculate a leader schedule for that epoch */
156
- leaderScheduleSlotOffset: number;
157
- /** Indicates whether epochs start short and grow */
158
- warmup: boolean;
159
- /** The first epoch with `slotsPerEpoch` slots */
160
- firstNormalEpoch: number;
161
- /** The first slot of `firstNormalEpoch` */
162
- firstNormalSlot: number;
163
- constructor(slotsPerEpoch: number, leaderScheduleSlotOffset: number, warmup: boolean, firstNormalEpoch: number, firstNormalSlot: number);
164
- getEpoch(slot: number): number;
165
- getEpochAndSlotIndex(slot: number): [number, number];
166
- getFirstSlotInEpoch(epoch: number): number;
167
- getLastSlotInEpoch(epoch: number): number;
168
- getSlotsInEpoch(epoch: number): number;
169
- }
170
-
171
- export const _default: typeof fetch;
172
- //# sourceMappingURL=fetch-impl.d.ts.map
173
-
174
- /**
175
- * Calculator for transaction fees.
176
- *
177
- * @deprecated Deprecated since Solana v1.8.0.
178
- */
179
- interface FeeCalculator {
180
- /** Cost in lamports to validate a signature. */
181
- lamportsPerSignature: number;
182
- }
183
-
184
- export const NONCE_ACCOUNT_LENGTH: number;
185
- /**
186
- * A durable nonce is a 32 byte value encoded as a base58 string.
187
- */
188
- type DurableNonce = string;
189
- /**
190
- * NonceAccount class
191
- */
192
- export class NonceAccount {
193
- authorizedPubkey: PublicKey;
194
- nonce: DurableNonce;
195
- feeCalculator: FeeCalculator;
196
- /**
197
- * Deserialize NonceAccount from the account data.
198
- *
199
- * @param buffer account data
200
- * @return NonceAccount
201
- */
202
- static fromAccountData(buffer: Buffer | Uint8Array | Array<number>): NonceAccount;
203
- }
204
-
205
- /**
206
- * A 64 byte secret key, the first 32 bytes of which is the
207
- * private scalar and the last 32 bytes is the public key.
208
- * Read more: https://blog.mozilla.org/warner/2011/11/29/ed25519-keys/
209
- */
210
- type Ed25519SecretKey = Uint8Array;
211
- /**
212
- * Ed25519 Keypair
213
- */
214
- interface Ed25519Keypair {
215
- publicKey: Uint8Array;
216
- secretKey: Ed25519SecretKey;
217
- }
218
-
219
- /**
220
- * Keypair signer interface
221
- */
222
- interface Signer {
223
- publicKey: PublicKey;
224
- secretKey: Uint8Array;
225
- }
226
- /**
227
- * An account keypair used for signing transactions.
228
- */
229
- export class Keypair {
230
- private _keypair;
231
- /**
232
- * Create a new keypair instance.
233
- * Generate random keypair if no {@link Ed25519Keypair} is provided.
234
- *
235
- * @param {Ed25519Keypair} keypair ed25519 keypair
236
- */
237
- constructor(keypair?: Ed25519Keypair);
238
- /**
239
- * Generate a new random keypair
240
- *
241
- * @returns {Keypair} Keypair
242
- */
243
- static generate(): Keypair;
244
- /**
245
- * Create a keypair from a raw secret key byte array.
246
- *
247
- * This method should only be used to recreate a keypair from a previously
248
- * generated secret key. Generating keypairs from a random seed should be done
249
- * with the {@link Keypair.fromSeed} method.
250
- *
251
- * @throws error if the provided secret key is invalid and validation is not skipped.
252
- *
253
- * @param secretKey secret key byte array
254
- * @param options skip secret key validation
255
- *
256
- * @returns {Keypair} Keypair
257
- */
258
- static fromSecretKey(secretKey: Uint8Array, options?: {
259
- skipValidation?: boolean;
260
- }): Keypair;
261
- /**
262
- * Generate a keypair from a 32 byte seed.
263
- *
264
- * @param seed seed byte array
265
- *
266
- * @returns {Keypair} Keypair
267
- */
268
- static fromSeed(seed: Uint8Array): Keypair;
269
- /**
270
- * The public key for this keypair
271
- *
272
- * @returns {PublicKey} PublicKey
273
- */
274
- get publicKey(): PublicKey;
275
- /**
276
- * The raw secret key for this keypair
277
- * @returns {Uint8Array} Secret key in an array of Uint8 bytes
278
- */
279
- get secretKey(): Uint8Array;
280
- }
281
-
282
- /**
283
- * Maximum over-the-wire size of a Transaction
284
- *
285
- * 1280 is IPv6 minimum MTU
286
- * 40 bytes is the size of the IPv6 header
287
- * 8 bytes is the size of the fragment header
288
- */
289
- export const PACKET_DATA_SIZE: number;
290
- export const VERSION_PREFIX_MASK = 127;
291
- export const SIGNATURE_LENGTH_IN_BYTES = 64;
292
-
293
- export class TransactionExpiredBlockheightExceededError extends Error {
294
- signature: string;
295
- constructor(signature: string);
296
- }
297
- export class TransactionExpiredTimeoutError extends Error {
298
- signature: string;
299
- constructor(signature: string, timeoutSeconds: number);
300
- }
301
- export class TransactionExpiredNonceInvalidError extends Error {
302
- signature: string;
303
- constructor(signature: string);
304
- }
305
-
306
- type AccountKeysFromLookups = LoadedAddresses;
307
- export class MessageAccountKeys {
308
- staticAccountKeys: Array<PublicKey>;
309
- accountKeysFromLookups?: AccountKeysFromLookups;
310
- constructor(staticAccountKeys: Array<PublicKey>, accountKeysFromLookups?: AccountKeysFromLookups);
311
- keySegments(): Array<Array<PublicKey>>;
312
- get(index: number): PublicKey | undefined;
313
- get length(): number;
314
- compileInstructions(instructions: Array<TransactionInstruction>): Array<MessageCompiledInstruction>;
315
- }
316
-
317
- /**
318
- * An instruction to execute by a program
319
- *
320
- * @property {number} programIdIndex
321
- * @property {number[]} accounts
322
- * @property {string} data
323
- */
324
- type CompiledInstruction = {
325
- /** Index into the transaction keys array indicating the program account that executes this instruction */
326
- programIdIndex: number;
327
- /** Ordered indices into the transaction keys array indicating which accounts to pass to the program */
328
- accounts: number[];
329
- /** The program input data encoded as base 58 */
330
- data: string;
331
- };
332
- /**
333
- * Message constructor arguments
334
- */
335
- type MessageArgs = {
336
- /** The message header, identifying signed and read-only `accountKeys` */
337
- header: MessageHeader;
338
- /** All the account keys used by this transaction */
339
- accountKeys: string[] | PublicKey[];
340
- /** The hash of a recent ledger block */
341
- recentBlockhash: Blockhash;
342
- /** Instructions that will be executed in sequence and committed in one atomic transaction if all succeed. */
343
- instructions: CompiledInstruction[];
344
- };
345
- type CompileLegacyArgs = {
346
- payerKey: PublicKey;
347
- instructions: Array<TransactionInstruction>;
348
- recentBlockhash: Blockhash;
349
- };
350
- /**
351
- * List of instructions to be processed atomically
352
- */
353
- export class Message {
354
- header: MessageHeader;
355
- accountKeys: PublicKey[];
356
- recentBlockhash: Blockhash;
357
- instructions: CompiledInstruction[];
358
- private indexToProgramIds;
359
- constructor(args: MessageArgs);
360
- get version(): 'legacy';
361
- get staticAccountKeys(): Array<PublicKey>;
362
- get compiledInstructions(): Array<MessageCompiledInstruction>;
363
- get addressTableLookups(): Array<MessageAddressTableLookup>;
364
- getAccountKeys(): MessageAccountKeys;
365
- static compile(args: CompileLegacyArgs): Message;
366
- isAccountSigner(index: number): boolean;
367
- isAccountWritable(index: number): boolean;
368
- isProgramId(index: number): boolean;
369
- programIds(): PublicKey[];
370
- nonProgramIds(): PublicKey[];
371
- serialize(): Buffer;
372
- /**
373
- * Decode a compiled message into a Message object.
374
- */
375
- static from(buffer: Buffer | Uint8Array | Array<number>): Message;
376
- }
377
-
378
- type AddressLookupTableState = {
379
- deactivationSlot: bigint;
380
- lastExtendedSlot: number;
381
- lastExtendedSlotStartIndex: number;
382
- authority?: PublicKey;
383
- addresses: Array<PublicKey>;
384
- };
385
- type AddressLookupTableAccountArgs = {
386
- key: PublicKey;
387
- state: AddressLookupTableState;
388
- };
389
- export class AddressLookupTableAccount {
390
- key: PublicKey;
391
- state: AddressLookupTableState;
392
- constructor(args: AddressLookupTableAccountArgs);
393
- isActive(): boolean;
394
- static deserialize(accountData: Uint8Array): AddressLookupTableState;
395
- }
396
-
397
- type CreateLookupTableParams = {
398
- /** Account used to derive and control the new address lookup table. */
399
- authority: PublicKey;
400
- /** Account that will fund the new address lookup table. */
401
- payer: PublicKey;
402
- /** A recent slot must be used in the derivation path for each initialized table. */
403
- recentSlot: bigint | number;
404
- };
405
- type FreezeLookupTableParams = {
406
- /** Address lookup table account to freeze. */
407
- lookupTable: PublicKey;
408
- /** Account which is the current authority. */
409
- authority: PublicKey;
410
- };
411
- type ExtendLookupTableParams = {
412
- /** Address lookup table account to extend. */
413
- lookupTable: PublicKey;
414
- /** Account which is the current authority. */
415
- authority: PublicKey;
416
- /** Account that will fund the table reallocation.
417
- * Not required if the reallocation has already been funded. */
418
- payer?: PublicKey;
419
- /** List of Public Keys to be added to the lookup table. */
420
- addresses: Array<PublicKey>;
421
- };
422
- type DeactivateLookupTableParams = {
423
- /** Address lookup table account to deactivate. */
424
- lookupTable: PublicKey;
425
- /** Account which is the current authority. */
426
- authority: PublicKey;
427
- };
428
- type CloseLookupTableParams = {
429
- /** Address lookup table account to close. */
430
- lookupTable: PublicKey;
431
- /** Account which is the current authority. */
432
- authority: PublicKey;
433
- /** Recipient of closed account lamports. */
434
- recipient: PublicKey;
435
- };
436
- /**
437
- * An enumeration of valid LookupTableInstructionType's
438
- */
439
- type LookupTableInstructionType = 'CreateLookupTable' | 'ExtendLookupTable' | 'CloseLookupTable' | 'FreezeLookupTable' | 'DeactivateLookupTable';
440
- export class AddressLookupTableInstruction {
441
- static decodeInstructionType(instruction: TransactionInstruction): LookupTableInstructionType;
442
- static decodeCreateLookupTable(instruction: TransactionInstruction): CreateLookupTableParams;
443
- static decodeExtendLookupTable(instruction: TransactionInstruction): ExtendLookupTableParams;
444
- static decodeCloseLookupTable(instruction: TransactionInstruction): CloseLookupTableParams;
445
- static decodeFreezeLookupTable(instruction: TransactionInstruction): FreezeLookupTableParams;
446
- static decodeDeactivateLookupTable(instruction: TransactionInstruction): DeactivateLookupTableParams;
447
- }
448
- export class AddressLookupTableProgram {
449
- static programId: PublicKey;
450
- static createLookupTable(params: CreateLookupTableParams): [TransactionInstruction, PublicKey];
451
- static freezeLookupTable(params: FreezeLookupTableParams): TransactionInstruction;
452
- static extendLookupTable(params: ExtendLookupTableParams): TransactionInstruction;
453
- static deactivateLookupTable(params: DeactivateLookupTableParams): TransactionInstruction;
454
- static closeLookupTable(params: CloseLookupTableParams): TransactionInstruction;
455
- }
456
-
457
- /**
458
- * Compute Budget Instruction class
459
- */
460
- export class ComputeBudgetInstruction {
461
- /**
462
- * Decode a compute budget instruction and retrieve the instruction type.
463
- */
464
- static decodeInstructionType(instruction: TransactionInstruction): ComputeBudgetInstructionType;
465
- /**
466
- * Decode request units compute budget instruction and retrieve the instruction params.
467
- */
468
- static decodeRequestUnits(instruction: TransactionInstruction): RequestUnitsParams;
469
- /**
470
- * Decode request heap frame compute budget instruction and retrieve the instruction params.
471
- */
472
- static decodeRequestHeapFrame(instruction: TransactionInstruction): RequestHeapFrameParams;
473
- /**
474
- * Decode set compute unit limit compute budget instruction and retrieve the instruction params.
475
- */
476
- static decodeSetComputeUnitLimit(instruction: TransactionInstruction): SetComputeUnitLimitParams;
477
- /**
478
- * Decode set compute unit price compute budget instruction and retrieve the instruction params.
479
- */
480
- static decodeSetComputeUnitPrice(instruction: TransactionInstruction): SetComputeUnitPriceParams;
481
- }
482
- /**
483
- * An enumeration of valid ComputeBudgetInstructionType's
484
- */
485
- type ComputeBudgetInstructionType = 'RequestUnits' | 'RequestHeapFrame' | 'SetComputeUnitLimit' | 'SetComputeUnitPrice';
486
- /**
487
- * Request units instruction params
488
- */
489
- interface RequestUnitsParams {
490
- /** Units to request for transaction-wide compute */
491
- units: number;
492
- /** Prioritization fee lamports */
493
- additionalFee: number;
494
- }
495
- /**
496
- * Request heap frame instruction params
497
- */
498
- type RequestHeapFrameParams = {
499
- /** Requested transaction-wide program heap size in bytes. Must be multiple of 1024. Applies to each program, including CPIs. */
500
- bytes: number;
501
- };
502
- /**
503
- * Set compute unit limit instruction params
504
- */
505
- interface SetComputeUnitLimitParams {
506
- /** Transaction-wide compute unit limit */
507
- units: number;
508
- }
509
- /**
510
- * Set compute unit price instruction params
511
- */
512
- interface SetComputeUnitPriceParams {
513
- /** Transaction compute unit price used for prioritization fees */
514
- microLamports: number | bigint;
515
- }
516
- /**
517
- * Factory class for transaction instructions to interact with the Compute Budget program
518
- */
519
- export class ComputeBudgetProgram {
520
- /**
521
- * Public key that identifies the Compute Budget program
522
- */
523
- static programId: PublicKey;
524
- /**
525
- * @deprecated Instead, call {@link setComputeUnitLimit} and/or {@link setComputeUnitPrice}
526
- */
527
- static requestUnits(params: RequestUnitsParams): TransactionInstruction;
528
- static requestHeapFrame(params: RequestHeapFrameParams): TransactionInstruction;
529
- static setComputeUnitLimit(params: SetComputeUnitLimitParams): TransactionInstruction;
530
- static setComputeUnitPrice(params: SetComputeUnitPriceParams): TransactionInstruction;
531
- }
532
-
533
- /**
534
- * Params for creating an ed25519 instruction using a public key
535
- */
536
- type CreateEd25519InstructionWithPublicKeyParams = {
537
- publicKey: Uint8Array;
538
- message: Uint8Array;
539
- signature: Uint8Array;
540
- instructionIndex?: number;
541
- };
542
- /**
543
- * Params for creating an ed25519 instruction using a private key
544
- */
545
- type CreateEd25519InstructionWithPrivateKeyParams = {
546
- privateKey: Uint8Array;
547
- message: Uint8Array;
548
- instructionIndex?: number;
549
- };
550
- export class Ed25519Program {
551
- /**
552
- * Public key that identifies the ed25519 program
553
- */
554
- static programId: PublicKey;
555
- /**
556
- * Create an ed25519 instruction with a public key and signature. The
557
- * public key must be a buffer that is 32 bytes long, and the signature
558
- * must be a buffer of 64 bytes.
559
- */
560
- static createInstructionWithPublicKey(params: CreateEd25519InstructionWithPublicKeyParams): TransactionInstruction;
561
- /**
562
- * Create an ed25519 instruction with a private key. The private key
563
- * must be a buffer that is 64 bytes long.
564
- */
565
- static createInstructionWithPrivateKey(params: CreateEd25519InstructionWithPrivateKeyParams): TransactionInstruction;
566
- }
567
-
568
- /**
569
- * Params for creating an secp256k1 instruction using a public key
570
- */
571
- type CreateSecp256k1InstructionWithPublicKeyParams = {
572
- publicKey: Buffer | Uint8Array | Array<number>;
573
- message: Buffer | Uint8Array | Array<number>;
574
- signature: Buffer | Uint8Array | Array<number>;
575
- recoveryId: number;
576
- instructionIndex?: number;
577
- };
578
- /**
579
- * Params for creating an secp256k1 instruction using an Ethereum address
580
- */
581
- type CreateSecp256k1InstructionWithEthAddressParams = {
582
- ethAddress: Buffer | Uint8Array | Array<number> | string;
583
- message: Buffer | Uint8Array | Array<number>;
584
- signature: Buffer | Uint8Array | Array<number>;
585
- recoveryId: number;
586
- instructionIndex?: number;
587
- };
588
- /**
589
- * Params for creating an secp256k1 instruction using a private key
590
- */
591
- type CreateSecp256k1InstructionWithPrivateKeyParams = {
592
- privateKey: Buffer | Uint8Array | Array<number>;
593
- message: Buffer | Uint8Array | Array<number>;
594
- instructionIndex?: number;
595
- };
596
- export class Secp256k1Program {
597
- /**
598
- * Public key that identifies the secp256k1 program
599
- */
600
- static programId: PublicKey;
601
- /**
602
- * Construct an Ethereum address from a secp256k1 public key buffer.
603
- * @param {Buffer} publicKey a 64 byte secp256k1 public key buffer
604
- */
605
- static publicKeyToEthAddress(publicKey: Buffer | Uint8Array | Array<number>): Buffer;
606
- /**
607
- * Create an secp256k1 instruction with a public key. The public key
608
- * must be a buffer that is 64 bytes long.
609
- */
610
- static createInstructionWithPublicKey(params: CreateSecp256k1InstructionWithPublicKeyParams): TransactionInstruction;
611
- /**
612
- * Create an secp256k1 instruction with an Ethereum address. The address
613
- * must be a hex string or a buffer that is 20 bytes long.
614
- */
615
- static createInstructionWithEthAddress(params: CreateSecp256k1InstructionWithEthAddressParams): TransactionInstruction;
616
- /**
617
- * Create an secp256k1 instruction with a private key. The private key
618
- * must be a buffer that is 32 bytes long.
619
- */
620
- static createInstructionWithPrivateKey(params: CreateSecp256k1InstructionWithPrivateKeyParams): TransactionInstruction;
621
- }
622
-
623
- /**
624
- * Address of the stake config account which configures the rate
625
- * of stake warmup and cooldown as well as the slashing penalty.
626
- */
627
- export const STAKE_CONFIG_ID: PublicKey;
628
- /**
629
- * Stake account authority info
630
- */
631
- export class Authorized {
632
- /** stake authority */
633
- staker: PublicKey;
634
- /** withdraw authority */
635
- withdrawer: PublicKey;
636
- /**
637
- * Create a new Authorized object
638
- * @param staker the stake authority
639
- * @param withdrawer the withdraw authority
640
- */
641
- constructor(staker: PublicKey, withdrawer: PublicKey);
642
- }
643
- /**
644
- * Stake account lockup info
645
- */
646
- export class Lockup {
647
- /** Unix timestamp of lockup expiration */
648
- unixTimestamp: number;
649
- /** Epoch of lockup expiration */
650
- epoch: number;
651
- /** Lockup custodian authority */
652
- custodian: PublicKey;
653
- /**
654
- * Create a new Lockup object
655
- */
656
- constructor(unixTimestamp: number, epoch: number, custodian: PublicKey);
657
- /**
658
- * Default, inactive Lockup value
659
- */
660
- static default: Lockup;
661
- }
662
- /**
663
- * Create stake account transaction params
664
- */
665
- type CreateStakeAccountParams = {
666
- /** Address of the account which will fund creation */
667
- fromPubkey: PublicKey;
668
- /** Address of the new stake account */
669
- stakePubkey: PublicKey;
670
- /** Authorities of the new stake account */
671
- authorized: Authorized;
672
- /** Lockup of the new stake account */
673
- lockup?: Lockup;
674
- /** Funding amount */
675
- lamports: number;
676
- };
677
- /**
678
- * Create stake account with seed transaction params
679
- */
680
- type CreateStakeAccountWithSeedParams = {
681
- fromPubkey: PublicKey;
682
- stakePubkey: PublicKey;
683
- basePubkey: PublicKey;
684
- seed: string;
685
- authorized: Authorized;
686
- lockup?: Lockup;
687
- lamports: number;
688
- };
689
- /**
690
- * Initialize stake instruction params
691
- */
692
- type InitializeStakeParams = {
693
- stakePubkey: PublicKey;
694
- authorized: Authorized;
695
- lockup?: Lockup;
696
- };
697
- /**
698
- * Delegate stake instruction params
699
- */
700
- type DelegateStakeParams = {
701
- stakePubkey: PublicKey;
702
- authorizedPubkey: PublicKey;
703
- votePubkey: PublicKey;
704
- };
705
- /**
706
- * Authorize stake instruction params
707
- */
708
- type AuthorizeStakeParams = {
709
- stakePubkey: PublicKey;
710
- authorizedPubkey: PublicKey;
711
- newAuthorizedPubkey: PublicKey;
712
- stakeAuthorizationType: StakeAuthorizationType;
713
- custodianPubkey?: PublicKey;
714
- };
715
- /**
716
- * Authorize stake instruction params using a derived key
717
- */
718
- type AuthorizeWithSeedStakeParams = {
719
- stakePubkey: PublicKey;
720
- authorityBase: PublicKey;
721
- authoritySeed: string;
722
- authorityOwner: PublicKey;
723
- newAuthorizedPubkey: PublicKey;
724
- stakeAuthorizationType: StakeAuthorizationType;
725
- custodianPubkey?: PublicKey;
726
- };
727
- /**
728
- * Split stake instruction params
729
- */
730
- type SplitStakeParams = {
731
- stakePubkey: PublicKey;
732
- authorizedPubkey: PublicKey;
733
- splitStakePubkey: PublicKey;
734
- lamports: number;
735
- };
736
- /**
737
- * Split with seed transaction params
738
- */
739
- type SplitStakeWithSeedParams = {
740
- stakePubkey: PublicKey;
741
- authorizedPubkey: PublicKey;
742
- splitStakePubkey: PublicKey;
743
- basePubkey: PublicKey;
744
- seed: string;
745
- lamports: number;
746
- };
747
- /**
748
- * Withdraw stake instruction params
749
- */
750
- type WithdrawStakeParams = {
751
- stakePubkey: PublicKey;
752
- authorizedPubkey: PublicKey;
753
- toPubkey: PublicKey;
754
- lamports: number;
755
- custodianPubkey?: PublicKey;
756
- };
757
- /**
758
- * Deactivate stake instruction params
759
- */
760
- type DeactivateStakeParams = {
761
- stakePubkey: PublicKey;
762
- authorizedPubkey: PublicKey;
763
- };
764
- /**
765
- * Merge stake instruction params
766
- */
767
- type MergeStakeParams = {
768
- stakePubkey: PublicKey;
769
- sourceStakePubKey: PublicKey;
770
- authorizedPubkey: PublicKey;
771
- };
772
- /**
773
- * Stake Instruction class
774
- */
775
- export class StakeInstruction {
776
- /**
777
- * Decode a stake instruction and retrieve the instruction type.
778
- */
779
- static decodeInstructionType(instruction: TransactionInstruction): StakeInstructionType;
780
- /**
781
- * Decode a initialize stake instruction and retrieve the instruction params.
782
- */
783
- static decodeInitialize(instruction: TransactionInstruction): InitializeStakeParams;
784
- /**
785
- * Decode a delegate stake instruction and retrieve the instruction params.
786
- */
787
- static decodeDelegate(instruction: TransactionInstruction): DelegateStakeParams;
788
- /**
789
- * Decode an authorize stake instruction and retrieve the instruction params.
790
- */
791
- static decodeAuthorize(instruction: TransactionInstruction): AuthorizeStakeParams;
792
- /**
793
- * Decode an authorize-with-seed stake instruction and retrieve the instruction params.
794
- */
795
- static decodeAuthorizeWithSeed(instruction: TransactionInstruction): AuthorizeWithSeedStakeParams;
796
- /**
797
- * Decode a split stake instruction and retrieve the instruction params.
798
- */
799
- static decodeSplit(instruction: TransactionInstruction): SplitStakeParams;
800
- /**
801
- * Decode a merge stake instruction and retrieve the instruction params.
802
- */
803
- static decodeMerge(instruction: TransactionInstruction): MergeStakeParams;
804
- /**
805
- * Decode a withdraw stake instruction and retrieve the instruction params.
806
- */
807
- static decodeWithdraw(instruction: TransactionInstruction): WithdrawStakeParams;
808
- /**
809
- * Decode a deactivate stake instruction and retrieve the instruction params.
810
- */
811
- static decodeDeactivate(instruction: TransactionInstruction): DeactivateStakeParams;
812
- }
813
- /**
814
- * An enumeration of valid StakeInstructionType's
815
- */
816
- type StakeInstructionType = 'Authorize' | 'AuthorizeWithSeed' | 'Deactivate' | 'Delegate' | 'Initialize' | 'Merge' | 'Split' | 'Withdraw';
817
- /**
818
- * Stake authorization type
819
- */
820
- type StakeAuthorizationType = {
821
- /** The Stake Authorization index (from solana-stake-program) */
822
- index: number;
823
- };
824
- /**
825
- * An enumeration of valid StakeAuthorizationLayout's
826
- */
827
- export const StakeAuthorizationLayout: Readonly<{
828
- Staker: {
829
- index: number;
830
- };
831
- Withdrawer: {
832
- index: number;
833
- };
834
- }>;
835
- /**
836
- * Factory class for transactions to interact with the Stake program
837
- */
838
- export class StakeProgram {
839
- /**
840
- * Public key that identifies the Stake program
841
- */
842
- static programId: PublicKey;
843
- /**
844
- * Max space of a Stake account
845
- *
846
- * This is generated from the solana-stake-program StakeState struct as
847
- * `StakeState::size_of()`:
848
- * https://docs.rs/solana-stake-program/latest/solana_stake_program/stake_state/enum.StakeState.html
849
- */
850
- static space: number;
851
- /**
852
- * Generate an Initialize instruction to add to a Stake Create transaction
853
- */
854
- static initialize(params: InitializeStakeParams): TransactionInstruction;
855
- /**
856
- * Generate a Transaction that creates a new Stake account at
857
- * an address generated with `from`, a seed, and the Stake programId
858
- */
859
- static createAccountWithSeed(params: CreateStakeAccountWithSeedParams): Transaction;
860
- /**
861
- * Generate a Transaction that creates a new Stake account
862
- */
863
- static createAccount(params: CreateStakeAccountParams): Transaction;
864
- /**
865
- * Generate a Transaction that delegates Stake tokens to a validator
866
- * Vote PublicKey. This transaction can also be used to redelegate Stake
867
- * to a new validator Vote PublicKey.
868
- */
869
- static delegate(params: DelegateStakeParams): Transaction;
870
- /**
871
- * Generate a Transaction that authorizes a new PublicKey as Staker
872
- * or Withdrawer on the Stake account.
873
- */
874
- static authorize(params: AuthorizeStakeParams): Transaction;
875
- /**
876
- * Generate a Transaction that authorizes a new PublicKey as Staker
877
- * or Withdrawer on the Stake account.
878
- */
879
- static authorizeWithSeed(params: AuthorizeWithSeedStakeParams): Transaction;
880
- /**
881
- * Generate a Transaction that splits Stake tokens into another stake account
882
- */
883
- static split(params: SplitStakeParams): Transaction;
884
- /**
885
- * Generate a Transaction that splits Stake tokens into another account
886
- * derived from a base public key and seed
887
- */
888
- static splitWithSeed(params: SplitStakeWithSeedParams): Transaction;
889
- /**
890
- * Generate a Transaction that merges Stake accounts.
891
- */
892
- static merge(params: MergeStakeParams): Transaction;
893
- /**
894
- * Generate a Transaction that withdraws deactivated Stake tokens.
895
- */
896
- static withdraw(params: WithdrawStakeParams): Transaction;
897
- /**
898
- * Generate a Transaction that deactivates Stake tokens.
899
- */
900
- static deactivate(params: DeactivateStakeParams): Transaction;
901
- }
902
-
903
- /**
904
- * Create account system transaction params
905
- */
906
- type CreateAccountParams = {
907
- /** The account that will transfer lamports to the created account */
908
- fromPubkey: PublicKey;
909
- /** Public key of the created account */
910
- newAccountPubkey: PublicKey;
911
- /** Amount of lamports to transfer to the created account */
912
- lamports: number;
913
- /** Amount of space in bytes to allocate to the created account */
914
- space: number;
915
- /** Public key of the program to assign as the owner of the created account */
916
- programId: PublicKey;
917
- };
918
- /**
919
- * Transfer system transaction params
920
- */
921
- type TransferParams = {
922
- /** Account that will transfer lamports */
923
- fromPubkey: PublicKey;
924
- /** Account that will receive transferred lamports */
925
- toPubkey: PublicKey;
926
- /** Amount of lamports to transfer */
927
- lamports: number | bigint;
928
- };
929
- /**
930
- * Assign system transaction params
931
- */
932
- type AssignParams = {
933
- /** Public key of the account which will be assigned a new owner */
934
- accountPubkey: PublicKey;
935
- /** Public key of the program to assign as the owner */
936
- programId: PublicKey;
937
- };
938
- /**
939
- * Create account with seed system transaction params
940
- */
941
- type CreateAccountWithSeedParams = {
942
- /** The account that will transfer lamports to the created account */
943
- fromPubkey: PublicKey;
944
- /** Public key of the created account. Must be pre-calculated with PublicKey.createWithSeed() */
945
- newAccountPubkey: PublicKey;
946
- /** 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` */
947
- basePubkey: PublicKey;
948
- /** Seed to use to derive the address of the created account. Must be the same as the seed used to create `newAccountPubkey` */
949
- seed: string;
950
- /** Amount of lamports to transfer to the created account */
951
- lamports: number;
952
- /** Amount of space in bytes to allocate to the created account */
953
- space: number;
954
- /** Public key of the program to assign as the owner of the created account */
955
- programId: PublicKey;
956
- };
957
- /**
958
- * Create nonce account system transaction params
959
- */
960
- type CreateNonceAccountParams = {
961
- /** The account that will transfer lamports to the created nonce account */
962
- fromPubkey: PublicKey;
963
- /** Public key of the created nonce account */
964
- noncePubkey: PublicKey;
965
- /** Public key to set as authority of the created nonce account */
966
- authorizedPubkey: PublicKey;
967
- /** Amount of lamports to transfer to the created nonce account */
968
- lamports: number;
969
- };
970
- /**
971
- * Create nonce account with seed system transaction params
972
- */
973
- type CreateNonceAccountWithSeedParams = {
974
- /** The account that will transfer lamports to the created nonce account */
975
- fromPubkey: PublicKey;
976
- /** Public key of the created nonce account */
977
- noncePubkey: PublicKey;
978
- /** Public key to set as authority of the created nonce account */
979
- authorizedPubkey: PublicKey;
980
- /** Amount of lamports to transfer to the created nonce account */
981
- lamports: number;
982
- /** Base public key to use to derive the address of the nonce account */
983
- basePubkey: PublicKey;
984
- /** Seed to use to derive the address of the nonce account */
985
- seed: string;
986
- };
987
- /**
988
- * Initialize nonce account system instruction params
989
- */
990
- type InitializeNonceParams = {
991
- /** Nonce account which will be initialized */
992
- noncePubkey: PublicKey;
993
- /** Public key to set as authority of the initialized nonce account */
994
- authorizedPubkey: PublicKey;
995
- };
996
- /**
997
- * Advance nonce account system instruction params
998
- */
999
- type AdvanceNonceParams = {
1000
- /** Nonce account */
1001
- noncePubkey: PublicKey;
1002
- /** Public key of the nonce authority */
1003
- authorizedPubkey: PublicKey;
1004
- };
1005
- /**
1006
- * Withdraw nonce account system transaction params
1007
- */
1008
- type WithdrawNonceParams = {
1009
- /** Nonce account */
1010
- noncePubkey: PublicKey;
1011
- /** Public key of the nonce authority */
1012
- authorizedPubkey: PublicKey;
1013
- /** Public key of the account which will receive the withdrawn nonce account balance */
1014
- toPubkey: PublicKey;
1015
- /** Amount of lamports to withdraw from the nonce account */
1016
- lamports: number;
1017
- };
1018
- /**
1019
- * Authorize nonce account system transaction params
1020
- */
1021
- type AuthorizeNonceParams = {
1022
- /** Nonce account */
1023
- noncePubkey: PublicKey;
1024
- /** Public key of the current nonce authority */
1025
- authorizedPubkey: PublicKey;
1026
- /** Public key to set as the new nonce authority */
1027
- newAuthorizedPubkey: PublicKey;
1028
- };
1029
- /**
1030
- * Allocate account system transaction params
1031
- */
1032
- type AllocateParams = {
1033
- /** Account to allocate */
1034
- accountPubkey: PublicKey;
1035
- /** Amount of space in bytes to allocate */
1036
- space: number;
1037
- };
1038
- /**
1039
- * Allocate account with seed system transaction params
1040
- */
1041
- type AllocateWithSeedParams = {
1042
- /** Account to allocate */
1043
- accountPubkey: PublicKey;
1044
- /** Base public key to use to derive the address of the allocated account */
1045
- basePubkey: PublicKey;
1046
- /** Seed to use to derive the address of the allocated account */
1047
- seed: string;
1048
- /** Amount of space in bytes to allocate */
1049
- space: number;
1050
- /** Public key of the program to assign as the owner of the allocated account */
1051
- programId: PublicKey;
1052
- };
1053
- /**
1054
- * Assign account with seed system transaction params
1055
- */
1056
- type AssignWithSeedParams = {
1057
- /** Public key of the account which will be assigned a new owner */
1058
- accountPubkey: PublicKey;
1059
- /** Base public key to use to derive the address of the assigned account */
1060
- basePubkey: PublicKey;
1061
- /** Seed to use to derive the address of the assigned account */
1062
- seed: string;
1063
- /** Public key of the program to assign as the owner */
1064
- programId: PublicKey;
1065
- };
1066
- /**
1067
- * Transfer with seed system transaction params
1068
- */
1069
- type TransferWithSeedParams = {
1070
- /** Account that will transfer lamports */
1071
- fromPubkey: PublicKey;
1072
- /** Base public key to use to derive the funding account address */
1073
- basePubkey: PublicKey;
1074
- /** Account that will receive transferred lamports */
1075
- toPubkey: PublicKey;
1076
- /** Amount of lamports to transfer */
1077
- lamports: number | bigint;
1078
- /** Seed to use to derive the funding account address */
1079
- seed: string;
1080
- /** Program id to use to derive the funding account address */
1081
- programId: PublicKey;
1082
- };
1083
- /** Decoded transfer system transaction instruction */
1084
- type DecodedTransferInstruction = {
1085
- /** Account that will transfer lamports */
1086
- fromPubkey: PublicKey;
1087
- /** Account that will receive transferred lamports */
1088
- toPubkey: PublicKey;
1089
- /** Amount of lamports to transfer */
1090
- lamports: bigint;
1091
- };
1092
- /** Decoded transferWithSeed system transaction instruction */
1093
- type DecodedTransferWithSeedInstruction = {
1094
- /** Account that will transfer lamports */
1095
- fromPubkey: PublicKey;
1096
- /** Base public key to use to derive the funding account address */
1097
- basePubkey: PublicKey;
1098
- /** Account that will receive transferred lamports */
1099
- toPubkey: PublicKey;
1100
- /** Amount of lamports to transfer */
1101
- lamports: bigint;
1102
- /** Seed to use to derive the funding account address */
1103
- seed: string;
1104
- /** Program id to use to derive the funding account address */
1105
- programId: PublicKey;
1106
- };
1107
- /**
1108
- * System Instruction class
1109
- */
1110
- export class SystemInstruction {
1111
- /**
1112
- * Decode a system instruction and retrieve the instruction type.
1113
- */
1114
- static decodeInstructionType(instruction: TransactionInstruction): SystemInstructionType;
1115
- /**
1116
- * Decode a create account system instruction and retrieve the instruction params.
1117
- */
1118
- static decodeCreateAccount(instruction: TransactionInstruction): CreateAccountParams;
1119
- /**
1120
- * Decode a transfer system instruction and retrieve the instruction params.
1121
- */
1122
- static decodeTransfer(instruction: TransactionInstruction): DecodedTransferInstruction;
1123
- /**
1124
- * Decode a transfer with seed system instruction and retrieve the instruction params.
1125
- */
1126
- static decodeTransferWithSeed(instruction: TransactionInstruction): DecodedTransferWithSeedInstruction;
1127
- /**
1128
- * Decode an allocate system instruction and retrieve the instruction params.
1129
- */
1130
- static decodeAllocate(instruction: TransactionInstruction): AllocateParams;
1131
- /**
1132
- * Decode an allocate with seed system instruction and retrieve the instruction params.
1133
- */
1134
- static decodeAllocateWithSeed(instruction: TransactionInstruction): AllocateWithSeedParams;
1135
- /**
1136
- * Decode an assign system instruction and retrieve the instruction params.
1137
- */
1138
- static decodeAssign(instruction: TransactionInstruction): AssignParams;
1139
- /**
1140
- * Decode an assign with seed system instruction and retrieve the instruction params.
1141
- */
1142
- static decodeAssignWithSeed(instruction: TransactionInstruction): AssignWithSeedParams;
1143
- /**
1144
- * Decode a create account with seed system instruction and retrieve the instruction params.
1145
- */
1146
- static decodeCreateWithSeed(instruction: TransactionInstruction): CreateAccountWithSeedParams;
1147
- /**
1148
- * Decode a nonce initialize system instruction and retrieve the instruction params.
1149
- */
1150
- static decodeNonceInitialize(instruction: TransactionInstruction): InitializeNonceParams;
1151
- /**
1152
- * Decode a nonce advance system instruction and retrieve the instruction params.
1153
- */
1154
- static decodeNonceAdvance(instruction: TransactionInstruction): AdvanceNonceParams;
1155
- /**
1156
- * Decode a nonce withdraw system instruction and retrieve the instruction params.
1157
- */
1158
- static decodeNonceWithdraw(instruction: TransactionInstruction): WithdrawNonceParams;
1159
- /**
1160
- * Decode a nonce authorize system instruction and retrieve the instruction params.
1161
- */
1162
- static decodeNonceAuthorize(instruction: TransactionInstruction): AuthorizeNonceParams;
1163
- }
1164
- /**
1165
- * An enumeration of valid SystemInstructionType's
1166
- */
1167
- type SystemInstructionType = 'AdvanceNonceAccount' | 'Allocate' | 'AllocateWithSeed' | 'Assign' | 'AssignWithSeed' | 'AuthorizeNonceAccount' | 'Create' | 'CreateWithSeed' | 'InitializeNonceAccount' | 'Transfer' | 'TransferWithSeed' | 'WithdrawNonceAccount' | 'UpgradeNonceAccount';
1168
- /**
1169
- * Factory class for transactions to interact with the System program
1170
- */
1171
- export class SystemProgram {
1172
- /**
1173
- * Public key that identifies the System program
1174
- */
1175
- static programId: PublicKey;
1176
- /**
1177
- * Generate a transaction instruction that creates a new account
1178
- */
1179
- static createAccount(params: CreateAccountParams): TransactionInstruction;
1180
- /**
1181
- * Generate a transaction instruction that transfers lamports from one account to another
1182
- */
1183
- static transfer(params: TransferParams | TransferWithSeedParams): TransactionInstruction;
1184
- /**
1185
- * Generate a transaction instruction that assigns an account to a program
1186
- */
1187
- static assign(params: AssignParams | AssignWithSeedParams): TransactionInstruction;
1188
- /**
1189
- * Generate a transaction instruction that creates a new account at
1190
- * an address generated with `from`, a seed, and programId
1191
- */
1192
- static createAccountWithSeed(params: CreateAccountWithSeedParams): TransactionInstruction;
1193
- /**
1194
- * Generate a transaction that creates a new Nonce account
1195
- */
1196
- static createNonceAccount(params: CreateNonceAccountParams | CreateNonceAccountWithSeedParams): Transaction;
1197
- /**
1198
- * Generate an instruction to initialize a Nonce account
1199
- */
1200
- static nonceInitialize(params: InitializeNonceParams): TransactionInstruction;
1201
- /**
1202
- * Generate an instruction to advance the nonce in a Nonce account
1203
- */
1204
- static nonceAdvance(params: AdvanceNonceParams): TransactionInstruction;
1205
- /**
1206
- * Generate a transaction instruction that withdraws lamports from a Nonce account
1207
- */
1208
- static nonceWithdraw(params: WithdrawNonceParams): TransactionInstruction;
1209
- /**
1210
- * Generate a transaction instruction that authorizes a new PublicKey as the authority
1211
- * on a Nonce account.
1212
- */
1213
- static nonceAuthorize(params: AuthorizeNonceParams): TransactionInstruction;
1214
- /**
1215
- * Generate a transaction instruction that allocates space in an account without funding
1216
- */
1217
- static allocate(params: AllocateParams | AllocateWithSeedParams): TransactionInstruction;
1218
- }
1219
-
1220
- /**
1221
- * Vote account info
1222
- */
1223
- export class VoteInit {
1224
- nodePubkey: PublicKey;
1225
- authorizedVoter: PublicKey;
1226
- authorizedWithdrawer: PublicKey;
1227
- commission: number; /** [0, 100] */
1228
- constructor(nodePubkey: PublicKey, authorizedVoter: PublicKey, authorizedWithdrawer: PublicKey, commission: number);
1229
- }
1230
- /**
1231
- * Create vote account transaction params
1232
- */
1233
- type CreateVoteAccountParams = {
1234
- fromPubkey: PublicKey;
1235
- votePubkey: PublicKey;
1236
- voteInit: VoteInit;
1237
- lamports: number;
1238
- };
1239
- /**
1240
- * InitializeAccount instruction params
1241
- */
1242
- type InitializeAccountParams = {
1243
- votePubkey: PublicKey;
1244
- nodePubkey: PublicKey;
1245
- voteInit: VoteInit;
1246
- };
1247
- /**
1248
- * Authorize instruction params
1249
- */
1250
- type AuthorizeVoteParams = {
1251
- votePubkey: PublicKey;
1252
- /** Current vote or withdraw authority, depending on `voteAuthorizationType` */
1253
- authorizedPubkey: PublicKey;
1254
- newAuthorizedPubkey: PublicKey;
1255
- voteAuthorizationType: VoteAuthorizationType;
1256
- };
1257
- /**
1258
- * AuthorizeWithSeed instruction params
1259
- */
1260
- type AuthorizeVoteWithSeedParams = {
1261
- currentAuthorityDerivedKeyBasePubkey: PublicKey;
1262
- currentAuthorityDerivedKeyOwnerPubkey: PublicKey;
1263
- currentAuthorityDerivedKeySeed: string;
1264
- newAuthorizedPubkey: PublicKey;
1265
- voteAuthorizationType: VoteAuthorizationType;
1266
- votePubkey: PublicKey;
1267
- };
1268
- /**
1269
- * Withdraw from vote account transaction params
1270
- */
1271
- type WithdrawFromVoteAccountParams = {
1272
- votePubkey: PublicKey;
1273
- authorizedWithdrawerPubkey: PublicKey;
1274
- lamports: number;
1275
- toPubkey: PublicKey;
1276
- };
1277
- /**
1278
- * Vote Instruction class
1279
- */
1280
- export class VoteInstruction {
1281
- /**
1282
- * Decode a vote instruction and retrieve the instruction type.
1283
- */
1284
- static decodeInstructionType(instruction: TransactionInstruction): VoteInstructionType;
1285
- /**
1286
- * Decode an initialize vote instruction and retrieve the instruction params.
1287
- */
1288
- static decodeInitializeAccount(instruction: TransactionInstruction): InitializeAccountParams;
1289
- /**
1290
- * Decode an authorize instruction and retrieve the instruction params.
1291
- */
1292
- static decodeAuthorize(instruction: TransactionInstruction): AuthorizeVoteParams;
1293
- /**
1294
- * Decode an authorize instruction and retrieve the instruction params.
1295
- */
1296
- static decodeAuthorizeWithSeed(instruction: TransactionInstruction): AuthorizeVoteWithSeedParams;
1297
- /**
1298
- * Decode a withdraw instruction and retrieve the instruction params.
1299
- */
1300
- static decodeWithdraw(instruction: TransactionInstruction): WithdrawFromVoteAccountParams;
1301
- }
1302
- /**
1303
- * An enumeration of valid VoteInstructionType's
1304
- */
1305
- type VoteInstructionType = 'Authorize' | 'AuthorizeWithSeed' | 'InitializeAccount' | 'Withdraw';
1306
- /**
1307
- * VoteAuthorize type
1308
- */
1309
- type VoteAuthorizationType = {
1310
- /** The VoteAuthorize index (from solana-vote-program) */
1311
- index: number;
1312
- };
1313
- /**
1314
- * An enumeration of valid VoteAuthorization layouts.
1315
- */
1316
- export const VoteAuthorizationLayout: Readonly<{
1317
- Voter: {
1318
- index: number;
1319
- };
1320
- Withdrawer: {
1321
- index: number;
1322
- };
1323
- }>;
1324
- /**
1325
- * Factory class for transactions to interact with the Vote program
1326
- */
1327
- export class VoteProgram {
1328
- /**
1329
- * Public key that identifies the Vote program
1330
- */
1331
- static programId: PublicKey;
1332
- /**
1333
- * Max space of a Vote account
1334
- *
1335
- * This is generated from the solana-vote-program VoteState struct as
1336
- * `VoteState::size_of()`:
1337
- * https://docs.rs/solana-vote-program/1.9.5/solana_vote_program/vote_state/struct.VoteState.html#method.size_of
1338
- *
1339
- * KEEP IN SYNC WITH `VoteState::size_of()` in https://github.com/solana-labs/solana/blob/a474cb24b9238f5edcc982f65c0b37d4a1046f7e/sdk/program/src/vote/state/mod.rs#L340-L342
1340
- */
1341
- static space: number;
1342
- /**
1343
- * Generate an Initialize instruction.
1344
- */
1345
- static initializeAccount(params: InitializeAccountParams): TransactionInstruction;
1346
- /**
1347
- * Generate a transaction that creates a new Vote account.
1348
- */
1349
- static createAccount(params: CreateVoteAccountParams): Transaction;
1350
- /**
1351
- * Generate a transaction that authorizes a new Voter or Withdrawer on the Vote account.
1352
- */
1353
- static authorize(params: AuthorizeVoteParams): Transaction;
1354
- /**
1355
- * Generate a transaction that authorizes a new Voter or Withdrawer on the Vote account
1356
- * where the current Voter or Withdrawer authority is a derived key.
1357
- */
1358
- static authorizeWithSeed(params: AuthorizeVoteWithSeedParams): Transaction;
1359
- /**
1360
- * Generate a transaction to withdraw from a Vote account.
1361
- */
1362
- static withdraw(params: WithdrawFromVoteAccountParams): Transaction;
1363
- /**
1364
- * Generate a transaction to withdraw safely from a Vote account.
1365
- *
1366
- * This function was created as a safeguard for vote accounts running validators, `safeWithdraw`
1367
- * checks that the withdraw amount will not exceed the specified balance while leaving enough left
1368
- * to cover rent. If you wish to close the vote account by withdrawing the full amount, call the
1369
- * `withdraw` method directly.
1370
- */
1371
- static safeWithdraw(params: WithdrawFromVoteAccountParams, currentVoteAccountBalance: number, rentExemptMinimum: number): Transaction;
1372
- }
1373
-
1374
- /**
1375
- * Message constructor arguments
1376
- */
1377
- type MessageV0Args = {
1378
- /** The message header, identifying signed and read-only `accountKeys` */
1379
- header: MessageHeader;
1380
- /** The static account keys used by this transaction */
1381
- staticAccountKeys: PublicKey[];
1382
- /** The hash of a recent ledger block */
1383
- recentBlockhash: Blockhash;
1384
- /** Instructions that will be executed in sequence and committed in one atomic transaction if all succeed. */
1385
- compiledInstructions: MessageCompiledInstruction[];
1386
- /** Instructions that will be executed in sequence and committed in one atomic transaction if all succeed. */
1387
- addressTableLookups: MessageAddressTableLookup[];
1388
- };
1389
- type CompileV0Args = {
1390
- payerKey: PublicKey;
1391
- instructions: Array<TransactionInstruction>;
1392
- recentBlockhash: Blockhash;
1393
- addressLookupTableAccounts?: Array<AddressLookupTableAccount>;
1394
- };
1395
- type GetAccountKeysArgs = {
1396
- accountKeysFromLookups?: AccountKeysFromLookups | null;
1397
- } | {
1398
- addressLookupTableAccounts?: AddressLookupTableAccount[] | null;
1399
- };
1400
- export class MessageV0 {
1401
- header: MessageHeader;
1402
- staticAccountKeys: Array<PublicKey>;
1403
- recentBlockhash: Blockhash;
1404
- compiledInstructions: Array<MessageCompiledInstruction>;
1405
- addressTableLookups: Array<MessageAddressTableLookup>;
1406
- constructor(args: MessageV0Args);
1407
- get version(): 0;
1408
- get numAccountKeysFromLookups(): number;
1409
- getAccountKeys(args?: GetAccountKeysArgs): MessageAccountKeys;
1410
- isAccountSigner(index: number): boolean;
1411
- isAccountWritable(index: number): boolean;
1412
- resolveAddressTableLookups(addressLookupTableAccounts: AddressLookupTableAccount[]): AccountKeysFromLookups;
1413
- static compile(args: CompileV0Args): MessageV0;
1414
- serialize(): Uint8Array;
1415
- private serializeInstructions;
1416
- private serializeAddressTableLookups;
1417
- static deserialize(serializedMessage: Uint8Array): MessageV0;
1418
- }
1419
-
1420
- type VersionedMessage = Message | MessageV0;
1421
- export const VersionedMessage: {
1422
- deserializeMessageVersion(serializedMessage: Uint8Array): 'legacy' | number;
1423
- deserialize: (serializedMessage: Uint8Array) => VersionedMessage;
1424
- };
1425
-
1426
- /**
1427
- * The message header, identifying signed and read-only account
1428
- */
1429
- type MessageHeader = {
1430
- /**
1431
- * The number of signatures required for this message to be considered valid. The
1432
- * signatures must match the first `numRequiredSignatures` of `accountKeys`.
1433
- */
1434
- numRequiredSignatures: number;
1435
- /** The last `numReadonlySignedAccounts` of the signed keys are read-only accounts */
1436
- numReadonlySignedAccounts: number;
1437
- /** The last `numReadonlySignedAccounts` of the unsigned keys are read-only accounts */
1438
- numReadonlyUnsignedAccounts: number;
1439
- };
1440
- /**
1441
- * An address table lookup used to load additional accounts
1442
- */
1443
- type MessageAddressTableLookup = {
1444
- accountKey: PublicKey;
1445
- writableIndexes: Array<number>;
1446
- readonlyIndexes: Array<number>;
1447
- };
1448
- /**
1449
- * An instruction to execute by a program
1450
- *
1451
- * @property {number} programIdIndex
1452
- * @property {number[]} accountKeyIndexes
1453
- * @property {Uint8Array} data
1454
- */
1455
- type MessageCompiledInstruction = {
1456
- /** Index into the transaction keys array indicating the program account that executes this instruction */
1457
- programIdIndex: number;
1458
- /** Ordered indices into the transaction keys array indicating which accounts to pass to the program */
1459
- accountKeyIndexes: number[];
1460
- /** The program input data */
1461
- data: Uint8Array;
1462
- };
1463
-
1464
- /**
1465
- * Transaction signature as base-58 encoded string
1466
- */
1467
- type TransactionSignature = string;
1468
- export const enum TransactionStatus {
1469
- BLOCKHEIGHT_EXCEEDED = 0,
1470
- PROCESSED = 1,
1471
- TIMED_OUT = 2,
1472
- NONCE_INVALID = 3
1473
- }
1474
- /**
1475
- * Account metadata used to define instructions
1476
- */
1477
- type AccountMeta = {
1478
- /** An account's public key */
1479
- pubkey: PublicKey;
1480
- /** True if an instruction requires a transaction signature matching `pubkey` */
1481
- isSigner: boolean;
1482
- /** True if the `pubkey` can be loaded as a read-write account. */
1483
- isWritable: boolean;
1484
- };
1485
- /**
1486
- * List of TransactionInstruction object fields that may be initialized at construction
1487
- */
1488
- type TransactionInstructionCtorFields = {
1489
- keys: Array<AccountMeta>;
1490
- programId: PublicKey;
1491
- data?: Buffer;
1492
- };
1493
- /**
1494
- * Configuration object for Transaction.serialize()
1495
- */
1496
- type SerializeConfig = {
1497
- /** Require all transaction signatures be present (default: true) */
1498
- requireAllSignatures?: boolean;
1499
- /** Verify provided signatures (default: true) */
1500
- verifySignatures?: boolean;
1501
- };
1502
- /**
1503
- * Transaction Instruction class
1504
- */
1505
- export class TransactionInstruction {
1506
- /**
1507
- * Public keys to include in this transaction
1508
- * Boolean represents whether this pubkey needs to sign the transaction
1509
- */
1510
- keys: Array<AccountMeta>;
1511
- /**
1512
- * Program Id to execute
1513
- */
1514
- programId: PublicKey;
1515
- /**
1516
- * Program input
1517
- */
1518
- data: Buffer;
1519
- constructor(opts: TransactionInstructionCtorFields);
1520
- }
1521
- /**
1522
- * Pair of signature and corresponding public key
1523
- */
1524
- type SignaturePubkeyPair = {
1525
- signature: Buffer | null;
1526
- publicKey: PublicKey;
1527
- };
1528
- /**
1529
- * List of Transaction object fields that may be initialized at construction
1530
- */
1531
- type TransactionCtorFields_DEPRECATED = {
1532
- /** Optional nonce information used for offline nonce'd transactions */
1533
- nonceInfo?: NonceInformation | null;
1534
- /** The transaction fee payer */
1535
- feePayer?: PublicKey | null;
1536
- /** One or more signatures */
1537
- signatures?: Array<SignaturePubkeyPair>;
1538
- /** A recent blockhash */
1539
- recentBlockhash?: Blockhash;
1540
- };
1541
- type TransactionCtorFields = TransactionCtorFields_DEPRECATED;
1542
- /**
1543
- * Blockhash-based transactions have a lifetime that are defined by
1544
- * the blockhash they include. Any transaction whose blockhash is
1545
- * too old will be rejected.
1546
- */
1547
- type TransactionBlockhashCtor = {
1548
- /** The transaction fee payer */
1549
- feePayer?: PublicKey | null;
1550
- /** One or more signatures */
1551
- signatures?: Array<SignaturePubkeyPair>;
1552
- /** A recent blockhash */
1553
- blockhash: Blockhash;
1554
- /** the last block chain can advance to before tx is exportd expired */
1555
- lastValidBlockHeight: number;
1556
- };
1557
- /**
1558
- * Use these options to construct a durable nonce transaction.
1559
- */
1560
- type TransactionNonceCtor = {
1561
- /** The transaction fee payer */
1562
- feePayer?: PublicKey | null;
1563
- minContextSlot: number;
1564
- nonceInfo: NonceInformation;
1565
- /** One or more signatures */
1566
- signatures?: Array<SignaturePubkeyPair>;
1567
- };
1568
- /**
1569
- * Nonce information to be used to build an offline Transaction.
1570
- */
1571
- type NonceInformation = {
1572
- /** The current blockhash stored in the nonce */
1573
- nonce: Blockhash;
1574
- /** AdvanceNonceAccount Instruction */
1575
- nonceInstruction: TransactionInstruction;
1576
- };
1577
- /**
1578
- * Transaction class
1579
- */
1580
- export class Transaction {
1581
- /**
1582
- * Signatures for the transaction. Typically created by invoking the
1583
- * `sign()` method
1584
- */
1585
- signatures: Array<SignaturePubkeyPair>;
1586
- /**
1587
- * The first (payer) Transaction signature
1588
- *
1589
- * @returns {Buffer | null} Buffer of payer's signature
1590
- */
1591
- get signature(): Buffer | null;
1592
- /**
1593
- * The transaction fee payer
1594
- */
1595
- feePayer?: PublicKey;
1596
- /**
1597
- * The instructions to atomically execute
1598
- */
1599
- instructions: Array<TransactionInstruction>;
1600
- /**
1601
- * A recent transaction id. Must be populated by the caller
1602
- */
1603
- recentBlockhash?: Blockhash;
1604
- /**
1605
- * the last block chain can advance to before tx is exportd expired
1606
- * */
1607
- lastValidBlockHeight?: number;
1608
- /**
1609
- * Optional Nonce information. If populated, transaction will use a durable
1610
- * Nonce hash instead of a recentBlockhash. Must be populated by the caller
1611
- */
1612
- nonceInfo?: NonceInformation;
1613
- /**
1614
- * If this is a nonce transaction this represents the minimum slot from which
1615
- * to evaluate if the nonce has advanced when attempting to confirm the
1616
- * transaction. This protects against a case where the transaction confirmation
1617
- * logic loads the nonce account from an old slot and assumes the mismatch in
1618
- * nonce value implies that the nonce has been advanced.
1619
- */
1620
- minNonceContextSlot?: number;
1621
- constructor(opts?: TransactionBlockhashCtor);
1622
- constructor(opts?: TransactionNonceCtor);
1623
- /**
1624
- * @deprecated `TransactionCtorFields` has been deprecated and will be removed in a future version.
1625
- * Please supply a `TransactionBlockhashCtor` instead.
1626
- */
1627
- constructor(opts?: TransactionCtorFields_DEPRECATED);
1628
- /**
1629
- * Add one or more instructions to this Transaction
1630
- *
1631
- * @param {Array< Transaction | TransactionInstruction | TransactionInstructionCtorFields >} items - Instructions to add to the Transaction
1632
- */
1633
- add(...items: Array<Transaction | TransactionInstruction | TransactionInstructionCtorFields>): Transaction;
1634
- /**
1635
- * Compile transaction data
1636
- */
1637
- compileMessage(): Message;
1638
- /**
1639
- * Get a buffer of the Transaction data that need to be covered by signatures
1640
- */
1641
- serializeMessage(): Buffer;
1642
- /**
1643
- * Get the estimated fee associated with a transaction
1644
- *
1645
- * @param {Connection} connection Connection to RPC Endpoint.
1646
- *
1647
- * @returns {Promise<number | null>} The estimated fee for the transaction
1648
- */
1649
- getEstimatedFee(connection: Connection): Promise<number | null>;
1650
- /**
1651
- * Specify the public keys which will be used to sign the Transaction.
1652
- * The first signer will be used as the transaction fee payer account.
1653
- *
1654
- * Signatures can be added with either `partialSign` or `addSignature`
1655
- *
1656
- * @deprecated Deprecated since v0.84.0. Only the fee payer needs to be
1657
- * specified and it can be set in the Transaction constructor or with the
1658
- * `feePayer` property.
1659
- */
1660
- setSigners(...signers: Array<PublicKey>): void;
1661
- /**
1662
- * Sign the Transaction with the specified signers. Multiple signatures may
1663
- * be applied to a Transaction. The first signature is considered "primary"
1664
- * and is used identify and confirm transactions.
1665
- *
1666
- * If the Transaction `feePayer` is not set, the first signer will be used
1667
- * as the transaction fee payer account.
1668
- *
1669
- * Transaction fields should not be modified after the first call to `sign`,
1670
- * as doing so may invalidate the signature and cause the Transaction to be
1671
- * rejected.
1672
- *
1673
- * The Transaction must be assigned a valid `recentBlockhash` before invoking this method
1674
- *
1675
- * @param {Array<Signer>} signers Array of signers that will sign the transaction
1676
- */
1677
- sign(...signers: Array<Signer>): void;
1678
- /**
1679
- * Partially sign a transaction with the specified accounts. All accounts must
1680
- * correspond to either the fee payer or a signer account in the transaction
1681
- * instructions.
1682
- *
1683
- * All the caveats from the `sign` method apply to `partialSign`
1684
- *
1685
- * @param {Array<Signer>} signers Array of signers that will sign the transaction
1686
- */
1687
- partialSign(...signers: Array<Signer>): void;
1688
- /**
1689
- * Add an externally created signature to a transaction. The public key
1690
- * must correspond to either the fee payer or a signer account in the transaction
1691
- * instructions.
1692
- *
1693
- * @param {PublicKey} pubkey Public key that will be added to the transaction.
1694
- * @param {Buffer} signature An externally created signature to add to the transaction.
1695
- */
1696
- addSignature(pubkey: PublicKey, signature: Buffer): void;
1697
- /**
1698
- * Verify signatures of a Transaction
1699
- * Optional parameter specifies if we're expecting a fully signed Transaction or a partially signed one.
1700
- * If no boolean is provided, we expect a fully signed Transaction by default.
1701
- *
1702
- * @param {boolean} [requireAllSignatures=true] Require a fully signed Transaction
1703
- */
1704
- verifySignatures(requireAllSignatures?: boolean): boolean;
1705
- /**
1706
- * Serialize the Transaction in the wire format.
1707
- *
1708
- * @param {Buffer} [config] Config of transaction.
1709
- *
1710
- * @returns {Buffer} Signature of transaction in wire format.
1711
- */
1712
- serialize(config?: SerializeConfig): Buffer;
1713
- /**
1714
- * Parse a wire transaction into a Transaction object.
1715
- *
1716
- * @param {Buffer | Uint8Array | Array<number>} buffer Signature of wire Transaction
1717
- *
1718
- * @returns {Transaction} Transaction associated with the signature
1719
- */
1720
- static from(buffer: Buffer | Uint8Array | Array<number>): Transaction;
1721
- /**
1722
- * Populate Transaction object from message and signatures
1723
- *
1724
- * @param {Message} message Message of transaction
1725
- * @param {Array<string>} signatures List of signatures to assign to the transaction
1726
- *
1727
- * @returns {Transaction} The populated Transaction
1728
- */
1729
- static populate(message: Message, signatures?: Array<string>): Transaction;
1730
- }
1731
-
1732
- type TransactionMessageArgs = {
1733
- payerKey: PublicKey;
1734
- instructions: Array<TransactionInstruction>;
1735
- recentBlockhash: Blockhash;
1736
- };
1737
- type DecompileArgs = {
1738
- accountKeysFromLookups: AccountKeysFromLookups;
1739
- } | {
1740
- addressLookupTableAccounts: AddressLookupTableAccount[];
1741
- };
1742
- export class TransactionMessage {
1743
- payerKey: PublicKey;
1744
- instructions: Array<TransactionInstruction>;
1745
- recentBlockhash: Blockhash;
1746
- constructor(args: TransactionMessageArgs);
1747
- static decompile(message: VersionedMessage, args?: DecompileArgs): TransactionMessage;
1748
- compileToLegacyMessage(): Message;
1749
- compileToV0Message(addressLookupTableAccounts?: AddressLookupTableAccount[]): MessageV0;
1750
- }
1751
-
1752
- type TransactionVersion = 'legacy' | 0;
1753
- /**
1754
- * Versioned transaction class
1755
- */
1756
- export class VersionedTransaction {
1757
- signatures: Array<Uint8Array>;
1758
- message: VersionedMessage;
1759
- get version(): TransactionVersion;
1760
- constructor(message: VersionedMessage, signatures?: Array<Uint8Array>);
1761
- serialize(): Uint8Array;
1762
- static deserialize(serializedTransaction: Uint8Array): VersionedTransaction;
1763
- sign(signers: Array<Signer>): void;
1764
- addSignature(publicKey: PublicKey, signature: Uint8Array): void;
1765
- }
1766
-
1767
- type ClientSubscriptionId = number;
1768
- type TokenAccountsFilter = {
1769
- mint: PublicKey;
1770
- } | {
1771
- programId: PublicKey;
1772
- };
1773
- /**
1774
- * Extra contextual information for RPC responses
1775
- */
1776
- type Context = {
1777
- slot: number;
1778
- };
1779
- /**
1780
- * Options for sending transactions
1781
- */
1782
- type SendOptions = {
1783
- /** disable transaction verification step */
1784
- skipPreflight?: boolean;
1785
- /** preflight commitment level */
1786
- preflightCommitment?: Commitment;
1787
- /** Maximum number of times for the RPC node to retry sending the transaction to the leader. */
1788
- maxRetries?: number;
1789
- /** The minimum slot that the request can be evaluated at */
1790
- minContextSlot?: number;
1791
- };
1792
- /**
1793
- * Options for confirming transactions
1794
- */
1795
- type ConfirmOptions = {
1796
- /** disable transaction verification step */
1797
- skipPreflight?: boolean;
1798
- /** desired commitment level */
1799
- commitment?: Commitment;
1800
- /** preflight commitment level */
1801
- preflightCommitment?: Commitment;
1802
- /** Maximum number of times for the RPC node to retry sending the transaction to the leader. */
1803
- maxRetries?: number;
1804
- /** The minimum slot that the request can be evaluated at */
1805
- minContextSlot?: number;
1806
- };
1807
- /**
1808
- * Options for getConfirmedSignaturesForAddress2
1809
- */
1810
- type ConfirmedSignaturesForAddress2Options = {
1811
- /**
1812
- * Start searching backwards from this transaction signature.
1813
- * @remark If not provided the search starts from the highest max confirmed block.
1814
- */
1815
- before?: TransactionSignature;
1816
- /** Search until this transaction signature is reached, if found before `limit`. */
1817
- until?: TransactionSignature;
1818
- /** Maximum transaction signatures to return (between 1 and 1,000, default: 1,000). */
1819
- limit?: number;
1820
- };
1821
- /**
1822
- * Options for getSignaturesForAddress
1823
- */
1824
- type SignaturesForAddressOptions = {
1825
- /**
1826
- * Start searching backwards from this transaction signature.
1827
- * @remark If not provided the search starts from the highest max confirmed block.
1828
- */
1829
- before?: TransactionSignature;
1830
- /** Search until this transaction signature is reached, if found before `limit`. */
1831
- until?: TransactionSignature;
1832
- /** Maximum transaction signatures to return (between 1 and 1,000, default: 1,000). */
1833
- limit?: number;
1834
- /** The minimum slot that the request can be evaluated at */
1835
- minContextSlot?: number;
1836
- };
1837
- /**
1838
- * RPC Response with extra contextual information
1839
- */
1840
- type RpcResponseAndContext<T> = {
1841
- /** response context */
1842
- context: Context;
1843
- /** response value */
1844
- value: T;
1845
- };
1846
- type BlockhashWithExpiryBlockHeight = Readonly<{
1847
- blockhash: Blockhash;
1848
- lastValidBlockHeight: number;
1849
- }>;
1850
- /**
1851
- * A strategy for confirming transactions that uses the last valid
1852
- * block height for a given blockhash to check for transaction expiration.
1853
- */
1854
- type BlockheightBasedTransactionConfirmationStrategy = BaseTransactionConfirmationStrategy & BlockhashWithExpiryBlockHeight;
1855
- /**
1856
- * A strategy for confirming durable nonce transactions.
1857
- */
1858
- type DurableNonceTransactionConfirmationStrategy = BaseTransactionConfirmationStrategy & {
1859
- /**
1860
- * The lowest slot at which to fetch the nonce value from the
1861
- * nonce account. This should be no lower than the slot at
1862
- * which the last-known value of the nonce was fetched.
1863
- */
1864
- minContextSlot: number;
1865
- /**
1866
- * The account where the current value of the nonce is stored.
1867
- */
1868
- nonceAccountPubkey: PublicKey;
1869
- /**
1870
- * The nonce value that was used to sign the transaction
1871
- * for which confirmation is being sought.
1872
- */
1873
- nonceValue: DurableNonce;
1874
- };
1875
- /**
1876
- * Properties shared by all transaction confirmation strategies
1877
- */
1878
- type BaseTransactionConfirmationStrategy = Readonly<{
1879
- /** A signal that, when aborted, cancels any outstanding transaction confirmation operations */
1880
- abortSignal?: AbortSignal;
1881
- signature: TransactionSignature;
1882
- }>;
1883
- /**
1884
- * This type represents all transaction confirmation strategies
1885
- */
1886
- type TransactionConfirmationStrategy = BlockheightBasedTransactionConfirmationStrategy | DurableNonceTransactionConfirmationStrategy;
1887
- /**
1888
- * The level of commitment desired when querying state
1889
- * <pre>
1890
- * 'processed': Query the most recent block which has reached 1 confirmation by the connected node
1891
- * 'confirmed': Query the most recent block which has reached 1 confirmation by the cluster
1892
- * 'finalized': Query the most recent block which has been finalized by the cluster
1893
- * </pre>
1894
- */
1895
- type Commitment = 'processed' | 'confirmed' | 'finalized' | 'recent' | 'single' | 'singleGossip' | 'root' | 'max';
1896
- /**
1897
- * A subset of Commitment levels, which are at least optimistically confirmed
1898
- * <pre>
1899
- * 'confirmed': Query the most recent block which has reached 1 confirmation by the cluster
1900
- * 'finalized': Query the most recent block which has been finalized by the cluster
1901
- * </pre>
1902
- */
1903
- type Finality = 'confirmed' | 'finalized';
1904
- /**
1905
- * Filter for largest accounts query
1906
- * <pre>
1907
- * 'circulating': Return the largest accounts that are part of the circulating supply
1908
- * 'nonCirculating': Return the largest accounts that are not part of the circulating supply
1909
- * </pre>
1910
- */
1911
- type LargestAccountsFilter = 'circulating' | 'nonCirculating';
1912
- /**
1913
- * Configuration object for changing `getAccountInfo` query behavior
1914
- */
1915
- type GetAccountInfoConfig = {
1916
- /** The level of commitment desired */
1917
- commitment?: Commitment;
1918
- /** The minimum slot that the request can be evaluated at */
1919
- minContextSlot?: number;
1920
- /** Optional data slice to limit the returned account data */
1921
- dataSlice?: DataSlice;
1922
- };
1923
- /**
1924
- * Configuration object for changing `getBalance` query behavior
1925
- */
1926
- type GetBalanceConfig = {
1927
- /** The level of commitment desired */
1928
- commitment?: Commitment;
1929
- /** The minimum slot that the request can be evaluated at */
1930
- minContextSlot?: number;
1931
- };
1932
- /**
1933
- * Configuration object for changing `getBlock` query behavior
1934
- */
1935
- type GetBlockConfig = {
1936
- /** The level of finality desired */
1937
- commitment?: Finality;
1938
- /**
1939
- * Whether to populate the rewards array. If parameter not provided, the default includes rewards.
1940
- */
1941
- rewards?: boolean;
1942
- /**
1943
- * Level of transaction detail to return, either "full", "accounts", "signatures", or "none". If
1944
- * parameter not provided, the default detail level is "full". If "accounts" are requested,
1945
- * transaction details only include signatures and an annotated list of accounts in each
1946
- * transaction. Transaction metadata is limited to only: fee, err, pre_balances, post_balances,
1947
- * pre_token_balances, and post_token_balances.
1948
- */
1949
- transactionDetails?: 'accounts' | 'full' | 'none' | 'signatures';
1950
- };
1951
- /**
1952
- * Configuration object for changing `getBlock` query behavior
1953
- */
1954
- type GetVersionedBlockConfig = {
1955
- /** The level of finality desired */
1956
- commitment?: Finality;
1957
- /** The max transaction version to return in responses. If the requested transaction is a higher version, an error will be returned */
1958
- maxSupportedTransactionVersion?: number;
1959
- /**
1960
- * Whether to populate the rewards array. If parameter not provided, the default includes rewards.
1961
- */
1962
- rewards?: boolean;
1963
- /**
1964
- * Level of transaction detail to return, either "full", "accounts", "signatures", or "none". If
1965
- * parameter not provided, the default detail level is "full". If "accounts" are requested,
1966
- * transaction details only include signatures and an annotated list of accounts in each
1967
- * transaction. Transaction metadata is limited to only: fee, err, pre_balances, post_balances,
1968
- * pre_token_balances, and post_token_balances.
1969
- */
1970
- transactionDetails?: 'accounts' | 'full' | 'none' | 'signatures';
1971
- };
1972
- /**
1973
- * Configuration object for changing `getStakeMinimumDelegation` query behavior
1974
- */
1975
- type GetStakeMinimumDelegationConfig = {
1976
- /** The level of commitment desired */
1977
- commitment?: Commitment;
1978
- };
1979
- /**
1980
- * Configuration object for changing `getBlockHeight` query behavior
1981
- */
1982
- type GetBlockHeightConfig = {
1983
- /** The level of commitment desired */
1984
- commitment?: Commitment;
1985
- /** The minimum slot that the request can be evaluated at */
1986
- minContextSlot?: number;
1987
- };
1988
- /**
1989
- * Configuration object for changing `getEpochInfo` query behavior
1990
- */
1991
- type GetEpochInfoConfig = {
1992
- /** The level of commitment desired */
1993
- commitment?: Commitment;
1994
- /** The minimum slot that the request can be evaluated at */
1995
- minContextSlot?: number;
1996
- };
1997
- /**
1998
- * Configuration object for changing `getInflationReward` query behavior
1999
- */
2000
- type GetInflationRewardConfig = {
2001
- /** The level of commitment desired */
2002
- commitment?: Commitment;
2003
- /** An epoch for which the reward occurs. If omitted, the previous epoch will be used */
2004
- epoch?: number;
2005
- /** The minimum slot that the request can be evaluated at */
2006
- minContextSlot?: number;
2007
- };
2008
- /**
2009
- * Configuration object for changing `getLatestBlockhash` query behavior
2010
- */
2011
- type GetLatestBlockhashConfig = {
2012
- /** The level of commitment desired */
2013
- commitment?: Commitment;
2014
- /** The minimum slot that the request can be evaluated at */
2015
- minContextSlot?: number;
2016
- };
2017
- /**
2018
- * Configuration object for changing `isBlockhashValid` query behavior
2019
- */
2020
- type IsBlockhashValidConfig = {
2021
- /** The level of commitment desired */
2022
- commitment?: Commitment;
2023
- /** The minimum slot that the request can be evaluated at */
2024
- minContextSlot?: number;
2025
- };
2026
- /**
2027
- * Configuration object for changing `getSlot` query behavior
2028
- */
2029
- type GetSlotConfig = {
2030
- /** The level of commitment desired */
2031
- commitment?: Commitment;
2032
- /** The minimum slot that the request can be evaluated at */
2033
- minContextSlot?: number;
2034
- };
2035
- /**
2036
- * Configuration object for changing `getSlotLeader` query behavior
2037
- */
2038
- type GetSlotLeaderConfig = {
2039
- /** The level of commitment desired */
2040
- commitment?: Commitment;
2041
- /** The minimum slot that the request can be evaluated at */
2042
- minContextSlot?: number;
2043
- };
2044
- /**
2045
- * Configuration object for changing `getTransaction` query behavior
2046
- */
2047
- type GetTransactionConfig = {
2048
- /** The level of finality desired */
2049
- commitment?: Finality;
2050
- };
2051
- /**
2052
- * Configuration object for changing `getTransaction` query behavior
2053
- */
2054
- type GetVersionedTransactionConfig = {
2055
- /** The level of finality desired */
2056
- commitment?: Finality;
2057
- /** The max transaction version to return in responses. If the requested transaction is a higher version, an error will be returned */
2058
- maxSupportedTransactionVersion?: number;
2059
- };
2060
- /**
2061
- * Configuration object for changing `getLargestAccounts` query behavior
2062
- */
2063
- type GetLargestAccountsConfig = {
2064
- /** The level of commitment desired */
2065
- commitment?: Commitment;
2066
- /** Filter largest accounts by whether they are part of the circulating supply */
2067
- filter?: LargestAccountsFilter;
2068
- };
2069
- /**
2070
- * Configuration object for changing `getSupply` request behavior
2071
- */
2072
- type GetSupplyConfig = {
2073
- /** The level of commitment desired */
2074
- commitment?: Commitment;
2075
- /** Exclude non circulating accounts list from response */
2076
- excludeNonCirculatingAccountsList?: boolean;
2077
- };
2078
- /**
2079
- * Configuration object for changing query behavior
2080
- */
2081
- type SignatureStatusConfig = {
2082
- /** enable searching status history, not needed for recent transactions */
2083
- searchTransactionHistory: boolean;
2084
- };
2085
- /**
2086
- * Information describing a cluster node
2087
- */
2088
- type ContactInfo = {
2089
- /** Identity public key of the node */
2090
- pubkey: string;
2091
- /** Gossip network address for the node */
2092
- gossip: string | null;
2093
- /** TPU network address for the node (null if not available) */
2094
- tpu: string | null;
2095
- /** JSON RPC network address for the node (null if not available) */
2096
- rpc: string | null;
2097
- /** Software version of the node (null if not available) */
2098
- version: string | null;
2099
- };
2100
- /**
2101
- * Information describing a vote account
2102
- */
2103
- type VoteAccountInfo = {
2104
- /** Public key of the vote account */
2105
- votePubkey: string;
2106
- /** Identity public key of the node voting with this account */
2107
- nodePubkey: string;
2108
- /** The stake, in lamports, delegated to this vote account and activated */
2109
- activatedStake: number;
2110
- /** Whether the vote account is staked for this epoch */
2111
- epochVoteAccount: boolean;
2112
- /** Recent epoch voting credit history for this voter */
2113
- epochCredits: Array<[number, number, number]>;
2114
- /** A percentage (0-100) of rewards payout owed to the voter */
2115
- commission: number;
2116
- /** Most recent slot voted on by this vote account */
2117
- lastVote: number;
2118
- };
2119
- /**
2120
- * A collection of cluster vote accounts
2121
- */
2122
- type VoteAccountStatus = {
2123
- /** Active vote accounts */
2124
- current: Array<VoteAccountInfo>;
2125
- /** Inactive vote accounts */
2126
- delinquent: Array<VoteAccountInfo>;
2127
- };
2128
- /**
2129
- * Network Inflation
2130
- * (see https://docs.solana.com/implemented-proposals/ed_overview)
2131
- */
2132
- type InflationGovernor = {
2133
- foundation: number;
2134
- foundationTerm: number;
2135
- initial: number;
2136
- taper: number;
2137
- terminal: number;
2138
- };
2139
- /**
2140
- * The inflation reward for an epoch
2141
- */
2142
- type InflationReward = {
2143
- /** epoch for which the reward occurs */
2144
- epoch: number;
2145
- /** the slot in which the rewards are effective */
2146
- effectiveSlot: number;
2147
- /** reward amount in lamports */
2148
- amount: number;
2149
- /** post balance of the account in lamports */
2150
- postBalance: number;
2151
- /** vote account commission when the reward was credited */
2152
- commission?: number | null;
2153
- };
2154
- type RecentPrioritizationFees = {
2155
- /** slot in which the fee was observed */
2156
- slot: number;
2157
- /** the per-compute-unit fee paid by at least one successfully landed transaction, specified in increments of 0.000001 lamports*/
2158
- prioritizationFee: number;
2159
- };
2160
- /**
2161
- * Configuration object for changing `getRecentPrioritizationFees` query behavior
2162
- */
2163
- type GetRecentPrioritizationFeesConfig = {
2164
- /**
2165
- * If this parameter is provided, the response will reflect a fee to land a transaction locking
2166
- * all of the provided accounts as writable.
2167
- */
2168
- lockedWritableAccounts?: PublicKey[];
2169
- };
2170
- type InflationRate = {
2171
- /** total inflation */
2172
- total: number;
2173
- /** inflation allocated to validators */
2174
- validator: number;
2175
- /** inflation allocated to the foundation */
2176
- foundation: number;
2177
- /** epoch for which these values are valid */
2178
- epoch: number;
2179
- };
2180
- /**
2181
- * Information about the current epoch
2182
- */
2183
- type EpochInfo = {
2184
- epoch: number;
2185
- slotIndex: number;
2186
- slotsInEpoch: number;
2187
- absoluteSlot: number;
2188
- blockHeight?: number;
2189
- transactionCount?: number;
2190
- };
2191
- /**
2192
- * Leader schedule
2193
- * (see https://docs.solana.com/terminology#leader-schedule)
2194
- */
2195
- type LeaderSchedule = {
2196
- [address: string]: number[];
2197
- };
2198
- /**
2199
- * Version info for a node
2200
- */
2201
- type Version = {
2202
- /** Version of solana-core */
2203
- 'solana-core': string;
2204
- 'feature-set'?: number;
2205
- };
2206
- type SimulatedTransactionAccountInfo = {
2207
- /** `true` if this account's data contains a loaded program */
2208
- executable: boolean;
2209
- /** Identifier of the program that owns the account */
2210
- owner: string;
2211
- /** Number of lamports assigned to the account */
2212
- lamports: number;
2213
- /** Optional data assigned to the account */
2214
- data: string[];
2215
- /** Optional rent epoch info for account */
2216
- rentEpoch?: number;
2217
- };
2218
- type TransactionReturnDataEncoding = 'base64';
2219
- type TransactionReturnData = {
2220
- programId: string;
2221
- data: [string, TransactionReturnDataEncoding];
2222
- };
2223
- type SimulateTransactionConfig = {
2224
- /** Optional parameter used to enable signature verification before simulation */
2225
- sigVerify?: boolean;
2226
- /** Optional parameter used to replace the simulated transaction's recent blockhash with the latest blockhash */
2227
- replaceRecentBlockhash?: boolean;
2228
- /** Optional parameter used to set the commitment level when selecting the latest block */
2229
- commitment?: Commitment;
2230
- /** Optional parameter used to specify a list of account addresses to return post simulation state for */
2231
- accounts?: {
2232
- encoding: 'base64';
2233
- addresses: string[];
2234
- };
2235
- /** Optional parameter used to specify the minimum block slot that can be used for simulation */
2236
- minContextSlot?: number;
2237
- };
2238
- type SimulatedTransactionResponse = {
2239
- err: TransactionError | string | null;
2240
- logs: Array<string> | null;
2241
- accounts?: (SimulatedTransactionAccountInfo | null)[] | null;
2242
- unitsConsumed?: number;
2243
- returnData?: TransactionReturnData | null;
2244
- };
2245
- type ParsedInnerInstruction = {
2246
- index: number;
2247
- instructions: (ParsedInstruction | PartiallyDecodedInstruction)[];
2248
- };
2249
- type TokenBalance = {
2250
- accountIndex: number;
2251
- mint: string;
2252
- owner?: string;
2253
- uiTokenAmount: TokenAmount;
2254
- };
2255
- /**
2256
- * Metadata for a parsed confirmed transaction on the ledger
2257
- *
2258
- * @deprecated Deprecated since Solana v1.8.0. Please use {@link ParsedTransactionMeta} instead.
2259
- */
2260
- type ParsedConfirmedTransactionMeta = ParsedTransactionMeta;
2261
- /**
2262
- * Collection of addresses loaded by a transaction using address table lookups
2263
- */
2264
- type LoadedAddresses = {
2265
- writable: Array<PublicKey>;
2266
- readonly: Array<PublicKey>;
2267
- };
2268
- /**
2269
- * Metadata for a parsed transaction on the ledger
2270
- */
2271
- type ParsedTransactionMeta = {
2272
- /** The fee charged for processing the transaction */
2273
- fee: number;
2274
- /** An array of cross program invoked parsed instructions */
2275
- innerInstructions?: ParsedInnerInstruction[] | null;
2276
- /** The balances of the transaction accounts before processing */
2277
- preBalances: Array<number>;
2278
- /** The balances of the transaction accounts after processing */
2279
- postBalances: Array<number>;
2280
- /** An array of program log messages emitted during a transaction */
2281
- logMessages?: Array<string> | null;
2282
- /** The token balances of the transaction accounts before processing */
2283
- preTokenBalances?: Array<TokenBalance> | null;
2284
- /** The token balances of the transaction accounts after processing */
2285
- postTokenBalances?: Array<TokenBalance> | null;
2286
- /** The error result of transaction processing */
2287
- err: TransactionError | null;
2288
- /** The collection of addresses loaded using address lookup tables */
2289
- loadedAddresses?: LoadedAddresses;
2290
- /** The compute units consumed after processing the transaction */
2291
- computeUnitsConsumed?: number;
2292
- };
2293
- type CompiledInnerInstruction = {
2294
- index: number;
2295
- instructions: CompiledInstruction[];
2296
- };
2297
- /**
2298
- * Metadata for a confirmed transaction on the ledger
2299
- */
2300
- type ConfirmedTransactionMeta = {
2301
- /** The fee charged for processing the transaction */
2302
- fee: number;
2303
- /** An array of cross program invoked instructions */
2304
- innerInstructions?: CompiledInnerInstruction[] | null;
2305
- /** The balances of the transaction accounts before processing */
2306
- preBalances: Array<number>;
2307
- /** The balances of the transaction accounts after processing */
2308
- postBalances: Array<number>;
2309
- /** An array of program log messages emitted during a transaction */
2310
- logMessages?: Array<string> | null;
2311
- /** The token balances of the transaction accounts before processing */
2312
- preTokenBalances?: Array<TokenBalance> | null;
2313
- /** The token balances of the transaction accounts after processing */
2314
- postTokenBalances?: Array<TokenBalance> | null;
2315
- /** The error result of transaction processing */
2316
- err: TransactionError | null;
2317
- /** The collection of addresses loaded using address lookup tables */
2318
- loadedAddresses?: LoadedAddresses;
2319
- /** The compute units consumed after processing the transaction */
2320
- computeUnitsConsumed?: number;
2321
- };
2322
- /**
2323
- * A processed transaction from the RPC API
2324
- */
2325
- type TransactionResponse = {
2326
- /** The slot during which the transaction was processed */
2327
- slot: number;
2328
- /** The transaction */
2329
- transaction: {
2330
- /** The transaction message */
2331
- message: Message;
2332
- /** The transaction signatures */
2333
- signatures: string[];
2334
- };
2335
- /** Metadata produced from the transaction */
2336
- meta: ConfirmedTransactionMeta | null;
2337
- /** The unix timestamp of when the transaction was processed */
2338
- blockTime?: number | null;
2339
- };
2340
- /**
2341
- * A processed transaction from the RPC API
2342
- */
2343
- type VersionedTransactionResponse = {
2344
- /** The slot during which the transaction was processed */
2345
- slot: number;
2346
- /** The transaction */
2347
- transaction: {
2348
- /** The transaction message */
2349
- message: VersionedMessage;
2350
- /** The transaction signatures */
2351
- signatures: string[];
2352
- };
2353
- /** Metadata produced from the transaction */
2354
- meta: ConfirmedTransactionMeta | null;
2355
- /** The unix timestamp of when the transaction was processed */
2356
- blockTime?: number | null;
2357
- /** The transaction version */
2358
- version?: TransactionVersion;
2359
- };
2360
- /**
2361
- * A confirmed transaction on the ledger
2362
- *
2363
- * @deprecated Deprecated since Solana v1.8.0.
2364
- */
2365
- type ConfirmedTransaction = {
2366
- /** The slot during which the transaction was processed */
2367
- slot: number;
2368
- /** The details of the transaction */
2369
- transaction: Transaction;
2370
- /** Metadata produced from the transaction */
2371
- meta: ConfirmedTransactionMeta | null;
2372
- /** The unix timestamp of when the transaction was processed */
2373
- blockTime?: number | null;
2374
- };
2375
- /**
2376
- * A partially decoded transaction instruction
2377
- */
2378
- type PartiallyDecodedInstruction = {
2379
- /** Program id called by this instruction */
2380
- programId: PublicKey;
2381
- /** Public keys of accounts passed to this instruction */
2382
- accounts: Array<PublicKey>;
2383
- /** Raw base-58 instruction data */
2384
- data: string;
2385
- };
2386
- /**
2387
- * A parsed transaction message account
2388
- */
2389
- type ParsedMessageAccount = {
2390
- /** Public key of the account */
2391
- pubkey: PublicKey;
2392
- /** Indicates if the account signed the transaction */
2393
- signer: boolean;
2394
- /** Indicates if the account is writable for this transaction */
2395
- writable: boolean;
2396
- /** Indicates if the account key came from the transaction or a lookup table */
2397
- source?: 'transaction' | 'lookupTable';
2398
- };
2399
- /**
2400
- * A parsed transaction instruction
2401
- */
2402
- type ParsedInstruction = {
2403
- /** Name of the program for this instruction */
2404
- program: string;
2405
- /** ID of the program for this instruction */
2406
- programId: PublicKey;
2407
- /** Parsed instruction info */
2408
- parsed: any;
2409
- };
2410
- /**
2411
- * A parsed address table lookup
2412
- */
2413
- type ParsedAddressTableLookup = {
2414
- /** Address lookup table account key */
2415
- accountKey: PublicKey;
2416
- /** Parsed instruction info */
2417
- writableIndexes: number[];
2418
- /** Parsed instruction info */
2419
- readonlyIndexes: number[];
2420
- };
2421
- /**
2422
- * A parsed transaction message
2423
- */
2424
- type ParsedMessage = {
2425
- /** Accounts used in the instructions */
2426
- accountKeys: ParsedMessageAccount[];
2427
- /** The atomically executed instructions for the transaction */
2428
- instructions: (ParsedInstruction | PartiallyDecodedInstruction)[];
2429
- /** Recent blockhash */
2430
- recentBlockhash: string;
2431
- /** Address table lookups used to load additional accounts */
2432
- addressTableLookups?: ParsedAddressTableLookup[] | null;
2433
- };
2434
- /**
2435
- * A parsed transaction
2436
- */
2437
- type ParsedTransaction = {
2438
- /** Signatures for the transaction */
2439
- signatures: Array<string>;
2440
- /** Message of the transaction */
2441
- message: ParsedMessage;
2442
- };
2443
- /**
2444
- * A parsed and confirmed transaction on the ledger
2445
- *
2446
- * @deprecated Deprecated since Solana v1.8.0. Please use {@link ParsedTransactionWithMeta} instead.
2447
- */
2448
- type ParsedConfirmedTransaction = ParsedTransactionWithMeta;
2449
- /**
2450
- * A parsed transaction on the ledger with meta
2451
- */
2452
- type ParsedTransactionWithMeta = {
2453
- /** The slot during which the transaction was processed */
2454
- slot: number;
2455
- /** The details of the transaction */
2456
- transaction: ParsedTransaction;
2457
- /** Metadata produced from the transaction */
2458
- meta: ParsedTransactionMeta | null;
2459
- /** The unix timestamp of when the transaction was processed */
2460
- blockTime?: number | null;
2461
- /** The version of the transaction message */
2462
- version?: TransactionVersion;
2463
- };
2464
- /**
2465
- * A processed block fetched from the RPC API
2466
- */
2467
- type BlockResponse = {
2468
- /** Blockhash of this block */
2469
- blockhash: Blockhash;
2470
- /** Blockhash of this block's parent */
2471
- previousBlockhash: Blockhash;
2472
- /** Slot index of this block's parent */
2473
- parentSlot: number;
2474
- /** Vector of transactions with status meta and original message */
2475
- transactions: Array<{
2476
- /** The transaction */
2477
- transaction: {
2478
- /** The transaction message */
2479
- message: Message;
2480
- /** The transaction signatures */
2481
- signatures: string[];
2482
- };
2483
- /** Metadata produced from the transaction */
2484
- meta: ConfirmedTransactionMeta | null;
2485
- /** The transaction version */
2486
- version?: TransactionVersion;
2487
- }>;
2488
- /** Vector of block rewards */
2489
- rewards?: Array<{
2490
- /** Public key of reward recipient */
2491
- pubkey: string;
2492
- /** Reward value in lamports */
2493
- lamports: number;
2494
- /** Account balance after reward is applied */
2495
- postBalance: number | null;
2496
- /** Type of reward received */
2497
- rewardType: string | null;
2498
- /** Vote account commission when the reward was credited, only present for voting and staking rewards */
2499
- commission?: number | null;
2500
- }>;
2501
- /** The unix timestamp of when the block was processed */
2502
- blockTime: number | null;
2503
- };
2504
- /**
2505
- * A processed block fetched from the RPC API where the `transactionDetails` mode is `accounts`
2506
- */
2507
- type AccountsModeBlockResponse = VersionedAccountsModeBlockResponse;
2508
- /**
2509
- * A processed block fetched from the RPC API where the `transactionDetails` mode is `none`
2510
- */
2511
- type NoneModeBlockResponse = VersionedNoneModeBlockResponse;
2512
- /**
2513
- * A block with parsed transactions
2514
- */
2515
- type ParsedBlockResponse = {
2516
- /** Blockhash of this block */
2517
- blockhash: Blockhash;
2518
- /** Blockhash of this block's parent */
2519
- previousBlockhash: Blockhash;
2520
- /** Slot index of this block's parent */
2521
- parentSlot: number;
2522
- /** Vector of transactions with status meta and original message */
2523
- transactions: Array<{
2524
- /** The details of the transaction */
2525
- transaction: ParsedTransaction;
2526
- /** Metadata produced from the transaction */
2527
- meta: ParsedTransactionMeta | null;
2528
- /** The transaction version */
2529
- version?: TransactionVersion;
2530
- }>;
2531
- /** Vector of block rewards */
2532
- rewards?: Array<{
2533
- /** Public key of reward recipient */
2534
- pubkey: string;
2535
- /** Reward value in lamports */
2536
- lamports: number;
2537
- /** Account balance after reward is applied */
2538
- postBalance: number | null;
2539
- /** Type of reward received */
2540
- rewardType: string | null;
2541
- /** Vote account commission when the reward was credited, only present for voting and staking rewards */
2542
- commission?: number | null;
2543
- }>;
2544
- /** The unix timestamp of when the block was processed */
2545
- blockTime: number | null;
2546
- /** The number of blocks beneath this block */
2547
- blockHeight: number | null;
2548
- };
2549
- /**
2550
- * A block with parsed transactions where the `transactionDetails` mode is `accounts`
2551
- */
2552
- type ParsedAccountsModeBlockResponse = Omit<ParsedBlockResponse, 'transactions'> & {
2553
- transactions: Array<Omit<ParsedBlockResponse['transactions'][number], 'transaction'> & {
2554
- transaction: Pick<ParsedBlockResponse['transactions'][number]['transaction'], 'signatures'> & {
2555
- accountKeys: ParsedMessageAccount[];
2556
- };
2557
- }>;
2558
- };
2559
- /**
2560
- * A block with parsed transactions where the `transactionDetails` mode is `none`
2561
- */
2562
- type ParsedNoneModeBlockResponse = Omit<ParsedBlockResponse, 'transactions'>;
2563
- /**
2564
- * A processed block fetched from the RPC API
2565
- */
2566
- type VersionedBlockResponse = {
2567
- /** Blockhash of this block */
2568
- blockhash: Blockhash;
2569
- /** Blockhash of this block's parent */
2570
- previousBlockhash: Blockhash;
2571
- /** Slot index of this block's parent */
2572
- parentSlot: number;
2573
- /** Vector of transactions with status meta and original message */
2574
- transactions: Array<{
2575
- /** The transaction */
2576
- transaction: {
2577
- /** The transaction message */
2578
- message: VersionedMessage;
2579
- /** The transaction signatures */
2580
- signatures: string[];
2581
- };
2582
- /** Metadata produced from the transaction */
2583
- meta: ConfirmedTransactionMeta | null;
2584
- /** The transaction version */
2585
- version?: TransactionVersion;
2586
- }>;
2587
- /** Vector of block rewards */
2588
- rewards?: Array<{
2589
- /** Public key of reward recipient */
2590
- pubkey: string;
2591
- /** Reward value in lamports */
2592
- lamports: number;
2593
- /** Account balance after reward is applied */
2594
- postBalance: number | null;
2595
- /** Type of reward received */
2596
- rewardType: string | null;
2597
- /** Vote account commission when the reward was credited, only present for voting and staking rewards */
2598
- commission?: number | null;
2599
- }>;
2600
- /** The unix timestamp of when the block was processed */
2601
- blockTime: number | null;
2602
- };
2603
- /**
2604
- * A processed block fetched from the RPC API where the `transactionDetails` mode is `accounts`
2605
- */
2606
- type VersionedAccountsModeBlockResponse = Omit<VersionedBlockResponse, 'transactions'> & {
2607
- transactions: Array<Omit<VersionedBlockResponse['transactions'][number], 'transaction'> & {
2608
- transaction: Pick<VersionedBlockResponse['transactions'][number]['transaction'], 'signatures'> & {
2609
- accountKeys: ParsedMessageAccount[];
2610
- };
2611
- }>;
2612
- };
2613
- /**
2614
- * A processed block fetched from the RPC API where the `transactionDetails` mode is `none`
2615
- */
2616
- type VersionedNoneModeBlockResponse = Omit<VersionedBlockResponse, 'transactions'>;
2617
- /**
2618
- * A confirmed block on the ledger
2619
- *
2620
- * @deprecated Deprecated since Solana v1.8.0.
2621
- */
2622
- type ConfirmedBlock = {
2623
- /** Blockhash of this block */
2624
- blockhash: Blockhash;
2625
- /** Blockhash of this block's parent */
2626
- previousBlockhash: Blockhash;
2627
- /** Slot index of this block's parent */
2628
- parentSlot: number;
2629
- /** Vector of transactions and status metas */
2630
- transactions: Array<{
2631
- transaction: Transaction;
2632
- meta: ConfirmedTransactionMeta | null;
2633
- }>;
2634
- /** Vector of block rewards */
2635
- rewards?: Array<{
2636
- pubkey: string;
2637
- lamports: number;
2638
- postBalance: number | null;
2639
- rewardType: string | null;
2640
- commission?: number | null;
2641
- }>;
2642
- /** The unix timestamp of when the block was processed */
2643
- blockTime: number | null;
2644
- };
2645
- /**
2646
- * A Block on the ledger with signatures only
2647
- */
2648
- type BlockSignatures = {
2649
- /** Blockhash of this block */
2650
- blockhash: Blockhash;
2651
- /** Blockhash of this block's parent */
2652
- previousBlockhash: Blockhash;
2653
- /** Slot index of this block's parent */
2654
- parentSlot: number;
2655
- /** Vector of signatures */
2656
- signatures: Array<string>;
2657
- /** The unix timestamp of when the block was processed */
2658
- blockTime: number | null;
2659
- };
2660
- /**
2661
- * recent block production information
2662
- */
2663
- type BlockProduction = Readonly<{
2664
- /** 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 */
2665
- byIdentity: Readonly<Record<string, ReadonlyArray<number>>>;
2666
- /** Block production slot range */
2667
- range: Readonly<{
2668
- /** first slot of the block production information (inclusive) */
2669
- firstSlot: number;
2670
- /** last slot of block production information (inclusive) */
2671
- lastSlot: number;
2672
- }>;
2673
- }>;
2674
- type GetBlockProductionConfig = {
2675
- /** Optional commitment level */
2676
- commitment?: Commitment;
2677
- /** Slot range to return block production for. If parameter not provided, defaults to current epoch. */
2678
- range?: {
2679
- /** first slot to return block production information for (inclusive) */
2680
- firstSlot: number;
2681
- /** last slot to return block production information for (inclusive). If parameter not provided, defaults to the highest slot */
2682
- lastSlot?: number;
2683
- };
2684
- /** Only return results for this validator identity (base-58 encoded) */
2685
- identity?: string;
2686
- };
2687
- /**
2688
- * A performance sample
2689
- */
2690
- type PerfSample = {
2691
- /** Slot number of sample */
2692
- slot: number;
2693
- /** Number of transactions in a sample window */
2694
- numTransactions: number;
2695
- /** Number of slots in a sample window */
2696
- numSlots: number;
2697
- /** Sample window in seconds */
2698
- samplePeriodSecs: number;
2699
- };
2700
- /**
2701
- * Supply
2702
- */
2703
- type Supply = {
2704
- /** Total supply in lamports */
2705
- total: number;
2706
- /** Circulating supply in lamports */
2707
- circulating: number;
2708
- /** Non-circulating supply in lamports */
2709
- nonCirculating: number;
2710
- /** List of non-circulating account addresses */
2711
- nonCirculatingAccounts: Array<PublicKey>;
2712
- };
2713
- /**
2714
- * Token amount object which returns a token amount in different formats
2715
- * for various client use cases.
2716
- */
2717
- type TokenAmount = {
2718
- /** Raw amount of tokens as string ignoring decimals */
2719
- amount: string;
2720
- /** Number of decimals configured for token's mint */
2721
- decimals: number;
2722
- /** Token amount as float, accounts for decimals */
2723
- uiAmount: number | null;
2724
- /** Token amount as string, accounts for decimals */
2725
- uiAmountString?: string;
2726
- };
2727
- /**
2728
- * Token address and balance.
2729
- */
2730
- type TokenAccountBalancePair = {
2731
- /** Address of the token account */
2732
- address: PublicKey;
2733
- /** Raw amount of tokens as string ignoring decimals */
2734
- amount: string;
2735
- /** Number of decimals configured for token's mint */
2736
- decimals: number;
2737
- /** Token amount as float, accounts for decimals */
2738
- uiAmount: number | null;
2739
- /** Token amount as string, accounts for decimals */
2740
- uiAmountString?: string;
2741
- };
2742
- /**
2743
- * Pair of an account address and its balance
2744
- */
2745
- type AccountBalancePair = {
2746
- address: PublicKey;
2747
- lamports: number;
2748
- };
2749
- /**
2750
- * Slot updates which can be used for tracking the live progress of a cluster.
2751
- * - `"firstShredReceived"`: connected node received the first shred of a block.
2752
- * Indicates that a new block that is being produced.
2753
- * - `"completed"`: connected node has received all shreds of a block. Indicates
2754
- * a block was recently produced.
2755
- * - `"optimisticConfirmation"`: block was optimistically confirmed by the
2756
- * cluster. It is not guaranteed that an optimistic confirmation notification
2757
- * will be sent for every finalized blocks.
2758
- * - `"root"`: the connected node rooted this block.
2759
- * - `"createdBank"`: the connected node has started validating this block.
2760
- * - `"frozen"`: the connected node has validated this block.
2761
- * - `"dead"`: the connected node failed to validate this block.
2762
- */
2763
- type SlotUpdate = {
2764
- type: 'firstShredReceived';
2765
- slot: number;
2766
- timestamp: number;
2767
- } | {
2768
- type: 'completed';
2769
- slot: number;
2770
- timestamp: number;
2771
- } | {
2772
- type: 'createdBank';
2773
- slot: number;
2774
- timestamp: number;
2775
- parent: number;
2776
- } | {
2777
- type: 'frozen';
2778
- slot: number;
2779
- timestamp: number;
2780
- stats: {
2781
- numTransactionEntries: number;
2782
- numSuccessfulTransactions: number;
2783
- numFailedTransactions: number;
2784
- maxTransactionsPerEntry: number;
2785
- };
2786
- } | {
2787
- type: 'dead';
2788
- slot: number;
2789
- timestamp: number;
2790
- err: string;
2791
- } | {
2792
- type: 'optimisticConfirmation';
2793
- slot: number;
2794
- timestamp: number;
2795
- } | {
2796
- type: 'root';
2797
- slot: number;
2798
- timestamp: number;
2799
- };
2800
- /**
2801
- * Information about the latest slot being processed by a node
2802
- */
2803
- type SlotInfo = {
2804
- /** Currently processing slot */
2805
- slot: number;
2806
- /** Parent of the current slot */
2807
- parent: number;
2808
- /** The root block of the current slot's fork */
2809
- root: number;
2810
- };
2811
- /**
2812
- * Parsed account data
2813
- */
2814
- type ParsedAccountData = {
2815
- /** Name of the program that owns this account */
2816
- program: string;
2817
- /** Parsed account data */
2818
- parsed: any;
2819
- /** Space used by account data */
2820
- space: number;
2821
- };
2822
- /**
2823
- * Stake Activation data
2824
- */
2825
- type StakeActivationData = {
2826
- /** the stake account's activation state */
2827
- state: 'active' | 'inactive' | 'activating' | 'deactivating';
2828
- /** stake active during the epoch */
2829
- active: number;
2830
- /** stake inactive during the epoch */
2831
- inactive: number;
2832
- };
2833
- /**
2834
- * Data slice argument for getProgramAccounts
2835
- */
2836
- type DataSlice = {
2837
- /** offset of data slice */
2838
- offset: number;
2839
- /** length of data slice */
2840
- length: number;
2841
- };
2842
- /**
2843
- * Memory comparison filter for getProgramAccounts
2844
- */
2845
- type MemcmpFilter = {
2846
- memcmp: {
2847
- /** offset into program account data to start comparison */
2848
- offset: number;
2849
- /** data to match, as base-58 encoded string and limited to less than 129 bytes */
2850
- bytes: string;
2851
- };
2852
- };
2853
- /**
2854
- * Data size comparison filter for getProgramAccounts
2855
- */
2856
- type DataSizeFilter = {
2857
- /** Size of data for program account data length comparison */
2858
- dataSize: number;
2859
- };
2860
- /**
2861
- * A filter object for getProgramAccounts
2862
- */
2863
- type GetProgramAccountsFilter = MemcmpFilter | DataSizeFilter;
2864
- /**
2865
- * Configuration object for getProgramAccounts requests
2866
- */
2867
- type GetProgramAccountsConfig = {
2868
- /** Optional commitment level */
2869
- commitment?: Commitment;
2870
- /** Optional encoding for account data (default base64)
2871
- * To use "jsonParsed" encoding, please refer to `getParsedProgramAccounts` in connection.ts
2872
- * */
2873
- encoding?: 'base64';
2874
- /** Optional data slice to limit the returned account data */
2875
- dataSlice?: DataSlice;
2876
- /** Optional array of filters to apply to accounts */
2877
- filters?: GetProgramAccountsFilter[];
2878
- /** The minimum slot that the request can be evaluated at */
2879
- minContextSlot?: number;
2880
- /** wrap the result in an RpcResponse JSON object */
2881
- withContext?: boolean;
2882
- };
2883
- type GetProgramAccountsResponse = readonly Readonly<{
2884
- account: AccountInfo<Buffer>;
2885
- /** the account Pubkey as base-58 encoded string */
2886
- pubkey: PublicKey;
2887
- }>[];
2888
- /**
2889
- * Configuration object for getParsedProgramAccounts
2890
- */
2891
- type GetParsedProgramAccountsConfig = {
2892
- /** Optional commitment level */
2893
- commitment?: Commitment;
2894
- /** Optional array of filters to apply to accounts */
2895
- filters?: GetProgramAccountsFilter[];
2896
- /** The minimum slot that the request can be evaluated at */
2897
- minContextSlot?: number;
2898
- };
2899
- /**
2900
- * Configuration object for getMultipleAccounts
2901
- */
2902
- type GetMultipleAccountsConfig = {
2903
- /** Optional commitment level */
2904
- commitment?: Commitment;
2905
- /** The minimum slot that the request can be evaluated at */
2906
- minContextSlot?: number;
2907
- /** Optional data slice to limit the returned account data */
2908
- dataSlice?: DataSlice;
2909
- };
2910
- /**
2911
- * Configuration object for `getStakeActivation`
2912
- */
2913
- type GetStakeActivationConfig = {
2914
- /** Optional commitment level */
2915
- commitment?: Commitment;
2916
- /** Epoch for which to calculate activation details. If parameter not provided, defaults to current epoch */
2917
- epoch?: number;
2918
- /** The minimum slot that the request can be evaluated at */
2919
- minContextSlot?: number;
2920
- };
2921
- /**
2922
- * Configuration object for `getStakeActivation`
2923
- */
2924
- type GetTokenAccountsByOwnerConfig = {
2925
- /** Optional commitment level */
2926
- commitment?: Commitment;
2927
- /** The minimum slot that the request can be evaluated at */
2928
- minContextSlot?: number;
2929
- };
2930
- /**
2931
- * Configuration object for `getStakeActivation`
2932
- */
2933
- type GetTransactionCountConfig = {
2934
- /** Optional commitment level */
2935
- commitment?: Commitment;
2936
- /** The minimum slot that the request can be evaluated at */
2937
- minContextSlot?: number;
2938
- };
2939
- /**
2940
- * Configuration object for `getNonce`
2941
- */
2942
- type GetNonceConfig = {
2943
- /** Optional commitment level */
2944
- commitment?: Commitment;
2945
- /** The minimum slot that the request can be evaluated at */
2946
- minContextSlot?: number;
2947
- };
2948
- /**
2949
- * Configuration object for `getNonceAndContext`
2950
- */
2951
- type GetNonceAndContextConfig = {
2952
- /** Optional commitment level */
2953
- commitment?: Commitment;
2954
- /** The minimum slot that the request can be evaluated at */
2955
- minContextSlot?: number;
2956
- };
2957
- /**
2958
- * Information describing an account
2959
- */
2960
- type AccountInfo<T> = {
2961
- /** `true` if this account's data contains a loaded program */
2962
- executable: boolean;
2963
- /** Identifier of the program that owns the account */
2964
- owner: PublicKey;
2965
- /** Number of lamports assigned to the account */
2966
- lamports: number;
2967
- /** Optional data assigned to the account */
2968
- data: T;
2969
- /** Optional rent epoch info for account */
2970
- rentEpoch?: number;
2971
- };
2972
- /**
2973
- * Account information identified by pubkey
2974
- */
2975
- type KeyedAccountInfo = {
2976
- accountId: PublicKey;
2977
- accountInfo: AccountInfo<Buffer>;
2978
- };
2979
- /**
2980
- * Callback function for account change notifications
2981
- */
2982
- type AccountChangeCallback = (accountInfo: AccountInfo<Buffer>, context: Context) => void;
2983
- /**
2984
- * Callback function for program account change notifications
2985
- */
2986
- type ProgramAccountChangeCallback = (keyedAccountInfo: KeyedAccountInfo, context: Context) => void;
2987
- /**
2988
- * Callback function for slot change notifications
2989
- */
2990
- type SlotChangeCallback = (slotInfo: SlotInfo) => void;
2991
- /**
2992
- * Callback function for slot update notifications
2993
- */
2994
- type SlotUpdateCallback = (slotUpdate: SlotUpdate) => void;
2995
- /**
2996
- * Callback function for signature status notifications
2997
- */
2998
- type SignatureResultCallback = (signatureResult: SignatureResult, context: Context) => void;
2999
- /**
3000
- * Signature status notification with transaction result
3001
- */
3002
- type SignatureStatusNotification = {
3003
- type: 'status';
3004
- result: SignatureResult;
3005
- };
3006
- /**
3007
- * Signature received notification
3008
- */
3009
- type SignatureReceivedNotification = {
3010
- type: 'received';
3011
- };
3012
- /**
3013
- * Callback function for signature notifications
3014
- */
3015
- type SignatureSubscriptionCallback = (notification: SignatureStatusNotification | SignatureReceivedNotification, context: Context) => void;
3016
- /**
3017
- * Signature subscription options
3018
- */
3019
- type SignatureSubscriptionOptions = {
3020
- commitment?: Commitment;
3021
- enableReceivedNotification?: boolean;
3022
- };
3023
- /**
3024
- * Callback function for root change notifications
3025
- */
3026
- type RootChangeCallback = (root: number) => void;
3027
- /**
3028
- * Logs result.
3029
- */
3030
- type Logs = {
3031
- err: TransactionError | null;
3032
- logs: string[];
3033
- signature: string;
3034
- };
3035
- /**
3036
- * Filter for log subscriptions.
3037
- */
3038
- type LogsFilter = PublicKey | 'all' | 'allWithVotes';
3039
- /**
3040
- * Callback function for log notifications.
3041
- */
3042
- type LogsCallback = (logs: Logs, ctx: Context) => void;
3043
- /**
3044
- * Signature result
3045
- */
3046
- type SignatureResult = {
3047
- err: TransactionError | null;
3048
- };
3049
- /**
3050
- * Transaction error
3051
- */
3052
- type TransactionError = {} | string;
3053
- /**
3054
- * Transaction confirmation status
3055
- * <pre>
3056
- * 'processed': Transaction landed in a block which has reached 1 confirmation by the connected node
3057
- * 'confirmed': Transaction landed in a block which has reached 1 confirmation by the cluster
3058
- * 'finalized': Transaction landed in a block which has been finalized by the cluster
3059
- * </pre>
3060
- */
3061
- type TransactionConfirmationStatus = 'processed' | 'confirmed' | 'finalized';
3062
- /**
3063
- * Signature status
3064
- */
3065
- type SignatureStatus = {
3066
- /** when the transaction was processed */
3067
- slot: number;
3068
- /** the number of blocks that have been confirmed and voted on in the fork containing `slot` */
3069
- confirmations: number | null;
3070
- /** transaction error, if any */
3071
- err: TransactionError | null;
3072
- /** cluster confirmation status, if data available. Possible responses: `processed`, `confirmed`, `finalized` */
3073
- confirmationStatus?: TransactionConfirmationStatus;
3074
- };
3075
- /**
3076
- * A confirmed signature with its status
3077
- */
3078
- type ConfirmedSignatureInfo = {
3079
- /** the transaction signature */
3080
- signature: string;
3081
- /** when the transaction was processed */
3082
- slot: number;
3083
- /** error, if any */
3084
- err: TransactionError | null;
3085
- /** memo associated with the transaction, if any */
3086
- memo: string | null;
3087
- /** The unix timestamp of when the transaction was processed */
3088
- blockTime?: number | null;
3089
- /** Cluster confirmation status, if available. Possible values: `processed`, `confirmed`, `finalized` */
3090
- confirmationStatus?: TransactionConfirmationStatus;
3091
- };
3092
- /**
3093
- * An object defining headers to be passed to the RPC server
3094
- */
3095
- type HttpHeaders = {
3096
- [header: string]: string;
3097
- } & {
3098
- 'solana-client'?: never;
3099
- };
3100
- /**
3101
- * The type of the JavaScript `fetch()` API
3102
- */
3103
- type FetchFn = typeof _default;
3104
- /**
3105
- * A callback used to augment the outgoing HTTP request
3106
- */
3107
- type FetchMiddleware = (info: Parameters<FetchFn>[0], init: Parameters<FetchFn>[1], fetch: (...a: Parameters<FetchFn>) => void) => void;
3108
- /**
3109
- * Configuration for instantiating a Connection
3110
- */
3111
- type ConnectionConfig = {
3112
- /**
3113
- * An `http.Agent` that will be used to manage socket connections (eg. to implement connection
3114
- * persistence). Set this to `false` to create a connection that uses no agent. This applies to
3115
- * Node environments only.
3116
- */
3117
- httpAgent?: Agent | Agent$1 | false;
3118
- /** Optional commitment level */
3119
- commitment?: Commitment;
3120
- /** Optional endpoint URL to the fullnode JSON RPC PubSub WebSocket Endpoint */
3121
- wsEndpoint?: string;
3122
- /** Optional HTTP headers object */
3123
- httpHeaders?: HttpHeaders;
3124
- /** Optional custom fetch function */
3125
- fetch?: FetchFn;
3126
- /** Optional fetch middleware callback */
3127
- fetchMiddleware?: FetchMiddleware;
3128
- /** Optional Disable retrying calls when server responds with HTTP 429 (Too Many Requests) */
3129
- disableRetryOnRateLimit?: boolean;
3130
- /** time to allow for the server to initially process a transaction (in milliseconds) */
3131
- confirmTransactionInitialTimeout?: number;
3132
- };
3133
- /**
3134
- * A connection to a fullnode JSON RPC endpoint
3135
- */
3136
- export class Connection {
3137
- /**
3138
- * Establish a JSON RPC connection
3139
- *
3140
- * @param endpoint URL to the fullnode JSON RPC endpoint
3141
- * @param commitmentOrConfig optional default commitment level or optional ConnectionConfig configuration object
3142
- */
3143
- constructor(endpoint: string, commitmentOrConfig?: Commitment | ConnectionConfig);
3144
- /**
3145
- * The default commitment used for requests
3146
- */
3147
- get commitment(): Commitment | undefined;
3148
- /**
3149
- * The RPC endpoint
3150
- */
3151
- get rpcEndpoint(): string;
3152
- /**
3153
- * Fetch the balance for the specified public key, return with context
3154
- */
3155
- getBalanceAndContext(publicKey: PublicKey, commitmentOrConfig?: Commitment | GetBalanceConfig): Promise<RpcResponseAndContext<number>>;
3156
- /**
3157
- * Fetch the balance for the specified public key
3158
- */
3159
- getBalance(publicKey: PublicKey, commitmentOrConfig?: Commitment | GetBalanceConfig): Promise<number>;
3160
- /**
3161
- * Fetch the estimated production time of a block
3162
- */
3163
- getBlockTime(slot: number): Promise<number | null>;
3164
- /**
3165
- * Fetch the lowest slot that the node has information about in its ledger.
3166
- * This value may increase over time if the node is configured to purge older ledger data
3167
- */
3168
- getMinimumLedgerSlot(): Promise<number>;
3169
- /**
3170
- * Fetch the slot of the lowest confirmed block that has not been purged from the ledger
3171
- */
3172
- getFirstAvailableBlock(): Promise<number>;
3173
- /**
3174
- * Fetch information about the current supply
3175
- */
3176
- getSupply(config?: GetSupplyConfig | Commitment): Promise<RpcResponseAndContext<Supply>>;
3177
- /**
3178
- * Fetch the current supply of a token mint
3179
- */
3180
- getTokenSupply(tokenMintAddress: PublicKey, commitment?: Commitment): Promise<RpcResponseAndContext<TokenAmount>>;
3181
- /**
3182
- * Fetch the current balance of a token account
3183
- */
3184
- getTokenAccountBalance(tokenAddress: PublicKey, commitment?: Commitment): Promise<RpcResponseAndContext<TokenAmount>>;
3185
- /**
3186
- * Fetch all the token accounts owned by the specified account
3187
- *
3188
- * @return {Promise<RpcResponseAndContext<GetProgramAccountsResponse>}
3189
- */
3190
- getTokenAccountsByOwner(ownerAddress: PublicKey, filter: TokenAccountsFilter, commitmentOrConfig?: Commitment | GetTokenAccountsByOwnerConfig): Promise<RpcResponseAndContext<GetProgramAccountsResponse>>;
3191
- /**
3192
- * Fetch parsed token accounts owned by the specified account
3193
- *
3194
- * @return {Promise<RpcResponseAndContext<Array<{pubkey: PublicKey, account: AccountInfo<ParsedAccountData>}>>>}
3195
- */
3196
- getParsedTokenAccountsByOwner(ownerAddress: PublicKey, filter: TokenAccountsFilter, commitment?: Commitment): Promise<RpcResponseAndContext<Array<{
3197
- pubkey: PublicKey;
3198
- account: AccountInfo<ParsedAccountData>;
3199
- }>>>;
3200
- /**
3201
- * Fetch the 20 largest accounts with their current balances
3202
- */
3203
- getLargestAccounts(config?: GetLargestAccountsConfig): Promise<RpcResponseAndContext<Array<AccountBalancePair>>>;
3204
- /**
3205
- * Fetch the 20 largest token accounts with their current balances
3206
- * for a given mint.
3207
- */
3208
- getTokenLargestAccounts(mintAddress: PublicKey, commitment?: Commitment): Promise<RpcResponseAndContext<Array<TokenAccountBalancePair>>>;
3209
- /**
3210
- * Fetch all the account info for the specified public key, return with context
3211
- */
3212
- getAccountInfoAndContext(publicKey: PublicKey, commitmentOrConfig?: Commitment | GetAccountInfoConfig): Promise<RpcResponseAndContext<AccountInfo<Buffer> | null>>;
3213
- /**
3214
- * Fetch parsed account info for the specified public key
3215
- */
3216
- getParsedAccountInfo(publicKey: PublicKey, commitmentOrConfig?: Commitment | GetAccountInfoConfig): Promise<RpcResponseAndContext<AccountInfo<Buffer | ParsedAccountData> | null>>;
3217
- /**
3218
- * Fetch all the account info for the specified public key
3219
- */
3220
- getAccountInfo(publicKey: PublicKey, commitmentOrConfig?: Commitment | GetAccountInfoConfig): Promise<AccountInfo<Buffer> | null>;
3221
- /**
3222
- * Fetch all the account info for multiple accounts specified by an array of public keys, return with context
3223
- */
3224
- getMultipleParsedAccounts(publicKeys: PublicKey[], rawConfig?: GetMultipleAccountsConfig): Promise<RpcResponseAndContext<(AccountInfo<Buffer | ParsedAccountData> | null)[]>>;
3225
- /**
3226
- * Fetch all the account info for multiple accounts specified by an array of public keys, return with context
3227
- */
3228
- getMultipleAccountsInfoAndContext(publicKeys: PublicKey[], commitmentOrConfig?: Commitment | GetMultipleAccountsConfig): Promise<RpcResponseAndContext<(AccountInfo<Buffer> | null)[]>>;
3229
- /**
3230
- * Fetch all the account info for multiple accounts specified by an array of public keys
3231
- */
3232
- getMultipleAccountsInfo(publicKeys: PublicKey[], commitmentOrConfig?: Commitment | GetMultipleAccountsConfig): Promise<(AccountInfo<Buffer> | null)[]>;
3233
- /**
3234
- * Returns epoch activation information for a stake account that has been delegated
3235
- */
3236
- getStakeActivation(publicKey: PublicKey, commitmentOrConfig?: Commitment | GetStakeActivationConfig, epoch?: number): Promise<StakeActivationData>;
3237
- /**
3238
- * Fetch all the accounts owned by the specified program id
3239
- *
3240
- * @return {Promise<Array<{pubkey: PublicKey, account: AccountInfo<Buffer>}>>}
3241
- */
3242
- getProgramAccounts(programId: PublicKey, configOrCommitment: GetProgramAccountsConfig & Readonly<{
3243
- withContext: true;
3244
- }>): Promise<RpcResponseAndContext<GetProgramAccountsResponse>>;
3245
- getProgramAccounts(programId: PublicKey, configOrCommitment?: GetProgramAccountsConfig | Commitment): Promise<GetProgramAccountsResponse>;
3246
- /**
3247
- * Fetch and parse all the accounts owned by the specified program id
3248
- *
3249
- * @return {Promise<Array<{pubkey: PublicKey, account: AccountInfo<Buffer | ParsedAccountData>}>>}
3250
- */
3251
- getParsedProgramAccounts(programId: PublicKey, configOrCommitment?: GetParsedProgramAccountsConfig | Commitment): Promise<Array<{
3252
- pubkey: PublicKey;
3253
- account: AccountInfo<Buffer | ParsedAccountData>;
3254
- }>>;
3255
- confirmTransaction(strategy: TransactionConfirmationStrategy, commitment?: Commitment): Promise<RpcResponseAndContext<SignatureResult>>;
3256
- /** @deprecated Instead, call `confirmTransaction` and pass in {@link TransactionConfirmationStrategy} */
3257
- confirmTransaction(strategy: TransactionSignature, commitment?: Commitment): Promise<RpcResponseAndContext<SignatureResult>>;
3258
- private getCancellationPromise;
3259
- private getTransactionConfirmationPromise;
3260
- private confirmTransactionUsingBlockHeightExceedanceStrategy;
3261
- private confirmTransactionUsingDurableNonceStrategy;
3262
- private confirmTransactionUsingLegacyTimeoutStrategy;
3263
- /**
3264
- * Return the list of nodes that are currently participating in the cluster
3265
- */
3266
- getClusterNodes(): Promise<Array<ContactInfo>>;
3267
- /**
3268
- * Return the list of nodes that are currently participating in the cluster
3269
- */
3270
- getVoteAccounts(commitment?: Commitment): Promise<VoteAccountStatus>;
3271
- /**
3272
- * Fetch the current slot that the node is processing
3273
- */
3274
- getSlot(commitmentOrConfig?: Commitment | GetSlotConfig): Promise<number>;
3275
- /**
3276
- * Fetch the current slot leader of the cluster
3277
- */
3278
- getSlotLeader(commitmentOrConfig?: Commitment | GetSlotLeaderConfig): Promise<string>;
3279
- /**
3280
- * Fetch `limit` number of slot leaders starting from `startSlot`
3281
- *
3282
- * @param startSlot fetch slot leaders starting from this slot
3283
- * @param limit number of slot leaders to return
3284
- */
3285
- getSlotLeaders(startSlot: number, limit: number): Promise<Array<PublicKey>>;
3286
- /**
3287
- * Fetch the current status of a signature
3288
- */
3289
- getSignatureStatus(signature: TransactionSignature, config?: SignatureStatusConfig): Promise<RpcResponseAndContext<SignatureStatus | null>>;
3290
- /**
3291
- * Fetch the current statuses of a batch of signatures
3292
- */
3293
- getSignatureStatuses(signatures: Array<TransactionSignature>, config?: SignatureStatusConfig): Promise<RpcResponseAndContext<Array<SignatureStatus | null>>>;
3294
- /**
3295
- * Fetch the current transaction count of the cluster
3296
- */
3297
- getTransactionCount(commitmentOrConfig?: Commitment | GetTransactionCountConfig): Promise<number>;
3298
- /**
3299
- * Fetch the current total currency supply of the cluster in lamports
3300
- *
3301
- * @deprecated Deprecated since v1.2.8. Please use {@link getSupply} instead.
3302
- */
3303
- getTotalSupply(commitment?: Commitment): Promise<number>;
3304
- /**
3305
- * Fetch the cluster InflationGovernor parameters
3306
- */
3307
- getInflationGovernor(commitment?: Commitment): Promise<InflationGovernor>;
3308
- /**
3309
- * Fetch the inflation reward for a list of addresses for an epoch
3310
- */
3311
- getInflationReward(addresses: PublicKey[], epoch?: number, commitmentOrConfig?: Commitment | GetInflationRewardConfig): Promise<(InflationReward | null)[]>;
3312
- /**
3313
- * Fetch the specific inflation values for the current epoch
3314
- */
3315
- getInflationRate(): Promise<InflationRate>;
3316
- /**
3317
- * Fetch the Epoch Info parameters
3318
- */
3319
- getEpochInfo(commitmentOrConfig?: Commitment | GetEpochInfoConfig): Promise<EpochInfo>;
3320
- /**
3321
- * Fetch the Epoch Schedule parameters
3322
- */
3323
- getEpochSchedule(): Promise<EpochSchedule>;
3324
- /**
3325
- * Fetch the leader schedule for the current epoch
3326
- * @return {Promise<RpcResponseAndContext<LeaderSchedule>>}
3327
- */
3328
- getLeaderSchedule(): Promise<LeaderSchedule>;
3329
- /**
3330
- * Fetch the minimum balance needed to exempt an account of `dataLength`
3331
- * size from rent
3332
- */
3333
- getMinimumBalanceForRentExemption(dataLength: number, commitment?: Commitment): Promise<number>;
3334
- /**
3335
- * Fetch a recent blockhash from the cluster, return with context
3336
- * @return {Promise<RpcResponseAndContext<{blockhash: Blockhash, feeCalculator: FeeCalculator}>>}
3337
- *
3338
- * @deprecated Deprecated since Solana v1.8.0. Please use {@link getLatestBlockhash} instead.
3339
- */
3340
- getRecentBlockhashAndContext(commitment?: Commitment): Promise<RpcResponseAndContext<{
3341
- blockhash: Blockhash;
3342
- feeCalculator: FeeCalculator;
3343
- }>>;
3344
- /**
3345
- * Fetch recent performance samples
3346
- * @return {Promise<Array<PerfSample>>}
3347
- */
3348
- getRecentPerformanceSamples(limit?: number): Promise<Array<PerfSample>>;
3349
- /**
3350
- * Fetch the fee calculator for a recent blockhash from the cluster, return with context
3351
- *
3352
- * @deprecated Deprecated since Solana v1.8.0. Please use {@link getFeeForMessage} instead.
3353
- */
3354
- getFeeCalculatorForBlockhash(blockhash: Blockhash, commitment?: Commitment): Promise<RpcResponseAndContext<FeeCalculator | null>>;
3355
- /**
3356
- * Fetch the fee for a message from the cluster, return with context
3357
- */
3358
- getFeeForMessage(message: VersionedMessage, commitment?: Commitment): Promise<RpcResponseAndContext<number | null>>;
3359
- /**
3360
- * Fetch a list of prioritization fees from recent blocks.
3361
- */
3362
- getRecentPrioritizationFees(config?: GetRecentPrioritizationFeesConfig): Promise<RecentPrioritizationFees[]>;
3363
- /**
3364
- * Fetch a recent blockhash from the cluster
3365
- * @return {Promise<{blockhash: Blockhash, feeCalculator: FeeCalculator}>}
3366
- *
3367
- * @deprecated Deprecated since Solana v1.8.0. Please use {@link getLatestBlockhash} instead.
3368
- */
3369
- getRecentBlockhash(commitment?: Commitment): Promise<{
3370
- blockhash: Blockhash;
3371
- feeCalculator: FeeCalculator;
3372
- }>;
3373
- /**
3374
- * Fetch the latest blockhash from the cluster
3375
- * @return {Promise<BlockhashWithExpiryBlockHeight>}
3376
- */
3377
- getLatestBlockhash(commitmentOrConfig?: Commitment | GetLatestBlockhashConfig): Promise<BlockhashWithExpiryBlockHeight>;
3378
- /**
3379
- * Fetch the latest blockhash from the cluster
3380
- * @return {Promise<BlockhashWithExpiryBlockHeight>}
3381
- */
3382
- getLatestBlockhashAndContext(commitmentOrConfig?: Commitment | GetLatestBlockhashConfig): Promise<RpcResponseAndContext<BlockhashWithExpiryBlockHeight>>;
3383
- /**
3384
- * Returns whether a blockhash is still valid or not
3385
- */
3386
- isBlockhashValid(blockhash: Blockhash, rawConfig?: IsBlockhashValidConfig): Promise<RpcResponseAndContext<boolean>>;
3387
- /**
3388
- * Fetch the node version
3389
- */
3390
- getVersion(): Promise<Version>;
3391
- /**
3392
- * Fetch the genesis hash
3393
- */
3394
- getGenesisHash(): Promise<string>;
3395
- /**
3396
- * Fetch a processed block from the cluster.
3397
- *
3398
- * @deprecated Instead, call `getBlock` using a `GetVersionedBlockConfig` by
3399
- * setting the `maxSupportedTransactionVersion` property.
3400
- */
3401
- getBlock(slot: number, rawConfig?: GetBlockConfig): Promise<BlockResponse | null>;
3402
- /**
3403
- * @deprecated Instead, call `getBlock` using a `GetVersionedBlockConfig` by
3404
- * setting the `maxSupportedTransactionVersion` property.
3405
- */
3406
- getBlock(slot: number, rawConfig: GetBlockConfig & {
3407
- transactionDetails: 'accounts';
3408
- }): Promise<AccountsModeBlockResponse | null>;
3409
- /**
3410
- * @deprecated Instead, call `getBlock` using a `GetVersionedBlockConfig` by
3411
- * setting the `maxSupportedTransactionVersion` property.
3412
- */
3413
- getBlock(slot: number, rawConfig: GetBlockConfig & {
3414
- transactionDetails: 'none';
3415
- }): Promise<NoneModeBlockResponse | null>;
3416
- /**
3417
- * Fetch a processed block from the cluster.
3418
- */
3419
- getBlock(slot: number, rawConfig?: GetVersionedBlockConfig): Promise<VersionedBlockResponse | null>;
3420
- getBlock(slot: number, rawConfig: GetVersionedBlockConfig & {
3421
- transactionDetails: 'accounts';
3422
- }): Promise<VersionedAccountsModeBlockResponse | null>;
3423
- getBlock(slot: number, rawConfig: GetVersionedBlockConfig & {
3424
- transactionDetails: 'none';
3425
- }): Promise<VersionedNoneModeBlockResponse | null>;
3426
- /**
3427
- * Fetch parsed transaction details for a confirmed or finalized block
3428
- */
3429
- getParsedBlock(slot: number, rawConfig?: GetVersionedBlockConfig): Promise<ParsedAccountsModeBlockResponse>;
3430
- getParsedBlock(slot: number, rawConfig: GetVersionedBlockConfig & {
3431
- transactionDetails: 'accounts';
3432
- }): Promise<ParsedAccountsModeBlockResponse>;
3433
- getParsedBlock(slot: number, rawConfig: GetVersionedBlockConfig & {
3434
- transactionDetails: 'none';
3435
- }): Promise<ParsedNoneModeBlockResponse>;
3436
- getBlockHeight: (commitmentOrConfig?: Commitment | GetBlockHeightConfig) => Promise<number>;
3437
- getBlockProduction(configOrCommitment?: GetBlockProductionConfig | Commitment): Promise<RpcResponseAndContext<BlockProduction>>;
3438
- /**
3439
- * Fetch a confirmed or finalized transaction from the cluster.
3440
- *
3441
- * @deprecated Instead, call `getTransaction` using a
3442
- * `GetVersionedTransactionConfig` by setting the
3443
- * `maxSupportedTransactionVersion` property.
3444
- */
3445
- getTransaction(signature: string, rawConfig?: GetTransactionConfig): Promise<TransactionResponse | null>;
3446
- /**
3447
- * Fetch a confirmed or finalized transaction from the cluster.
3448
- */
3449
- getTransaction(signature: string, rawConfig: GetVersionedTransactionConfig): Promise<VersionedTransactionResponse | null>;
3450
- /**
3451
- * Fetch parsed transaction details for a confirmed or finalized transaction
3452
- */
3453
- getParsedTransaction(signature: TransactionSignature, commitmentOrConfig?: GetVersionedTransactionConfig | Finality): Promise<ParsedTransactionWithMeta | null>;
3454
- /**
3455
- * Fetch parsed transaction details for a batch of confirmed transactions
3456
- */
3457
- getParsedTransactions(signatures: TransactionSignature[], commitmentOrConfig?: GetVersionedTransactionConfig | Finality): Promise<(ParsedTransactionWithMeta | null)[]>;
3458
- /**
3459
- * Fetch transaction details for a batch of confirmed transactions.
3460
- * Similar to {@link getParsedTransactions} but returns a {@link TransactionResponse}.
3461
- *
3462
- * @deprecated Instead, call `getTransactions` using a
3463
- * `GetVersionedTransactionConfig` by setting the
3464
- * `maxSupportedTransactionVersion` property.
3465
- */
3466
- getTransactions(signatures: TransactionSignature[], commitmentOrConfig?: GetTransactionConfig | Finality): Promise<(TransactionResponse | null)[]>;
3467
- /**
3468
- * Fetch transaction details for a batch of confirmed transactions.
3469
- * Similar to {@link getParsedTransactions} but returns a {@link
3470
- * VersionedTransactionResponse}.
3471
- */
3472
- getTransactions(signatures: TransactionSignature[], commitmentOrConfig: GetVersionedTransactionConfig | Finality): Promise<(VersionedTransactionResponse | null)[]>;
3473
- /**
3474
- * Fetch a list of Transactions and transaction statuses from the cluster
3475
- * for a confirmed block.
3476
- *
3477
- * @deprecated Deprecated since v1.13.0. Please use {@link getBlock} instead.
3478
- */
3479
- getConfirmedBlock(slot: number, commitment?: Finality): Promise<ConfirmedBlock>;
3480
- /**
3481
- * Fetch confirmed blocks between two slots
3482
- */
3483
- getBlocks(startSlot: number, endSlot?: number, commitment?: Finality): Promise<Array<number>>;
3484
- /**
3485
- * Fetch a list of Signatures from the cluster for a block, excluding rewards
3486
- */
3487
- getBlockSignatures(slot: number, commitment?: Finality): Promise<BlockSignatures>;
3488
- /**
3489
- * Fetch a list of Signatures from the cluster for a confirmed block, excluding rewards
3490
- *
3491
- * @deprecated Deprecated since Solana v1.8.0. Please use {@link getBlockSignatures} instead.
3492
- */
3493
- getConfirmedBlockSignatures(slot: number, commitment?: Finality): Promise<BlockSignatures>;
3494
- /**
3495
- * Fetch a transaction details for a confirmed transaction
3496
- *
3497
- * @deprecated Deprecated since Solana v1.8.0. Please use {@link getTransaction} instead.
3498
- */
3499
- getConfirmedTransaction(signature: TransactionSignature, commitment?: Finality): Promise<ConfirmedTransaction | null>;
3500
- /**
3501
- * Fetch parsed transaction details for a confirmed transaction
3502
- *
3503
- * @deprecated Deprecated since Solana v1.8.0. Please use {@link getParsedTransaction} instead.
3504
- */
3505
- getParsedConfirmedTransaction(signature: TransactionSignature, commitment?: Finality): Promise<ParsedConfirmedTransaction | null>;
3506
- /**
3507
- * Fetch parsed transaction details for a batch of confirmed transactions
3508
- *
3509
- * @deprecated Deprecated since Solana v1.8.0. Please use {@link getParsedTransactions} instead.
3510
- */
3511
- getParsedConfirmedTransactions(signatures: TransactionSignature[], commitment?: Finality): Promise<(ParsedConfirmedTransaction | null)[]>;
3512
- /**
3513
- * Fetch a list of all the confirmed signatures for transactions involving an address
3514
- * within a specified slot range. Max range allowed is 10,000 slots.
3515
- *
3516
- * @deprecated Deprecated since v1.3. Please use {@link getConfirmedSignaturesForAddress2} instead.
3517
- *
3518
- * @param address queried address
3519
- * @param startSlot start slot, inclusive
3520
- * @param endSlot end slot, inclusive
3521
- */
3522
- getConfirmedSignaturesForAddress(address: PublicKey, startSlot: number, endSlot: number): Promise<Array<TransactionSignature>>;
3523
- /**
3524
- * Returns confirmed signatures for transactions involving an
3525
- * address backwards in time from the provided signature or most recent confirmed block
3526
- *
3527
- *
3528
- * @param address queried address
3529
- * @param options
3530
- */
3531
- getConfirmedSignaturesForAddress2(address: PublicKey, options?: ConfirmedSignaturesForAddress2Options, commitment?: Finality): Promise<Array<ConfirmedSignatureInfo>>;
3532
- /**
3533
- * Returns confirmed signatures for transactions involving an
3534
- * address backwards in time from the provided signature or most recent confirmed block
3535
- *
3536
- *
3537
- * @param address queried address
3538
- * @param options
3539
- */
3540
- getSignaturesForAddress(address: PublicKey, options?: SignaturesForAddressOptions, commitment?: Finality): Promise<Array<ConfirmedSignatureInfo>>;
3541
- getAddressLookupTable(accountKey: PublicKey, config?: GetAccountInfoConfig): Promise<RpcResponseAndContext<AddressLookupTableAccount | null>>;
3542
- /**
3543
- * Fetch the contents of a Nonce account from the cluster, return with context
3544
- */
3545
- getNonceAndContext(nonceAccount: PublicKey, commitmentOrConfig?: Commitment | GetNonceAndContextConfig): Promise<RpcResponseAndContext<NonceAccount | null>>;
3546
- /**
3547
- * Fetch the contents of a Nonce account from the cluster
3548
- */
3549
- getNonce(nonceAccount: PublicKey, commitmentOrConfig?: Commitment | GetNonceConfig): Promise<NonceAccount | null>;
3550
- /**
3551
- * Request an allocation of lamports to the specified address
3552
- *
3553
- * ```typescript
3554
- * import { Connection, PublicKey, LAMPORTS_PER_SOL } from "@solana/web3.js";
3555
- *
3556
- * (async () => {
3557
- * const connection = new Connection("https://api.testnet.solana.com", "confirmed");
3558
- * const myAddress = new PublicKey("2nr1bHFT86W9tGnyvmYW4vcHKsQB3sVQfnddasz4kExM");
3559
- * const signature = await connection.requestAirdrop(myAddress, LAMPORTS_PER_SOL);
3560
- * await connection.confirmTransaction(signature);
3561
- * })();
3562
- * ```
3563
- */
3564
- requestAirdrop(to: PublicKey, lamports: number): Promise<TransactionSignature>;
3565
- /**
3566
- * get the stake minimum delegation
3567
- */
3568
- getStakeMinimumDelegation(config?: GetStakeMinimumDelegationConfig): Promise<RpcResponseAndContext<number>>;
3569
- /**
3570
- * Simulate a transaction
3571
- *
3572
- * @deprecated Instead, call {@link simulateTransaction} with {@link
3573
- * VersionedTransaction} and {@link SimulateTransactionConfig} parameters
3574
- */
3575
- simulateTransaction(transactionOrMessage: Transaction | Message, signers?: Array<Signer>, includeAccounts?: boolean | Array<PublicKey>): Promise<RpcResponseAndContext<SimulatedTransactionResponse>>;
3576
- /**
3577
- * Simulate a transaction
3578
- */
3579
- simulateTransaction(transaction: VersionedTransaction, config?: SimulateTransactionConfig): Promise<RpcResponseAndContext<SimulatedTransactionResponse>>;
3580
- /**
3581
- * Sign and send a transaction
3582
- *
3583
- * @deprecated Instead, call {@link sendTransaction} with a {@link
3584
- * VersionedTransaction}
3585
- */
3586
- sendTransaction(transaction: Transaction, signers: Array<Signer>, options?: SendOptions): Promise<TransactionSignature>;
3587
- /**
3588
- * Send a signed transaction
3589
- */
3590
- sendTransaction(transaction: VersionedTransaction, options?: SendOptions): Promise<TransactionSignature>;
3591
- /**
3592
- * Send a transaction that has already been signed and serialized into the
3593
- * wire format
3594
- */
3595
- sendRawTransaction(rawTransaction: Buffer | Uint8Array | Array<number>, options?: SendOptions): Promise<TransactionSignature>;
3596
- /**
3597
- * Send a transaction that has already been signed, serialized into the
3598
- * wire format, and encoded as a base64 string
3599
- */
3600
- sendEncodedTransaction(encodedTransaction: string, options?: SendOptions): Promise<TransactionSignature>;
3601
- /**
3602
- * Register a callback to be invoked whenever the specified account changes
3603
- *
3604
- * @param publicKey Public key of the account to monitor
3605
- * @param callback Function to invoke whenever the account is changed
3606
- * @param commitment Specify the commitment level account changes must reach before notification
3607
- * @return subscription id
3608
- */
3609
- onAccountChange(publicKey: PublicKey, callback: AccountChangeCallback, commitment?: Commitment): ClientSubscriptionId;
3610
- /**
3611
- * Deregister an account notification callback
3612
- *
3613
- * @param id client subscription id to deregister
3614
- */
3615
- removeAccountChangeListener(clientSubscriptionId: ClientSubscriptionId): Promise<void>;
3616
- /**
3617
- * Register a callback to be invoked whenever accounts owned by the
3618
- * specified program change
3619
- *
3620
- * @param programId Public key of the program to monitor
3621
- * @param callback Function to invoke whenever the account is changed
3622
- * @param commitment Specify the commitment level account changes must reach before notification
3623
- * @param filters The program account filters to pass into the RPC method
3624
- * @return subscription id
3625
- */
3626
- onProgramAccountChange(programId: PublicKey, callback: ProgramAccountChangeCallback, commitment?: Commitment, filters?: GetProgramAccountsFilter[]): ClientSubscriptionId;
3627
- /**
3628
- * Deregister an account notification callback
3629
- *
3630
- * @param id client subscription id to deregister
3631
- */
3632
- removeProgramAccountChangeListener(clientSubscriptionId: ClientSubscriptionId): Promise<void>;
3633
- /**
3634
- * Registers a callback to be invoked whenever logs are emitted.
3635
- */
3636
- onLogs(filter: LogsFilter, callback: LogsCallback, commitment?: Commitment): ClientSubscriptionId;
3637
- /**
3638
- * Deregister a logs callback.
3639
- *
3640
- * @param id client subscription id to deregister.
3641
- */
3642
- removeOnLogsListener(clientSubscriptionId: ClientSubscriptionId): Promise<void>;
3643
- /**
3644
- * Register a callback to be invoked upon slot changes
3645
- *
3646
- * @param callback Function to invoke whenever the slot changes
3647
- * @return subscription id
3648
- */
3649
- onSlotChange(callback: SlotChangeCallback): ClientSubscriptionId;
3650
- /**
3651
- * Deregister a slot notification callback
3652
- *
3653
- * @param id client subscription id to deregister
3654
- */
3655
- removeSlotChangeListener(clientSubscriptionId: ClientSubscriptionId): Promise<void>;
3656
- /**
3657
- * Register a callback to be invoked upon slot updates. {@link SlotUpdate}'s
3658
- * may be useful to track live progress of a cluster.
3659
- *
3660
- * @param callback Function to invoke whenever the slot updates
3661
- * @return subscription id
3662
- */
3663
- onSlotUpdate(callback: SlotUpdateCallback): ClientSubscriptionId;
3664
- /**
3665
- * Deregister a slot update notification callback
3666
- *
3667
- * @param id client subscription id to deregister
3668
- */
3669
- removeSlotUpdateListener(clientSubscriptionId: ClientSubscriptionId): Promise<void>;
3670
- _buildArgs(args: Array<any>, override?: Commitment, encoding?: 'jsonParsed' | 'base64', extra?: any): Array<any>;
3671
- /**
3672
- * Register a callback to be invoked upon signature updates
3673
- *
3674
- * @param signature Transaction signature string in base 58
3675
- * @param callback Function to invoke on signature notifications
3676
- * @param commitment Specify the commitment level signature must reach before notification
3677
- * @return subscription id
3678
- */
3679
- onSignature(signature: TransactionSignature, callback: SignatureResultCallback, commitment?: Commitment): ClientSubscriptionId;
3680
- /**
3681
- * Register a callback to be invoked when a transaction is
3682
- * received and/or processed.
3683
- *
3684
- * @param signature Transaction signature string in base 58
3685
- * @param callback Function to invoke on signature notifications
3686
- * @param options Enable received notifications and set the commitment
3687
- * level that signature must reach before notification
3688
- * @return subscription id
3689
- */
3690
- onSignatureWithOptions(signature: TransactionSignature, callback: SignatureSubscriptionCallback, options?: SignatureSubscriptionOptions): ClientSubscriptionId;
3691
- /**
3692
- * Deregister a signature notification callback
3693
- *
3694
- * @param id client subscription id to deregister
3695
- */
3696
- removeSignatureListener(clientSubscriptionId: ClientSubscriptionId): Promise<void>;
3697
- /**
3698
- * Register a callback to be invoked upon root changes
3699
- *
3700
- * @param callback Function to invoke whenever the root changes
3701
- * @return subscription id
3702
- */
3703
- onRootChange(callback: RootChangeCallback): ClientSubscriptionId;
3704
- /**
3705
- * Deregister a root notification callback
3706
- *
3707
- * @param id client subscription id to deregister
3708
- */
3709
- removeRootChangeListener(clientSubscriptionId: ClientSubscriptionId): Promise<void>;
3710
- }
3711
-
3712
- export const BPF_LOADER_PROGRAM_ID: PublicKey;
3713
- /**
3714
- * Factory class for transactions to interact with a program loader
3715
- */
3716
- export class BpfLoader {
3717
- /**
3718
- * Minimum number of signatures required to load a program not including
3719
- * retries
3720
- *
3721
- * Can be used to calculate transaction fees
3722
- */
3723
- static getMinNumSignatures(dataLength: number): number;
3724
- /**
3725
- * Load a SBF program
3726
- *
3727
- * @param connection The connection to use
3728
- * @param payer Account that will pay program loading fees
3729
- * @param program Account to load the program into
3730
- * @param elf The entire ELF containing the SBF program
3731
- * @param loaderProgramId The program id of the BPF loader to use
3732
- * @return true if program was loaded successfully, false if program was already loaded
3733
- */
3734
- static load(connection: Connection, payer: Signer, program: Signer, elf: Buffer | Uint8Array | Array<number>, loaderProgramId: PublicKey): Promise<boolean>;
3735
- }
3736
-
3737
- export class SendTransactionError extends Error {
3738
- logs: string[] | undefined;
3739
- constructor(message: string, logs?: string[]);
3740
- }
3741
- export const SolanaJSONRPCErrorCode: {
3742
- readonly JSON_RPC_SERVER_ERROR_BLOCK_CLEANED_UP: -32001;
3743
- readonly JSON_RPC_SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE: -32002;
3744
- readonly JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_VERIFICATION_FAILURE: -32003;
3745
- readonly JSON_RPC_SERVER_ERROR_BLOCK_NOT_AVAILABLE: -32004;
3746
- readonly JSON_RPC_SERVER_ERROR_NODE_UNHEALTHY: -32005;
3747
- readonly JSON_RPC_SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE: -32006;
3748
- readonly JSON_RPC_SERVER_ERROR_SLOT_SKIPPED: -32007;
3749
- readonly JSON_RPC_SERVER_ERROR_NO_SNAPSHOT: -32008;
3750
- readonly JSON_RPC_SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED: -32009;
3751
- readonly JSON_RPC_SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX: -32010;
3752
- readonly JSON_RPC_SERVER_ERROR_TRANSACTION_HISTORY_NOT_AVAILABLE: -32011;
3753
- readonly JSON_RPC_SCAN_ERROR: -32012;
3754
- readonly JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_LEN_MISMATCH: -32013;
3755
- readonly JSON_RPC_SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET: -32014;
3756
- readonly JSON_RPC_SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION: -32015;
3757
- readonly JSON_RPC_SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED: -32016;
3758
- };
3759
- type SolanaJSONRPCErrorCodeEnum = (typeof SolanaJSONRPCErrorCode)[keyof typeof SolanaJSONRPCErrorCode];
3760
- export class SolanaJSONRPCError extends Error {
3761
- code: SolanaJSONRPCErrorCodeEnum | unknown;
3762
- data?: any;
3763
- constructor({ code, message, data, }: Readonly<{
3764
- code: unknown;
3765
- message: string;
3766
- data?: any;
3767
- }>, customMessage?: string);
3768
- }
3769
-
3770
- /**
3771
- * Program loader interface
3772
- */
3773
- export class Loader {
3774
- /**
3775
- * Amount of program data placed in each load Transaction
3776
- */
3777
- static chunkSize: number;
3778
- /**
3779
- * Minimum number of signatures required to load a program not including
3780
- * retries
3781
- *
3782
- * Can be used to calculate transaction fees
3783
- */
3784
- static getMinNumSignatures(dataLength: number): number;
3785
- /**
3786
- * Loads a generic program
3787
- *
3788
- * @param connection The connection to use
3789
- * @param payer System account that pays to load the program
3790
- * @param program Account to load the program into
3791
- * @param programId Public key that identifies the loader
3792
- * @param data Program octets
3793
- * @return true if program was loaded successfully, false if program was already loaded
3794
- */
3795
- static load(connection: Connection, payer: Signer, program: Signer, programId: PublicKey, data: Buffer | Uint8Array | Array<number>): Promise<boolean>;
3796
- }
3797
-
3798
- export const VALIDATOR_INFO_KEY: PublicKey;
3799
- /**
3800
- * Info used to identity validators.
3801
- */
3802
- type Info = {
3803
- /** validator name */
3804
- name: string;
3805
- /** optional, validator website */
3806
- website?: string;
3807
- /** optional, extra information the validator chose to share */
3808
- details?: string;
3809
- /** optional, used to identify validators on keybase.io */
3810
- keybaseUsername?: string;
3811
- };
3812
- /**
3813
- * ValidatorInfo class
3814
- */
3815
- export class ValidatorInfo {
3816
- /**
3817
- * validator public key
3818
- */
3819
- key: PublicKey;
3820
- /**
3821
- * validator information
3822
- */
3823
- info: Info;
3824
- /**
3825
- * Construct a valid ValidatorInfo
3826
- *
3827
- * @param key validator public key
3828
- * @param info validator information
3829
- */
3830
- constructor(key: PublicKey, info: Info);
3831
- /**
3832
- * Deserialize ValidatorInfo from the config account data. Exactly two config
3833
- * keys are required in the data.
3834
- *
3835
- * @param buffer config account data
3836
- * @return null if info was not found
3837
- */
3838
- static fromConfigData(buffer: Buffer | Uint8Array | Array<number>): ValidatorInfo | null;
3839
- }
3840
-
3841
- export const VOTE_PROGRAM_ID: PublicKey;
3842
- type Lockout = {
3843
- slot: number;
3844
- confirmationCount: number;
3845
- };
3846
- /**
3847
- * History of how many credits earned by the end of each epoch
3848
- */
3849
- type EpochCredits = Readonly<{
3850
- epoch: number;
3851
- credits: number;
3852
- prevCredits: number;
3853
- }>;
3854
- type AuthorizedVoter = Readonly<{
3855
- epoch: number;
3856
- authorizedVoter: PublicKey;
3857
- }>;
3858
- type PriorVoter = Readonly<{
3859
- authorizedPubkey: PublicKey;
3860
- epochOfLastAuthorizedSwitch: number;
3861
- targetEpoch: number;
3862
- }>;
3863
- type BlockTimestamp = Readonly<{
3864
- slot: number;
3865
- timestamp: number;
3866
- }>;
3867
- /**
3868
- * VoteAccount class
3869
- */
3870
- export class VoteAccount {
3871
- nodePubkey: PublicKey;
3872
- authorizedWithdrawer: PublicKey;
3873
- commission: number;
3874
- rootSlot: number | null;
3875
- votes: Lockout[];
3876
- authorizedVoters: AuthorizedVoter[];
3877
- priorVoters: PriorVoter[];
3878
- epochCredits: EpochCredits[];
3879
- lastTimestamp: BlockTimestamp;
3880
- /**
3881
- * Deserialize VoteAccount from the account data.
3882
- *
3883
- * @param buffer account data
3884
- * @return VoteAccount
3885
- */
3886
- static fromAccountData(buffer: Buffer | Uint8Array | Array<number>): VoteAccount;
3887
- }
3888
-
3889
- export const SYSVAR_CLOCK_PUBKEY: PublicKey;
3890
- export const SYSVAR_EPOCH_SCHEDULE_PUBKEY: PublicKey;
3891
- export const SYSVAR_INSTRUCTIONS_PUBKEY: PublicKey;
3892
- export const SYSVAR_RECENT_BLOCKHASHES_PUBKEY: PublicKey;
3893
- export const SYSVAR_RENT_PUBKEY: PublicKey;
3894
- export const SYSVAR_REWARDS_PUBKEY: PublicKey;
3895
- export const SYSVAR_SLOT_HASHES_PUBKEY: PublicKey;
3896
- export const SYSVAR_SLOT_HISTORY_PUBKEY: PublicKey;
3897
- export const SYSVAR_STAKE_HISTORY_PUBKEY: PublicKey;
3898
-
3899
- type Cluster = 'devnet' | 'testnet' | 'mainnet-beta';
3900
- /**
3901
- * Retrieves the RPC API URL for the specified cluster
3902
- * @param {Cluster} [cluster="devnet"] - The cluster name of the RPC API URL to use. Possible options: 'devnet' | 'testnet' | 'mainnet-beta'
3903
- * @param {boolean} [tls="http"] - Use TLS when connecting to cluster.
3904
- *
3905
- * @returns {string} URL string of the RPC endpoint
3906
- */
3907
- export function clusterApiUrl(cluster?: Cluster, tls?: boolean): string;
3908
-
3909
- /**
3910
- * Send and confirm a raw transaction
3911
- *
3912
- * If `commitment` option is not specified, defaults to 'max' commitment.
3913
- *
3914
- * @param {Connection} connection
3915
- * @param {Buffer} rawTransaction
3916
- * @param {TransactionConfirmationStrategy} confirmationStrategy
3917
- * @param {ConfirmOptions} [options]
3918
- * @returns {Promise<TransactionSignature>}
3919
- */
3920
- export function sendAndConfirmRawTransaction(connection: Connection, rawTransaction: Buffer, confirmationStrategy: TransactionConfirmationStrategy, options?: ConfirmOptions): Promise<TransactionSignature>;
3921
- /**
3922
- * @deprecated Calling `sendAndConfirmRawTransaction()` without a `confirmationStrategy`
3923
- * is no longer supported and will be removed in a future version.
3924
- */
3925
- export function sendAndConfirmRawTransaction(connection: Connection, rawTransaction: Buffer, options?: ConfirmOptions): Promise<TransactionSignature>;
3926
-
3927
- /**
3928
- * Sign, send and confirm a transaction.
3929
- *
3930
- * If `commitment` option is not specified, defaults to 'max' commitment.
3931
- *
3932
- * @param {Connection} connection
3933
- * @param {Transaction} transaction
3934
- * @param {Array<Signer>} signers
3935
- * @param {ConfirmOptions} [options]
3936
- * @returns {Promise<TransactionSignature>}
3937
- */
3938
- export function sendAndConfirmTransaction(connection: Connection, transaction: Transaction, signers: Array<Signer>, options?: ConfirmOptions & Readonly<{
3939
- abortSignal?: AbortSignal;
3940
- }>): Promise<TransactionSignature>;
3941
-
3942
- /**
3943
- * There are 1-billion lamports in one SOL
3944
- */
3945
- export const LAMPORTS_PER_SOL = 1000000000;
3946
-
3947
- }