@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,552 @@
1
+ import type {
2
+ Base58EncodedBytes,
3
+ Blockhash,
4
+ Commitment,
5
+ Reward,
6
+ Slot,
7
+ TransactionForAccounts,
8
+ TransactionForFullBase58,
9
+ TransactionForFullBase64,
10
+ TransactionForFullJson,
11
+ TransactionForFullJsonParsed,
12
+ UnixTimestamp,
13
+ } from '@solana/rpc-types';
14
+ import type { TransactionVersion } from '@solana/transaction-messages';
15
+
16
+ // API response types
17
+
18
+ type GetBlockApiResponseBase = Readonly<{
19
+ /** The number of blocks beneath this block */
20
+ blockHeight: bigint;
21
+ /** Estimated production time, as Unix timestamp */
22
+ blockTime: UnixTimestamp;
23
+ /** the blockhash of this block */
24
+ blockhash: Blockhash;
25
+ /** The slot index of this block's parent */
26
+ parentSlot: Slot;
27
+ /** The blockhash of this block's parent */
28
+ previousBlockhash: Blockhash;
29
+ }>;
30
+
31
+ type GetBlockApiResponseWithRewards = Readonly<{
32
+ /** Block-level rewards */
33
+ rewards: readonly Reward[];
34
+ }>;
35
+
36
+ type GetBlockApiResponseWithSignatures = Readonly<{
37
+ /** List of signatures applied to transactions in this block */
38
+ signatures: readonly Base58EncodedBytes[];
39
+ }>;
40
+
41
+ type GetBlockApiResponseWithTransactions<TTransaction> = Readonly<{
42
+ transactions: readonly TTransaction[];
43
+ }>;
44
+
45
+ // API parameter types
46
+
47
+ type GetBlockCommonConfig = Readonly<{
48
+ /**
49
+ * Fetch blocks from slots that have reached at least this level of commitment.
50
+ *
51
+ * @defaultValue Whichever default is applied by the underlying {@link RpcApi} in use. For
52
+ * example, when using an API created by a `createSolanaRpc*()` helper, the default commitment
53
+ * is `"confirmed"` unless configured otherwise. Unmitigated by an API layer on the client, the
54
+ * default commitment applied by the server is `"finalized"`.
55
+ */
56
+ commitment?: Omit<Commitment, 'processed'>;
57
+ /**
58
+ * Determines how the transaction property should be encoded in the response.
59
+ *
60
+ * - `'base58'` produces a tuple whose first element is the wire transaction as a base58-encoded
61
+ * string.
62
+ * - `'base64'` produces a tuple whose first element is the wire transaction as a base64-encoded
63
+ * string.
64
+ * - `'json'` produces an object with `message` and `signatures` properties. The `instructions`
65
+ * property of the message is an array of instructions, each an object containing the indices
66
+ * of the instruction's accounts, the instruction data, the index of the program address, and
67
+ * optionally the stack height if it is an inner instruction.
68
+ * - `'jsonParsed'` produces an object with `message` and `signatures` properties. This property
69
+ * will cause the server to attempt to process each instruction using a parser specific to its
70
+ * program. If successful, the parsed instruction will be returned in the response as JSON.
71
+ * Otherwise, each instruction will be returned according to the rules of `'json'` encoding.
72
+ *
73
+ * @defaultValue "json"
74
+ */
75
+ encoding?: GetBlockEncoding;
76
+ /**
77
+ * The newest transaction version that the caller wants to receive in the response. This
78
+ * argument has no effect unless the {@link GetBlockCommonConfig.transactionDetails | transactionDetails}
79
+ * argument is set to `'accounts'` or `'full'`.
80
+ *
81
+ * When not supplied, only legacy (unversioned) transactions will be returned, and no `version`
82
+ * property will be returned in the response.
83
+ *
84
+ * If a block contains any transaction at a version higher than this, the server will throw
85
+ * {@link SolanaErrorCode.SOLANA_ERROR__JSON_RPC__SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION | SOLANA_ERROR__JSON_RPC__SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION}.
86
+ */
87
+ maxSupportedTransactionVersion?: GetBlockMaxSupportedTransactionVersion;
88
+ /**
89
+ * Set this to `false` to omit block rewards from the response. These typically only
90
+ * materialize on the first block of an epoch.
91
+ * @defaultValue true
92
+ */
93
+ rewards?: boolean;
94
+ /**
95
+ * The level of transaction detail to include in the response.
96
+ *
97
+ * - `'accounts'` includes signatures, an annotated list of accounts, and some transaction
98
+ * metadata.
99
+ * - `'full'` includes the entire transaction message and its signatures.
100
+ * - `'none'` excludes transaction details completely.
101
+ * - `'signatures'` includes transaction signatures only.
102
+ *
103
+ * @defaultValue "full"
104
+ */
105
+ transactionDetails?: GetBlockTransactionDetailsMode;
106
+ }>;
107
+
108
+ type GetBlockEncoding = 'base58' | 'base64' | 'json' | 'jsonParsed';
109
+ type GetBlockTransactionDetailsMode = 'accounts' | 'full' | 'none' | 'signatures';
110
+
111
+ type GetBlockMaxSupportedTransactionVersion = Exclude<TransactionVersion, 'legacy'>;
112
+
113
+ export type GetBlockApi = {
114
+ /**
115
+ * Returns identity and transaction information about a confirmed block in the ledger
116
+ *
117
+ * {@label transactions-none--rewards-none}
118
+ * @see https://solana.com/docs/rpc/http/getblock
119
+ */
120
+ getBlock(
121
+ slot: Slot,
122
+ // transactionDetails=none, rewards=false, encoding + maxSupportedTransactionVersion irrelevant
123
+ config: GetBlockCommonConfig &
124
+ Readonly<{
125
+ rewards: false;
126
+ transactionDetails: 'none';
127
+ }>,
128
+ ): GetBlockApiResponseBase | null;
129
+ /**
130
+ * Returns identity and transaction information about a confirmed block in the ledger
131
+ *
132
+ * {@label transactions-none--rewards-included}
133
+ * @see https://solana.com/docs/rpc/http/getblock
134
+ */
135
+ getBlock(
136
+ slot: Slot,
137
+ // transactionDetails=none, rewards=missing/true, encoding + maxSupportedTransactionVersion irrelevant
138
+ config: GetBlockCommonConfig &
139
+ Readonly<{
140
+ rewards?: true;
141
+ transactionDetails: 'none';
142
+ }>,
143
+ ): (GetBlockApiResponseBase & GetBlockApiResponseWithRewards) | null;
144
+ /**
145
+ * Returns identity and transaction information about a confirmed block in the ledger
146
+ *
147
+ * {@label transactions-signatures--rewards-none}
148
+ * @see https://solana.com/docs/rpc/http/getblock
149
+ */
150
+ getBlock(
151
+ slot: Slot,
152
+ // transactionDetails=signatures, rewards=false, encoding + maxSupportedTransactionVersion irrelevant
153
+ config: GetBlockCommonConfig &
154
+ Readonly<{
155
+ rewards: false;
156
+ transactionDetails: 'signatures';
157
+ }>,
158
+ ): (GetBlockApiResponseBase & GetBlockApiResponseWithSignatures) | null;
159
+ /**
160
+ * Returns identity and transaction information about a confirmed block in the ledger
161
+ *
162
+ * {@label transactions-signatures--rewards-included}
163
+ * @see https://solana.com/docs/rpc/http/getblock
164
+ */
165
+ getBlock(
166
+ slot: Slot,
167
+ // transactionDetails=signatures, rewards=missing/true, encoding + maxSupportedTransactionVersion irrelevant
168
+ config: GetBlockCommonConfig &
169
+ Readonly<{
170
+ rewards?: true;
171
+ transactionDetails: 'signatures';
172
+ }>,
173
+ ): (GetBlockApiResponseBase & GetBlockApiResponseWithRewards & GetBlockApiResponseWithSignatures) | null;
174
+ /**
175
+ * Returns identity and transaction information about a confirmed block in the ledger
176
+ *
177
+ * {@label transactions-accounts--rewards-none--version-specified}
178
+ * @see https://solana.com/docs/rpc/http/getblock
179
+ */
180
+ getBlock(
181
+ slot: Slot,
182
+ // transactionDetails=accounts, rewards=false, maxSupportedTransactionVersion=0, encoding irrelevant
183
+ config: GetBlockCommonConfig &
184
+ Readonly<{
185
+ maxSupportedTransactionVersion: GetBlockMaxSupportedTransactionVersion;
186
+ rewards: false;
187
+ transactionDetails: 'accounts';
188
+ }>,
189
+ ):
190
+ | (GetBlockApiResponseBase &
191
+ GetBlockApiResponseWithTransactions<TransactionForAccounts<GetBlockMaxSupportedTransactionVersion>>)
192
+ | null;
193
+ /**
194
+ * Returns identity and transaction information about a confirmed block in the ledger
195
+ *
196
+ * {@label transactions-accounts--rewards-none--version-legacy}
197
+ * @see https://solana.com/docs/rpc/http/getblock
198
+ */
199
+ getBlock(
200
+ slot: Slot,
201
+ // transactionDetails=accounts, rewards=false, maxSupportedTransactionVersion=missing, encoding irrelevant
202
+ config: Omit<GetBlockCommonConfig, 'maxSupportedTransactionVersion'> &
203
+ Readonly<{
204
+ rewards: false;
205
+ transactionDetails: 'accounts';
206
+ }>,
207
+ ): (GetBlockApiResponseBase & GetBlockApiResponseWithTransactions<TransactionForAccounts<void>>) | null;
208
+ /**
209
+ * Returns identity and transaction information about a confirmed block in the ledger
210
+ *
211
+ * {@label transactions-accounts--rewards-included--version-specified}
212
+ * @see https://solana.com/docs/rpc/http/getblock
213
+ */
214
+ getBlock(
215
+ slot: Slot,
216
+ // transactionDetails=accounts, rewards=missing/true, maxSupportedTransactionVersion=0, encoding irrelevant
217
+ config: GetBlockCommonConfig &
218
+ Readonly<{
219
+ maxSupportedTransactionVersion: GetBlockMaxSupportedTransactionVersion;
220
+ rewards?: true;
221
+ transactionDetails: 'accounts';
222
+ }>,
223
+ ):
224
+ | (GetBlockApiResponseBase &
225
+ GetBlockApiResponseWithRewards &
226
+ GetBlockApiResponseWithTransactions<TransactionForAccounts<GetBlockMaxSupportedTransactionVersion>>)
227
+ | null;
228
+ /**
229
+ * Returns identity and transaction information about a confirmed block in the ledger
230
+ *
231
+ * {@label transactions-accounts--rewards-included--version-legacy}
232
+ * @see https://solana.com/docs/rpc/http/getblock
233
+ */
234
+ getBlock(
235
+ slot: Slot,
236
+ // transactionDetails=accounts, rewards=missing/true, maxSupportedTransactionVersion=missing, encoding irrelevant
237
+ config: Omit<GetBlockCommonConfig, 'maxSupportedTransactionVersion'> &
238
+ Readonly<{
239
+ rewards?: true;
240
+ transactionDetails: 'accounts';
241
+ }>,
242
+ ):
243
+ | (GetBlockApiResponseBase &
244
+ GetBlockApiResponseWithRewards &
245
+ GetBlockApiResponseWithTransactions<TransactionForAccounts<void>>)
246
+ | null;
247
+ /**
248
+ * Returns identity and transaction information about a confirmed block in the ledger
249
+ *
250
+ * {@label transactions-base58--rewards-none--version-specified}
251
+ * @see https://solana.com/docs/rpc/http/getblock
252
+ */
253
+ getBlock(
254
+ slot: Slot,
255
+ // transactionDetails=full (default), encoding=base58, rewards=false, maxSupportedTransactionVersion=0
256
+ config: GetBlockCommonConfig &
257
+ Readonly<{
258
+ encoding: 'base58';
259
+ maxSupportedTransactionVersion: GetBlockMaxSupportedTransactionVersion;
260
+ rewards: false;
261
+ transactionDetails?: 'full';
262
+ }>,
263
+ ):
264
+ | (GetBlockApiResponseBase &
265
+ GetBlockApiResponseWithTransactions<TransactionForFullBase58<GetBlockMaxSupportedTransactionVersion>>)
266
+ | null;
267
+ /**
268
+ * Returns identity and transaction information about a confirmed block in the ledger
269
+ *
270
+ * {@label transactions-base58--rewards-none--version-legacy}
271
+ * @see https://solana.com/docs/rpc/http/getblock
272
+ */
273
+ getBlock(
274
+ slot: Slot,
275
+ // transactionDetails=full (default), encoding=base58, rewards=false, maxSupportedTransactionVersion=missing
276
+ config: Omit<GetBlockCommonConfig, 'maxSupportedTransactionVersion'> &
277
+ Readonly<{
278
+ encoding: 'base58';
279
+ rewards: false;
280
+ transactionDetails?: 'full';
281
+ }>,
282
+ ): (GetBlockApiResponseBase & GetBlockApiResponseWithTransactions<TransactionForFullBase58<void>>) | null;
283
+ /**
284
+ * Returns identity and transaction information about a confirmed block in the ledger
285
+ *
286
+ * {@label transactions-base58--rewards-included--version-specified}
287
+ * @see https://solana.com/docs/rpc/http/getblock
288
+ */
289
+ getBlock(
290
+ slot: Slot,
291
+ // transactionDetails=full (default), encoding=base58, rewards=missing/true, maxSupportedTransactionVersion=0
292
+ config: GetBlockCommonConfig &
293
+ Readonly<{
294
+ encoding: 'base58';
295
+ maxSupportedTransactionVersion: GetBlockMaxSupportedTransactionVersion;
296
+ rewards?: true;
297
+ transactionDetails?: 'full';
298
+ }>,
299
+ ):
300
+ | (GetBlockApiResponseBase &
301
+ GetBlockApiResponseWithRewards &
302
+ GetBlockApiResponseWithTransactions<TransactionForFullBase58<GetBlockMaxSupportedTransactionVersion>>)
303
+ | null;
304
+ /**
305
+ * Returns identity and transaction information about a confirmed block in the ledger
306
+ *
307
+ * {@label transactions-base58--rewards-included--version-legacy}
308
+ * @see https://solana.com/docs/rpc/http/getblock
309
+ */
310
+ getBlock(
311
+ slot: Slot,
312
+ // transactionDetails=full (default), encoding=base58, rewards=missing/true, maxSupportedTransactionVersion=missing
313
+ config: Omit<GetBlockCommonConfig, 'maxSupportedTransactionVersion'> &
314
+ Readonly<{
315
+ encoding: 'base58';
316
+ rewards?: true;
317
+ transactionDetails?: 'full';
318
+ }>,
319
+ ):
320
+ | (GetBlockApiResponseBase &
321
+ GetBlockApiResponseWithRewards &
322
+ GetBlockApiResponseWithTransactions<TransactionForFullBase58<void>>)
323
+ | null;
324
+ /**
325
+ * Returns identity and transaction information about a confirmed block in the ledger
326
+ *
327
+ * {@label transactions-base64--rewards-none--version-specified}
328
+ * @see https://solana.com/docs/rpc/http/getblock
329
+ */
330
+ getBlock(
331
+ slot: Slot,
332
+ // transactionDetails=full (default), encoding=base64, rewards=false, maxSupportedTransactionVersion=0
333
+ config: GetBlockCommonConfig &
334
+ Readonly<{
335
+ encoding: 'base64';
336
+ maxSupportedTransactionVersion: GetBlockMaxSupportedTransactionVersion;
337
+ rewards: false;
338
+ transactionDetails?: 'full';
339
+ }>,
340
+ ):
341
+ | (GetBlockApiResponseBase &
342
+ GetBlockApiResponseWithTransactions<TransactionForFullBase64<GetBlockMaxSupportedTransactionVersion>>)
343
+ | null;
344
+ /**
345
+ * Returns identity and transaction information about a confirmed block in the ledger
346
+ *
347
+ * {@label transactions-base64--rewards-none--version-legacy}
348
+ * @see https://solana.com/docs/rpc/http/getblock
349
+ */
350
+ getBlock(
351
+ slot: Slot,
352
+ // transactionDetails=full (default), encoding=base64, rewards=false, maxSupportedTransactionVersion=missing
353
+ config: Omit<GetBlockCommonConfig, 'maxSupportedTransactionVersion'> &
354
+ Readonly<{
355
+ encoding: 'base64';
356
+ rewards: false;
357
+ transactionDetails?: 'full';
358
+ }>,
359
+ ): (GetBlockApiResponseBase & GetBlockApiResponseWithTransactions<TransactionForFullBase64<void>>) | null;
360
+ /**
361
+ * Returns identity and transaction information about a confirmed block in the ledger
362
+ *
363
+ * {@label transactions-base64--rewards-included--version-specified}
364
+ * @see https://solana.com/docs/rpc/http/getblock
365
+ */
366
+ getBlock(
367
+ slot: Slot,
368
+ // transactionDetails=full (default), encoding=base64, rewards=missing/true, maxSupportedTransactionVersion=0
369
+ config: GetBlockCommonConfig &
370
+ Readonly<{
371
+ encoding: 'base64';
372
+ maxSupportedTransactionVersion: GetBlockMaxSupportedTransactionVersion;
373
+ rewards?: true;
374
+ transactionDetails?: 'full';
375
+ }>,
376
+ ):
377
+ | (GetBlockApiResponseBase &
378
+ GetBlockApiResponseWithRewards &
379
+ GetBlockApiResponseWithTransactions<TransactionForFullBase64<GetBlockMaxSupportedTransactionVersion>>)
380
+ | null;
381
+ /**
382
+ * Returns identity and transaction information about a confirmed block in the ledger
383
+ *
384
+ * {@label transactions-base64--rewards-included--version-legacy}
385
+ * @see https://solana.com/docs/rpc/http/getblock
386
+ */
387
+ getBlock(
388
+ slot: Slot,
389
+ // transactionDetails=full (default), encoding=base64, rewards=missing/true, maxSupportedTransactionVersion=missing
390
+ config: Omit<GetBlockCommonConfig, 'maxSupportedTransactionVersion'> &
391
+ Readonly<{
392
+ encoding: 'base64';
393
+ rewards?: true;
394
+ transactionDetails?: 'full';
395
+ }>,
396
+ ):
397
+ | (GetBlockApiResponseBase &
398
+ GetBlockApiResponseWithRewards &
399
+ GetBlockApiResponseWithTransactions<TransactionForFullBase64<void>>)
400
+ | null;
401
+ /**
402
+ * Returns identity and transaction information about a confirmed block in the ledger
403
+ *
404
+ * {@label transactions-parsed--rewards-none--version-specified}
405
+ * @see https://solana.com/docs/rpc/http/getblock
406
+ */
407
+ getBlock(
408
+ slot: Slot,
409
+ // transactionDetails=full (default), encoding=jsonParsed, rewards=false, maxSupportedTransactionVersion=0
410
+ config: GetBlockCommonConfig &
411
+ Readonly<{
412
+ encoding: 'jsonParsed';
413
+ maxSupportedTransactionVersion: GetBlockMaxSupportedTransactionVersion;
414
+ rewards: false;
415
+ transactionDetails?: 'full';
416
+ }>,
417
+ ):
418
+ | (GetBlockApiResponseBase &
419
+ GetBlockApiResponseWithTransactions<TransactionForFullJsonParsed<GetBlockMaxSupportedTransactionVersion>>)
420
+ | null;
421
+ /**
422
+ * Returns identity and transaction information about a confirmed block in the ledger
423
+ *
424
+ * {@label transactions-parsed--rewards-none--version-legacy}
425
+ * @see https://solana.com/docs/rpc/http/getblock
426
+ */
427
+ getBlock(
428
+ slot: Slot,
429
+ // transactionDetails=full (default), encoding=jsonParsed, rewards=false, maxSupportedTransactionVersion=missing
430
+ config: Omit<GetBlockCommonConfig, 'maxSupportedTransactionVersion'> &
431
+ Readonly<{
432
+ encoding: 'jsonParsed';
433
+ rewards: false;
434
+ transactionDetails?: 'full';
435
+ }>,
436
+ ): (GetBlockApiResponseBase & GetBlockApiResponseWithTransactions<TransactionForFullJsonParsed<void>>) | null;
437
+ /**
438
+ * Returns identity and transaction information about a confirmed block in the ledger
439
+ *
440
+ * {@label transactions-parsed--rewards-included--version-specified}
441
+ * @see https://solana.com/docs/rpc/http/getblock
442
+ */
443
+ getBlock(
444
+ slot: Slot,
445
+ // transactionDetails=full (default), encoding=jsonParsed, rewards=missing/true, maxSupportedTransactionVersion=0
446
+ config: GetBlockCommonConfig &
447
+ Readonly<{
448
+ encoding: 'jsonParsed';
449
+ maxSupportedTransactionVersion: GetBlockMaxSupportedTransactionVersion;
450
+ transactionDetails?: 'full';
451
+ }>,
452
+ ):
453
+ | (GetBlockApiResponseBase &
454
+ GetBlockApiResponseWithRewards &
455
+ GetBlockApiResponseWithTransactions<TransactionForFullJsonParsed<GetBlockMaxSupportedTransactionVersion>>)
456
+ | null;
457
+ /**
458
+ * Returns identity and transaction information about a confirmed block in the ledger
459
+ *
460
+ * {@label transactions-parsed--rewards-included--version-legacy}
461
+ * @see https://solana.com/docs/rpc/http/getblock
462
+ */
463
+ getBlock(
464
+ slot: Slot,
465
+ // transactionDetails=full (default), encoding=jsonParsed, rewards=missing/true, maxSupportedTransactionVersion=missing
466
+ config: Omit<GetBlockCommonConfig, 'maxSupportedTransactionVersion'> &
467
+ Readonly<{
468
+ encoding: 'jsonParsed';
469
+ rewards?: boolean;
470
+ transactionDetails?: 'full';
471
+ }>,
472
+ ):
473
+ | (GetBlockApiResponseBase &
474
+ GetBlockApiResponseWithRewards &
475
+ GetBlockApiResponseWithTransactions<TransactionForFullJsonParsed<void>>)
476
+ | null;
477
+ /**
478
+ * Returns identity and transaction information about a confirmed block in the ledger
479
+ *
480
+ * {@label transactions-json--rewards-none--version-specified}
481
+ * @see https://solana.com/docs/rpc/http/getblock
482
+ */
483
+ getBlock(
484
+ slot: Slot,
485
+ // transactionDetails=full (default), encoding=json (default), rewards=false, maxSupportedTransactionVersion=0
486
+ config: GetBlockCommonConfig &
487
+ Readonly<{
488
+ encoding?: 'json';
489
+ maxSupportedTransactionVersion: GetBlockMaxSupportedTransactionVersion;
490
+ rewards: false;
491
+ transactionDetails?: 'full';
492
+ }>,
493
+ ):
494
+ | (GetBlockApiResponseBase &
495
+ GetBlockApiResponseWithTransactions<TransactionForFullJson<GetBlockMaxSupportedTransactionVersion>>)
496
+ | null;
497
+ /**
498
+ * Returns identity and transaction information about a confirmed block in the ledger
499
+ *
500
+ * {@label transactions-json--rewards-none--version-legacy}
501
+ * @see https://solana.com/docs/rpc/http/getblock
502
+ */
503
+ getBlock(
504
+ slot: Slot,
505
+ // transactionDetails=full (default), encoding=json (default), rewards=false, maxSupportedTransactionVersion=missing
506
+ config: Omit<GetBlockCommonConfig, 'maxSupportedTransactionVersion'> &
507
+ Readonly<{
508
+ encoding?: 'json';
509
+ rewards: false;
510
+ transactionDetails?: 'full';
511
+ }>,
512
+ ): (GetBlockApiResponseBase & GetBlockApiResponseWithTransactions<TransactionForFullJson<void>>) | null;
513
+ /**
514
+ * Returns identity and transaction information about a confirmed block in the ledger
515
+ *
516
+ * {@label transactions-json--rewards-included--version-specified}
517
+ * @see https://solana.com/docs/rpc/http/getblock
518
+ */
519
+ getBlock(
520
+ slot: Slot,
521
+ // transactionDetails=full (default), encoding=json (default), rewards=missing/true, maxSupportedTransactionVersion=0
522
+ config: GetBlockCommonConfig &
523
+ Readonly<{
524
+ encoding?: 'json';
525
+ maxSupportedTransactionVersion: GetBlockMaxSupportedTransactionVersion;
526
+ transactionDetails?: 'full';
527
+ }>,
528
+ ):
529
+ | (GetBlockApiResponseBase &
530
+ GetBlockApiResponseWithRewards &
531
+ GetBlockApiResponseWithTransactions<TransactionForFullJson<GetBlockMaxSupportedTransactionVersion>>)
532
+ | null;
533
+ /**
534
+ * Returns identity and transaction information about a confirmed block in the ledger
535
+ *
536
+ * {@label transactions-json--rewards-included--version-legacy}
537
+ * @see https://solana.com/docs/rpc/http/getblock
538
+ */
539
+ getBlock(
540
+ slot: Slot,
541
+ // transactionDetails=full (default), encoding=json (default), rewards=missing/true, maxSupportedTransactionVersion=missing
542
+ config?: Omit<GetBlockCommonConfig, 'maxSupportedTransactionVersion'> &
543
+ Readonly<{
544
+ encoding?: 'json';
545
+ transactionDetails?: 'full';
546
+ }>,
547
+ ):
548
+ | (GetBlockApiResponseBase &
549
+ GetBlockApiResponseWithRewards &
550
+ GetBlockApiResponseWithTransactions<TransactionForFullJson<void>>)
551
+ | null;
552
+ };
@@ -0,0 +1,20 @@
1
+ import type { Lamports, Slot } from '@solana/rpc-types';
2
+
3
+ type GetBlockCommitmentApiResponse = Readonly<{
4
+ /**
5
+ * An array that represents the amount of cluster stake, denominated in {@link Lamports}, that
6
+ * has voted on the block at each depth from `0` to `MAX_LOCKOUT_HISTORY`.
7
+ */
8
+ commitment: readonly Lamports[] | null;
9
+ /** The total active stake, in {@link Lamports}, of the current epoch. */
10
+ totalStake: Lamports;
11
+ }>;
12
+
13
+ export type GetBlockCommitmentApi = {
14
+ /**
15
+ * Returns the amount of cluster stake in {@link Lamports} that has voted on a particular block,
16
+ * as well as the stake attributed to each vote account.
17
+ * @see https://solana.com/docs/rpc/http/getblockcommitment
18
+ */
19
+ getBlockCommitment(slot: Slot): GetBlockCommitmentApiResponse;
20
+ };
@@ -0,0 +1,29 @@
1
+ import type { Commitment, Slot } from '@solana/rpc-types';
2
+
3
+ type GetBlockHeightApiResponse = bigint;
4
+
5
+ export type GetBlockHeightApi = {
6
+ /**
7
+ * Returns the current block height of the node
8
+ * @see https://solana.com/docs/rpc/http/getblockheight
9
+ */
10
+ getBlockHeight(
11
+ config?: Readonly<{
12
+ /**
13
+ * Fetch the block height as of the highest slot that has reached this level of
14
+ * commitment.
15
+ *
16
+ * @defaultValue Whichever default is applied by the underlying {@link RpcApi} in use.
17
+ * For example, when using an API created by a `createSolanaRpc*()` helper, the default
18
+ * commitment is `"confirmed"` unless configured otherwise. Unmitigated by an API layer
19
+ * on the client, the default commitment applied by the server is `"finalized"`.
20
+ */
21
+ commitment?: Commitment;
22
+ /**
23
+ * Prevents accessing stale data by enforcing that the RPC node has processed
24
+ * transactions up to this slot
25
+ */
26
+ minContextSlot?: Slot;
27
+ }>,
28
+ ): GetBlockHeightApiResponse;
29
+ };
@@ -0,0 +1,83 @@
1
+ import type { Address } from '@solana/addresses';
2
+ import type { Commitment, Slot, SolanaRpcResponse } from '@solana/rpc-types';
3
+
4
+ type NumberOfLeaderSlots = bigint;
5
+ type NumberOfBlocksProduced = bigint;
6
+
7
+ type SlotRange = Readonly<{
8
+ /** First slot to return block production information for */
9
+ firstSlot: Slot;
10
+ /**
11
+ * Last slot to return block production information for.
12
+ * @defaultValue If not provided, defaults to the highest slot.
13
+ */
14
+ lastSlot?: Slot;
15
+ }>;
16
+
17
+ type GetBlockProductionApiConfigBase = Readonly<{
18
+ /**
19
+ * Fetch the block production information as of the highest slot that has reached this level of
20
+ * commitment.
21
+ *
22
+ * @defaultValue Whichever default is applied by the underlying {@link RpcApi} in use. For
23
+ * example, when using an API created by a `createSolanaRpc*()` helper, the default commitment
24
+ * is `"confirmed"` unless configured otherwise. Unmitigated by an API layer on the client, the
25
+ * default commitment applied by the server is `"finalized"`.
26
+ */
27
+ commitment?: Commitment;
28
+ /**
29
+ * Slot range to return block production for (inclusive).
30
+ * @defaultValue If not provided, fetches block production for the current epoch.
31
+ */
32
+ range?: SlotRange;
33
+ }>;
34
+
35
+ type BlockProductionRecord = [
36
+ /** The number of leader slots the validator had, in the slot range given */
37
+ numLeaderSlots: NumberOfLeaderSlots,
38
+ /** The number of blocks that the validator produced, in the slot range given */
39
+ numBlocksProduced: NumberOfBlocksProduced,
40
+ ];
41
+
42
+ type BlockProductionWithSingleIdentity<TIdentity extends string> = Readonly<{
43
+ [TAddress in TIdentity]?: BlockProductionRecord;
44
+ }>;
45
+
46
+ type BlockProductionWithAllIdentities = Record<Address, BlockProductionRecord>;
47
+
48
+ type GetBlockProductionApiResponse<T> = Readonly<{
49
+ /** Block production results, indexed by validator address. */
50
+ byIdentity: T;
51
+ /** The range of slots (inclusive) for which block production information was fetched */
52
+ range: SlotRange;
53
+ }>;
54
+
55
+ export type GetBlockProductionApi = {
56
+ /**
57
+ * Returns a validator's leader slot count and the number of blocks it produced, in the given
58
+ * slot range
59
+ *
60
+ * {@label specific-validator}
61
+ * @see https://solana.com/docs/rpc/http/getblockproduction
62
+ */
63
+ getBlockProduction<TIdentity extends Address>(
64
+ config: GetBlockProductionApiConfigBase &
65
+ Readonly<{
66
+ /**
67
+ * When supplied, the response will only include results for the validator with this
68
+ * address
69
+ */
70
+ identity: TIdentity;
71
+ }>,
72
+ ): SolanaRpcResponse<GetBlockProductionApiResponse<BlockProductionWithSingleIdentity<TIdentity>>>;
73
+ /**
74
+ * Returns each validator's leader slot count and the number of blocks they produced, in the
75
+ * given slot range
76
+ *
77
+ * {@label all-validators}
78
+ * @see https://solana.com/docs/rpc/http/getblockproduction
79
+ */
80
+ getBlockProduction(
81
+ config?: GetBlockProductionApiConfigBase,
82
+ ): SolanaRpcResponse<GetBlockProductionApiResponse<BlockProductionWithAllIdentities>>;
83
+ };