@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.
- package/package.json +14 -13
- package/src/getAccountInfo.ts +145 -0
- package/src/getBalance.ts +31 -0
- package/src/getBlock.ts +552 -0
- package/src/getBlockCommitment.ts +20 -0
- package/src/getBlockHeight.ts +29 -0
- package/src/getBlockProduction.ts +83 -0
- package/src/getBlockTime.ts +21 -0
- package/src/getBlocks.ts +34 -0
- package/src/getBlocksWithLimit.ts +33 -0
- package/src/getClusterNodes.ts +49 -0
- package/src/getEpochInfo.ts +43 -0
- package/src/getEpochSchedule.ts +29 -0
- package/src/getFeeForMessage.ts +35 -0
- package/src/getFirstAvailableBlock.ts +17 -0
- package/src/getGenesisHash.ts +13 -0
- package/src/getHealth.ts +17 -0
- package/src/getHighestSnapshotSlot.ts +23 -0
- package/src/getIdentity.ts +14 -0
- package/src/getInflationGovernor.ts +39 -0
- package/src/getInflationRate.ts +21 -0
- package/src/getInflationReward.ts +53 -0
- package/src/getLargestAccounts.ts +42 -0
- package/src/getLatestBlockhash.ts +40 -0
- package/src/getLeaderSchedule.ts +103 -0
- package/src/getMaxRetransmitSlot.ts +12 -0
- package/src/getMaxShredInsertSlot.ts +12 -0
- package/src/getMinimumBalanceForRentExemption.ts +32 -0
- package/src/getMultipleAccounts.ts +156 -0
- package/src/getProgramAccounts.ts +264 -0
- package/src/getRecentPerformanceSamples.ts +29 -0
- package/src/getRecentPrioritizationFees.ts +28 -0
- package/src/getSignatureStatuses.ts +62 -0
- package/src/getSignaturesForAddress.ts +88 -0
- package/src/getSlot.ts +29 -0
- package/src/getSlotLeader.ts +32 -0
- package/src/getSlotLeaders.ts +21 -0
- package/src/getStakeMinimumDelegation.ts +26 -0
- package/src/getSupply.ts +66 -0
- package/src/getTokenAccountBalance.ts +26 -0
- package/src/getTokenAccountsByDelegate.ts +196 -0
- package/src/getTokenAccountsByOwner.ts +190 -0
- package/src/getTokenLargestAccounts.ts +29 -0
- package/src/getTokenSupply.ts +26 -0
- package/src/getTransaction.ts +437 -0
- package/src/getTransactionCount.ts +30 -0
- package/src/getVersion.ts +21 -0
- package/src/getVoteAccounts.ts +80 -0
- package/src/index.ts +353 -0
- package/src/isBlockhashValid.ts +35 -0
- package/src/minimumLedgerSlot.ts +16 -0
- package/src/requestAirdrop.ts +34 -0
- package/src/sendTransaction.ts +80 -0
- package/src/simulateTransaction.ts +727 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Slot, UnixTimestamp } from '@solana/rpc-types';
|
|
2
|
+
|
|
3
|
+
type GetBlockTimeApiResponse = UnixTimestamp;
|
|
4
|
+
|
|
5
|
+
export type GetBlockTimeApi = {
|
|
6
|
+
/**
|
|
7
|
+
* Returns the estimated production time of a block.
|
|
8
|
+
*
|
|
9
|
+
* Each validator reports their UTC time to the ledger on a regular interval by intermittently
|
|
10
|
+
* adding a timestamp to a vote for a particular block. A requested block's time is calculated
|
|
11
|
+
* from the stake-weighted mean of the vote timestamps in a set of recent blocks recorded on the
|
|
12
|
+
* ledger.
|
|
13
|
+
*
|
|
14
|
+
* @returns Estimated production time, as Unix timestamp (seconds since the Unix epoch)
|
|
15
|
+
* @see https://solana.com/docs/rpc/http/getblocktime
|
|
16
|
+
*/
|
|
17
|
+
getBlockTime(
|
|
18
|
+
/** Block number, identified by slot */
|
|
19
|
+
blockNumber: Slot,
|
|
20
|
+
): GetBlockTimeApiResponse;
|
|
21
|
+
};
|
package/src/getBlocks.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Commitment, Slot } from '@solana/rpc-types';
|
|
2
|
+
|
|
3
|
+
type GetBlocksApiResponse = Slot[];
|
|
4
|
+
|
|
5
|
+
export type GetBlocksApi = {
|
|
6
|
+
/**
|
|
7
|
+
* Returns a list of confirmed blocks between two slots (inclusive).
|
|
8
|
+
*
|
|
9
|
+
* @see https://solana.com/docs/rpc/http/getblocks
|
|
10
|
+
*/
|
|
11
|
+
getBlocks(
|
|
12
|
+
/** The first slot for which to return a confirmed block */
|
|
13
|
+
startSlotInclusive: Slot,
|
|
14
|
+
/**
|
|
15
|
+
* The last slot for which to return a confirmed block.
|
|
16
|
+
*
|
|
17
|
+
* Must be no more than 500,000 blocks higher than the start slot.
|
|
18
|
+
*
|
|
19
|
+
* @defaultValue If not provided, defaults to the latest confirmed slot.
|
|
20
|
+
*/
|
|
21
|
+
endSlotInclusive?: Slot,
|
|
22
|
+
config?: Readonly<{
|
|
23
|
+
/**
|
|
24
|
+
* Include only blocks at slots that have reached at least this level of commitment.
|
|
25
|
+
*
|
|
26
|
+
* @defaultValue Whichever default is applied by the underlying {@link RpcApi} in use.
|
|
27
|
+
* For example, when using an API created by a `createSolanaRpc*()` helper, the default
|
|
28
|
+
* commitment is `"confirmed"` unless configured otherwise. Unmitigated by an API layer
|
|
29
|
+
* on the client, the default commitment applied by the server is `"finalized"`.
|
|
30
|
+
*/
|
|
31
|
+
commitment?: Exclude<Commitment, 'processed'>;
|
|
32
|
+
}>,
|
|
33
|
+
): GetBlocksApiResponse;
|
|
34
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Commitment, Slot } from '@solana/rpc-types';
|
|
2
|
+
|
|
3
|
+
type GetBlocksWithLimitApiResponse = Slot[];
|
|
4
|
+
|
|
5
|
+
export type GetBlocksWithLimitApi = {
|
|
6
|
+
/**
|
|
7
|
+
* Returns a list of confirmed blocks starting at the given slot (inclusive). Returns up to the
|
|
8
|
+
* number of blocks specified by the limit.
|
|
9
|
+
*
|
|
10
|
+
* @see https://solana.com/docs/rpc/http/getblockswithlimit
|
|
11
|
+
*/
|
|
12
|
+
getBlocksWithLimit(
|
|
13
|
+
/** The first slot for which to return a confirmed block */
|
|
14
|
+
startSlotInclusive: Slot,
|
|
15
|
+
/**
|
|
16
|
+
* The maximum number of blocks to return (between 0 and 500,000).
|
|
17
|
+
*
|
|
18
|
+
* Specifying 0 will result in an empty array being returned.
|
|
19
|
+
*/
|
|
20
|
+
limit: number,
|
|
21
|
+
config?: Readonly<{
|
|
22
|
+
/**
|
|
23
|
+
* Include only blocks at slots that have reached at least this level of commitment.
|
|
24
|
+
*
|
|
25
|
+
* @defaultValue Whichever default is applied by the underlying {@link RpcApi} in use.
|
|
26
|
+
* For example, when using an API created by a `createSolanaRpc*()` helper, the default
|
|
27
|
+
* commitment is `"confirmed"` unless configured otherwise. Unmitigated by an API layer
|
|
28
|
+
* on the client, the default commitment applied by the server is `"finalized"`.
|
|
29
|
+
*/
|
|
30
|
+
commitment?: Exclude<Commitment, 'processed'>;
|
|
31
|
+
}>,
|
|
32
|
+
): GetBlocksWithLimitApiResponse;
|
|
33
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Address } from '@solana/addresses';
|
|
2
|
+
|
|
3
|
+
type ClusterNode = Readonly<{
|
|
4
|
+
/**
|
|
5
|
+
* The unique identifier of the node's feature set.
|
|
6
|
+
*
|
|
7
|
+
* This value is computed by sorting all feature addresses' byte arrays lexicographically,
|
|
8
|
+
* hashing them, then taking the first 4 bytes of the result. This keeps the feature set value
|
|
9
|
+
* stable across versions until a new feature is introduced.
|
|
10
|
+
*/
|
|
11
|
+
featureSet: number | null;
|
|
12
|
+
/** Gossip network address for the node (host:port) */
|
|
13
|
+
gossip: string | null;
|
|
14
|
+
/** Node public key, as base-58 encoded string */
|
|
15
|
+
pubkey: Address;
|
|
16
|
+
/** WebSocket PubSub network address for the node (host:port) */
|
|
17
|
+
pubsub: string | null;
|
|
18
|
+
/** JSON RPC network address for the node, or `null` if the JSON RPC service is not enabled */
|
|
19
|
+
rpc: string | null;
|
|
20
|
+
/** Server repair UDP network address for the node (host:port) */
|
|
21
|
+
serveRepair: string | null;
|
|
22
|
+
/** The shred version the node has been configured to use */
|
|
23
|
+
shredVersion: number | null;
|
|
24
|
+
/** TPU network address for the node (host:port) */
|
|
25
|
+
tpu: string | null;
|
|
26
|
+
/** Tpu UDP forwards network address for the node (host:port) */
|
|
27
|
+
tpuForwards: string | null;
|
|
28
|
+
/** Tpu QUIC forwards network address for the node (host:port) */
|
|
29
|
+
tpuForwardsQuic: string | null;
|
|
30
|
+
/** Tpu QUIC network address for the node (host:port) */
|
|
31
|
+
tpuQuic: string | null;
|
|
32
|
+
/** Tpu UDP vote network address for the node (host:port) */
|
|
33
|
+
tpuVote: string | null;
|
|
34
|
+
/** Tvu UDP network address for the node (host:port) */
|
|
35
|
+
tvu: string | null;
|
|
36
|
+
/** The software version of the node, or `null` if the version information is not available */
|
|
37
|
+
version: string | null;
|
|
38
|
+
}>;
|
|
39
|
+
|
|
40
|
+
type GetClusterNodesApiResponse = readonly ClusterNode[];
|
|
41
|
+
|
|
42
|
+
export type GetClusterNodesApi = {
|
|
43
|
+
/**
|
|
44
|
+
* Returns information about all the nodes participating in the cluster.
|
|
45
|
+
*
|
|
46
|
+
* @see https://solana.com/docs/rpc/http/getclusternodes
|
|
47
|
+
*/
|
|
48
|
+
getClusterNodes(): GetClusterNodesApiResponse;
|
|
49
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Commitment, Slot } from '@solana/rpc-types';
|
|
2
|
+
|
|
3
|
+
type GetEpochInfoApiResponse = Readonly<{
|
|
4
|
+
/** The current slot */
|
|
5
|
+
absoluteSlot: Slot;
|
|
6
|
+
/** The current block height */
|
|
7
|
+
blockHeight: bigint;
|
|
8
|
+
/** The current epoch */
|
|
9
|
+
epoch: bigint;
|
|
10
|
+
/** The current slot relative to the start of the current epoch */
|
|
11
|
+
slotIndex: bigint;
|
|
12
|
+
/** The number of slots in this epoch */
|
|
13
|
+
slotsInEpoch: bigint;
|
|
14
|
+
/** Total number of transactions processed without error since genesis */
|
|
15
|
+
transactionCount: bigint | null;
|
|
16
|
+
}>;
|
|
17
|
+
|
|
18
|
+
export type GetEpochInfoApi = {
|
|
19
|
+
/**
|
|
20
|
+
* Returns information about the current epoch.
|
|
21
|
+
*
|
|
22
|
+
* @see https://solana.com/docs/rpc/http/getepochinfo
|
|
23
|
+
*/
|
|
24
|
+
getEpochInfo(
|
|
25
|
+
config?: Readonly<{
|
|
26
|
+
/**
|
|
27
|
+
* Fetch epoch information as of the highest slot that has reached this level of
|
|
28
|
+
* commitment.
|
|
29
|
+
*
|
|
30
|
+
* @defaultValue Whichever default is applied by the underlying {@link RpcApi} in use.
|
|
31
|
+
* For example, when using an API created by a `createSolanaRpc*()` helper, the default
|
|
32
|
+
* commitment is `"confirmed"` unless configured otherwise. Unmitigated by an API layer
|
|
33
|
+
* on the client, the default commitment applied by the server is `"finalized"`.
|
|
34
|
+
*/
|
|
35
|
+
commitment?: Commitment;
|
|
36
|
+
/**
|
|
37
|
+
* Prevents accessing stale data by enforcing that the RPC node has processed
|
|
38
|
+
* transactions up to this slot
|
|
39
|
+
*/
|
|
40
|
+
minContextSlot?: Slot;
|
|
41
|
+
}>,
|
|
42
|
+
): GetEpochInfoApiResponse;
|
|
43
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
type GetEpochScheduleApiResponse = Readonly<{
|
|
2
|
+
/**
|
|
3
|
+
* First normal-length epoch after the warmup period,
|
|
4
|
+
* log2(slotsPerEpoch) - log2(MINIMUM_SLOTS_PER_EPOCH)
|
|
5
|
+
*/
|
|
6
|
+
firstNormalEpoch: bigint;
|
|
7
|
+
/**
|
|
8
|
+
* The first slot after the warmup period, MINIMUM_SLOTS_PER_EPOCH * (2^(firstNormalEpoch) - 1)
|
|
9
|
+
*/
|
|
10
|
+
firstNormalSlot: bigint;
|
|
11
|
+
/**
|
|
12
|
+
* The number of slots before beginning of an epoch to calculate a leader schedule for that
|
|
13
|
+
* epoch
|
|
14
|
+
*/
|
|
15
|
+
leaderScheduleSlotOffset: bigint;
|
|
16
|
+
/** The maximum number of slots in each epoch */
|
|
17
|
+
slotsPerEpoch: bigint;
|
|
18
|
+
/** Whether epochs start short and grow */
|
|
19
|
+
warmup: boolean;
|
|
20
|
+
}>;
|
|
21
|
+
|
|
22
|
+
export type GetEpochScheduleApi = {
|
|
23
|
+
/**
|
|
24
|
+
* Returns the epoch schedule information from this cluster's genesis config
|
|
25
|
+
*
|
|
26
|
+
* @see https://solana.com/docs/rpc/http/getepochschedule
|
|
27
|
+
*/
|
|
28
|
+
getEpochSchedule(): GetEpochScheduleApiResponse;
|
|
29
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Commitment, Lamports, Slot, SolanaRpcResponse } from '@solana/rpc-types';
|
|
2
|
+
import type { TransactionMessageBytesBase64 } from '@solana/transactions';
|
|
3
|
+
|
|
4
|
+
type GetFeeForMessageApiResponse = Lamports | null;
|
|
5
|
+
|
|
6
|
+
export type GetFeeForMessageApi = {
|
|
7
|
+
/**
|
|
8
|
+
* Returns the fee the network will charge for a particular message
|
|
9
|
+
*
|
|
10
|
+
* @returns The fee that the network will charge to process the message, in {@link Lamports}, as
|
|
11
|
+
* computed at the specified blockhash.
|
|
12
|
+
* @see https://solana.com/docs/rpc/http/getfeeformessage
|
|
13
|
+
*/
|
|
14
|
+
getFeeForMessage(
|
|
15
|
+
/** A transaction message encoded as a base64 string */
|
|
16
|
+
message: TransactionMessageBytesBase64,
|
|
17
|
+
config?: Readonly<{
|
|
18
|
+
/**
|
|
19
|
+
* Fetch the fee 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.
|
|
23
|
+
* For example, when using an API created by a `createSolanaRpc*()` helper, the default
|
|
24
|
+
* commitment is `"confirmed"` unless configured otherwise. Unmitigated by an API layer
|
|
25
|
+
* on the client, the default commitment applied by the server is `"finalized"`.
|
|
26
|
+
*/
|
|
27
|
+
commitment?: Commitment;
|
|
28
|
+
/**
|
|
29
|
+
* Prevents accessing stale data by enforcing that the RPC node has processed
|
|
30
|
+
* transactions up to this slot
|
|
31
|
+
*/
|
|
32
|
+
minContextSlot?: Slot;
|
|
33
|
+
}>,
|
|
34
|
+
): SolanaRpcResponse<GetFeeForMessageApiResponse>;
|
|
35
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Slot } from '@solana/rpc-types';
|
|
2
|
+
|
|
3
|
+
type GetFirstAvailableBlockApiResponse = Slot;
|
|
4
|
+
|
|
5
|
+
export type GetFirstAvailableBlockApi = {
|
|
6
|
+
/**
|
|
7
|
+
* Returns the slot of the lowest confirmed block available on the node.
|
|
8
|
+
*
|
|
9
|
+
* Different nodes may offer more or less historical block data, depending on their
|
|
10
|
+
* configuration. An appropriately configured node should be able to access all blocks, from
|
|
11
|
+
* genesis onward. When it is not, this method will tell you the slot of the lowest block
|
|
12
|
+
* available.
|
|
13
|
+
*
|
|
14
|
+
* @see https://solana.com/docs/rpc/http/getfirstavailableblock
|
|
15
|
+
*/
|
|
16
|
+
getFirstAvailableBlock(): GetFirstAvailableBlockApiResponse;
|
|
17
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Base58EncodedBytes } from '@solana/rpc-types';
|
|
2
|
+
|
|
3
|
+
type GetGenesisHashApiResponse = Base58EncodedBytes;
|
|
4
|
+
|
|
5
|
+
export type GetGenesisHashApi = {
|
|
6
|
+
/**
|
|
7
|
+
* Returns the genesis hash.
|
|
8
|
+
*
|
|
9
|
+
* @returns A SHA-256 hash of the network's genesis config.
|
|
10
|
+
* @see https://solana.com/docs/rpc/http/getgenesishash
|
|
11
|
+
*/
|
|
12
|
+
getGenesisHash(): GetGenesisHashApiResponse;
|
|
13
|
+
};
|
package/src/getHealth.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type GetHealthApiResponse = 'ok';
|
|
2
|
+
|
|
3
|
+
export type GetHealthApi = {
|
|
4
|
+
/**
|
|
5
|
+
* Returns the health status of the node.
|
|
6
|
+
*
|
|
7
|
+
* A healthy node is one that is within _n_ slots of the latest cluster-confirmed slot, where
|
|
8
|
+
* _n_ is a node-configurable parameter with a
|
|
9
|
+
* [default of 128](https://github.com/anza-xyz/agave/blob/a080c4bb157f48b268b74cf5dd2f3de39db7dc5d/rpc-client-types/src/request.rs#L157).
|
|
10
|
+
*
|
|
11
|
+
* @returns The string "ok" if the node is healthy.
|
|
12
|
+
* @throws {SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NODE_UNHEALTHY} if the node is unhealthy. The
|
|
13
|
+
* specifics of the error response are unstable and may change in the future.
|
|
14
|
+
* @see https://solana.com/docs/rpc/http/gethealth
|
|
15
|
+
*/
|
|
16
|
+
getHealth(): GetHealthApiResponse;
|
|
17
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Slot } from '@solana/rpc-types';
|
|
2
|
+
|
|
3
|
+
type GetHighestSnapshotSlotApiResponse = Readonly<{
|
|
4
|
+
/** The highest full snapshot slot */
|
|
5
|
+
full: Slot;
|
|
6
|
+
/**
|
|
7
|
+
* The highest incremental snapshot slot based on the slot indicated by
|
|
8
|
+
* {@link GetHighestSnapshotSlotApiResponse.full | full}
|
|
9
|
+
*/
|
|
10
|
+
incremental: Slot | null;
|
|
11
|
+
}>;
|
|
12
|
+
|
|
13
|
+
export type GetHighestSnapshotSlotApi = {
|
|
14
|
+
/**
|
|
15
|
+
* Returns the highest slot information that the node has snapshots for.
|
|
16
|
+
*
|
|
17
|
+
* This will find the highest full snapshot slot, and the highest incremental snapshot slot
|
|
18
|
+
* based on the full snapshot slot, if there is one.
|
|
19
|
+
*
|
|
20
|
+
* @see https://solana.com/docs/rpc/http/gethighestsnapshotslot
|
|
21
|
+
*/
|
|
22
|
+
getHighestSnapshotSlot(): GetHighestSnapshotSlotApiResponse;
|
|
23
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Address } from '@solana/addresses';
|
|
2
|
+
|
|
3
|
+
type GetIdentityApiResponse = Readonly<{
|
|
4
|
+
identity: Address;
|
|
5
|
+
}>;
|
|
6
|
+
|
|
7
|
+
export type GetIdentityApi = {
|
|
8
|
+
/**
|
|
9
|
+
* Returns the identity pubkey for the current node.
|
|
10
|
+
*
|
|
11
|
+
* @see https://solana.com/docs/rpc/http/getidentity
|
|
12
|
+
*/
|
|
13
|
+
getIdentity(): GetIdentityApiResponse;
|
|
14
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Commitment, F64UnsafeSeeDocumentation } from '@solana/rpc-types';
|
|
2
|
+
|
|
3
|
+
type GetInflationGovernorApiResponse = Readonly<{
|
|
4
|
+
/** Percentage of total inflation allocated to the foundation */
|
|
5
|
+
foundation: F64UnsafeSeeDocumentation;
|
|
6
|
+
/** Duration of foundation pool inflation in years */
|
|
7
|
+
foundationTerm: F64UnsafeSeeDocumentation;
|
|
8
|
+
/** The initial inflation percentage from time 0 */
|
|
9
|
+
initial: F64UnsafeSeeDocumentation;
|
|
10
|
+
/**
|
|
11
|
+
* Rate per year at which inflation is lowered. (Rate reduction is derived using the target slot
|
|
12
|
+
* time in genesis config)
|
|
13
|
+
*/
|
|
14
|
+
taper: F64UnsafeSeeDocumentation;
|
|
15
|
+
/** Terminal inflation percentage */
|
|
16
|
+
terminal: F64UnsafeSeeDocumentation;
|
|
17
|
+
}>;
|
|
18
|
+
|
|
19
|
+
export type GetInflationGovernorApi = {
|
|
20
|
+
/**
|
|
21
|
+
* Returns the current inflation governor.
|
|
22
|
+
*
|
|
23
|
+
* @see https://solana.com/docs/rpc/http/getinflationgovernor
|
|
24
|
+
*/
|
|
25
|
+
getInflationGovernor(
|
|
26
|
+
config?: Readonly<{
|
|
27
|
+
/**
|
|
28
|
+
* Return the inflation governor as of the highest slot that has reached this level of
|
|
29
|
+
* commitment.
|
|
30
|
+
*
|
|
31
|
+
* @defaultValue Whichever default is applied by the underlying {@link RpcApi} in use.
|
|
32
|
+
* For example, when using an API created by a `createSolanaRpc*()` helper, the default
|
|
33
|
+
* commitment is `"confirmed"` unless configured otherwise. Unmitigated by an API layer
|
|
34
|
+
* on the client, the default commitment applied by the server is `"finalized"`.
|
|
35
|
+
*/
|
|
36
|
+
commitment?: Commitment;
|
|
37
|
+
}>,
|
|
38
|
+
): GetInflationGovernorApiResponse;
|
|
39
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { F64UnsafeSeeDocumentation } from '@solana/rpc-types';
|
|
2
|
+
|
|
3
|
+
type GetInflationRateApiResponse = Readonly<{
|
|
4
|
+
/** Epoch for which these values are valid */
|
|
5
|
+
epoch: bigint;
|
|
6
|
+
/** Inflation allocated to the foundation */
|
|
7
|
+
foundation: F64UnsafeSeeDocumentation;
|
|
8
|
+
/** Total inflation */
|
|
9
|
+
total: F64UnsafeSeeDocumentation;
|
|
10
|
+
/** Inflation allocated to validators */
|
|
11
|
+
validator: F64UnsafeSeeDocumentation;
|
|
12
|
+
}>;
|
|
13
|
+
|
|
14
|
+
export type GetInflationRateApi = {
|
|
15
|
+
/**
|
|
16
|
+
* Returns the specific inflation values for the current epoch.
|
|
17
|
+
*
|
|
18
|
+
* @see https://solana.com/docs/rpc/http/getinflationrate
|
|
19
|
+
*/
|
|
20
|
+
getInflationRate(): GetInflationRateApiResponse;
|
|
21
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { Address } from '@solana/addresses';
|
|
2
|
+
import type { Commitment, Lamports, Slot } from '@solana/rpc-types';
|
|
3
|
+
|
|
4
|
+
type GetInflationRewardApiConfig = Readonly<{
|
|
5
|
+
/**
|
|
6
|
+
* Fetch the inflation reward details as of the highest slot that has reached this level of
|
|
7
|
+
* commitment.
|
|
8
|
+
*
|
|
9
|
+
* @defaultValue Whichever default is applied by the underlying {@link RpcApi} in use. For
|
|
10
|
+
* example, when using an API created by a `createSolanaRpc*()` helper, the default commitment
|
|
11
|
+
* is `"confirmed"` unless configured otherwise. Unmitigated by an API layer on the client, the
|
|
12
|
+
* default commitment applied by the server is `"finalized"`.
|
|
13
|
+
*/
|
|
14
|
+
commitment?: Commitment;
|
|
15
|
+
/**
|
|
16
|
+
* An epoch for which the reward occurs.
|
|
17
|
+
*
|
|
18
|
+
* @defaultValue If omitted, the previous epoch will be used.
|
|
19
|
+
*/
|
|
20
|
+
epoch?: bigint;
|
|
21
|
+
/**
|
|
22
|
+
* Prevents accessing stale data by enforcing that the RPC node has processed transactions up to
|
|
23
|
+
* this slot
|
|
24
|
+
*/
|
|
25
|
+
minContextSlot?: Slot;
|
|
26
|
+
}>;
|
|
27
|
+
|
|
28
|
+
type InflationReward = Readonly<{
|
|
29
|
+
/** Reward amount in {@link Lamports} */
|
|
30
|
+
amount: Lamports;
|
|
31
|
+
/** Vote account commission when the reward was credited */
|
|
32
|
+
commission: number;
|
|
33
|
+
/** The slot in which the rewards are delivered */
|
|
34
|
+
effectiveSlot: Slot;
|
|
35
|
+
/** Epoch for which reward occurred */
|
|
36
|
+
epoch: bigint;
|
|
37
|
+
/** Post balance of the account in {@link Lamports} */
|
|
38
|
+
postBalance: Lamports;
|
|
39
|
+
}>;
|
|
40
|
+
|
|
41
|
+
type GetInflationRewardApiResponse = readonly (InflationReward | null)[];
|
|
42
|
+
|
|
43
|
+
export type GetInflationRewardApi = {
|
|
44
|
+
/**
|
|
45
|
+
* Returns the inflation / staking reward for a list of addresses for an epoch.
|
|
46
|
+
*
|
|
47
|
+
* @see https://solana.com/docs/rpc/http/getinflationreward
|
|
48
|
+
*/
|
|
49
|
+
getInflationReward(
|
|
50
|
+
addresses: readonly Address[],
|
|
51
|
+
config?: GetInflationRewardApiConfig,
|
|
52
|
+
): GetInflationRewardApiResponse;
|
|
53
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { Address } from '@solana/addresses';
|
|
2
|
+
import type { Commitment, Lamports, SolanaRpcResponse } from '@solana/rpc-types';
|
|
3
|
+
|
|
4
|
+
type GetLargestAccountsResponseItem = Readonly<{
|
|
5
|
+
/** Base-58 encoded address of the account */
|
|
6
|
+
address: Address;
|
|
7
|
+
/** Number of {@link Lamports} in the account */
|
|
8
|
+
lamports: Lamports;
|
|
9
|
+
}>;
|
|
10
|
+
|
|
11
|
+
type GetLargestAccountsApiResponse = readonly GetLargestAccountsResponseItem[];
|
|
12
|
+
|
|
13
|
+
export type GetLargestAccountsApi = {
|
|
14
|
+
/**
|
|
15
|
+
* Returns the 20 largest accounts, by {@link Lamports | Lamport} balance.
|
|
16
|
+
*
|
|
17
|
+
* Results may be cached up to two hours.
|
|
18
|
+
*
|
|
19
|
+
* @see https://solana.com/docs/rpc/http/getlargestaccounts
|
|
20
|
+
*/
|
|
21
|
+
getLargestAccounts(
|
|
22
|
+
config?: Readonly<{
|
|
23
|
+
/**
|
|
24
|
+
* Fetch the largest accounts as of the highest slot that has reached this level of
|
|
25
|
+
* commitment.
|
|
26
|
+
*
|
|
27
|
+
* @defaultValue Whichever default is applied by the underlying {@link RpcApi} in use.
|
|
28
|
+
* For example, when using an API created by a `createSolanaRpc*()` helper, the default
|
|
29
|
+
* commitment is `"confirmed"` unless configured otherwise. Unmitigated by an API layer
|
|
30
|
+
* on the client, the default commitment applied by the server is `"finalized"`.
|
|
31
|
+
*/
|
|
32
|
+
commitment?: Commitment;
|
|
33
|
+
/**
|
|
34
|
+
* Filter results by account type.
|
|
35
|
+
*
|
|
36
|
+
* @defaultValue When not specified, all accounts will be considered regardless of their
|
|
37
|
+
* type.
|
|
38
|
+
*/
|
|
39
|
+
filter?: 'circulating' | 'nonCirculating';
|
|
40
|
+
}>,
|
|
41
|
+
): SolanaRpcResponse<GetLargestAccountsApiResponse>;
|
|
42
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Blockhash, Commitment, Slot, SolanaRpcResponse } from '@solana/rpc-types';
|
|
2
|
+
|
|
3
|
+
type GetLatestBlockhashApiResponse = Readonly<{
|
|
4
|
+
/** A SHA-256 hash as base-58 encoded string */
|
|
5
|
+
blockhash: Blockhash;
|
|
6
|
+
/**
|
|
7
|
+
* Last block height at which the blockhash will be considered a valid lifetime specifier with
|
|
8
|
+
* which to land a transaction.
|
|
9
|
+
*
|
|
10
|
+
* @see {@link setTransactionMessageLifetimeUsingBlockhash}
|
|
11
|
+
*/
|
|
12
|
+
lastValidBlockHeight: bigint;
|
|
13
|
+
}>;
|
|
14
|
+
|
|
15
|
+
export type GetLatestBlockhashApi = {
|
|
16
|
+
/**
|
|
17
|
+
* Returns the blockhash of the latest block.
|
|
18
|
+
*
|
|
19
|
+
* @see https://solana.com/docs/rpc/http/getlatestblockhash
|
|
20
|
+
*/
|
|
21
|
+
getLatestBlockhash(
|
|
22
|
+
config?: Readonly<{
|
|
23
|
+
/**
|
|
24
|
+
* Fetch the latest blockhash as of the highest slot that has reached this level of
|
|
25
|
+
* commitment.
|
|
26
|
+
*
|
|
27
|
+
* @defaultValue Whichever default is applied by the underlying {@link RpcApi} in use.
|
|
28
|
+
* For example, when using an API created by a `createSolanaRpc*()` helper, the default
|
|
29
|
+
* commitment is `"confirmed"` unless configured otherwise. Unmitigated by an API layer
|
|
30
|
+
* on the client, the default commitment applied by the server is `"finalized"`.
|
|
31
|
+
*/
|
|
32
|
+
commitment?: Commitment;
|
|
33
|
+
/**
|
|
34
|
+
* Prevents accessing stale data by enforcing that the RPC node has processed
|
|
35
|
+
* transactions up to this slot
|
|
36
|
+
*/
|
|
37
|
+
minContextSlot?: Slot;
|
|
38
|
+
}>,
|
|
39
|
+
): SolanaRpcResponse<GetLatestBlockhashApiResponse>;
|
|
40
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import type { Address } from '@solana/addresses';
|
|
2
|
+
import type { Commitment, Slot } from '@solana/rpc-types';
|
|
3
|
+
|
|
4
|
+
type GetLeaderScheduleApiConfigBase = Readonly<{
|
|
5
|
+
/**
|
|
6
|
+
* Fetch the leader schedule as of the highest slot that has reached this level of commitment.
|
|
7
|
+
*
|
|
8
|
+
* @defaultValue Whichever default is applied by the underlying {@link RpcApi} in use. For
|
|
9
|
+
* example, when using an API created by a `createSolanaRpc*()` helper, the default commitment
|
|
10
|
+
* is `"confirmed"` unless configured otherwise. Unmitigated by an API layer on the client, the
|
|
11
|
+
* default commitment applied by the server is `"finalized"`.
|
|
12
|
+
*/
|
|
13
|
+
commitment?: Commitment;
|
|
14
|
+
}>;
|
|
15
|
+
|
|
16
|
+
// A dictionary of validator identities as base-58 encoded strings, and their corresponding leader
|
|
17
|
+
// slot indices as values relative to the first slot in the requested epoch.
|
|
18
|
+
//
|
|
19
|
+
// @example
|
|
20
|
+
// ```json
|
|
21
|
+
// {
|
|
22
|
+
// "4Qkev8aNZcqFNSRhQzwyLMFSsi94jHqE8WNVTJzTP99F": [
|
|
23
|
+
// 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
|
|
24
|
+
// 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
|
|
25
|
+
// 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
|
|
26
|
+
// 57, 58, 59, 60, 61, 62, 63
|
|
27
|
+
// ]
|
|
28
|
+
// }
|
|
29
|
+
// ```
|
|
30
|
+
type GetLeaderScheduleApiResponseWithAllIdentities = Record<Address, Slot[]>;
|
|
31
|
+
|
|
32
|
+
type GetLeaderScheduleApiResponseWithSingleIdentity<TIdentity extends string> = Readonly<{
|
|
33
|
+
[TAddress in TIdentity]?: Slot[];
|
|
34
|
+
}>;
|
|
35
|
+
|
|
36
|
+
export type GetLeaderScheduleApi = {
|
|
37
|
+
/**
|
|
38
|
+
* Fetch the leader schedule of a particular validator.
|
|
39
|
+
*
|
|
40
|
+
* @param slot A slot that will be used to select the epoch for which to return the leader
|
|
41
|
+
* schedule.
|
|
42
|
+
*
|
|
43
|
+
* @returns A dictionary having a single key representing the specified validator identity, and
|
|
44
|
+
* its corresponding leader slot indices as values relative to the first slot in the requested
|
|
45
|
+
* epoch, or `null` if there is no epoch that corresponds to the given slot.
|
|
46
|
+
* @see https://solana.com/docs/rpc/http/getleaderschedule
|
|
47
|
+
*/
|
|
48
|
+
getLeaderSchedule<TIdentity extends Address>(
|
|
49
|
+
slot: Slot,
|
|
50
|
+
config: GetLeaderScheduleApiConfigBase &
|
|
51
|
+
Readonly<{
|
|
52
|
+
/** Only return results for this validator identity (base58 encoded address) */
|
|
53
|
+
identity: Address;
|
|
54
|
+
}>,
|
|
55
|
+
): GetLeaderScheduleApiResponseWithSingleIdentity<TIdentity> | null;
|
|
56
|
+
/**
|
|
57
|
+
* Fetch the leader schedule for all validators.
|
|
58
|
+
*
|
|
59
|
+
* @param slot A slot that will be used to select the epoch for which to return the leader
|
|
60
|
+
* schedule.
|
|
61
|
+
*
|
|
62
|
+
* @returns A dictionary of validator identities as base-58 encoded strings, and their
|
|
63
|
+
* corresponding leader slot indices as values relative to the first slot in the requested
|
|
64
|
+
* epoch, or `null` if there is no epoch that corresponds to the given slot.
|
|
65
|
+
* @see https://solana.com/docs/rpc/http/getleaderschedule
|
|
66
|
+
*/
|
|
67
|
+
getLeaderSchedule(
|
|
68
|
+
slot: Slot,
|
|
69
|
+
config?: GetLeaderScheduleApiConfigBase,
|
|
70
|
+
): GetLeaderScheduleApiResponseWithAllIdentities | null;
|
|
71
|
+
/**
|
|
72
|
+
* Fetch the leader schedule of a particular validator.
|
|
73
|
+
*
|
|
74
|
+
* @param slot When `null`, orders the leader schedule for the current epoch.
|
|
75
|
+
*
|
|
76
|
+
* @returns A dictionary having a single key representing the specified validator identity, and
|
|
77
|
+
* its corresponding leader slot indices as values relative to the first slot in the current
|
|
78
|
+
* epoch.
|
|
79
|
+
* @see https://solana.com/docs/rpc/http/getleaderschedule
|
|
80
|
+
*/
|
|
81
|
+
getLeaderSchedule<TIdentity extends Address>(
|
|
82
|
+
slot: null,
|
|
83
|
+
config: GetLeaderScheduleApiConfigBase &
|
|
84
|
+
Readonly<{
|
|
85
|
+
/** Only return results for this validator identity (base58 encoded address) */
|
|
86
|
+
identity: Address;
|
|
87
|
+
}>,
|
|
88
|
+
): GetLeaderScheduleApiResponseWithSingleIdentity<TIdentity>;
|
|
89
|
+
/**
|
|
90
|
+
* Fetch the leader schedule of all validators.
|
|
91
|
+
*
|
|
92
|
+
* @param slot When `null`, orders the leader schedule for the current epoch.
|
|
93
|
+
*
|
|
94
|
+
* @returns A dictionary of validator identities as base-58 encoded strings, and their
|
|
95
|
+
* corresponding leader slot indices as values relative to the first slot in the current
|
|
96
|
+
* epoch.
|
|
97
|
+
* @see https://solana.com/docs/rpc/http/getleaderschedule
|
|
98
|
+
*/
|
|
99
|
+
getLeaderSchedule(
|
|
100
|
+
slot?: null,
|
|
101
|
+
config?: GetLeaderScheduleApiConfigBase,
|
|
102
|
+
): GetLeaderScheduleApiResponseWithAllIdentities;
|
|
103
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Slot } from '@solana/rpc-types';
|
|
2
|
+
|
|
3
|
+
type GetMaxRetransmitSlotApiResponse = Slot;
|
|
4
|
+
|
|
5
|
+
export type GetMaxRetransmitSlotApi = {
|
|
6
|
+
/**
|
|
7
|
+
* Get the max slot seen from retransmit stage.
|
|
8
|
+
*
|
|
9
|
+
* @see https://solana.com/docs/rpc/http/getmaxretransmitslot
|
|
10
|
+
*/
|
|
11
|
+
getMaxRetransmitSlot(): GetMaxRetransmitSlotApiResponse;
|
|
12
|
+
};
|