@solana/rpc-api 6.3.1 → 6.3.2-canary-20260313112147

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 (54) hide show
  1. package/package.json +14 -13
  2. package/src/getAccountInfo.ts +145 -0
  3. package/src/getBalance.ts +31 -0
  4. package/src/getBlock.ts +552 -0
  5. package/src/getBlockCommitment.ts +20 -0
  6. package/src/getBlockHeight.ts +29 -0
  7. package/src/getBlockProduction.ts +83 -0
  8. package/src/getBlockTime.ts +21 -0
  9. package/src/getBlocks.ts +34 -0
  10. package/src/getBlocksWithLimit.ts +33 -0
  11. package/src/getClusterNodes.ts +49 -0
  12. package/src/getEpochInfo.ts +43 -0
  13. package/src/getEpochSchedule.ts +29 -0
  14. package/src/getFeeForMessage.ts +35 -0
  15. package/src/getFirstAvailableBlock.ts +17 -0
  16. package/src/getGenesisHash.ts +13 -0
  17. package/src/getHealth.ts +17 -0
  18. package/src/getHighestSnapshotSlot.ts +23 -0
  19. package/src/getIdentity.ts +14 -0
  20. package/src/getInflationGovernor.ts +39 -0
  21. package/src/getInflationRate.ts +21 -0
  22. package/src/getInflationReward.ts +53 -0
  23. package/src/getLargestAccounts.ts +42 -0
  24. package/src/getLatestBlockhash.ts +40 -0
  25. package/src/getLeaderSchedule.ts +103 -0
  26. package/src/getMaxRetransmitSlot.ts +12 -0
  27. package/src/getMaxShredInsertSlot.ts +12 -0
  28. package/src/getMinimumBalanceForRentExemption.ts +32 -0
  29. package/src/getMultipleAccounts.ts +156 -0
  30. package/src/getProgramAccounts.ts +264 -0
  31. package/src/getRecentPerformanceSamples.ts +29 -0
  32. package/src/getRecentPrioritizationFees.ts +28 -0
  33. package/src/getSignatureStatuses.ts +62 -0
  34. package/src/getSignaturesForAddress.ts +88 -0
  35. package/src/getSlot.ts +29 -0
  36. package/src/getSlotLeader.ts +32 -0
  37. package/src/getSlotLeaders.ts +21 -0
  38. package/src/getStakeMinimumDelegation.ts +26 -0
  39. package/src/getSupply.ts +66 -0
  40. package/src/getTokenAccountBalance.ts +26 -0
  41. package/src/getTokenAccountsByDelegate.ts +196 -0
  42. package/src/getTokenAccountsByOwner.ts +190 -0
  43. package/src/getTokenLargestAccounts.ts +29 -0
  44. package/src/getTokenSupply.ts +26 -0
  45. package/src/getTransaction.ts +437 -0
  46. package/src/getTransactionCount.ts +30 -0
  47. package/src/getVersion.ts +21 -0
  48. package/src/getVoteAccounts.ts +80 -0
  49. package/src/index.ts +353 -0
  50. package/src/isBlockhashValid.ts +35 -0
  51. package/src/minimumLedgerSlot.ts +16 -0
  52. package/src/requestAirdrop.ts +34 -0
  53. package/src/sendTransaction.ts +80 -0
  54. package/src/simulateTransaction.ts +727 -0
