@elsoul/erpc-sdk 0.1.0
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/LICENSE +21 -0
- package/README.md +95 -0
- package/dist/index.cjs +1286 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +785 -0
- package/dist/index.d.ts +785 -0
- package/dist/index.js +1257 -0
- package/dist/index.js.map +1 -0
- package/package.json +64 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,785 @@
|
|
|
1
|
+
type JsonPrimitive = boolean | null | number | string;
|
|
2
|
+
type JsonValue = JsonPrimitive | readonly JsonValue[] | {
|
|
3
|
+
readonly [key: string]: JsonValue;
|
|
4
|
+
};
|
|
5
|
+
type JsonObject = {
|
|
6
|
+
readonly [key: string]: JsonValue;
|
|
7
|
+
};
|
|
8
|
+
type JsonRpcId = number | string;
|
|
9
|
+
type JsonRpcParams = object | readonly unknown[];
|
|
10
|
+
type RpcMethodSpec<TParams extends JsonRpcParams | undefined, TResult> = {
|
|
11
|
+
readonly params: TParams;
|
|
12
|
+
readonly result: TResult;
|
|
13
|
+
};
|
|
14
|
+
type RpcParams<TSpec> = TSpec extends RpcMethodSpec<infer TParams, unknown> ? TParams : never;
|
|
15
|
+
type RpcResult<TSpec> = TSpec extends RpcMethodSpec<JsonRpcParams | undefined, infer TResult> ? TResult : never;
|
|
16
|
+
interface JsonRpcRequest<TParams extends JsonRpcParams | undefined> {
|
|
17
|
+
readonly jsonrpc: '2.0';
|
|
18
|
+
readonly id: JsonRpcId;
|
|
19
|
+
readonly method: string;
|
|
20
|
+
readonly params?: TParams;
|
|
21
|
+
}
|
|
22
|
+
interface JsonRpcSuccess<TResult> {
|
|
23
|
+
readonly jsonrpc: '2.0';
|
|
24
|
+
readonly id: JsonRpcId;
|
|
25
|
+
readonly result: TResult;
|
|
26
|
+
}
|
|
27
|
+
interface JsonRpcErrorObject {
|
|
28
|
+
readonly code: number;
|
|
29
|
+
readonly message: string;
|
|
30
|
+
readonly data?: unknown;
|
|
31
|
+
}
|
|
32
|
+
interface JsonRpcFailure {
|
|
33
|
+
readonly jsonrpc: '2.0';
|
|
34
|
+
readonly id: JsonRpcId | null;
|
|
35
|
+
readonly error: JsonRpcErrorObject;
|
|
36
|
+
}
|
|
37
|
+
type JsonRpcResponse<TResult> = JsonRpcFailure | JsonRpcSuccess<TResult>;
|
|
38
|
+
interface RpcSendOptions {
|
|
39
|
+
readonly signal?: AbortSignal;
|
|
40
|
+
}
|
|
41
|
+
interface RpcBatchCall {
|
|
42
|
+
readonly method: string;
|
|
43
|
+
readonly params?: JsonRpcParams;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
type QueryValue = boolean | number | readonly string[] | string | undefined;
|
|
47
|
+
type Query = Readonly<Record<string, QueryValue>>;
|
|
48
|
+
interface RestTransportConfig {
|
|
49
|
+
readonly apiKey: string;
|
|
50
|
+
readonly endpoint: URL;
|
|
51
|
+
readonly fetch: typeof globalThis.fetch;
|
|
52
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
53
|
+
readonly timeoutMs: number;
|
|
54
|
+
}
|
|
55
|
+
interface RestStreamResponse {
|
|
56
|
+
readonly response: Response;
|
|
57
|
+
close(): void;
|
|
58
|
+
normalizeError(error: unknown): Error;
|
|
59
|
+
}
|
|
60
|
+
declare class RestTransport {
|
|
61
|
+
#private;
|
|
62
|
+
readonly endpoint: string;
|
|
63
|
+
constructor(config: RestTransportConfig);
|
|
64
|
+
url(path: string, query?: Query): URL;
|
|
65
|
+
get<TResult>(path: string, query?: Query, options?: RpcSendOptions): Promise<TResult>;
|
|
66
|
+
stream(path: string, query?: Query, options?: RpcSendOptions): Promise<RestStreamResponse>;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
type ErpcPlan = 'business' | 'developer' | 'free' | 'pro';
|
|
70
|
+
interface TokenBalance {
|
|
71
|
+
readonly max_tokens: number;
|
|
72
|
+
readonly next_refill_at: string | null;
|
|
73
|
+
readonly plan: ErpcPlan;
|
|
74
|
+
readonly remaining_tokens: number;
|
|
75
|
+
}
|
|
76
|
+
declare class AccountClient {
|
|
77
|
+
#private;
|
|
78
|
+
constructor(transport: RestTransport);
|
|
79
|
+
getTokenBalance(options?: RpcSendOptions): Promise<TokenBalance>;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
declare const DEFAULT_ENDPOINT = "https://edge.erpc.global";
|
|
83
|
+
declare const DEFAULT_ACCOUNT_ENDPOINT = "https://solana-rpc.erpc.global";
|
|
84
|
+
declare const DEFAULT_TIMEOUT_MS = 30000;
|
|
85
|
+
interface ErpcClientConfig {
|
|
86
|
+
readonly accountEndpoint?: string;
|
|
87
|
+
readonly apiKey: string;
|
|
88
|
+
readonly endpoint?: string;
|
|
89
|
+
readonly fetch?: typeof globalThis.fetch;
|
|
90
|
+
readonly headers?: Readonly<Record<string, string>>;
|
|
91
|
+
readonly timeoutMs?: number;
|
|
92
|
+
readonly webSocket?: typeof globalThis.WebSocket;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
type PriceEncoding = 'base64' | 'hex';
|
|
96
|
+
type PriceAssetType = 'crypto' | 'equity' | 'fx' | 'metal' | 'rates';
|
|
97
|
+
interface PriceFeedMetadata {
|
|
98
|
+
readonly attributes?: Readonly<Record<string, string>>;
|
|
99
|
+
readonly id: string;
|
|
100
|
+
}
|
|
101
|
+
interface PricePoint {
|
|
102
|
+
readonly conf: string;
|
|
103
|
+
readonly expo: number;
|
|
104
|
+
readonly price: string;
|
|
105
|
+
readonly publish_time: number;
|
|
106
|
+
}
|
|
107
|
+
interface ParsedPriceUpdate {
|
|
108
|
+
readonly ema_price: PricePoint;
|
|
109
|
+
readonly id: string;
|
|
110
|
+
readonly metadata?: {
|
|
111
|
+
readonly prev_publish_time?: number;
|
|
112
|
+
readonly proof_available_time?: number;
|
|
113
|
+
readonly slot?: number;
|
|
114
|
+
};
|
|
115
|
+
readonly price: PricePoint;
|
|
116
|
+
}
|
|
117
|
+
interface BinaryUpdate {
|
|
118
|
+
readonly data: readonly string[];
|
|
119
|
+
readonly encoding: string;
|
|
120
|
+
}
|
|
121
|
+
interface PriceUpdateResponse {
|
|
122
|
+
readonly binary: BinaryUpdate;
|
|
123
|
+
readonly parsed?: readonly ParsedPriceUpdate[];
|
|
124
|
+
}
|
|
125
|
+
interface PriceUpdateOptions {
|
|
126
|
+
readonly encoding?: PriceEncoding;
|
|
127
|
+
readonly ids: readonly string[];
|
|
128
|
+
readonly ignoreInvalidPriceIds?: boolean;
|
|
129
|
+
readonly parsed?: boolean;
|
|
130
|
+
}
|
|
131
|
+
interface PriceStreamOptions extends PriceUpdateOptions {
|
|
132
|
+
readonly allowUnordered?: boolean;
|
|
133
|
+
readonly benchmarksOnly?: boolean;
|
|
134
|
+
}
|
|
135
|
+
interface PublisherStakeCap {
|
|
136
|
+
readonly cap: number;
|
|
137
|
+
readonly publisher: string;
|
|
138
|
+
}
|
|
139
|
+
interface PublisherStakeCapsResponse {
|
|
140
|
+
readonly binary: BinaryUpdate;
|
|
141
|
+
readonly parsed?: readonly {
|
|
142
|
+
readonly publisher_stake_caps: readonly PublisherStakeCap[];
|
|
143
|
+
}[];
|
|
144
|
+
}
|
|
145
|
+
interface PriceStreamEvent {
|
|
146
|
+
readonly data: PriceUpdateResponse;
|
|
147
|
+
readonly event?: string;
|
|
148
|
+
readonly id?: string;
|
|
149
|
+
}
|
|
150
|
+
declare class PriceClient {
|
|
151
|
+
#private;
|
|
152
|
+
constructor(transport: RestTransport);
|
|
153
|
+
getPriceFeeds(options?: {
|
|
154
|
+
readonly assetType?: PriceAssetType;
|
|
155
|
+
readonly query?: string;
|
|
156
|
+
}, sendOptions?: RpcSendOptions): Promise<readonly PriceFeedMetadata[]>;
|
|
157
|
+
getLatestPriceUpdates(options: PriceUpdateOptions, sendOptions?: RpcSendOptions): Promise<PriceUpdateResponse>;
|
|
158
|
+
getPriceUpdatesAtTimestamp(publishTime: number | string, options: PriceUpdateOptions, sendOptions?: RpcSendOptions): Promise<PriceUpdateResponse>;
|
|
159
|
+
getLatestPublisherStakeCaps(options?: {
|
|
160
|
+
readonly encoding?: PriceEncoding;
|
|
161
|
+
readonly parsed?: boolean;
|
|
162
|
+
}, sendOptions?: RpcSendOptions): Promise<PublisherStakeCapsResponse>;
|
|
163
|
+
streamPriceUpdates(options: PriceStreamOptions, sendOptions?: RpcSendOptions): AsyncGenerator<PriceStreamEvent, void, undefined>;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
interface JsonRpcTransport {
|
|
167
|
+
readonly endpoint: string;
|
|
168
|
+
readonly maxBatchSize: number;
|
|
169
|
+
batch<TResult extends readonly unknown[]>(calls: readonly RpcBatchCall[], options?: RpcSendOptions): Promise<TResult>;
|
|
170
|
+
request<TResult>(method: string, params?: JsonRpcParams, options?: RpcSendOptions): Promise<TResult>;
|
|
171
|
+
}
|
|
172
|
+
declare class PendingRpcRequest<TResult> {
|
|
173
|
+
#private;
|
|
174
|
+
constructor(send: (options?: RpcSendOptions) => Promise<TResult>);
|
|
175
|
+
send(options?: RpcSendOptions): Promise<TResult>;
|
|
176
|
+
}
|
|
177
|
+
declare class PendingRpcBatchRequest<TResult extends readonly unknown[]> {
|
|
178
|
+
#private;
|
|
179
|
+
constructor(send: (options?: RpcSendOptions) => Promise<TResult>);
|
|
180
|
+
send(options?: RpcSendOptions): Promise<TResult>;
|
|
181
|
+
}
|
|
182
|
+
type SchemaConstraint<TSchema> = {
|
|
183
|
+
readonly [TMethod in keyof TSchema]: RpcMethodSpec<JsonRpcParams | undefined, unknown>;
|
|
184
|
+
};
|
|
185
|
+
type MethodName<TSchema> = Extract<keyof TSchema, string>;
|
|
186
|
+
type MethodFunction<TSpec> = TSpec extends RpcMethodSpec<infer TParams, infer TResult> ? TParams extends readonly unknown[] ? (...params: TParams) => PendingRpcRequest<TResult> : TParams extends object ? (params: TParams) => PendingRpcRequest<TResult> : () => PendingRpcRequest<TResult> : never;
|
|
187
|
+
type BatchCall<TSchema> = {
|
|
188
|
+
readonly [TMethod in MethodName<TSchema>]: RpcParams<TSchema[TMethod]> extends undefined ? {
|
|
189
|
+
readonly method: TMethod;
|
|
190
|
+
readonly params?: undefined;
|
|
191
|
+
} : {
|
|
192
|
+
readonly method: TMethod;
|
|
193
|
+
readonly params: RpcParams<TSchema[TMethod]>;
|
|
194
|
+
};
|
|
195
|
+
}[MethodName<TSchema>];
|
|
196
|
+
type BatchResults<TSchema, TCalls extends readonly BatchCall<TSchema>[]> = {
|
|
197
|
+
readonly [TIndex in keyof TCalls]: TCalls[TIndex] extends {
|
|
198
|
+
readonly method: infer TMethod;
|
|
199
|
+
} ? TMethod extends MethodName<TSchema> ? RpcResult<TSchema[TMethod]> : never : never;
|
|
200
|
+
};
|
|
201
|
+
interface RpcNamespaceBase<TSchema> {
|
|
202
|
+
readonly endpoint: string;
|
|
203
|
+
batch<const TCalls extends readonly BatchCall<TSchema>[]>(calls: TCalls): PendingRpcBatchRequest<BatchResults<TSchema, TCalls>>;
|
|
204
|
+
raw<TResult = unknown>(method: string, params?: JsonRpcParams): PendingRpcRequest<TResult>;
|
|
205
|
+
request<TMethod extends MethodName<TSchema>>(method: TMethod, ...params: RpcParams<TSchema[TMethod]> extends undefined ? [] : [params: RpcParams<TSchema[TMethod]>]): PendingRpcRequest<RpcResult<TSchema[TMethod]>>;
|
|
206
|
+
}
|
|
207
|
+
type RpcNamespace<TSchema extends SchemaConstraint<TSchema>> = RpcNamespaceBase<TSchema> & {
|
|
208
|
+
readonly [TMethod in MethodName<TSchema>]: MethodFunction<TSchema[TMethod]>;
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
type Hex = `0x${string}`;
|
|
212
|
+
type EthereumAddress = Hex;
|
|
213
|
+
type EthereumBlockTag = 'earliest' | 'finalized' | 'latest' | 'pending' | 'safe' | Hex;
|
|
214
|
+
type EthereumObject = Readonly<Record<string, unknown>>;
|
|
215
|
+
type EthereumTransactionRequest = EthereumObject;
|
|
216
|
+
type EthereumFilter = EthereumObject;
|
|
217
|
+
interface EthereumRpcSchema {
|
|
218
|
+
readonly eth_accounts: RpcMethodSpec<readonly [], readonly EthereumAddress[]>;
|
|
219
|
+
readonly eth_baseFee: RpcMethodSpec<readonly [], Hex>;
|
|
220
|
+
readonly eth_blobBaseFee: RpcMethodSpec<readonly [], Hex>;
|
|
221
|
+
readonly eth_blockNumber: RpcMethodSpec<readonly [], Hex>;
|
|
222
|
+
readonly eth_call: RpcMethodSpec<readonly [
|
|
223
|
+
transaction: EthereumTransactionRequest,
|
|
224
|
+
block?: EthereumBlockTag,
|
|
225
|
+
stateOverride?: EthereumObject
|
|
226
|
+
], Hex>;
|
|
227
|
+
readonly eth_callMany: RpcMethodSpec<readonly [
|
|
228
|
+
calls: readonly EthereumObject[],
|
|
229
|
+
simulationContext?: EthereumObject,
|
|
230
|
+
stateOverride?: EthereumObject,
|
|
231
|
+
timeout?: number
|
|
232
|
+
], JsonValue>;
|
|
233
|
+
readonly eth_capabilities: RpcMethodSpec<readonly [], JsonValue>;
|
|
234
|
+
readonly eth_chainId: RpcMethodSpec<readonly [], Hex>;
|
|
235
|
+
readonly eth_createAccessList: RpcMethodSpec<readonly [
|
|
236
|
+
transaction: EthereumTransactionRequest,
|
|
237
|
+
block?: EthereumBlockTag
|
|
238
|
+
], JsonValue>;
|
|
239
|
+
readonly eth_estimateGas: RpcMethodSpec<readonly [
|
|
240
|
+
transaction: EthereumTransactionRequest,
|
|
241
|
+
block?: EthereumBlockTag,
|
|
242
|
+
stateOverride?: EthereumObject
|
|
243
|
+
], Hex>;
|
|
244
|
+
readonly eth_feeHistory: RpcMethodSpec<readonly [
|
|
245
|
+
blockCount: Hex,
|
|
246
|
+
newestBlock: EthereumBlockTag,
|
|
247
|
+
rewardPercentiles: readonly number[]
|
|
248
|
+
], JsonValue>;
|
|
249
|
+
readonly eth_gasPrice: RpcMethodSpec<readonly [], Hex>;
|
|
250
|
+
readonly eth_getAccount: RpcMethodSpec<readonly [address: EthereumAddress, block: EthereumBlockTag], JsonValue>;
|
|
251
|
+
readonly eth_getBalance: RpcMethodSpec<readonly [address: EthereumAddress, block?: EthereumBlockTag], Hex>;
|
|
252
|
+
readonly eth_getBlockByHash: RpcMethodSpec<readonly [hash: Hex, includeTransactions: boolean], JsonValue | null>;
|
|
253
|
+
readonly eth_getBlockByNumber: RpcMethodSpec<readonly [block: EthereumBlockTag, includeTransactions: boolean], JsonValue | null>;
|
|
254
|
+
readonly eth_getBlockReceipts: RpcMethodSpec<readonly [block: EthereumBlockTag], JsonValue | null>;
|
|
255
|
+
readonly eth_getBlockTransactionCountByHash: RpcMethodSpec<readonly [hash: Hex], Hex | null>;
|
|
256
|
+
readonly eth_getBlockTransactionCountByNumber: RpcMethodSpec<readonly [block: EthereumBlockTag], Hex | null>;
|
|
257
|
+
readonly eth_getCode: RpcMethodSpec<readonly [address: EthereumAddress, block?: EthereumBlockTag], Hex>;
|
|
258
|
+
readonly eth_getFilterChanges: RpcMethodSpec<readonly [filterId: Hex], JsonValue>;
|
|
259
|
+
readonly eth_getFilterLogs: RpcMethodSpec<readonly [filterId: Hex], JsonValue>;
|
|
260
|
+
readonly eth_getLogs: RpcMethodSpec<readonly [filter?: EthereumFilter], JsonValue>;
|
|
261
|
+
readonly eth_getProof: RpcMethodSpec<readonly [
|
|
262
|
+
address: EthereumAddress,
|
|
263
|
+
storageKeys: readonly Hex[],
|
|
264
|
+
block: EthereumBlockTag
|
|
265
|
+
], JsonValue>;
|
|
266
|
+
readonly eth_getRawTransactionByHash: RpcMethodSpec<readonly [hash: Hex], Hex | null>;
|
|
267
|
+
readonly eth_getStorageAt: RpcMethodSpec<readonly [
|
|
268
|
+
address: EthereumAddress,
|
|
269
|
+
position: Hex,
|
|
270
|
+
block?: EthereumBlockTag
|
|
271
|
+
], Hex>;
|
|
272
|
+
readonly eth_getTransactionByBlockHashAndIndex: RpcMethodSpec<readonly [blockHash: Hex, index: Hex], JsonValue | null>;
|
|
273
|
+
readonly eth_getTransactionByBlockNumberAndIndex: RpcMethodSpec<readonly [block: EthereumBlockTag, index: Hex], JsonValue | null>;
|
|
274
|
+
readonly eth_getTransactionByHash: RpcMethodSpec<readonly [hash: Hex], JsonValue | null>;
|
|
275
|
+
readonly eth_getTransactionBySenderAndNonce: RpcMethodSpec<readonly [sender: EthereumAddress, nonce: Hex], JsonValue | null>;
|
|
276
|
+
readonly eth_getTransactionCount: RpcMethodSpec<readonly [address: EthereumAddress, block?: EthereumBlockTag], Hex>;
|
|
277
|
+
readonly eth_getTransactionReceipt: RpcMethodSpec<readonly [hash: Hex], JsonValue | null>;
|
|
278
|
+
readonly eth_getUncleCountByBlockHash: RpcMethodSpec<readonly [hash: Hex], Hex>;
|
|
279
|
+
readonly eth_getUncleCountByBlockNumber: RpcMethodSpec<readonly [block: EthereumBlockTag], Hex>;
|
|
280
|
+
readonly eth_maxPriorityFeePerGas: RpcMethodSpec<readonly [], Hex>;
|
|
281
|
+
readonly eth_newBlockFilter: RpcMethodSpec<readonly [], Hex>;
|
|
282
|
+
readonly eth_newFilter: RpcMethodSpec<readonly [filter?: EthereumFilter], Hex>;
|
|
283
|
+
readonly eth_newPendingTransactionFilter: RpcMethodSpec<readonly [], Hex>;
|
|
284
|
+
readonly eth_sendRawTransaction: RpcMethodSpec<readonly [transaction: Hex], Hex>;
|
|
285
|
+
readonly eth_signTransaction: RpcMethodSpec<readonly [transaction: EthereumTransactionRequest], Hex>;
|
|
286
|
+
readonly eth_simulateV1: RpcMethodSpec<readonly [simulation: EthereumObject, block?: EthereumBlockTag], JsonValue>;
|
|
287
|
+
readonly eth_submitWork: RpcMethodSpec<readonly [nonce: Hex, proofOfWorkHash: Hex, digest: Hex], boolean>;
|
|
288
|
+
readonly eth_syncing: RpcMethodSpec<readonly [], boolean | JsonValue>;
|
|
289
|
+
readonly eth_uninstallFilter: RpcMethodSpec<readonly [filterId: Hex], boolean>;
|
|
290
|
+
readonly net_listening: RpcMethodSpec<readonly [], boolean>;
|
|
291
|
+
readonly net_peerCount: RpcMethodSpec<readonly [], Hex>;
|
|
292
|
+
readonly net_version: RpcMethodSpec<readonly [], string>;
|
|
293
|
+
readonly txpool_content: RpcMethodSpec<readonly [], JsonValue>;
|
|
294
|
+
readonly txpool_contentFrom: RpcMethodSpec<readonly [address: EthereumAddress], JsonValue>;
|
|
295
|
+
readonly txpool_inspect: RpcMethodSpec<readonly [], JsonValue>;
|
|
296
|
+
readonly txpool_status: RpcMethodSpec<readonly [], JsonValue>;
|
|
297
|
+
readonly web3_clientVersion: RpcMethodSpec<readonly [], string>;
|
|
298
|
+
readonly web3_sha3: RpcMethodSpec<readonly [data: Hex], Hex>;
|
|
299
|
+
}
|
|
300
|
+
interface EthereumSubscriptionSchema {
|
|
301
|
+
readonly eth_subscribe: RpcMethodSpec<readonly [subscription: string, ...options: readonly unknown[]], string>;
|
|
302
|
+
readonly eth_unsubscribe: RpcMethodSpec<readonly [subscriptionId: string], boolean>;
|
|
303
|
+
}
|
|
304
|
+
declare const ETHEREUM_RPC_METHODS: readonly ["eth_accounts", "eth_baseFee", "eth_blobBaseFee", "eth_blockNumber", "eth_call", "eth_callMany", "eth_capabilities", "eth_chainId", "eth_createAccessList", "eth_estimateGas", "eth_feeHistory", "eth_gasPrice", "eth_getAccount", "eth_getBalance", "eth_getBlockByHash", "eth_getBlockByNumber", "eth_getBlockReceipts", "eth_getBlockTransactionCountByHash", "eth_getBlockTransactionCountByNumber", "eth_getCode", "eth_getFilterChanges", "eth_getFilterLogs", "eth_getLogs", "eth_getProof", "eth_getRawTransactionByHash", "eth_getStorageAt", "eth_getTransactionByBlockHashAndIndex", "eth_getTransactionByBlockNumberAndIndex", "eth_getTransactionByHash", "eth_getTransactionBySenderAndNonce", "eth_getTransactionCount", "eth_getTransactionReceipt", "eth_getUncleCountByBlockHash", "eth_getUncleCountByBlockNumber", "eth_maxPriorityFeePerGas", "eth_newBlockFilter", "eth_newFilter", "eth_newPendingTransactionFilter", "eth_sendRawTransaction", "eth_signTransaction", "eth_simulateV1", "eth_submitWork", "eth_syncing", "eth_uninstallFilter", "net_listening", "net_peerCount", "net_version", "txpool_content", "txpool_contentFrom", "txpool_inspect", "txpool_status", "web3_clientVersion", "web3_sha3"];
|
|
305
|
+
declare const ETHEREUM_SUBSCRIPTION_METHODS: readonly ["eth_subscribe", "eth_unsubscribe"];
|
|
306
|
+
interface EthereumClient {
|
|
307
|
+
readonly rpc: RpcNamespace<EthereumRpcSchema>;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
type SolanaCommitment = 'confirmed' | 'finalized' | 'processed';
|
|
311
|
+
type SolanaEncoding = 'base58' | 'base64' | 'base64+zstd' | 'jsonParsed';
|
|
312
|
+
type SolanaConfig = Readonly<Record<string, unknown>>;
|
|
313
|
+
interface SolanaContext {
|
|
314
|
+
readonly apiVersion?: string;
|
|
315
|
+
readonly slot: number;
|
|
316
|
+
}
|
|
317
|
+
interface SolanaContextResult<TValue> {
|
|
318
|
+
readonly context: SolanaContext;
|
|
319
|
+
readonly value: TValue;
|
|
320
|
+
}
|
|
321
|
+
interface PriorityFeeEstimate {
|
|
322
|
+
readonly priorityFeeEstimate: number;
|
|
323
|
+
readonly [key: string]: unknown;
|
|
324
|
+
}
|
|
325
|
+
interface SolanaRpcSchema {
|
|
326
|
+
readonly getAccountInfo: RpcMethodSpec<readonly [address: string, config?: SolanaConfig], SolanaContextResult<JsonValue | null>>;
|
|
327
|
+
readonly getBalance: RpcMethodSpec<readonly [address: string, config?: SolanaConfig], SolanaContextResult<number>>;
|
|
328
|
+
readonly getBlock: RpcMethodSpec<readonly [slot: number, config?: SolanaConfig], JsonValue | null>;
|
|
329
|
+
readonly getBlockCommitment: RpcMethodSpec<readonly [slot: number], JsonValue>;
|
|
330
|
+
readonly getBlockHeight: RpcMethodSpec<readonly [config?: SolanaConfig], number>;
|
|
331
|
+
readonly getBlockProduction: RpcMethodSpec<readonly [config?: SolanaConfig], JsonValue>;
|
|
332
|
+
readonly getBlockTime: RpcMethodSpec<readonly [slot: number], number | null>;
|
|
333
|
+
readonly getBlocks: RpcMethodSpec<readonly [startSlot: number, endSlot?: number, commitment?: SolanaCommitment], readonly number[]>;
|
|
334
|
+
readonly getBlocksWithLimit: RpcMethodSpec<readonly [startSlot: number, limit: number, commitment?: SolanaCommitment], readonly number[]>;
|
|
335
|
+
readonly getClusterNodes: RpcMethodSpec<readonly [], JsonValue>;
|
|
336
|
+
readonly getEpochInfo: RpcMethodSpec<readonly [config?: SolanaConfig], JsonValue>;
|
|
337
|
+
readonly getEpochSchedule: RpcMethodSpec<readonly [], JsonValue>;
|
|
338
|
+
readonly getFeeForMessage: RpcMethodSpec<readonly [message: string, config?: SolanaConfig], SolanaContextResult<number | null>>;
|
|
339
|
+
readonly getFirstAvailableBlock: RpcMethodSpec<readonly [], number>;
|
|
340
|
+
readonly getGenesisHash: RpcMethodSpec<readonly [], string>;
|
|
341
|
+
readonly getHealth: RpcMethodSpec<readonly [], string>;
|
|
342
|
+
readonly getHighestSnapshotSlot: RpcMethodSpec<readonly [], JsonValue>;
|
|
343
|
+
readonly getIdentity: RpcMethodSpec<readonly [], JsonValue>;
|
|
344
|
+
readonly getInflationGovernor: RpcMethodSpec<readonly [config?: SolanaConfig], JsonValue>;
|
|
345
|
+
readonly getInflationRate: RpcMethodSpec<readonly [], JsonValue>;
|
|
346
|
+
readonly getInflationReward: RpcMethodSpec<readonly [addresses: readonly string[], config?: SolanaConfig], JsonValue>;
|
|
347
|
+
readonly getLargestAccounts: RpcMethodSpec<readonly [config?: SolanaConfig], JsonValue>;
|
|
348
|
+
readonly getLatestBlockhash: RpcMethodSpec<readonly [config?: SolanaConfig], JsonValue>;
|
|
349
|
+
readonly getLeaderSchedule: RpcMethodSpec<readonly [slot?: number | null, config?: SolanaConfig], JsonValue | null>;
|
|
350
|
+
readonly getMaxRetransmitSlot: RpcMethodSpec<readonly [], number>;
|
|
351
|
+
readonly getMaxShredInsertSlot: RpcMethodSpec<readonly [], number>;
|
|
352
|
+
readonly getMinimumBalanceForRentExemption: RpcMethodSpec<readonly [dataLength: number, config?: SolanaConfig], number>;
|
|
353
|
+
readonly getMultipleAccounts: RpcMethodSpec<readonly [addresses: readonly string[], config?: SolanaConfig], SolanaContextResult<JsonValue>>;
|
|
354
|
+
readonly getParsedTransaction: RpcMethodSpec<readonly [signature: string, config?: SolanaConfig], JsonValue | null>;
|
|
355
|
+
readonly getPriorityFeeEstimate: RpcMethodSpec<readonly [request: SolanaConfig], PriorityFeeEstimate>;
|
|
356
|
+
readonly getProgramAccounts: RpcMethodSpec<readonly [programAddress: string, config?: SolanaConfig], JsonValue>;
|
|
357
|
+
readonly getProgramAccountsV2: RpcMethodSpec<readonly [programAddress: string, config: SolanaConfig], JsonValue>;
|
|
358
|
+
readonly getRecentPerformanceSamples: RpcMethodSpec<readonly [limit?: number], JsonValue>;
|
|
359
|
+
readonly getRecentPrioritizationFees: RpcMethodSpec<readonly [addresses?: readonly string[]], JsonValue>;
|
|
360
|
+
readonly getSignatureStatuses: RpcMethodSpec<readonly [signatures: readonly string[], config?: SolanaConfig], JsonValue>;
|
|
361
|
+
readonly getSignaturesForAddress: RpcMethodSpec<readonly [address: string, config?: SolanaConfig], JsonValue>;
|
|
362
|
+
readonly getSlot: RpcMethodSpec<readonly [config?: SolanaConfig], number>;
|
|
363
|
+
readonly getSlotLeader: RpcMethodSpec<readonly [config?: SolanaConfig], string>;
|
|
364
|
+
readonly getSlotLeaders: RpcMethodSpec<readonly [startSlot: number, limit: number], readonly string[]>;
|
|
365
|
+
readonly getStakeMinimumDelegation: RpcMethodSpec<readonly [config?: SolanaConfig], SolanaContextResult<number>>;
|
|
366
|
+
readonly getSupply: RpcMethodSpec<readonly [config?: SolanaConfig], JsonValue>;
|
|
367
|
+
readonly getTokenAccountBalance: RpcMethodSpec<readonly [address: string, config?: SolanaConfig], JsonValue>;
|
|
368
|
+
readonly getTokenAccountsByDelegate: RpcMethodSpec<readonly [delegate: string, filter: SolanaConfig, config?: SolanaConfig], JsonValue>;
|
|
369
|
+
readonly getTokenAccountsByOwner: RpcMethodSpec<readonly [owner: string, filter: SolanaConfig, config?: SolanaConfig], JsonValue>;
|
|
370
|
+
readonly getTokenLargestAccounts: RpcMethodSpec<readonly [mint: string, config?: SolanaConfig], JsonValue>;
|
|
371
|
+
readonly getTokenSupply: RpcMethodSpec<readonly [mint: string, config?: SolanaConfig], JsonValue>;
|
|
372
|
+
readonly getTransaction: RpcMethodSpec<readonly [signature: string, config?: SolanaConfig], JsonValue | null>;
|
|
373
|
+
readonly getTransactionCount: RpcMethodSpec<readonly [config?: SolanaConfig], number>;
|
|
374
|
+
readonly getVersion: RpcMethodSpec<readonly [], JsonObject>;
|
|
375
|
+
readonly getVoteAccounts: RpcMethodSpec<readonly [config?: SolanaConfig], JsonValue>;
|
|
376
|
+
readonly isBlockhashValid: RpcMethodSpec<readonly [blockhash: string, config?: SolanaConfig], SolanaContextResult<boolean>>;
|
|
377
|
+
readonly minimumLedgerSlot: RpcMethodSpec<readonly [], number>;
|
|
378
|
+
readonly requestAirdrop: RpcMethodSpec<readonly [address: string, lamports: number, config?: SolanaConfig], string>;
|
|
379
|
+
readonly sendTransaction: RpcMethodSpec<readonly [transaction: string, config?: SolanaConfig], string>;
|
|
380
|
+
readonly simulateTransaction: RpcMethodSpec<readonly [transaction: string, config?: SolanaConfig], JsonValue>;
|
|
381
|
+
}
|
|
382
|
+
interface AssetRequest {
|
|
383
|
+
readonly id: string;
|
|
384
|
+
readonly displayOptions?: Readonly<Record<string, boolean>>;
|
|
385
|
+
}
|
|
386
|
+
interface AssetBatchRequest {
|
|
387
|
+
readonly ids: readonly string[];
|
|
388
|
+
readonly displayOptions?: Readonly<Record<string, boolean>>;
|
|
389
|
+
}
|
|
390
|
+
interface AssetListRequest {
|
|
391
|
+
readonly cursor?: string;
|
|
392
|
+
readonly limit?: number;
|
|
393
|
+
readonly page?: number;
|
|
394
|
+
readonly [key: string]: unknown;
|
|
395
|
+
}
|
|
396
|
+
type IndexedAsset = Readonly<Record<string, unknown>>;
|
|
397
|
+
type IndexedAssetProof = Readonly<Record<string, unknown>>;
|
|
398
|
+
interface IndexedAssetList<TItem = IndexedAsset> {
|
|
399
|
+
readonly cursor?: string;
|
|
400
|
+
readonly items: readonly TItem[];
|
|
401
|
+
readonly limit?: number;
|
|
402
|
+
readonly page?: number;
|
|
403
|
+
readonly total?: number;
|
|
404
|
+
readonly [key: string]: unknown;
|
|
405
|
+
}
|
|
406
|
+
interface SolanaDasSchema {
|
|
407
|
+
readonly getAsset: RpcMethodSpec<AssetRequest, IndexedAsset | null>;
|
|
408
|
+
readonly getAssetBatch: RpcMethodSpec<AssetBatchRequest, readonly (IndexedAsset | null)[]>;
|
|
409
|
+
readonly getAssetProof: RpcMethodSpec<AssetRequest, IndexedAssetProof | null>;
|
|
410
|
+
readonly getAssetProofBatch: RpcMethodSpec<AssetBatchRequest, readonly (IndexedAssetProof | null)[]>;
|
|
411
|
+
readonly getAssetsByAuthority: RpcMethodSpec<AssetListRequest & {
|
|
412
|
+
readonly authorityAddress: string;
|
|
413
|
+
}, IndexedAssetList>;
|
|
414
|
+
readonly getAssetsByCreator: RpcMethodSpec<AssetListRequest & {
|
|
415
|
+
readonly creatorAddress: string;
|
|
416
|
+
readonly onlyVerified?: boolean;
|
|
417
|
+
}, IndexedAssetList>;
|
|
418
|
+
readonly getAssetsByGroup: RpcMethodSpec<AssetListRequest & {
|
|
419
|
+
readonly groupKey: string;
|
|
420
|
+
readonly groupValue: string;
|
|
421
|
+
}, IndexedAssetList>;
|
|
422
|
+
readonly getAssetsByOwner: RpcMethodSpec<AssetListRequest & {
|
|
423
|
+
readonly ownerAddress: string;
|
|
424
|
+
}, IndexedAssetList>;
|
|
425
|
+
readonly getNftEditions: RpcMethodSpec<AssetListRequest & {
|
|
426
|
+
readonly mint: string;
|
|
427
|
+
}, Readonly<Record<string, unknown>>>;
|
|
428
|
+
readonly getSignaturesForAsset: RpcMethodSpec<AssetListRequest & {
|
|
429
|
+
readonly id: string;
|
|
430
|
+
}, Readonly<Record<string, unknown>>>;
|
|
431
|
+
readonly getTokenAccounts: RpcMethodSpec<AssetListRequest, Readonly<Record<string, unknown>>>;
|
|
432
|
+
readonly getTokensByDelegate: RpcMethodSpec<AssetListRequest & {
|
|
433
|
+
readonly delegate: string;
|
|
434
|
+
}, Readonly<Record<string, unknown>>>;
|
|
435
|
+
readonly getTokensByOwner: RpcMethodSpec<AssetListRequest & {
|
|
436
|
+
readonly owner: string;
|
|
437
|
+
}, Readonly<Record<string, unknown>>>;
|
|
438
|
+
readonly searchAssets: RpcMethodSpec<AssetListRequest, IndexedAssetList>;
|
|
439
|
+
}
|
|
440
|
+
interface NumericFilter {
|
|
441
|
+
readonly eq?: number;
|
|
442
|
+
readonly gt?: number;
|
|
443
|
+
readonly gte?: number;
|
|
444
|
+
readonly lt?: number;
|
|
445
|
+
readonly lte?: number;
|
|
446
|
+
}
|
|
447
|
+
interface AddressTransactionsOptions {
|
|
448
|
+
readonly before?: string;
|
|
449
|
+
readonly commitment?: SolanaCommitment;
|
|
450
|
+
readonly encoding?: 'base58' | 'base64' | 'json';
|
|
451
|
+
readonly filters?: Readonly<Record<string, unknown>>;
|
|
452
|
+
readonly limit?: number;
|
|
453
|
+
readonly maxSupportedTransactionVersion?: number;
|
|
454
|
+
readonly paginationToken?: string;
|
|
455
|
+
readonly sortOrder?: 'asc' | 'desc';
|
|
456
|
+
readonly transactionDetails?: 'full' | 'signatures';
|
|
457
|
+
readonly until?: string;
|
|
458
|
+
}
|
|
459
|
+
interface AddressTransaction {
|
|
460
|
+
readonly blockTime: number | null;
|
|
461
|
+
readonly confirmationStatus: SolanaCommitment;
|
|
462
|
+
readonly err: unknown;
|
|
463
|
+
readonly memo: string | null;
|
|
464
|
+
readonly meta?: unknown;
|
|
465
|
+
readonly signature: string;
|
|
466
|
+
readonly slot: number;
|
|
467
|
+
readonly transaction?: unknown;
|
|
468
|
+
readonly transactionIndex: number;
|
|
469
|
+
readonly version?: unknown;
|
|
470
|
+
readonly [key: string]: unknown;
|
|
471
|
+
}
|
|
472
|
+
interface AddressTransactionPage {
|
|
473
|
+
readonly data: readonly AddressTransaction[];
|
|
474
|
+
readonly paginationToken: string | null;
|
|
475
|
+
readonly windowStart: number | null;
|
|
476
|
+
}
|
|
477
|
+
interface AddressTransfersOptions {
|
|
478
|
+
readonly commitment?: SolanaCommitment;
|
|
479
|
+
readonly direction?: 'any' | 'in' | 'out';
|
|
480
|
+
readonly filters?: {
|
|
481
|
+
readonly amount?: NumericFilter;
|
|
482
|
+
readonly blockTime?: NumericFilter;
|
|
483
|
+
readonly slot?: NumericFilter;
|
|
484
|
+
};
|
|
485
|
+
readonly limit?: number;
|
|
486
|
+
readonly mint?: string;
|
|
487
|
+
readonly paginationToken?: string;
|
|
488
|
+
readonly solMode?: 'merged' | 'separate';
|
|
489
|
+
readonly sortOrder?: 'asc' | 'desc';
|
|
490
|
+
readonly with?: string;
|
|
491
|
+
}
|
|
492
|
+
interface AddressTransfer {
|
|
493
|
+
readonly amount: string;
|
|
494
|
+
readonly blockTime: number | null;
|
|
495
|
+
readonly confirmationStatus: 'finalized';
|
|
496
|
+
readonly decimals: number;
|
|
497
|
+
readonly feeAmount: string | null;
|
|
498
|
+
readonly feeUiAmount: string | null;
|
|
499
|
+
readonly fromTokenAccount: string | null;
|
|
500
|
+
readonly fromUserAccount: string | null;
|
|
501
|
+
readonly innerInstructionIdx: number;
|
|
502
|
+
readonly instructionIdx: number;
|
|
503
|
+
readonly mint: string | null;
|
|
504
|
+
readonly signature: string;
|
|
505
|
+
readonly slot: number;
|
|
506
|
+
readonly toTokenAccount: string | null;
|
|
507
|
+
readonly toUserAccount: string | null;
|
|
508
|
+
readonly transactionIdx: number;
|
|
509
|
+
readonly type: 'burn' | 'changeOwner' | 'mint' | 'transfer' | 'unwrap' | 'withdrawWithheldFee' | 'wrap';
|
|
510
|
+
readonly uiAmount: string;
|
|
511
|
+
readonly [key: string]: unknown;
|
|
512
|
+
}
|
|
513
|
+
interface AddressTransferPage {
|
|
514
|
+
readonly data: readonly AddressTransfer[];
|
|
515
|
+
readonly paginationToken: string | null;
|
|
516
|
+
readonly windowStart: number | null;
|
|
517
|
+
}
|
|
518
|
+
interface SolanaHistorySchema {
|
|
519
|
+
readonly getTransactionsForAddress: RpcMethodSpec<readonly [address: string, options?: AddressTransactionsOptions], AddressTransactionPage | null>;
|
|
520
|
+
readonly getTransfersByAddress: RpcMethodSpec<readonly [address: string, options?: AddressTransfersOptions], AddressTransferPage>;
|
|
521
|
+
}
|
|
522
|
+
interface PingMeasurement {
|
|
523
|
+
readonly city: string | null;
|
|
524
|
+
readonly country: string | null;
|
|
525
|
+
readonly fromIp: string | null;
|
|
526
|
+
readonly icmpReplied: boolean;
|
|
527
|
+
readonly lat: number | null;
|
|
528
|
+
readonly lon: number | null;
|
|
529
|
+
readonly measuredAt: string | null;
|
|
530
|
+
readonly ms: number | null;
|
|
531
|
+
readonly org: string | null;
|
|
532
|
+
readonly postal: string | null;
|
|
533
|
+
readonly region: string | null;
|
|
534
|
+
readonly timezone: string | null;
|
|
535
|
+
readonly [key: string]: unknown;
|
|
536
|
+
}
|
|
537
|
+
interface LeaderSlot {
|
|
538
|
+
readonly epoch: number;
|
|
539
|
+
readonly featureSet: string | null;
|
|
540
|
+
readonly gossipPort: number | null;
|
|
541
|
+
readonly gossipUpdatedAt: string | null;
|
|
542
|
+
readonly identity: string;
|
|
543
|
+
readonly ipAddress: string | null;
|
|
544
|
+
readonly leaderCity: string | null;
|
|
545
|
+
readonly leaderCountry: string | null;
|
|
546
|
+
readonly leaderLat: number | null;
|
|
547
|
+
readonly leaderLon: number | null;
|
|
548
|
+
readonly leaderOrg: string | null;
|
|
549
|
+
readonly leaderRegion: string | null;
|
|
550
|
+
readonly leaderTimezone: string | null;
|
|
551
|
+
readonly pingToLeaders: readonly PingMeasurement[];
|
|
552
|
+
readonly rpcAddress: string | null;
|
|
553
|
+
readonly slot: string;
|
|
554
|
+
readonly stakeWeight: number;
|
|
555
|
+
readonly tpuPort: number | null;
|
|
556
|
+
readonly tpuQuicPort: number | null;
|
|
557
|
+
readonly version: string | null;
|
|
558
|
+
readonly [key: string]: unknown;
|
|
559
|
+
}
|
|
560
|
+
interface LeaderSlotsResult {
|
|
561
|
+
readonly data: readonly LeaderSlot[];
|
|
562
|
+
readonly message: string;
|
|
563
|
+
readonly success: boolean;
|
|
564
|
+
readonly total: number;
|
|
565
|
+
readonly [key: string]: unknown;
|
|
566
|
+
}
|
|
567
|
+
interface ValidatorInformation extends Omit<LeaderSlot, 'epoch' | 'slot'> {
|
|
568
|
+
readonly gossipNodeId: number | null;
|
|
569
|
+
readonly slotCount: number;
|
|
570
|
+
}
|
|
571
|
+
interface ValidatorsInformationOptions {
|
|
572
|
+
readonly country?: string;
|
|
573
|
+
readonly limit?: number;
|
|
574
|
+
readonly region?: string;
|
|
575
|
+
}
|
|
576
|
+
interface ValidatorsInformationResult {
|
|
577
|
+
readonly data: readonly ValidatorInformation[];
|
|
578
|
+
readonly epoch: number;
|
|
579
|
+
readonly message: string;
|
|
580
|
+
readonly success: boolean;
|
|
581
|
+
readonly total: number;
|
|
582
|
+
readonly totalValidators: number;
|
|
583
|
+
readonly [key: string]: unknown;
|
|
584
|
+
}
|
|
585
|
+
interface SolanaLeaderSchema {
|
|
586
|
+
readonly getLeaderSlots: RpcMethodSpec<readonly [slot: number], LeaderSlotsResult>;
|
|
587
|
+
readonly getValidatorsInformation: RpcMethodSpec<readonly [options: ValidatorsInformationOptions], ValidatorsInformationResult>;
|
|
588
|
+
}
|
|
589
|
+
type AnalyticsTimeBound = number | string;
|
|
590
|
+
interface TopProgramsOptions {
|
|
591
|
+
readonly includeVotes?: boolean;
|
|
592
|
+
readonly limit?: number;
|
|
593
|
+
readonly since?: AnalyticsTimeBound;
|
|
594
|
+
readonly until?: AnalyticsTimeBound;
|
|
595
|
+
}
|
|
596
|
+
interface TopProgramRow {
|
|
597
|
+
readonly errors: string;
|
|
598
|
+
readonly invocations: string;
|
|
599
|
+
readonly program: string;
|
|
600
|
+
readonly total_cus: string;
|
|
601
|
+
readonly [key: string]: unknown;
|
|
602
|
+
}
|
|
603
|
+
type SlotStatsOptions = {
|
|
604
|
+
readonly slot: number;
|
|
605
|
+
} | {
|
|
606
|
+
readonly fromSlot: number;
|
|
607
|
+
readonly toSlot: number;
|
|
608
|
+
};
|
|
609
|
+
interface SlotStatsRow {
|
|
610
|
+
readonly block_time: number;
|
|
611
|
+
readonly non_vote_transaction_count: number;
|
|
612
|
+
readonly slot: number;
|
|
613
|
+
readonly transaction_count: number;
|
|
614
|
+
readonly vote_transaction_count: number;
|
|
615
|
+
readonly [key: string]: unknown;
|
|
616
|
+
}
|
|
617
|
+
interface TpsTimeseriesOptions {
|
|
618
|
+
readonly bucketSec?: number;
|
|
619
|
+
readonly from: AnalyticsTimeBound;
|
|
620
|
+
readonly to: AnalyticsTimeBound;
|
|
621
|
+
}
|
|
622
|
+
interface TpsBucket {
|
|
623
|
+
readonly bucket: number;
|
|
624
|
+
readonly non_vote_tps: number;
|
|
625
|
+
readonly total_tps: number;
|
|
626
|
+
readonly [key: string]: unknown;
|
|
627
|
+
}
|
|
628
|
+
interface EpochSummary {
|
|
629
|
+
readonly distinct_programs: string;
|
|
630
|
+
readonly epoch: number;
|
|
631
|
+
readonly first_block_time: number;
|
|
632
|
+
readonly last_block_time: number;
|
|
633
|
+
readonly non_vote_txs: string;
|
|
634
|
+
readonly program_invocations: string;
|
|
635
|
+
readonly slots: string;
|
|
636
|
+
readonly total_txs: string;
|
|
637
|
+
readonly vote_txs: string;
|
|
638
|
+
readonly [key: string]: unknown;
|
|
639
|
+
}
|
|
640
|
+
interface ProgramStatsOptions {
|
|
641
|
+
readonly bucketSec?: number;
|
|
642
|
+
readonly programIdBase58: string;
|
|
643
|
+
readonly since?: AnalyticsTimeBound;
|
|
644
|
+
readonly until?: AnalyticsTimeBound;
|
|
645
|
+
}
|
|
646
|
+
interface ProgramStatsBucket {
|
|
647
|
+
readonly bucket: number;
|
|
648
|
+
readonly errors: string;
|
|
649
|
+
readonly invocations: string;
|
|
650
|
+
readonly total_cus: string;
|
|
651
|
+
readonly [key: string]: unknown;
|
|
652
|
+
}
|
|
653
|
+
interface SolanaAnalyticsSchema {
|
|
654
|
+
readonly jetEpochSummary: RpcMethodSpec<readonly [options: {
|
|
655
|
+
readonly epoch: number;
|
|
656
|
+
}], EpochSummary | null>;
|
|
657
|
+
readonly jetProgramStats: RpcMethodSpec<readonly [options: ProgramStatsOptions], readonly ProgramStatsBucket[]>;
|
|
658
|
+
readonly jetSlotStats: RpcMethodSpec<readonly [options: SlotStatsOptions], readonly SlotStatsRow[]>;
|
|
659
|
+
readonly jetTopPrograms: RpcMethodSpec<readonly [options: TopProgramsOptions], readonly TopProgramRow[]>;
|
|
660
|
+
readonly jetTpsTimeseries: RpcMethodSpec<readonly [options: TpsTimeseriesOptions], readonly TpsBucket[]>;
|
|
661
|
+
}
|
|
662
|
+
declare const SOLANA_RPC_METHODS: readonly ["getAccountInfo", "getBalance", "getBlock", "getBlockCommitment", "getBlockHeight", "getBlockProduction", "getBlockTime", "getBlocks", "getBlocksWithLimit", "getClusterNodes", "getEpochInfo", "getEpochSchedule", "getFeeForMessage", "getFirstAvailableBlock", "getGenesisHash", "getHealth", "getHighestSnapshotSlot", "getIdentity", "getInflationGovernor", "getInflationRate", "getInflationReward", "getLargestAccounts", "getLatestBlockhash", "getLeaderSchedule", "getMaxRetransmitSlot", "getMaxShredInsertSlot", "getMinimumBalanceForRentExemption", "getMultipleAccounts", "getParsedTransaction", "getPriorityFeeEstimate", "getProgramAccounts", "getProgramAccountsV2", "getRecentPerformanceSamples", "getRecentPrioritizationFees", "getSignatureStatuses", "getSignaturesForAddress", "getSlot", "getSlotLeader", "getSlotLeaders", "getStakeMinimumDelegation", "getSupply", "getTokenAccountBalance", "getTokenAccountsByDelegate", "getTokenAccountsByOwner", "getTokenLargestAccounts", "getTokenSupply", "getTransaction", "getTransactionCount", "getVersion", "getVoteAccounts", "isBlockhashValid", "minimumLedgerSlot", "requestAirdrop", "sendTransaction", "simulateTransaction"];
|
|
663
|
+
declare const SOLANA_DAS_METHODS: readonly ["getAsset", "getAssetBatch", "getAssetProof", "getAssetProofBatch", "getAssetsByAuthority", "getAssetsByCreator", "getAssetsByGroup", "getAssetsByOwner", "getNftEditions", "getSignaturesForAsset", "getTokenAccounts", "getTokensByDelegate", "getTokensByOwner", "searchAssets"];
|
|
664
|
+
declare const SOLANA_HISTORY_METHODS: readonly ["getTransactionsForAddress", "getTransfersByAddress"];
|
|
665
|
+
declare const SOLANA_LEADER_METHODS: readonly ["getLeaderSlots", "getValidatorsInformation"];
|
|
666
|
+
declare const SOLANA_ANALYTICS_METHODS: readonly ["jetEpochSummary", "jetProgramStats", "jetSlotStats", "jetTopPrograms", "jetTpsTimeseries"];
|
|
667
|
+
interface SolanaClient {
|
|
668
|
+
readonly analytics: RpcNamespace<SolanaAnalyticsSchema>;
|
|
669
|
+
readonly das: RpcNamespace<SolanaDasSchema>;
|
|
670
|
+
readonly history: RpcNamespace<SolanaHistorySchema>;
|
|
671
|
+
readonly leaders: RpcNamespace<SolanaLeaderSchema>;
|
|
672
|
+
readonly rpc: RpcNamespace<SolanaRpcSchema>;
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
interface RpcNotification {
|
|
676
|
+
readonly jsonrpc: '2.0';
|
|
677
|
+
readonly method: string;
|
|
678
|
+
readonly params: unknown;
|
|
679
|
+
}
|
|
680
|
+
type RpcNotificationListener = (notification: RpcNotification) => void;
|
|
681
|
+
interface WebSocketTransportConfig {
|
|
682
|
+
readonly endpoint: URL;
|
|
683
|
+
readonly maxBatchSize?: number;
|
|
684
|
+
readonly timeoutMs: number;
|
|
685
|
+
readonly webSocket?: typeof globalThis.WebSocket;
|
|
686
|
+
}
|
|
687
|
+
declare class WebSocketJsonRpcTransport implements JsonRpcTransport {
|
|
688
|
+
#private;
|
|
689
|
+
readonly endpoint: string;
|
|
690
|
+
readonly maxBatchSize: number;
|
|
691
|
+
constructor(config: WebSocketTransportConfig);
|
|
692
|
+
connect(): Promise<void>;
|
|
693
|
+
close(code?: number, reason?: string): void;
|
|
694
|
+
onNotification(listener: RpcNotificationListener): () => void;
|
|
695
|
+
request<TResult>(method: string, params?: JsonRpcParams, options?: RpcSendOptions): Promise<TResult>;
|
|
696
|
+
batch<TResult extends readonly unknown[]>(calls: readonly RpcBatchCall[], options?: RpcSendOptions): Promise<TResult>;
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
type SubscriptionId = number | string;
|
|
700
|
+
type SubscriptionListener<TResult> = (result: TResult) => void;
|
|
701
|
+
declare class RpcSubscription<TId extends SubscriptionId = SubscriptionId> {
|
|
702
|
+
#private;
|
|
703
|
+
readonly id: TId;
|
|
704
|
+
constructor(id: TId, unsubscribe: () => Promise<boolean>);
|
|
705
|
+
unsubscribe(): Promise<boolean>;
|
|
706
|
+
}
|
|
707
|
+
declare class EthereumSubscriptions {
|
|
708
|
+
#private;
|
|
709
|
+
readonly rpc: RpcNamespace<EthereumSubscriptionSchema>;
|
|
710
|
+
constructor(transport: WebSocketJsonRpcTransport);
|
|
711
|
+
close(): void;
|
|
712
|
+
onNotification(listener: RpcNotificationListener): () => void;
|
|
713
|
+
subscribe<TResult = unknown>(subscription: string, listener: SubscriptionListener<TResult>, ...options: readonly unknown[]): Promise<RpcSubscription<string>>;
|
|
714
|
+
}
|
|
715
|
+
interface SolanaEnhancedSubscriptionSchema {
|
|
716
|
+
readonly accountSubscribe: RpcMethodSpec<readonly [address: string, options?: Readonly<Record<string, unknown>>], number>;
|
|
717
|
+
readonly accountUnsubscribe: RpcMethodSpec<readonly [subscriptionId: number], boolean>;
|
|
718
|
+
readonly transactionSubscribe: RpcMethodSpec<readonly [
|
|
719
|
+
filter: Readonly<Record<string, unknown>>,
|
|
720
|
+
options?: Readonly<Record<string, unknown>>
|
|
721
|
+
], number>;
|
|
722
|
+
readonly transactionUnsubscribe: RpcMethodSpec<readonly [subscriptionId: number], boolean>;
|
|
723
|
+
}
|
|
724
|
+
declare const SOLANA_ENHANCED_SUBSCRIPTION_METHODS: readonly ["accountSubscribe", "accountUnsubscribe", "transactionSubscribe", "transactionUnsubscribe"];
|
|
725
|
+
declare class SolanaSubscriptions {
|
|
726
|
+
#private;
|
|
727
|
+
readonly rpc: RpcNamespace<SolanaEnhancedSubscriptionSchema>;
|
|
728
|
+
constructor(transport: WebSocketJsonRpcTransport);
|
|
729
|
+
close(): void;
|
|
730
|
+
onNotification(listener: RpcNotificationListener): () => void;
|
|
731
|
+
accountSubscribe<TResult = unknown>(address: string, listener: SubscriptionListener<TResult>, options?: Readonly<Record<string, unknown>>): Promise<RpcSubscription<number>>;
|
|
732
|
+
transactionSubscribe<TResult = unknown>(filter: Readonly<Record<string, unknown>>, listener: SubscriptionListener<TResult>, options?: Readonly<Record<string, unknown>>): Promise<RpcSubscription<number>>;
|
|
733
|
+
rawSubscribe<TResult = unknown>(subscribeMethod: string, params: readonly unknown[], unsubscribeMethod: string, listener: SubscriptionListener<TResult>): Promise<RpcSubscription>;
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
interface ErpcSolanaClient extends SolanaClient {
|
|
737
|
+
readonly subscriptions: SolanaSubscriptions;
|
|
738
|
+
}
|
|
739
|
+
interface ErpcEthereumClient extends EthereumClient {
|
|
740
|
+
readonly subscriptions: EthereumSubscriptions;
|
|
741
|
+
}
|
|
742
|
+
interface ErpcClient {
|
|
743
|
+
readonly account: AccountClient;
|
|
744
|
+
readonly ethereum: ErpcEthereumClient;
|
|
745
|
+
readonly price: PriceClient;
|
|
746
|
+
readonly solana: ErpcSolanaClient;
|
|
747
|
+
close(): void;
|
|
748
|
+
}
|
|
749
|
+
declare const createErpcClient: (config: ErpcClientConfig) => ErpcClient;
|
|
750
|
+
|
|
751
|
+
type ErpcErrorCode = 'ERPC_ABORTED' | 'ERPC_BATCH_POLICY' | 'ERPC_CONFIG' | 'ERPC_HTTP' | 'ERPC_INVALID_RESPONSE' | 'ERPC_RPC' | 'ERPC_TIMEOUT' | 'ERPC_TRANSPORT';
|
|
752
|
+
declare class ErpcError extends Error {
|
|
753
|
+
readonly code: ErpcErrorCode;
|
|
754
|
+
constructor(code: ErpcErrorCode, message: string, options?: ErrorOptions);
|
|
755
|
+
}
|
|
756
|
+
declare class ErpcConfigError extends ErpcError {
|
|
757
|
+
constructor(message: string);
|
|
758
|
+
}
|
|
759
|
+
declare class ErpcTransportError extends ErpcError {
|
|
760
|
+
constructor(message: string, options?: ErrorOptions);
|
|
761
|
+
}
|
|
762
|
+
declare class ErpcHttpError extends ErpcError {
|
|
763
|
+
readonly status: number;
|
|
764
|
+
constructor(status: number, message?: string);
|
|
765
|
+
}
|
|
766
|
+
declare class ErpcTimeoutError extends ErpcError {
|
|
767
|
+
readonly timeoutMs: number;
|
|
768
|
+
constructor(timeoutMs: number);
|
|
769
|
+
}
|
|
770
|
+
declare class ErpcAbortedError extends ErpcError {
|
|
771
|
+
constructor();
|
|
772
|
+
}
|
|
773
|
+
declare class ErpcInvalidResponseError extends ErpcError {
|
|
774
|
+
constructor(message?: string);
|
|
775
|
+
}
|
|
776
|
+
declare class ErpcJsonRpcError extends ErpcError {
|
|
777
|
+
readonly rpcCode: number;
|
|
778
|
+
readonly data?: unknown;
|
|
779
|
+
constructor(error: JsonRpcErrorObject);
|
|
780
|
+
}
|
|
781
|
+
declare class ErpcBatchPolicyError extends ErpcError {
|
|
782
|
+
constructor(message: string);
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
export { AccountClient, type AddressTransaction, type AddressTransactionPage, type AddressTransactionsOptions, type AddressTransfer, type AddressTransferPage, type AddressTransfersOptions, type AnalyticsTimeBound, type AssetBatchRequest, type AssetListRequest, type AssetRequest, type BinaryUpdate, DEFAULT_ACCOUNT_ENDPOINT, DEFAULT_ENDPOINT, DEFAULT_TIMEOUT_MS, ETHEREUM_RPC_METHODS, ETHEREUM_SUBSCRIPTION_METHODS, type EpochSummary, ErpcAbortedError, ErpcBatchPolicyError, type ErpcClient, type ErpcClientConfig, ErpcConfigError, ErpcError, type ErpcErrorCode, type ErpcEthereumClient, ErpcHttpError, ErpcInvalidResponseError, ErpcJsonRpcError, type ErpcPlan, type ErpcSolanaClient, ErpcTimeoutError, ErpcTransportError, type EthereumAddress, type EthereumBlockTag, type EthereumClient, type EthereumFilter, type EthereumObject, type EthereumRpcSchema, type EthereumSubscriptionSchema, EthereumSubscriptions, type EthereumTransactionRequest, type Hex, type IndexedAsset, type IndexedAssetList, type IndexedAssetProof, type JsonObject, type JsonPrimitive, type JsonRpcErrorObject, type JsonRpcFailure, type JsonRpcId, type JsonRpcParams, type JsonRpcRequest, type JsonRpcResponse, type JsonRpcSuccess, type JsonRpcTransport, type JsonValue, type LeaderSlot, type LeaderSlotsResult, type NumericFilter, type ParsedPriceUpdate, PendingRpcBatchRequest, PendingRpcRequest, type PingMeasurement, type PriceAssetType, PriceClient, type PriceEncoding, type PriceFeedMetadata, type PricePoint, type PriceStreamEvent, type PriceStreamOptions, type PriceUpdateOptions, type PriceUpdateResponse, type PriorityFeeEstimate, type ProgramStatsBucket, type ProgramStatsOptions, type PublisherStakeCap, type PublisherStakeCapsResponse, type RpcBatchCall, type RpcMethodSpec, type RpcNamespace, type RpcNamespaceBase, type RpcNotification, type RpcNotificationListener, type RpcParams, type RpcResult, type RpcSendOptions, RpcSubscription, SOLANA_ANALYTICS_METHODS, SOLANA_DAS_METHODS, SOLANA_ENHANCED_SUBSCRIPTION_METHODS, SOLANA_HISTORY_METHODS, SOLANA_LEADER_METHODS, SOLANA_RPC_METHODS, type SlotStatsOptions, type SlotStatsRow, type SolanaAnalyticsSchema, type SolanaClient, type SolanaCommitment, type SolanaConfig, type SolanaContext, type SolanaContextResult, type SolanaDasSchema, type SolanaEncoding, type SolanaEnhancedSubscriptionSchema, type SolanaHistorySchema, type SolanaLeaderSchema, type SolanaRpcSchema, SolanaSubscriptions, type SubscriptionId, type SubscriptionListener, type TokenBalance, type TopProgramRow, type TopProgramsOptions, type TpsBucket, type TpsTimeseriesOptions, type ValidatorInformation, type ValidatorsInformationOptions, type ValidatorsInformationResult, createErpcClient };
|