@psalomo/jsonrpc-client 1.1.0 → 1.3.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/README.md +69 -19
- package/dist/browser-standalone.js +1010 -68
- package/dist/browser-standalone.min.js +1 -1
- package/dist/chunk-GCIU6ZLN.mjs +395 -0
- package/dist/convenience-5WSFl5pu.d.mts +440 -0
- package/dist/convenience-5WSFl5pu.d.ts +440 -0
- package/dist/convenience.d.ts +9 -1
- package/dist/convenience.d.ts.map +1 -1
- package/dist/generated-types.d.ts +229 -1
- package/dist/generated-types.d.ts.map +1 -1
- package/dist/index.d.mts +137 -172
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +626 -51
- package/dist/index.mjs +673 -340
- package/dist/no-validation/index.d.mts +6 -0
- package/dist/no-validation/index.d.ts +9 -0
- package/dist/no-validation/index.d.ts.map +1 -0
- package/dist/no-validation/index.js +471 -0
- package/dist/no-validation/index.mjs +95 -0
- package/dist/validated/index.d.ts +168 -0
- package/dist/validated/index.d.ts.map +1 -0
- package/package.json +7 -2
@@ -0,0 +1,440 @@
|
|
1
|
+
import { RpcStateChangesInBlockByTypeRequest, RpcStateChangesInBlockResponse, RpcStateChangesInBlockRequest, RpcStateChangesInBlockByTypeResponse, RpcCongestionLevelRequest, RpcCongestionLevelResponse, GenesisConfigRequest, GenesisConfig, RpcLightClientBlockProofRequest, RpcLightClientBlockProofResponse, RpcLightClientExecutionProofRequest, RpcLightClientExecutionProofResponse, RpcMaintenanceWindowsRequest, EXPERIMENTALMaintenanceWindowsResponse, RpcProtocolConfigRequest, RpcProtocolConfigResponse, RpcReceiptRequest, RpcReceiptResponse, RpcSplitStorageInfoRequest, RpcSplitStorageInfoResponse, RpcTransactionStatusRequest, RpcTransactionResponse, RpcValidatorsOrderedRequest, EXPERIMENTALValidatorsOrderedResponse, RpcBlockRequest, RpcBlockResponse, RpcSendTransactionRequest, CryptoHash, RpcChunkRequest, RpcChunkResponse, RpcClientConfigRequest, RpcClientConfigResponse, RpcGasPriceRequest, RpcGasPriceResponse, RpcHealthRequest, RpcHealthResponse, MaintenanceWindowsResponse, RpcNetworkInfoRequest, RpcNetworkInfoResponse, RpcLightClientNextBlockRequest, RpcLightClientNextBlockResponse, RpcQueryRequest, RpcQueryResponse, RpcStatusRequest, RpcStatusResponse, RpcValidatorRequest, RpcValidatorResponse, AccountView, CallResult, AccessKeyView } from '@psalomo/jsonrpc-types';
|
2
|
+
|
3
|
+
interface ValidationResult {
|
4
|
+
validateRequest: (request: JsonRpcRequest) => void;
|
5
|
+
validateResponse: (response: JsonRpcResponse) => void;
|
6
|
+
validateMethodRequest?: (method: string, request: JsonRpcRequest) => void;
|
7
|
+
validateMethodResponse?: (method: string, response: JsonRpcResponse) => void;
|
8
|
+
}
|
9
|
+
/**
|
10
|
+
* Enable validation for the client
|
11
|
+
* This function should only be called if you want to include schema validation
|
12
|
+
* Calling this function will include Zod schemas in your bundle
|
13
|
+
*/
|
14
|
+
declare function enableValidation(): ValidationResult;
|
15
|
+
|
16
|
+
interface ClientConfig {
|
17
|
+
endpoint: string;
|
18
|
+
headers?: Record<string, string>;
|
19
|
+
timeout?: number;
|
20
|
+
retries?: number;
|
21
|
+
validation?: ValidationResult;
|
22
|
+
}
|
23
|
+
interface JsonRpcRequest<T = unknown> {
|
24
|
+
jsonrpc: '2.0';
|
25
|
+
id: string;
|
26
|
+
method: string;
|
27
|
+
params?: T;
|
28
|
+
}
|
29
|
+
interface JsonRpcResponse<T = unknown> {
|
30
|
+
jsonrpc: '2.0';
|
31
|
+
id: string;
|
32
|
+
result?: T;
|
33
|
+
error?: JsonRpcError;
|
34
|
+
}
|
35
|
+
interface JsonRpcError {
|
36
|
+
code: number;
|
37
|
+
message: string;
|
38
|
+
data?: unknown;
|
39
|
+
}
|
40
|
+
declare class JsonRpcClientError extends Error {
|
41
|
+
code?: number | undefined;
|
42
|
+
data?: unknown | undefined;
|
43
|
+
constructor(message: string, code?: number | undefined, data?: unknown | undefined);
|
44
|
+
}
|
45
|
+
declare class JsonRpcNetworkError extends Error {
|
46
|
+
originalError?: Error | undefined;
|
47
|
+
responseBody?: unknown | undefined;
|
48
|
+
constructor(message: string, originalError?: Error | undefined, responseBody?: unknown | undefined);
|
49
|
+
}
|
50
|
+
/**
|
51
|
+
* NEAR RPC Client with static function architecture
|
52
|
+
* This client only holds configuration and provides a makeRequest method
|
53
|
+
* Individual RPC methods are provided as standalone functions that take this client as a parameter
|
54
|
+
*/
|
55
|
+
declare class NearRpcClient {
|
56
|
+
readonly endpoint: string;
|
57
|
+
readonly headers: Record<string, string>;
|
58
|
+
readonly timeout: number;
|
59
|
+
readonly retries: number;
|
60
|
+
private readonly validation;
|
61
|
+
constructor(config: string | ClientConfig);
|
62
|
+
/**
|
63
|
+
* Make a raw JSON-RPC request
|
64
|
+
* This is used internally by the standalone RPC functions
|
65
|
+
*/
|
66
|
+
makeRequest<TParams = unknown, TResult = unknown>(method: string, params?: TParams): Promise<TResult>;
|
67
|
+
/**
|
68
|
+
* Create a new client with modified configuration
|
69
|
+
*/
|
70
|
+
withConfig(config: Partial<ClientConfig>): NearRpcClient;
|
71
|
+
}
|
72
|
+
declare const defaultClient: NearRpcClient;
|
73
|
+
|
74
|
+
interface RpcRequest {
|
75
|
+
jsonrpc: '2.0';
|
76
|
+
id: string | number;
|
77
|
+
method: string;
|
78
|
+
params: unknown;
|
79
|
+
}
|
80
|
+
interface RpcResponse<T = unknown> {
|
81
|
+
jsonrpc: '2.0';
|
82
|
+
id: string | number;
|
83
|
+
result?: T;
|
84
|
+
error?: RpcError;
|
85
|
+
}
|
86
|
+
interface RpcError {
|
87
|
+
code: number;
|
88
|
+
message: string;
|
89
|
+
data?: unknown;
|
90
|
+
}
|
91
|
+
declare class NearRpcError extends Error {
|
92
|
+
code: number;
|
93
|
+
data?: unknown | undefined;
|
94
|
+
constructor(code: number, message: string, data?: unknown | undefined);
|
95
|
+
}
|
96
|
+
|
97
|
+
interface DynamicRpcMethods {
|
98
|
+
/**
|
99
|
+
* [Deprecated] Returns changes for a given account, contract or contract code
|
100
|
+
* for given block height or hash. Consider using changes instead.
|
101
|
+
*/
|
102
|
+
experimentalChanges(params?: RpcStateChangesInBlockByTypeRequest): Promise<RpcStateChangesInBlockResponse>;
|
103
|
+
/**
|
104
|
+
* [Deprecated] Returns changes in block for given block height or hash over
|
105
|
+
* all transactions for all the types. Includes changes like account_touched,
|
106
|
+
* access_key_touched, data_touched, contract_code_touched. Consider using
|
107
|
+
* block_effects instead
|
108
|
+
*/
|
109
|
+
experimentalChangesInBlock(params?: RpcStateChangesInBlockRequest): Promise<RpcStateChangesInBlockByTypeResponse>;
|
110
|
+
/**
|
111
|
+
* Queries the congestion level of a shard. More info about congestion
|
112
|
+
* [here](https://near.github.io/nearcore/architecture/how/receipt-congestion.html?highlight=congestion#receipt-congestion)
|
113
|
+
*/
|
114
|
+
experimentalCongestionLevel(params?: RpcCongestionLevelRequest): Promise<RpcCongestionLevelResponse>;
|
115
|
+
/**
|
116
|
+
* [Deprecated] Get initial state and parameters for the genesis block.
|
117
|
+
* Consider genesis_config instead.
|
118
|
+
*/
|
119
|
+
experimentalGenesisConfig(params?: GenesisConfigRequest): Promise<GenesisConfig>;
|
120
|
+
/** Returns the proofs for a transaction execution. */
|
121
|
+
experimentalLightClientBlockProof(params?: RpcLightClientBlockProofRequest): Promise<RpcLightClientBlockProofResponse>;
|
122
|
+
/** Returns the proofs for a transaction execution. */
|
123
|
+
experimentalLightClientProof(params?: RpcLightClientExecutionProofRequest): Promise<RpcLightClientExecutionProofResponse>;
|
124
|
+
/**
|
125
|
+
* [Deprecated] Returns the future windows for maintenance in current epoch
|
126
|
+
* for the specified account. In the maintenance windows, the node will not be
|
127
|
+
* block producer or chunk producer. Consider using maintenance_windows
|
128
|
+
* instead.
|
129
|
+
*/
|
130
|
+
experimentalMaintenanceWindows(params?: RpcMaintenanceWindowsRequest): Promise<EXPERIMENTALMaintenanceWindowsResponse>;
|
131
|
+
/**
|
132
|
+
* A configuration that defines the protocol-level parameters such as
|
133
|
+
* gas/storage costs, limits, feature flags, other settings
|
134
|
+
*/
|
135
|
+
experimentalProtocolConfig(params?: RpcProtocolConfigRequest): Promise<RpcProtocolConfigResponse>;
|
136
|
+
/** Fetches a receipt by its ID (as is, without a status or execution outcome) */
|
137
|
+
experimentalReceipt(params?: RpcReceiptRequest): Promise<RpcReceiptResponse>;
|
138
|
+
/**
|
139
|
+
* Contains the split storage information. More info on split storage
|
140
|
+
* [here](https://near-nodes.io/archival/split-storage-archival)
|
141
|
+
*/
|
142
|
+
experimentalSplitStorageInfo(params?: RpcSplitStorageInfoRequest): Promise<RpcSplitStorageInfoResponse>;
|
143
|
+
/**
|
144
|
+
* Queries status of a transaction by hash, returning the final transaction
|
145
|
+
* result and details of all receipts.
|
146
|
+
*/
|
147
|
+
experimentalTxStatus(params?: RpcTransactionStatusRequest): Promise<RpcTransactionResponse>;
|
148
|
+
/**
|
149
|
+
* Returns the current epoch validators ordered in the block producer order
|
150
|
+
* with repetition. This endpoint is solely used for bridge currently and is
|
151
|
+
* not intended for other external use cases.
|
152
|
+
*/
|
153
|
+
experimentalValidatorsOrdered(params?: RpcValidatorsOrderedRequest): Promise<EXPERIMENTALValidatorsOrderedResponse>;
|
154
|
+
/** Returns block details for given height or hash */
|
155
|
+
block(params?: RpcBlockRequest): Promise<RpcBlockResponse>;
|
156
|
+
/**
|
157
|
+
* Returns changes in block for given block height or hash over all
|
158
|
+
* transactions for all the types. Includes changes like account_touched,
|
159
|
+
* access_key_touched, data_touched, contract_code_touched.
|
160
|
+
*/
|
161
|
+
blockEffects(params?: RpcStateChangesInBlockRequest): Promise<RpcStateChangesInBlockByTypeResponse>;
|
162
|
+
/**
|
163
|
+
* [Deprecated] Sends a transaction and immediately returns transaction hash.
|
164
|
+
* Consider using send_tx instead.
|
165
|
+
*/
|
166
|
+
broadcastTxAsync(params?: RpcSendTransactionRequest): Promise<CryptoHash>;
|
167
|
+
/**
|
168
|
+
* [Deprecated] Sends a transaction and waits until transaction is fully
|
169
|
+
* complete. (Has a 10 second timeout). Consider using send_tx instead.
|
170
|
+
*/
|
171
|
+
broadcastTxCommit(params?: RpcSendTransactionRequest): Promise<RpcTransactionResponse>;
|
172
|
+
/**
|
173
|
+
* Returns changes for a given account, contract or contract code for given
|
174
|
+
* block height or hash.
|
175
|
+
*/
|
176
|
+
changes(params?: RpcStateChangesInBlockByTypeRequest): Promise<RpcStateChangesInBlockResponse>;
|
177
|
+
/**
|
178
|
+
* Returns details of a specific chunk. You can run a block details query to
|
179
|
+
* get a valid chunk hash.
|
180
|
+
*/
|
181
|
+
chunk(params?: RpcChunkRequest): Promise<RpcChunkResponse>;
|
182
|
+
/** Queries client node configuration */
|
183
|
+
clientConfig(params?: RpcClientConfigRequest): Promise<RpcClientConfigResponse>;
|
184
|
+
/**
|
185
|
+
* Returns gas price for a specific block_height or block_hash. Using [null]
|
186
|
+
* will return the most recent block's gas price.
|
187
|
+
*/
|
188
|
+
gasPrice(params?: RpcGasPriceRequest): Promise<RpcGasPriceResponse>;
|
189
|
+
/** Get initial state and parameters for the genesis block */
|
190
|
+
genesisConfig(params?: GenesisConfigRequest): Promise<GenesisConfig>;
|
191
|
+
/** Returns the current health status of the RPC node the client connects to. */
|
192
|
+
health(params?: RpcHealthRequest): Promise<RpcHealthResponse>;
|
193
|
+
/** Returns the proofs for a transaction execution. */
|
194
|
+
lightClientProof(params?: RpcLightClientExecutionProofRequest): Promise<RpcLightClientExecutionProofResponse>;
|
195
|
+
/**
|
196
|
+
* Returns the future windows for maintenance in current epoch for the
|
197
|
+
* specified account. In the maintenance windows, the node will not be block
|
198
|
+
* producer or chunk producer.
|
199
|
+
*/
|
200
|
+
maintenanceWindows(params?: RpcMaintenanceWindowsRequest): Promise<MaintenanceWindowsResponse>;
|
201
|
+
/**
|
202
|
+
* Queries the current state of node network connections. This includes
|
203
|
+
* information about active peers, transmitted data, known producers, etc.
|
204
|
+
*/
|
205
|
+
networkInfo(params?: RpcNetworkInfoRequest): Promise<RpcNetworkInfoResponse>;
|
206
|
+
/** Returns the next light client block. */
|
207
|
+
nextLightClientBlock(params?: RpcLightClientNextBlockRequest): Promise<RpcLightClientNextBlockResponse>;
|
208
|
+
/**
|
209
|
+
* This module allows you to make generic requests to the network. The
|
210
|
+
* `RpcQueryRequest` struct takes in a
|
211
|
+
* [`BlockReference`](https://docs.rs/near-primitives/0.12.0/near_primitives/types/enum.BlockReference.html)
|
212
|
+
* and a
|
213
|
+
* [`QueryRequest`](https://docs.rs/near-primitives/0.12.0/near_primitives/views/enum.QueryRequest.html).
|
214
|
+
* The `BlockReference` enum allows you to specify a block by `Finality`,
|
215
|
+
* `BlockId` or `SyncCheckpoint`. The `QueryRequest` enum provides multiple
|
216
|
+
* variants for performing the following actions: - View an account's details
|
217
|
+
* - View a contract's code - View the state of an account - View the
|
218
|
+
* `AccessKey` of an account - View the `AccessKeyList` of an account - Call a
|
219
|
+
* function in a contract deployed on the network.
|
220
|
+
*/
|
221
|
+
query(params?: RpcQueryRequest): Promise<RpcQueryResponse>;
|
222
|
+
/**
|
223
|
+
* Sends transaction. Returns the guaranteed execution status and the results
|
224
|
+
* the blockchain can provide at the moment.
|
225
|
+
*/
|
226
|
+
sendTx(params?: RpcSendTransactionRequest): Promise<RpcTransactionResponse>;
|
227
|
+
/**
|
228
|
+
* Requests the status of the connected RPC node. This includes information
|
229
|
+
* about sync status, nearcore node version, protocol version, the current set
|
230
|
+
* of validators, etc.
|
231
|
+
*/
|
232
|
+
status(params?: RpcStatusRequest): Promise<RpcStatusResponse>;
|
233
|
+
/**
|
234
|
+
* Queries status of a transaction by hash and returns the final transaction
|
235
|
+
* result.
|
236
|
+
*/
|
237
|
+
tx(params?: RpcTransactionStatusRequest): Promise<RpcTransactionResponse>;
|
238
|
+
/**
|
239
|
+
* Queries active validators on the network. Returns details and the state of
|
240
|
+
* validation on the blockchain.
|
241
|
+
*/
|
242
|
+
validators(params?: RpcValidatorRequest): Promise<RpcValidatorResponse>;
|
243
|
+
}
|
244
|
+
interface ConvenienceMethods {
|
245
|
+
viewAccount(params: {
|
246
|
+
accountId: string;
|
247
|
+
finality?: 'final' | 'near-final' | 'optimistic';
|
248
|
+
blockId?: string | number;
|
249
|
+
}): Promise<AccountView>;
|
250
|
+
viewFunction(params: {
|
251
|
+
accountId: string;
|
252
|
+
methodName: string;
|
253
|
+
argsBase64?: string;
|
254
|
+
finality?: 'final' | 'near-final' | 'optimistic';
|
255
|
+
blockId?: string | number;
|
256
|
+
}): Promise<CallResult>;
|
257
|
+
viewAccessKey(params: {
|
258
|
+
accountId: string;
|
259
|
+
publicKey: string;
|
260
|
+
finality?: 'final' | 'near-final' | 'optimistic';
|
261
|
+
blockId?: string | number;
|
262
|
+
}): Promise<AccessKeyView>;
|
263
|
+
}
|
264
|
+
interface CompleteClientInterface extends DynamicRpcMethods, ConvenienceMethods {
|
265
|
+
call<TParams = unknown, TResult = unknown>(method: string, params?: TParams): Promise<TResult>;
|
266
|
+
}
|
267
|
+
/**
|
268
|
+
* [Deprecated] Returns changes for a given account, contract or contract code
|
269
|
+
* for given block height or hash. Consider using changes instead.
|
270
|
+
*/
|
271
|
+
declare function experimentalChanges(client: NearRpcClient, params?: RpcStateChangesInBlockByTypeRequest): Promise<RpcStateChangesInBlockResponse>;
|
272
|
+
/**
|
273
|
+
* [Deprecated] Returns changes in block for given block height or hash over
|
274
|
+
* all transactions for all the types. Includes changes like account_touched,
|
275
|
+
* access_key_touched, data_touched, contract_code_touched. Consider using
|
276
|
+
* block_effects instead
|
277
|
+
*/
|
278
|
+
declare function experimentalChangesInBlock(client: NearRpcClient, params?: RpcStateChangesInBlockRequest): Promise<RpcStateChangesInBlockByTypeResponse>;
|
279
|
+
/**
|
280
|
+
* Queries the congestion level of a shard. More info about congestion
|
281
|
+
* [here](https://near.github.io/nearcore/architecture/how/receipt-congestion.html?highlight=congestion#receipt-congestion)
|
282
|
+
*/
|
283
|
+
declare function experimentalCongestionLevel(client: NearRpcClient, params?: RpcCongestionLevelRequest): Promise<RpcCongestionLevelResponse>;
|
284
|
+
/**
|
285
|
+
* [Deprecated] Get initial state and parameters for the genesis block.
|
286
|
+
* Consider genesis_config instead.
|
287
|
+
*/
|
288
|
+
declare function experimentalGenesisConfig(client: NearRpcClient, params?: GenesisConfigRequest): Promise<GenesisConfig>;
|
289
|
+
/** Returns the proofs for a transaction execution. */
|
290
|
+
declare function experimentalLightClientBlockProof(client: NearRpcClient, params?: RpcLightClientBlockProofRequest): Promise<RpcLightClientBlockProofResponse>;
|
291
|
+
/** Returns the proofs for a transaction execution. */
|
292
|
+
declare function experimentalLightClientProof(client: NearRpcClient, params?: RpcLightClientExecutionProofRequest): Promise<RpcLightClientExecutionProofResponse>;
|
293
|
+
/**
|
294
|
+
* [Deprecated] Returns the future windows for maintenance in current epoch
|
295
|
+
* for the specified account. In the maintenance windows, the node will not be
|
296
|
+
* block producer or chunk producer. Consider using maintenance_windows
|
297
|
+
* instead.
|
298
|
+
*/
|
299
|
+
declare function experimentalMaintenanceWindows(client: NearRpcClient, params?: RpcMaintenanceWindowsRequest): Promise<EXPERIMENTALMaintenanceWindowsResponse>;
|
300
|
+
/**
|
301
|
+
* A configuration that defines the protocol-level parameters such as
|
302
|
+
* gas/storage costs, limits, feature flags, other settings
|
303
|
+
*/
|
304
|
+
declare function experimentalProtocolConfig(client: NearRpcClient, params?: RpcProtocolConfigRequest): Promise<RpcProtocolConfigResponse>;
|
305
|
+
/** Fetches a receipt by its ID (as is, without a status or execution outcome) */
|
306
|
+
declare function experimentalReceipt(client: NearRpcClient, params?: RpcReceiptRequest): Promise<RpcReceiptResponse>;
|
307
|
+
/**
|
308
|
+
* Contains the split storage information. More info on split storage
|
309
|
+
* [here](https://near-nodes.io/archival/split-storage-archival)
|
310
|
+
*/
|
311
|
+
declare function experimentalSplitStorageInfo(client: NearRpcClient, params?: RpcSplitStorageInfoRequest): Promise<RpcSplitStorageInfoResponse>;
|
312
|
+
/**
|
313
|
+
* Queries status of a transaction by hash, returning the final transaction
|
314
|
+
* result and details of all receipts.
|
315
|
+
*/
|
316
|
+
declare function experimentalTxStatus(client: NearRpcClient, params?: RpcTransactionStatusRequest): Promise<RpcTransactionResponse>;
|
317
|
+
/**
|
318
|
+
* Returns the current epoch validators ordered in the block producer order
|
319
|
+
* with repetition. This endpoint is solely used for bridge currently and is
|
320
|
+
* not intended for other external use cases.
|
321
|
+
*/
|
322
|
+
declare function experimentalValidatorsOrdered(client: NearRpcClient, params?: RpcValidatorsOrderedRequest): Promise<EXPERIMENTALValidatorsOrderedResponse>;
|
323
|
+
/** Returns block details for given height or hash */
|
324
|
+
declare function block(client: NearRpcClient, params?: RpcBlockRequest): Promise<RpcBlockResponse>;
|
325
|
+
/**
|
326
|
+
* Returns changes in block for given block height or hash over all
|
327
|
+
* transactions for all the types. Includes changes like account_touched,
|
328
|
+
* access_key_touched, data_touched, contract_code_touched.
|
329
|
+
*/
|
330
|
+
declare function blockEffects(client: NearRpcClient, params?: RpcStateChangesInBlockRequest): Promise<RpcStateChangesInBlockByTypeResponse>;
|
331
|
+
/**
|
332
|
+
* [Deprecated] Sends a transaction and immediately returns transaction hash.
|
333
|
+
* Consider using send_tx instead.
|
334
|
+
*/
|
335
|
+
declare function broadcastTxAsync(client: NearRpcClient, params?: RpcSendTransactionRequest): Promise<CryptoHash>;
|
336
|
+
/**
|
337
|
+
* [Deprecated] Sends a transaction and waits until transaction is fully
|
338
|
+
* complete. (Has a 10 second timeout). Consider using send_tx instead.
|
339
|
+
*/
|
340
|
+
declare function broadcastTxCommit(client: NearRpcClient, params?: RpcSendTransactionRequest): Promise<RpcTransactionResponse>;
|
341
|
+
/**
|
342
|
+
* Returns changes for a given account, contract or contract code for given
|
343
|
+
* block height or hash.
|
344
|
+
*/
|
345
|
+
declare function changes(client: NearRpcClient, params?: RpcStateChangesInBlockByTypeRequest): Promise<RpcStateChangesInBlockResponse>;
|
346
|
+
/**
|
347
|
+
* Returns details of a specific chunk. You can run a block details query to
|
348
|
+
* get a valid chunk hash.
|
349
|
+
*/
|
350
|
+
declare function chunk(client: NearRpcClient, params?: RpcChunkRequest): Promise<RpcChunkResponse>;
|
351
|
+
/** Queries client node configuration */
|
352
|
+
declare function clientConfig(client: NearRpcClient, params?: RpcClientConfigRequest): Promise<RpcClientConfigResponse>;
|
353
|
+
/**
|
354
|
+
* Returns gas price for a specific block_height or block_hash. Using [null]
|
355
|
+
* will return the most recent block's gas price.
|
356
|
+
*/
|
357
|
+
declare function gasPrice(client: NearRpcClient, params?: RpcGasPriceRequest): Promise<RpcGasPriceResponse>;
|
358
|
+
/** Get initial state and parameters for the genesis block */
|
359
|
+
declare function genesisConfig(client: NearRpcClient, params?: GenesisConfigRequest): Promise<GenesisConfig>;
|
360
|
+
/** Returns the current health status of the RPC node the client connects to. */
|
361
|
+
declare function health(client: NearRpcClient, params?: RpcHealthRequest): Promise<RpcHealthResponse>;
|
362
|
+
/** Returns the proofs for a transaction execution. */
|
363
|
+
declare function lightClientProof(client: NearRpcClient, params?: RpcLightClientExecutionProofRequest): Promise<RpcLightClientExecutionProofResponse>;
|
364
|
+
/**
|
365
|
+
* Returns the future windows for maintenance in current epoch for the
|
366
|
+
* specified account. In the maintenance windows, the node will not be block
|
367
|
+
* producer or chunk producer.
|
368
|
+
*/
|
369
|
+
declare function maintenanceWindows(client: NearRpcClient, params?: RpcMaintenanceWindowsRequest): Promise<MaintenanceWindowsResponse>;
|
370
|
+
/**
|
371
|
+
* Queries the current state of node network connections. This includes
|
372
|
+
* information about active peers, transmitted data, known producers, etc.
|
373
|
+
*/
|
374
|
+
declare function networkInfo(client: NearRpcClient, params?: RpcNetworkInfoRequest): Promise<RpcNetworkInfoResponse>;
|
375
|
+
/** Returns the next light client block. */
|
376
|
+
declare function nextLightClientBlock(client: NearRpcClient, params?: RpcLightClientNextBlockRequest): Promise<RpcLightClientNextBlockResponse>;
|
377
|
+
/**
|
378
|
+
* This module allows you to make generic requests to the network. The
|
379
|
+
* `RpcQueryRequest` struct takes in a
|
380
|
+
* [`BlockReference`](https://docs.rs/near-primitives/0.12.0/near_primitives/types/enum.BlockReference.html)
|
381
|
+
* and a
|
382
|
+
* [`QueryRequest`](https://docs.rs/near-primitives/0.12.0/near_primitives/views/enum.QueryRequest.html).
|
383
|
+
* The `BlockReference` enum allows you to specify a block by `Finality`,
|
384
|
+
* `BlockId` or `SyncCheckpoint`. The `QueryRequest` enum provides multiple
|
385
|
+
* variants for performing the following actions: - View an account's details
|
386
|
+
* - View a contract's code - View the state of an account - View the
|
387
|
+
* `AccessKey` of an account - View the `AccessKeyList` of an account - Call a
|
388
|
+
* function in a contract deployed on the network.
|
389
|
+
*/
|
390
|
+
declare function query(client: NearRpcClient, params?: RpcQueryRequest): Promise<RpcQueryResponse>;
|
391
|
+
/**
|
392
|
+
* Sends transaction. Returns the guaranteed execution status and the results
|
393
|
+
* the blockchain can provide at the moment.
|
394
|
+
*/
|
395
|
+
declare function sendTx(client: NearRpcClient, params?: RpcSendTransactionRequest): Promise<RpcTransactionResponse>;
|
396
|
+
/**
|
397
|
+
* Requests the status of the connected RPC node. This includes information
|
398
|
+
* about sync status, nearcore node version, protocol version, the current set
|
399
|
+
* of validators, etc.
|
400
|
+
*/
|
401
|
+
declare function status(client: NearRpcClient, params?: RpcStatusRequest): Promise<RpcStatusResponse>;
|
402
|
+
/**
|
403
|
+
* Queries status of a transaction by hash and returns the final transaction
|
404
|
+
* result.
|
405
|
+
*/
|
406
|
+
declare function tx(client: NearRpcClient, params?: RpcTransactionStatusRequest): Promise<RpcTransactionResponse>;
|
407
|
+
/**
|
408
|
+
* Queries active validators on the network. Returns details and the state of
|
409
|
+
* validation on the blockchain.
|
410
|
+
*/
|
411
|
+
declare function validators(client: NearRpcClient, params?: RpcValidatorRequest): Promise<RpcValidatorResponse>;
|
412
|
+
|
413
|
+
declare function viewAccount(client: NearRpcClient, params: {
|
414
|
+
accountId: string;
|
415
|
+
finality?: 'final' | 'near-final' | 'optimistic';
|
416
|
+
blockId?: string | number;
|
417
|
+
}): Promise<AccountView>;
|
418
|
+
declare function viewFunction(client: NearRpcClient, params: {
|
419
|
+
accountId: string;
|
420
|
+
methodName: string;
|
421
|
+
argsBase64?: string;
|
422
|
+
finality?: 'final' | 'near-final' | 'optimistic';
|
423
|
+
blockId?: string | number;
|
424
|
+
}): Promise<CallResult>;
|
425
|
+
declare function viewAccessKey(client: NearRpcClient, params: {
|
426
|
+
accountId: string;
|
427
|
+
publicKey: string;
|
428
|
+
finality?: 'final' | 'near-final' | 'optimistic';
|
429
|
+
blockId?: string | number;
|
430
|
+
}): Promise<AccessKeyView>;
|
431
|
+
declare function parseCallResultToJson<T = unknown>(callResult: CallResult): T;
|
432
|
+
declare function viewFunctionAsJson<T = unknown>(client: NearRpcClient, params: {
|
433
|
+
accountId: string;
|
434
|
+
methodName: string;
|
435
|
+
argsBase64?: string;
|
436
|
+
finality?: 'final' | 'near-final' | 'optimistic';
|
437
|
+
blockId?: string | number;
|
438
|
+
}): Promise<T>;
|
439
|
+
|
440
|
+
export { blockEffects as A, broadcastTxAsync as B, type ConvenienceMethods as C, type DynamicRpcMethods as D, broadcastTxCommit as E, changes as F, chunk as G, clientConfig as H, gasPrice as I, type JsonRpcRequest as J, genesisConfig as K, health as L, lightClientProof as M, NearRpcClient as N, maintenanceWindows as O, networkInfo as P, nextLightClientBlock as Q, type RpcRequest as R, query as S, sendTx as T, status as U, tx as V, validators as W, viewAccount as X, viewFunction as Y, viewAccessKey as Z, type CompleteClientInterface as a, type ClientConfig as b, type JsonRpcResponse as c, defaultClient as d, enableValidation as e, type JsonRpcError as f, JsonRpcClientError as g, JsonRpcNetworkError as h, type RpcResponse as i, type RpcError as j, NearRpcError as k, experimentalChanges as l, experimentalChangesInBlock as m, experimentalCongestionLevel as n, experimentalGenesisConfig as o, parseCallResultToJson as p, experimentalLightClientBlockProof as q, experimentalLightClientProof as r, experimentalMaintenanceWindows as s, experimentalProtocolConfig as t, experimentalReceipt as u, viewFunctionAsJson as v, experimentalSplitStorageInfo as w, experimentalTxStatus as x, experimentalValidatorsOrdered as y, block as z };
|