@@ -0,0 +1,437 @@
1
+ import type { Address } from '@solana/addresses';
2
+ import type { Signature } from '@solana/keys';
3
+ import type {
4
+ Base58EncodedBytes,
5
+ Base58EncodedDataResponse,
6
+ Base64EncodedDataResponse,
7
+ Blockhash,
8
+ Commitment,
9
+ Lamports,
10
+ Reward,
11
+ Slot,
12
+ TokenBalance,
13
+ TransactionError,
14
+ TransactionStatus,
15
+ UnixTimestamp,
16
+ } from '@solana/rpc-types';
17
+ import type { TransactionVersion } from '@solana/transaction-messages';
18
+
19
+ type ReturnData = {
20
+ /** A tuple whose first element is the bytes of the return data as a base64-encoded string. */
21
+ data: Base64EncodedDataResponse;
22
+ /** The address of the program that generated the return data */
23
+ programId: Address;
24
+ };
25
+
26
+ type TransactionMetaBase = Readonly<{
27
+ /** Number of compute units consumed by the transaction */
28
+ computeUnitsConsumed?: bigint;
29
+ /** Error if transaction failed, `null` if transaction succeeded. */
30
+ err: TransactionError | null;
31
+ /** The fee this transaction was charged, in {@link Lamports} */
32
+ fee: Lamports;
33
+ /**
34
+ * String log messages or `null` if log message recording was not enabled during this
35
+ * transaction
36
+ */
37
+ logMessages: readonly string[] | null;
38
+ /** Account balances after the transaction was processed */
39
+ postBalances: readonly Lamports[];
40
+ /**
41
+ * List of token balances from after the transaction was processed or omitted if token balance
42
+ * recording was not yet enabled during this transaction
43
+ */
44
+ postTokenBalances?: readonly TokenBalance[];
45
+ /** Account balances from before the transaction was processed */
46
+ preBalances: readonly Lamports[];
47
+ /**
48
+ * List of token balances from before the transaction was processed or omitted if token balance
49
+ * recording was not yet enabled during this transaction
50
+ */
51
+ preTokenBalances?: readonly TokenBalance[];
52
+ /** The most-recent return data generated by an instruction in the transaction */
53
+ returnData?: ReturnData;
54
+ /**
55
+ * Transaction-level rewards; currently only `"Rent"`, but other types may be added in the
56
+ * future
57
+ */
58
+ rewards: readonly Reward[] | null;
59
+ /** @deprecated */
60
+ status: TransactionStatus;
61
+ }>;
62
+
63
+ type AddressTableLookup = Readonly<{
64
+ /** The address of the address lookup table account. */
65
+ accountKey: Address;
66
+ /** Indexes of accounts in a lookup table to load as read-only. */
67
+ readonlyIndexes: readonly number[];
68
+ /** Indexes of accounts in a lookup table to load as writable. */
69
+ writableIndexes: readonly number[];
70
+ }>;
71
+
72
+ type TransactionBase = Readonly<{
73
+ message: {
74
+ /**
75
+ * For transactions whose lifetime is specified by a recent blockhash, this is that
76
+ * blockhash, and for transactions whose lifetime is specified by a durable nonce, this is
77
+ * the nonce value.
78
+ */
79
+ recentBlockhash: Blockhash;
80
+ };
81
+ /**
82
+ * An ordered list of signatures belonging to the accounts required to sign this transaction.
83
+ *
84
+ * Each signature is an Ed25519 signature of the transaction message using the private key
85
+ * associated with the account required to sign the transaction.
86
+ */
87
+ signatures: readonly Base58EncodedBytes[];
88
+ }>;
89
+
90
+ type InstructionWithStackHeight = Readonly<{
91
+ /**
92
+ * A number indicating the height at which this instruction was called with respect to the
93
+ * bottom of the call stack denoted by `1` or `null`.
94
+ *
95
+ * For instance, an instruction explicitly declared in the transaction message will have a `1`
96
+ * or `null` height, the first instruction that it calls using a cross-program invocation (CPI)
97
+ * will have a height of 2, an instruction called by that instruction using a CPI will have a
98
+ * depth of 3, and so on.
99
+ */
100
+ stackHeight: number; // FIXME(https://github.com/anza-xyz/agave/issues/5732) Should be `1` instead of `null` at base of stack
101
+ }>;
102
+
103
+ type InstructionWithData = Readonly<{
104
+ /** The input to the invoked program */
105
+ data: Base58EncodedBytes;
106
+ }>;
107
+
108
+ type TransactionInstruction = InstructionWithData &
109
+ Partial<InstructionWithStackHeight> &
110
+ Readonly<{
111
+ /**
112
+ * An ordered list of indices that indicate which accounts in the transaction message's
113
+ * accounts list are loaded by this instruction.
114
+ */
115
+ accounts: readonly number[];
116
+ /**
117
+ * The index of the address in the transaction message's accounts list associated with the
118
+ * program to invoke.
119
+ */
120
+ programIdIndex: number;
121
+ }>;
122
+
123
+ type TransactionJson = Readonly<{
124
+ message: {
125
+ /** An ordered list of addresses belonging to the accounts loaded by this transaction */
126
+ accountKeys: readonly Address[];
127
+ header: {
128
+ /**
129
+ * The number of read-only accounts in the static accounts list that must sign this
130
+ * transaction.
131
+ *
132
+ * Subtracting this number from `numRequiredSignatures` yields the index of the first
133
+ * read-only signer account in the static accounts list.
134
+ */
135
+ numReadonlySignedAccounts: number;
136
+ /**
137
+ * The number of accounts in the static accounts list that are neither writable nor
138
+ * signers.
139
+ *
140
+ * Adding this number to `numRequiredSignatures` yields the index of the first read-only
141
+ * non-signer account in the static accounts list.
142
+ */
143
+ numReadonlyUnsignedAccounts: number;
144
+ /**
145
+ * The number of accounts in the static accounts list that must sign this transaction.
146
+ *
147
+ * Subtracting `numReadonlySignedAccounts` from this number yields the number of
148
+ * writable signer accounts in the static accounts list. Writable signer accounts always
149
+ * begin at index zero in the static accounts list.
150
+ *
151
+ * This number itself is the index of the first non-signer account in the static
152
+ * accounts list.
153
+ */
154
+ numRequiredSignatures: number;
155
+ };
156
+ instructions: readonly TransactionInstruction[];
157
+ };
158
+ }> &
159
+ TransactionBase;
160
+
161
+ type PartiallyDecodedTransactionInstruction = InstructionWithData &
162
+ Partial<InstructionWithStackHeight> &
163
+ Readonly<{
164
+ /** An ordered list of addresses belonging to the accounts loaded by this instruction */
165
+ accounts: readonly Address[];
166
+ /** The address of the program to invoke */
167
+ programId: Address;
168
+ }>;
169
+
170
+ type ParsedTransactionInstruction = Partial<InstructionWithStackHeight> &
171
+ Readonly<{
172
+ /** The output of the program's instruction parser */
173
+ parsed: {
174
+ /** The instruction, as interpreted the program's instruction parser. */
175
+ info?: object;
176
+ /**
177
+ * A label that indicates the type of the instruction, as determined by the program's
178
+ * instruction parser.
179
+ */
180
+ type: string;
181
+ };
182
+ /** The name of the program. */
183
+ program: string;
184
+ /** The address of the program */
185
+ programId: Address;
186
+ }>;
187
+
188
+ type ParsedAccount = Readonly<{
189
+ /** The address of the account */
190
+ pubkey: Address;
191
+ /** Whether this account is required to sign the transaction that it's a part of */
192
+ signer: boolean;
193
+ /**
194
+ * Indicates whether the account was statically declared in the transaction message or loaded
195
+ * from an address lookup table.
196
+ */
197
+ source: 'lookupTable' | 'transaction';
198
+ /** Whether this account must be loaded with a write-lock */
199
+ writable: boolean;
200
+ }>;
201
+
202
+ type TransactionJsonParsed = Readonly<{
203
+ message: {
204
+ /**
205
+ * An ordered list of parsed accounts belonging to the accounts loaded by this transaction
206
+ */
207
+ accountKeys: readonly ParsedAccount[];
208
+ instructions: readonly (ParsedTransactionInstruction | PartiallyDecodedTransactionInstruction)[];
209
+ };
210
+ }> &
211
+ TransactionBase;
212
+
213
+ type GetTransactionCommonConfig<TMaxSupportedTransactionVersion> = Readonly<{
214
+ /**
215
+ * Fetch the transaction details as of the highest slot that has reached this level of
216
+ * commitment.
217
+ *
218
+ * @defaultValue Whichever default is applied by the underlying {@link RpcApi} in use. For
219
+ * example, when using an API created by a `createSolanaRpc*()` helper, the default commitment
220
+ * is `"confirmed"` unless configured otherwise. Unmitigated by an API layer on the client, the
221
+ * default commitment applied by the server is `"finalized"`.
222
+ */
223
+ commitment?: Commitment;
224
+ /**
225
+ * Determines how the transaction should be encoded in the response.
226
+ *
227
+ * - `'base58'` returns a tuple whose first element is the bytes of the wire transaction as a
228
+ * base58-encoded string.
229
+ * - `'base64'` returns a tuple whose first element is the bytes of the wire transaction as a
230
+ * base64-encoded string.
231
+ * - `'json'` returns structured {@link TransactionJson}
232
+ * - `'jsonParsed'` returns structured {@link TransactionJson} which the server will attempt to
233
+ * further process using account parsers and parsers specific to the transaction instructions'
234
+ * owning program. Whenever an instruction parser is successful, instruction will consist of
235
+ * parsed data as JSON. Otherwise, the instruction will materialize as a list of accounts, a
236
+ * program address, and base64-encoded instruction data.
237
+ */
238
+ encoding: 'base58' | 'base64' | 'json' | 'jsonParsed';
239
+ /**
240
+ * The newest transaction version that the caller wants to receive in the response.
241
+ *
242
+ * When not supplied, only legacy (unversioned) transactions will be returned, and no `version`
243
+ * property will be returned in the response.
244
+ *
245
+ * If a transaction with the supplied signature is found with a version higher than this, the
246
+ * server will throw
247
+ * {@link SolanaErrorCode.SOLANA_ERROR__JSON_RPC__SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION | SOLANA_ERROR__JSON_RPC__SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION}.
248
+ */
249
+ maxSupportedTransactionVersion?: TMaxSupportedTransactionVersion;
250
+ }>;
251
+
252
+ type GetTransactionApiResponseBase = Readonly<{
253
+ /**
254
+ * The estimated production time at which the transaction was processed. `null` if not
255
+ * available.
256
+ */
257
+ blockTime: UnixTimestamp | null;
258
+ /** The slot during which this transaction was processed */
259
+ slot: Slot;
260
+ }>;
261
+
262
+ type TransactionMetaLoadedAddresses = Readonly<{
263
+ /** Addresses loaded from lookup tables */
264
+ loadedAddresses: {
265
+ /** Ordered list of base-58 encoded addresses for read-only accounts */
266
+ readonly: readonly Address[];
267
+ /** Ordered list of base-58 encoded addresses for writable accounts */
268
+ writable: readonly Address[];
269
+ };
270
+ }>;
271
+
272
+ type InnerInstructions<TInstructionType> = Readonly<{
273
+ /** The index of the instruction in the transaction */
274
+ index: number;
275
+ /** The instructions */
276
+ instructions: readonly TInstructionType[];
277
+ }>;
278
+
279
+ type TransactionMetaInnerInstructionsNotParsed = Readonly<{
280
+ /** A list of instructions called by programs via cross-program invocation (CPI) */
281
+ innerInstructions?: readonly InnerInstructions<TransactionInstruction>[] | null;
282
+ }>;
283
+
284
+ type TransactionMetaInnerInstructionsParsed = Readonly<{
285
+ /** A list of instructions called by programs via cross-program invocation (CPI) */
286
+ innerInstructions?:
287
+ | readonly InnerInstructions<ParsedTransactionInstruction | PartiallyDecodedTransactionInstruction>[]
288
+ | null;
289
+ }>;
290
+
291
+ type TransactionAddressTableLookups = Readonly<{
292
+ message: Readonly<{
293
+ /** A list of address tables and the accounts that this transaction loads from them */
294
+ addressTableLookups: readonly AddressTableLookup[];
295
+ }>;
296
+ }>;
297
+
298
+ export type GetTransactionApi = {
299
+ /**
300
+ * Returns details of the confirmed transaction identified by the given signature.
301
+ *
302
+ * @param signature A 64 byte Ed25519 signature, encoded as a base-58 string, that uniquely
303
+ * identifies a transaction by virtue of being the first or only signature in its list of
304
+ * signatures.
305
+ *
306
+ * Materializes the transaction as structured {@link TransactionJson} which the server will
307
+ * attempt to further process using account parsers and parsers specific to the transaction
308
+ * instructions' owning program. Whenever an instruction parser is successful, instruction will
309
+ * consist of parsed data as JSON. Otherwise, the instruction will materialize as a list of
310
+ * accounts, a program address, and base64-encoded instruction data.
311
+ *
312
+ * {@label parsed}
313
+ * @see https://solana.com/docs/rpc/http/gettransaction
314
+ */
315
+ getTransaction<TMaxSupportedTransactionVersion extends TransactionVersion | void = void>(
316
+ signature: Signature,
317
+ config: GetTransactionCommonConfig<TMaxSupportedTransactionVersion> &
318
+ Readonly<{
319
+ encoding: 'jsonParsed';
320
+ }>,
321
+ ):
322
+ | (GetTransactionApiResponseBase &
323
+ (TMaxSupportedTransactionVersion extends void
324
+ ? Record<string, never>
325
+ : { version: TransactionVersion }) & {
326
+ meta: (TransactionMetaBase & TransactionMetaInnerInstructionsParsed) | null;
327
+ transaction: TransactionJsonParsed &
328
+ (TMaxSupportedTransactionVersion extends void
329
+ ? Record<string, never>
330
+ : TransactionAddressTableLookups);
331
+ })
332
+ | null;
333
+ /**
334
+ * Returns details of the confirmed transaction identified by the given signature.
335
+ *
336
+ * @param signature A 64 byte Ed25519 signature, encoded as a base-58 string, that uniquely
337
+ * identifies a transaction by virtue of being the first or only signature in its list of
338
+ * signatures.
339
+ *
340
+ * Materializes the transaction as a tuple whose first element is the bytes of the wire
341
+ * transaction as a base64-encoded string.
342
+ *
343
+ * {@label base64}
344
+ * @see https://solana.com/docs/rpc/http/gettransaction
345
+ */
346
+ getTransaction<TMaxSupportedTransactionVersion extends TransactionVersion | void = void>(
347
+ signature: Signature,
348
+ config: GetTransactionCommonConfig<TMaxSupportedTransactionVersion> &
349
+ Readonly<{
350
+ encoding: 'base64';
351
+ }>,
352
+ ):
353
+ | (GetTransactionApiResponseBase &
354
+ (TMaxSupportedTransactionVersion extends void
355
+ ? Record<string, never>
356
+ : { version: TransactionVersion }) & {
357
+ meta:
358
+ | (TransactionMetaBase &
359
+ TransactionMetaInnerInstructionsNotParsed &
360
+ (TMaxSupportedTransactionVersion extends void
361
+ ? Record<string, never>
362
+ : TransactionMetaLoadedAddresses))
363
+ | null;
364
+ transaction: Base64EncodedDataResponse;
365
+ })
366
+ | null;
367
+ /**
368
+ * Returns details of the confirmed transaction identified by the given signature.
369
+ *
370
+ * @param signature A 64 byte Ed25519 signature, encoded as a base-58 string, that uniquely
371
+ * identifies a transaction by virtue of being the first or only signature in its list of
372
+ * signatures.
373
+ *
374
+ * Materializes the transaction as a tuple whose first element is the bytes of the wire
375
+ * transaction as a base58-encoded string.
376
+ *
377
+ * {@label base58}
378
+ * @see https://solana.com/docs/rpc/http/gettransaction
379
+ */
380
+ getTransaction<TMaxSupportedTransactionVersion extends TransactionVersion | void = void>(
381
+ signature: Signature,
382
+ config: GetTransactionCommonConfig<TMaxSupportedTransactionVersion> &
383
+ Readonly<{
384
+ encoding: 'base58';
385
+ }>,
386
+ ):
387
+ | (GetTransactionApiResponseBase &
388
+ (TMaxSupportedTransactionVersion extends void
389
+ ? Record<string, never>
390
+ : { version: TransactionVersion }) & {
391
+ meta:
392
+ | (TransactionMetaBase &
393
+ TransactionMetaInnerInstructionsNotParsed &
394
+ (TMaxSupportedTransactionVersion extends void
395
+ ? Record<string, never>
396
+ : TransactionMetaLoadedAddresses))
397
+ | null;
398
+ transaction: Base58EncodedDataResponse;
399
+ })
400
+ | null;
401
+ /**
402
+ * Returns details of the confirmed transaction identified by the given signature.
403
+ *
404
+ * @param signature A 64 byte Ed25519 signature, encoded as a base-58 string, that uniquely
405
+ * identifies a transaction by virtue of being the first or only signature in its list of
406
+ * signatures.
407
+ *
408
+ * Materializes the transaction as structured {@link TransactionJson}.
409
+ *
410
+ * {@label json}
411
+ * @see https://solana.com/docs/rpc/http/gettransaction
412
+ */
413
+ getTransaction<TMaxSupportedTransactionVersion extends TransactionVersion | void = void>(
414
+ signature: Signature,
415
+ config?: GetTransactionCommonConfig<TMaxSupportedTransactionVersion> &
416
+ Readonly<{
417
+ encoding?: 'json';
418
+ }>,
419
+ ):
420
+ | (GetTransactionApiResponseBase &
421
+ (TMaxSupportedTransactionVersion extends void
422
+ ? Record<string, never>
423
+ : { version: TransactionVersion }) & {
424
+ meta:
425
+ | (TransactionMetaBase &
426
+ TransactionMetaInnerInstructionsNotParsed &
427
+ (TMaxSupportedTransactionVersion extends void
428
+ ? Record<string, never>
429
+ : TransactionMetaLoadedAddresses))
430
+ | null;
431
+ transaction: TransactionJson &
432
+ (TMaxSupportedTransactionVersion extends void
433
+ ? Record<string, never>
434
+ : TransactionAddressTableLookups);
435
+ })
436
+ | null;
437
+ };
@@ -0,0 +1,30 @@
1
+ import type { Commitment, Slot } from '@solana/rpc-types';
2
+
3
+ type GetTransactionCountApiResponse = bigint;
4
+
5
+ export type GetTransactionCountApi = {
6
+ /**
7
+ * Returns the current number of transactions to have achieved a given level of commitment.
8
+ *
9
+ * @see https://solana.com/docs/rpc/http/gettransactioncount
10
+ */
11
+ getTransactionCount(
12
+ config?: Readonly<{
13
+ /**
14
+ * Fetch the transaction count as of the highest slot that has reached this level of
15
+ * commitment.
16
+ *
17
+ * @defaultValue Whichever default is applied by the underlying {@link RpcApi} in use.
18
+ * For example, when using an API created by a `createSolanaRpc*()` helper, the default
19
+ * commitment is `"confirmed"` unless configured otherwise. Unmitigated by an API layer
20
+ * on the client, the default commitment applied by the server is `"finalized"`.
21
+ */
22
+ commitment?: Commitment;
23
+ /**
24
+ * Prevents accessing stale data by enforcing that the RPC node has processed
25
+ * transactions up to this slot
26
+ */
27
+ minContextSlot?: Slot;
28
+ }>,
29
+ ): GetTransactionCountApiResponse;
30
+ };
@@ -0,0 +1,21 @@
1
+ type GetVersionApiResponse = Readonly<{
2
+ /**
3
+ * The unique identifier of the node's feature set.
4
+ *
5
+ * This value is computed by sorting all feature addresses' byte arrays lexicographically,
6
+ * hashing them, then taking the first 4 bytes of the result. This keeps the feature set value
7
+ * stable across versions until a new feature is introduced.
8
+ */
9
+ 'feature-set': number; // `u32`
10
+ /** Software version of the node */
11
+ 'solana-core': string;
12
+ }>;
13
+
14
+ export type GetVersionApi = {
15
+ /**
16
+ * Returns the current Solana version running on the node.
17
+ *
18
+ * @see https://solana.com/docs/rpc/http/getversion
19
+ */
20
+ getVersion(): GetVersionApiResponse;
21
+ };
@@ -0,0 +1,80 @@
1
+ import type { Address } from '@solana/addresses';
2
+ import type { Commitment, Epoch, Slot } from '@solana/rpc-types';
3
+
4
+ type Credits = bigint;
5
+ type PreviousCredits = bigint;
6
+
7
+ type EpochCredit = [Epoch, Credits, PreviousCredits];
8
+
9
+ type VoteAccount<TVotePubkey extends Address> = Readonly<{
10
+ /**
11
+ * The amount of stake, in {@link Lamports}, delegated to this vote account and active in this
12
+ * epoch.
13
+ */
14
+ activatedStake: bigint;
15
+ /** The percentage of rewards payout owed to the vote account */
16
+ commission: number;
17
+ /** Latest history of earned credits for up to five epochs */
18
+ epochCredits: readonly EpochCredit[];
19
+ /** Whether the vote account is staked for this epoch */
20
+ epochVoteAccount: boolean;
21
+ /** Most recent slot voted on by this vote account */
22
+ lastVote: bigint;
23
+ /** Validator identity */
24
+ nodePubkey: Address;
25
+ /** Current root slot for this vote account */
26
+ rootSlot: Slot;
27
+ /** Vote account address */
28
+ votePubkey: TVotePubkey;
29
+ }>;
30
+
31
+ type GetVoteAccountsApiResponse<TVotePubkey extends Address> = Readonly<{
32
+ /** Vote accounts belonging to validators which are keeping pace with the tip of the chain */
33
+ current: readonly VoteAccount<TVotePubkey>[];
34
+ /** Vote accounts belonging to validators which have fallen behind the tip of the chain */
35
+ delinquent: readonly VoteAccount<TVotePubkey>[];
36
+ }>;
37
+
38
+ type GetVoteAccountsConfig<TVoteAddress extends Address> = Readonly<{
39
+ /**
40
+ * Fetch the details of the vote accounts as of the highest slot that has reached this level of
41
+ * commitment.
42
+ *
43
+ * @defaultValue Whichever default is applied by the underlying {@link RpcApi} in use. For
44
+ * example, when using an API created by a `createSolanaRpc*()` helper, the default commitment
45
+ * is `"confirmed"` unless configured otherwise. Unmitigated by an API layer on the client, the
46
+ * default commitment applied by the server is `"finalized"`.
47
+ */
48
+ commitment?: Commitment;
49
+ /**
50
+ * Specify the number of slots behind the tip that a validator must fall to be considered
51
+ * delinquent.
52
+ *
53
+ * For the sake of consistency between ecosystem products, _it is recommended that this argument
54
+ * be **omitted**._
55
+ *
56
+ * @defaultValue `128n`
57
+ */
58
+ delinquentSlotDistance?: bigint;
59
+ /**
60
+ * Return delinquent validators (ie. validators who are behind the tip of the chain by the
61
+ * number of slots specified by `delinquentSlotDistance`), even if they are unstaked
62
+ *
63
+ * @defaultValue `false`
64
+ */
65
+ keepUnstakedDelinquents?: boolean;
66
+ /** Only return results for the validator with this vote account address */
67
+ votePubkey?: TVoteAddress;
68
+ }>;
69
+
70
+ export type GetVoteAccountsApi = {
71
+ /**
72
+ * Returns the account info and associated stake for all the voting accounts in the current
73
+ * bank.
74
+ *
75
+ * @see https://solana.com/docs/rpc/http/getvoteaccounts
76
+ */
77
+ getVoteAccounts<TVoteAccount extends Address>(
78
+ config?: GetVoteAccountsConfig<TVoteAccount>,
79
+ ): GetVoteAccountsApiResponse<TVoteAccount>;
80
+ };