@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.
@@ -4890,138 +4890,251 @@ Object.entries(PATH_TO_METHOD_MAP).forEach(([path, method]) => {
4890
4890
  var RPC_METHODS = Object.values(PATH_TO_METHOD_MAP);
4891
4891
 
4892
4892
  // Auto-generated static RPC functions for tree-shaking
4893
- // Generated at: 2025-07-30T06:06:30.752Z
4893
+ // Generated at: 2025-08-03T18:51:29.359Z
4894
4894
  // Total functions: 31
4895
4895
  //
4896
4896
  // This file is automatically generated by tools/codegen/generate-client-interface.ts
4897
4897
  // Do not edit manually - changes will be overwritten
4898
- // EXPERIMENTAL_changes static function
4899
- async function experimentalChanges(client, params) {
4898
+ /**
4899
+ * [Deprecated] Returns changes for a given account, contract or contract code
4900
+ * for given block height or hash. Consider using changes instead.
4901
+ */
4902
+ async function experimentalChanges$1(client, params) {
4900
4903
  return client.makeRequest('EXPERIMENTAL_changes', params);
4901
4904
  }
4902
- // EXPERIMENTAL_changes_in_block static function
4903
- async function experimentalChangesInBlock(client, params) {
4905
+ /**
4906
+ * [Deprecated] Returns changes in block for given block height or hash over
4907
+ * all transactions for all the types. Includes changes like account_touched,
4908
+ * access_key_touched, data_touched, contract_code_touched. Consider using
4909
+ * block_effects instead
4910
+ */
4911
+ async function experimentalChangesInBlock$1(client, params) {
4904
4912
  return client.makeRequest('EXPERIMENTAL_changes_in_block', params);
4905
4913
  }
4906
- // EXPERIMENTAL_congestion_level static function
4907
- async function experimentalCongestionLevel(client, params) {
4914
+ /**
4915
+ * Queries the congestion level of a shard. More info about congestion
4916
+ * [here](https://near.github.io/nearcore/architecture/how/receipt-congestion.html?highlight=congestion#receipt-congestion)
4917
+ */
4918
+ async function experimentalCongestionLevel$1(client, params) {
4908
4919
  return client.makeRequest('EXPERIMENTAL_congestion_level', params);
4909
4920
  }
4910
- // EXPERIMENTAL_genesis_config static function
4911
- async function experimentalGenesisConfig(client, params) {
4921
+ /**
4922
+ * [Deprecated] Get initial state and parameters for the genesis block.
4923
+ * Consider genesis_config instead.
4924
+ */
4925
+ async function experimentalGenesisConfig$1(client, params) {
4912
4926
  return client.makeRequest('EXPERIMENTAL_genesis_config', params);
4913
4927
  }
4914
- // EXPERIMENTAL_light_client_block_proof static function
4915
- async function experimentalLightClientBlockProof(client, params) {
4928
+ /** Returns the proofs for a transaction execution. */
4929
+ async function experimentalLightClientBlockProof$1(client, params) {
4916
4930
  return client.makeRequest('EXPERIMENTAL_light_client_block_proof', params);
4917
4931
  }
4918
- // EXPERIMENTAL_light_client_proof static function
4919
- async function experimentalLightClientProof(client, params) {
4932
+ /** Returns the proofs for a transaction execution. */
4933
+ async function experimentalLightClientProof$1(client, params) {
4920
4934
  return client.makeRequest('EXPERIMENTAL_light_client_proof', params);
4921
4935
  }
4922
- // EXPERIMENTAL_maintenance_windows static function
4923
- async function experimentalMaintenanceWindows(client, params) {
4936
+ /**
4937
+ * [Deprecated] Returns the future windows for maintenance in current epoch
4938
+ * for the specified account. In the maintenance windows, the node will not be
4939
+ * block producer or chunk producer. Consider using maintenance_windows
4940
+ * instead.
4941
+ */
4942
+ async function experimentalMaintenanceWindows$1(client, params) {
4924
4943
  return client.makeRequest('EXPERIMENTAL_maintenance_windows', params);
4925
4944
  }
4926
- // EXPERIMENTAL_protocol_config static function
4927
- async function experimentalProtocolConfig(client, params) {
4945
+ /**
4946
+ * A configuration that defines the protocol-level parameters such as
4947
+ * gas/storage costs, limits, feature flags, other settings
4948
+ */
4949
+ async function experimentalProtocolConfig$1(client, params) {
4928
4950
  return client.makeRequest('EXPERIMENTAL_protocol_config', params);
4929
4951
  }
4930
- // EXPERIMENTAL_receipt static function
4931
- async function experimentalReceipt(client, params) {
4952
+ /** Fetches a receipt by its ID (as is, without a status or execution outcome) */
4953
+ async function experimentalReceipt$1(client, params) {
4932
4954
  return client.makeRequest('EXPERIMENTAL_receipt', params);
4933
4955
  }
4934
- // EXPERIMENTAL_split_storage_info static function
4935
- async function experimentalSplitStorageInfo(client, params) {
4956
+ /**
4957
+ * Contains the split storage information. More info on split storage
4958
+ * [here](https://near-nodes.io/archival/split-storage-archival)
4959
+ */
4960
+ async function experimentalSplitStorageInfo$1(client, params) {
4936
4961
  return client.makeRequest('EXPERIMENTAL_split_storage_info', params);
4937
4962
  }
4938
- // EXPERIMENTAL_tx_status static function
4939
- async function experimentalTxStatus(client, params) {
4963
+ /**
4964
+ * Queries status of a transaction by hash, returning the final transaction
4965
+ * result and details of all receipts.
4966
+ */
4967
+ async function experimentalTxStatus$1(client, params) {
4940
4968
  return client.makeRequest('EXPERIMENTAL_tx_status', params);
4941
4969
  }
4942
- // EXPERIMENTAL_validators_ordered static function
4943
- async function experimentalValidatorsOrdered(client, params) {
4970
+ /**
4971
+ * Returns the current epoch validators ordered in the block producer order
4972
+ * with repetition. This endpoint is solely used for bridge currently and is
4973
+ * not intended for other external use cases.
4974
+ */
4975
+ async function experimentalValidatorsOrdered$1(client, params) {
4944
4976
  return client.makeRequest('EXPERIMENTAL_validators_ordered', params);
4945
4977
  }
4946
- // block static function
4947
- async function block(client, params) {
4978
+ /** Returns block details for given height or hash */
4979
+ async function block$1(client, params) {
4948
4980
  return client.makeRequest('block', params);
4949
4981
  }
4950
- // block_effects static function
4951
- async function blockEffects(client, params) {
4982
+ /**
4983
+ * Returns changes in block for given block height or hash over all
4984
+ * transactions for all the types. Includes changes like account_touched,
4985
+ * access_key_touched, data_touched, contract_code_touched.
4986
+ */
4987
+ async function blockEffects$1(client, params) {
4952
4988
  return client.makeRequest('block_effects', params);
4953
4989
  }
4954
- // broadcast_tx_async static function
4955
- async function broadcastTxAsync(client, params) {
4990
+ /**
4991
+ * [Deprecated] Sends a transaction and immediately returns transaction hash.
4992
+ * Consider using send_tx instead.
4993
+ */
4994
+ async function broadcastTxAsync$1(client, params) {
4956
4995
  return client.makeRequest('broadcast_tx_async', params);
4957
4996
  }
4958
- // broadcast_tx_commit static function
4959
- async function broadcastTxCommit(client, params) {
4997
+ /**
4998
+ * [Deprecated] Sends a transaction and waits until transaction is fully
4999
+ * complete. (Has a 10 second timeout). Consider using send_tx instead.
5000
+ */
5001
+ async function broadcastTxCommit$1(client, params) {
4960
5002
  return client.makeRequest('broadcast_tx_commit', params);
4961
5003
  }
4962
- // changes static function
4963
- async function changes(client, params) {
5004
+ /**
5005
+ * Returns changes for a given account, contract or contract code for given
5006
+ * block height or hash.
5007
+ */
5008
+ async function changes$1(client, params) {
4964
5009
  return client.makeRequest('changes', params);
4965
5010
  }
4966
- // chunk static function
4967
- async function chunk(client, params) {
5011
+ /**
5012
+ * Returns details of a specific chunk. You can run a block details query to
5013
+ * get a valid chunk hash.
5014
+ */
5015
+ async function chunk$1(client, params) {
4968
5016
  return client.makeRequest('chunk', params);
4969
5017
  }
4970
- // client_config static function
4971
- async function clientConfig(client, params) {
5018
+ /** Queries client node configuration */
5019
+ async function clientConfig$1(client, params) {
4972
5020
  return client.makeRequest('client_config', params);
4973
5021
  }
4974
- // gas_price static function
4975
- async function gasPrice(client, params) {
5022
+ /**
5023
+ * Returns gas price for a specific block_height or block_hash. Using [null]
5024
+ * will return the most recent block's gas price.
5025
+ */
5026
+ async function gasPrice$1(client, params) {
4976
5027
  return client.makeRequest('gas_price', params);
4977
5028
  }
4978
- // genesis_config static function
4979
- async function genesisConfig(client, params) {
5029
+ /** Get initial state and parameters for the genesis block */
5030
+ async function genesisConfig$1(client, params) {
4980
5031
  return client.makeRequest('genesis_config', params);
4981
5032
  }
4982
- // health static function
4983
- async function health(client, params) {
5033
+ /** Returns the current health status of the RPC node the client connects to. */
5034
+ async function health$1(client, params) {
4984
5035
  return client.makeRequest('health', params);
4985
5036
  }
4986
- // light_client_proof static function
4987
- async function lightClientProof(client, params) {
5037
+ /** Returns the proofs for a transaction execution. */
5038
+ async function lightClientProof$1(client, params) {
4988
5039
  return client.makeRequest('light_client_proof', params);
4989
5040
  }
4990
- // maintenance_windows static function
4991
- async function maintenanceWindows(client, params) {
5041
+ /**
5042
+ * Returns the future windows for maintenance in current epoch for the
5043
+ * specified account. In the maintenance windows, the node will not be block
5044
+ * producer or chunk producer.
5045
+ */
5046
+ async function maintenanceWindows$1(client, params) {
4992
5047
  return client.makeRequest('maintenance_windows', params);
4993
5048
  }
4994
- // network_info static function
4995
- async function networkInfo(client, params) {
5049
+ /**
5050
+ * Queries the current state of node network connections. This includes
5051
+ * information about active peers, transmitted data, known producers, etc.
5052
+ */
5053
+ async function networkInfo$1(client, params) {
4996
5054
  return client.makeRequest('network_info', params);
4997
5055
  }
4998
- // next_light_client_block static function
4999
- async function nextLightClientBlock(client, params) {
5056
+ /** Returns the next light client block. */
5057
+ async function nextLightClientBlock$1(client, params) {
5000
5058
  return client.makeRequest('next_light_client_block', params);
5001
5059
  }
5002
- // query static function
5003
- async function query(client, params) {
5060
+ /**
5061
+ * This module allows you to make generic requests to the network. The
5062
+ * `RpcQueryRequest` struct takes in a
5063
+ * [`BlockReference`](https://docs.rs/near-primitives/0.12.0/near_primitives/types/enum.BlockReference.html)
5064
+ * and a
5065
+ * [`QueryRequest`](https://docs.rs/near-primitives/0.12.0/near_primitives/views/enum.QueryRequest.html).
5066
+ * The `BlockReference` enum allows you to specify a block by `Finality`,
5067
+ * `BlockId` or `SyncCheckpoint`. The `QueryRequest` enum provides multiple
5068
+ * variants for performing the following actions: - View an account's details
5069
+ * - View a contract's code - View the state of an account - View the
5070
+ * `AccessKey` of an account - View the `AccessKeyList` of an account - Call a
5071
+ * function in a contract deployed on the network.
5072
+ */
5073
+ async function query$1(client, params) {
5004
5074
  return client.makeRequest('query', params);
5005
5075
  }
5006
- // send_tx static function
5007
- async function sendTx(client, params) {
5076
+ /**
5077
+ * Sends transaction. Returns the guaranteed execution status and the results
5078
+ * the blockchain can provide at the moment.
5079
+ */
5080
+ async function sendTx$1(client, params) {
5008
5081
  return client.makeRequest('send_tx', params);
5009
5082
  }
5010
- // status static function
5011
- async function status(client, params) {
5083
+ /**
5084
+ * Requests the status of the connected RPC node. This includes information
5085
+ * about sync status, nearcore node version, protocol version, the current set
5086
+ * of validators, etc.
5087
+ */
5088
+ async function status$1(client, params) {
5012
5089
  return client.makeRequest('status', params);
5013
5090
  }
5014
- // tx static function
5015
- async function tx(client, params) {
5091
+ /**
5092
+ * Queries status of a transaction by hash and returns the final transaction
5093
+ * result.
5094
+ */
5095
+ async function tx$1(client, params) {
5016
5096
  return client.makeRequest('tx', params);
5017
5097
  }
5018
- // validators static function
5019
- async function validators(client, params) {
5098
+ /**
5099
+ * Queries active validators on the network. Returns details and the state of
5100
+ * validation on the blockchain.
5101
+ */
5102
+ async function validators$1(client, params) {
5020
5103
  return client.makeRequest('validators', params);
5021
5104
  }
5022
5105
 
5023
- async function viewAccount(client, params) {
5106
+ async function viewFunction$1(client, params) {
5024
5107
  // Construct query parameters: use blockId if provided, otherwise use finality (default 'final')
5108
+ const baseParams = {
5109
+ requestType: 'call_function',
5110
+ accountId: params.accountId,
5111
+ methodName: params.methodName,
5112
+ argsBase64: params.argsBase64 ?? '', // Default to empty string if no arguments
5113
+ };
5114
+ const queryParams = params.blockId
5115
+ ? { ...baseParams, blockId: params.blockId }
5116
+ : { ...baseParams, finality: params.finality || 'final' };
5117
+ return query$1(client, queryParams);
5118
+ }
5119
+ function parseCallResultToJson(callResult) {
5120
+ const bytes = new Uint8Array(callResult.result);
5121
+ const text = new TextDecoder().decode(bytes);
5122
+ return JSON.parse(text);
5123
+ }
5124
+ async function viewFunctionAsJson(client, params) {
5125
+ const result = await viewFunction$1(client, params);
5126
+ return parseCallResultToJson(result);
5127
+ }
5128
+
5129
+ // Auto-generated validation wrapper functions
5130
+ // Generated at: 2025-08-03T18:51:29.361Z
5131
+ // Total functions: 31
5132
+ //
5133
+ // This file is automatically generated by tools/codegen/generate-validation-wrappers.ts
5134
+ // Do not edit manually - changes will be overwritten
5135
+ // Convenience function wrappers with validation
5136
+ async function viewAccount(client, params) {
5137
+ // Use the validated query function
5025
5138
  const queryParams = params.blockId
5026
5139
  ? {
5027
5140
  requestType: 'view_account',
@@ -5036,12 +5149,12 @@ async function viewAccount(client, params) {
5036
5149
  return query(client, queryParams);
5037
5150
  }
5038
5151
  async function viewFunction(client, params) {
5039
- // Construct query parameters: use blockId if provided, otherwise use finality (default 'final')
5152
+ // Use the validated query function
5040
5153
  const baseParams = {
5041
5154
  requestType: 'call_function',
5042
5155
  accountId: params.accountId,
5043
5156
  methodName: params.methodName,
5044
- argsBase64: params.argsBase64 ?? '', // Default to empty string if no arguments
5157
+ argsBase64: params.argsBase64 ?? '',
5045
5158
  };
5046
5159
  const queryParams = params.blockId
5047
5160
  ? { ...baseParams, blockId: params.blockId }
@@ -5049,7 +5162,7 @@ async function viewFunction(client, params) {
5049
5162
  return query(client, queryParams);
5050
5163
  }
5051
5164
  async function viewAccessKey(client, params) {
5052
- // Construct query parameters: use blockId if provided, otherwise use finality (default 'final')
5165
+ // Use the validated query function
5053
5166
  const queryParams = params.blockId
5054
5167
  ? {
5055
5168
  requestType: 'view_access_key',
@@ -5065,6 +5178,835 @@ async function viewAccessKey(client, params) {
5065
5178
  };
5066
5179
  return query(client, queryParams);
5067
5180
  }
5181
+ // Validation wrapper functions
5182
+ /**
5183
+ * [Deprecated] Returns changes for a given account, contract or contract code
5184
+ * for given block height or hash. Consider using changes instead.
5185
+ */
5186
+ async function experimentalChanges(client, params) {
5187
+ // Validate request parameters
5188
+ const requestSchema = RpcStateChangesInBlockByTypeRequestSchema();
5189
+ if (params !== undefined) {
5190
+ try {
5191
+ requestSchema.parse(params);
5192
+ }
5193
+ catch (error) {
5194
+ throw new Error(`Request validation failed: ${error}`);
5195
+ }
5196
+ }
5197
+ // Call the base function
5198
+ const result = await experimentalChanges$1(client, params);
5199
+ // Validate response
5200
+ const responseSchema = RpcStateChangesInBlockResponseSchema();
5201
+ try {
5202
+ // Wrap in JSON-RPC response format for validation
5203
+ responseSchema.parse(result);
5204
+ }
5205
+ catch (error) {
5206
+ throw new Error(`Response validation failed: ${error}`);
5207
+ }
5208
+ return result;
5209
+ }
5210
+ /**
5211
+ * [Deprecated] Returns changes in block for given block height or hash over
5212
+ * all transactions for all the types. Includes changes like account_touched,
5213
+ * access_key_touched, data_touched, contract_code_touched. Consider using
5214
+ * block_effects instead
5215
+ */
5216
+ async function experimentalChangesInBlock(client, params) {
5217
+ // Validate request parameters
5218
+ const requestSchema = RpcStateChangesInBlockRequestSchema();
5219
+ if (params !== undefined) {
5220
+ try {
5221
+ requestSchema.parse(params);
5222
+ }
5223
+ catch (error) {
5224
+ throw new Error(`Request validation failed: ${error}`);
5225
+ }
5226
+ }
5227
+ // Call the base function
5228
+ const result = await experimentalChangesInBlock$1(client, params);
5229
+ // Validate response
5230
+ const responseSchema = RpcStateChangesInBlockByTypeResponseSchema();
5231
+ try {
5232
+ // Wrap in JSON-RPC response format for validation
5233
+ responseSchema.parse(result);
5234
+ }
5235
+ catch (error) {
5236
+ throw new Error(`Response validation failed: ${error}`);
5237
+ }
5238
+ return result;
5239
+ }
5240
+ /**
5241
+ * Queries the congestion level of a shard. More info about congestion
5242
+ * [here](https://near.github.io/nearcore/architecture/how/receipt-congestion.html?highlight=congestion#receipt-congestion)
5243
+ */
5244
+ async function experimentalCongestionLevel(client, params) {
5245
+ // Validate request parameters
5246
+ const requestSchema = RpcCongestionLevelRequestSchema();
5247
+ if (params !== undefined) {
5248
+ try {
5249
+ requestSchema.parse(params);
5250
+ }
5251
+ catch (error) {
5252
+ throw new Error(`Request validation failed: ${error}`);
5253
+ }
5254
+ }
5255
+ // Call the base function
5256
+ const result = await experimentalCongestionLevel$1(client, params);
5257
+ // Validate response
5258
+ const responseSchema = RpcCongestionLevelResponseSchema();
5259
+ try {
5260
+ // Wrap in JSON-RPC response format for validation
5261
+ responseSchema.parse(result);
5262
+ }
5263
+ catch (error) {
5264
+ throw new Error(`Response validation failed: ${error}`);
5265
+ }
5266
+ return result;
5267
+ }
5268
+ /**
5269
+ * [Deprecated] Get initial state and parameters for the genesis block.
5270
+ * Consider genesis_config instead.
5271
+ */
5272
+ async function experimentalGenesisConfig(client, params) {
5273
+ // Validate request parameters
5274
+ const requestSchema = GenesisConfigRequestSchema();
5275
+ if (params !== undefined) {
5276
+ try {
5277
+ requestSchema.parse(params);
5278
+ }
5279
+ catch (error) {
5280
+ throw new Error(`Request validation failed: ${error}`);
5281
+ }
5282
+ }
5283
+ // Call the base function
5284
+ const result = await experimentalGenesisConfig$1(client, params);
5285
+ // Validate response
5286
+ const responseSchema = GenesisConfigSchema();
5287
+ try {
5288
+ // Wrap in JSON-RPC response format for validation
5289
+ responseSchema.parse(result);
5290
+ }
5291
+ catch (error) {
5292
+ throw new Error(`Response validation failed: ${error}`);
5293
+ }
5294
+ return result;
5295
+ }
5296
+ /** Returns the proofs for a transaction execution. */
5297
+ async function experimentalLightClientBlockProof(client, params) {
5298
+ // Validate request parameters
5299
+ const requestSchema = RpcLightClientBlockProofRequestSchema();
5300
+ if (params !== undefined) {
5301
+ try {
5302
+ requestSchema.parse(params);
5303
+ }
5304
+ catch (error) {
5305
+ throw new Error(`Request validation failed: ${error}`);
5306
+ }
5307
+ }
5308
+ // Call the base function
5309
+ const result = await experimentalLightClientBlockProof$1(client, params);
5310
+ // Validate response
5311
+ const responseSchema = RpcLightClientBlockProofResponseSchema();
5312
+ try {
5313
+ // Wrap in JSON-RPC response format for validation
5314
+ responseSchema.parse(result);
5315
+ }
5316
+ catch (error) {
5317
+ throw new Error(`Response validation failed: ${error}`);
5318
+ }
5319
+ return result;
5320
+ }
5321
+ /** Returns the proofs for a transaction execution. */
5322
+ async function experimentalLightClientProof(client, params) {
5323
+ // Validate request parameters
5324
+ const requestSchema = RpcLightClientExecutionProofRequestSchema();
5325
+ if (params !== undefined) {
5326
+ try {
5327
+ requestSchema.parse(params);
5328
+ }
5329
+ catch (error) {
5330
+ throw new Error(`Request validation failed: ${error}`);
5331
+ }
5332
+ }
5333
+ // Call the base function
5334
+ const result = await experimentalLightClientProof$1(client, params);
5335
+ // Validate response
5336
+ const responseSchema = RpcLightClientExecutionProofResponseSchema();
5337
+ try {
5338
+ // Wrap in JSON-RPC response format for validation
5339
+ responseSchema.parse(result);
5340
+ }
5341
+ catch (error) {
5342
+ throw new Error(`Response validation failed: ${error}`);
5343
+ }
5344
+ return result;
5345
+ }
5346
+ /**
5347
+ * [Deprecated] Returns the future windows for maintenance in current epoch
5348
+ * for the specified account. In the maintenance windows, the node will not be
5349
+ * block producer or chunk producer. Consider using maintenance_windows
5350
+ * instead.
5351
+ */
5352
+ async function experimentalMaintenanceWindows(client, params) {
5353
+ // Validate request parameters
5354
+ const requestSchema = RpcMaintenanceWindowsRequestSchema();
5355
+ if (params !== undefined) {
5356
+ try {
5357
+ requestSchema.parse(params);
5358
+ }
5359
+ catch (error) {
5360
+ throw new Error(`Request validation failed: ${error}`);
5361
+ }
5362
+ }
5363
+ // Call the base function (no response validation needed)
5364
+ return experimentalMaintenanceWindows$1(client, params);
5365
+ }
5366
+ /**
5367
+ * A configuration that defines the protocol-level parameters such as
5368
+ * gas/storage costs, limits, feature flags, other settings
5369
+ */
5370
+ async function experimentalProtocolConfig(client, params) {
5371
+ // Validate request parameters
5372
+ const requestSchema = RpcProtocolConfigRequestSchema();
5373
+ if (params !== undefined) {
5374
+ try {
5375
+ requestSchema.parse(params);
5376
+ }
5377
+ catch (error) {
5378
+ throw new Error(`Request validation failed: ${error}`);
5379
+ }
5380
+ }
5381
+ // Call the base function
5382
+ const result = await experimentalProtocolConfig$1(client, params);
5383
+ // Validate response
5384
+ const responseSchema = RpcProtocolConfigResponseSchema();
5385
+ try {
5386
+ // Wrap in JSON-RPC response format for validation
5387
+ responseSchema.parse(result);
5388
+ }
5389
+ catch (error) {
5390
+ throw new Error(`Response validation failed: ${error}`);
5391
+ }
5392
+ return result;
5393
+ }
5394
+ /** Fetches a receipt by its ID (as is, without a status or execution outcome) */
5395
+ async function experimentalReceipt(client, params) {
5396
+ // Validate request parameters
5397
+ const requestSchema = RpcReceiptRequestSchema();
5398
+ if (params !== undefined) {
5399
+ try {
5400
+ requestSchema.parse(params);
5401
+ }
5402
+ catch (error) {
5403
+ throw new Error(`Request validation failed: ${error}`);
5404
+ }
5405
+ }
5406
+ // Call the base function
5407
+ const result = await experimentalReceipt$1(client, params);
5408
+ // Validate response
5409
+ const responseSchema = RpcReceiptResponseSchema();
5410
+ try {
5411
+ // Wrap in JSON-RPC response format for validation
5412
+ responseSchema.parse(result);
5413
+ }
5414
+ catch (error) {
5415
+ throw new Error(`Response validation failed: ${error}`);
5416
+ }
5417
+ return result;
5418
+ }
5419
+ /**
5420
+ * Contains the split storage information. More info on split storage
5421
+ * [here](https://near-nodes.io/archival/split-storage-archival)
5422
+ */
5423
+ async function experimentalSplitStorageInfo(client, params) {
5424
+ // Validate request parameters
5425
+ const requestSchema = RpcSplitStorageInfoRequestSchema();
5426
+ if (params !== undefined) {
5427
+ try {
5428
+ requestSchema.parse(params);
5429
+ }
5430
+ catch (error) {
5431
+ throw new Error(`Request validation failed: ${error}`);
5432
+ }
5433
+ }
5434
+ // Call the base function
5435
+ const result = await experimentalSplitStorageInfo$1(client, params);
5436
+ // Validate response
5437
+ const responseSchema = RpcSplitStorageInfoResponseSchema();
5438
+ try {
5439
+ // Wrap in JSON-RPC response format for validation
5440
+ responseSchema.parse(result);
5441
+ }
5442
+ catch (error) {
5443
+ throw new Error(`Response validation failed: ${error}`);
5444
+ }
5445
+ return result;
5446
+ }
5447
+ /**
5448
+ * Queries status of a transaction by hash, returning the final transaction
5449
+ * result and details of all receipts.
5450
+ */
5451
+ async function experimentalTxStatus(client, params) {
5452
+ // Validate request parameters
5453
+ const requestSchema = RpcTransactionStatusRequestSchema();
5454
+ if (params !== undefined) {
5455
+ try {
5456
+ requestSchema.parse(params);
5457
+ }
5458
+ catch (error) {
5459
+ throw new Error(`Request validation failed: ${error}`);
5460
+ }
5461
+ }
5462
+ // Call the base function
5463
+ const result = await experimentalTxStatus$1(client, params);
5464
+ // Validate response
5465
+ const responseSchema = RpcTransactionResponseSchema();
5466
+ try {
5467
+ // Wrap in JSON-RPC response format for validation
5468
+ responseSchema.parse(result);
5469
+ }
5470
+ catch (error) {
5471
+ throw new Error(`Response validation failed: ${error}`);
5472
+ }
5473
+ return result;
5474
+ }
5475
+ /**
5476
+ * Returns the current epoch validators ordered in the block producer order
5477
+ * with repetition. This endpoint is solely used for bridge currently and is
5478
+ * not intended for other external use cases.
5479
+ */
5480
+ async function experimentalValidatorsOrdered(client, params) {
5481
+ // Validate request parameters
5482
+ const requestSchema = RpcValidatorsOrderedRequestSchema();
5483
+ if (params !== undefined) {
5484
+ try {
5485
+ requestSchema.parse(params);
5486
+ }
5487
+ catch (error) {
5488
+ throw new Error(`Request validation failed: ${error}`);
5489
+ }
5490
+ }
5491
+ // Call the base function (no response validation needed)
5492
+ return experimentalValidatorsOrdered$1(client, params);
5493
+ }
5494
+ /** Returns block details for given height or hash */
5495
+ async function block(client, params) {
5496
+ // Validate request parameters
5497
+ const requestSchema = RpcBlockRequestSchema();
5498
+ if (params !== undefined) {
5499
+ try {
5500
+ requestSchema.parse(params);
5501
+ }
5502
+ catch (error) {
5503
+ throw new Error(`Request validation failed: ${error}`);
5504
+ }
5505
+ }
5506
+ // Call the base function
5507
+ const result = await block$1(client, params);
5508
+ // Validate response
5509
+ const responseSchema = RpcBlockResponseSchema();
5510
+ try {
5511
+ // Wrap in JSON-RPC response format for validation
5512
+ responseSchema.parse(result);
5513
+ }
5514
+ catch (error) {
5515
+ throw new Error(`Response validation failed: ${error}`);
5516
+ }
5517
+ return result;
5518
+ }
5519
+ /**
5520
+ * Returns changes in block for given block height or hash over all
5521
+ * transactions for all the types. Includes changes like account_touched,
5522
+ * access_key_touched, data_touched, contract_code_touched.
5523
+ */
5524
+ async function blockEffects(client, params) {
5525
+ // Validate request parameters
5526
+ const requestSchema = RpcStateChangesInBlockRequestSchema();
5527
+ if (params !== undefined) {
5528
+ try {
5529
+ requestSchema.parse(params);
5530
+ }
5531
+ catch (error) {
5532
+ throw new Error(`Request validation failed: ${error}`);
5533
+ }
5534
+ }
5535
+ // Call the base function
5536
+ const result = await blockEffects$1(client, params);
5537
+ // Validate response
5538
+ const responseSchema = RpcStateChangesInBlockByTypeResponseSchema();
5539
+ try {
5540
+ // Wrap in JSON-RPC response format for validation
5541
+ responseSchema.parse(result);
5542
+ }
5543
+ catch (error) {
5544
+ throw new Error(`Response validation failed: ${error}`);
5545
+ }
5546
+ return result;
5547
+ }
5548
+ /**
5549
+ * [Deprecated] Sends a transaction and immediately returns transaction hash.
5550
+ * Consider using send_tx instead.
5551
+ */
5552
+ async function broadcastTxAsync(client, params) {
5553
+ // Validate request parameters
5554
+ const requestSchema = RpcSendTransactionRequestSchema();
5555
+ if (params !== undefined) {
5556
+ try {
5557
+ requestSchema.parse(params);
5558
+ }
5559
+ catch (error) {
5560
+ throw new Error(`Request validation failed: ${error}`);
5561
+ }
5562
+ }
5563
+ // Call the base function
5564
+ const result = await broadcastTxAsync$1(client, params);
5565
+ // Validate response
5566
+ const responseSchema = CryptoHashSchema();
5567
+ try {
5568
+ // Wrap in JSON-RPC response format for validation
5569
+ responseSchema.parse(result);
5570
+ }
5571
+ catch (error) {
5572
+ throw new Error(`Response validation failed: ${error}`);
5573
+ }
5574
+ return result;
5575
+ }
5576
+ /**
5577
+ * [Deprecated] Sends a transaction and waits until transaction is fully
5578
+ * complete. (Has a 10 second timeout). Consider using send_tx instead.
5579
+ */
5580
+ async function broadcastTxCommit(client, params) {
5581
+ // Validate request parameters
5582
+ const requestSchema = RpcSendTransactionRequestSchema();
5583
+ if (params !== undefined) {
5584
+ try {
5585
+ requestSchema.parse(params);
5586
+ }
5587
+ catch (error) {
5588
+ throw new Error(`Request validation failed: ${error}`);
5589
+ }
5590
+ }
5591
+ // Call the base function
5592
+ const result = await broadcastTxCommit$1(client, params);
5593
+ // Validate response
5594
+ const responseSchema = RpcTransactionResponseSchema();
5595
+ try {
5596
+ // Wrap in JSON-RPC response format for validation
5597
+ responseSchema.parse(result);
5598
+ }
5599
+ catch (error) {
5600
+ throw new Error(`Response validation failed: ${error}`);
5601
+ }
5602
+ return result;
5603
+ }
5604
+ /**
5605
+ * Returns changes for a given account, contract or contract code for given
5606
+ * block height or hash.
5607
+ */
5608
+ async function changes(client, params) {
5609
+ // Validate request parameters
5610
+ const requestSchema = RpcStateChangesInBlockByTypeRequestSchema();
5611
+ if (params !== undefined) {
5612
+ try {
5613
+ requestSchema.parse(params);
5614
+ }
5615
+ catch (error) {
5616
+ throw new Error(`Request validation failed: ${error}`);
5617
+ }
5618
+ }
5619
+ // Call the base function
5620
+ const result = await changes$1(client, params);
5621
+ // Validate response
5622
+ const responseSchema = RpcStateChangesInBlockResponseSchema();
5623
+ try {
5624
+ // Wrap in JSON-RPC response format for validation
5625
+ responseSchema.parse(result);
5626
+ }
5627
+ catch (error) {
5628
+ throw new Error(`Response validation failed: ${error}`);
5629
+ }
5630
+ return result;
5631
+ }
5632
+ /**
5633
+ * Returns details of a specific chunk. You can run a block details query to
5634
+ * get a valid chunk hash.
5635
+ */
5636
+ async function chunk(client, params) {
5637
+ // Validate request parameters
5638
+ const requestSchema = RpcChunkRequestSchema();
5639
+ if (params !== undefined) {
5640
+ try {
5641
+ requestSchema.parse(params);
5642
+ }
5643
+ catch (error) {
5644
+ throw new Error(`Request validation failed: ${error}`);
5645
+ }
5646
+ }
5647
+ // Call the base function
5648
+ const result = await chunk$1(client, params);
5649
+ // Validate response
5650
+ const responseSchema = RpcChunkResponseSchema();
5651
+ try {
5652
+ // Wrap in JSON-RPC response format for validation
5653
+ responseSchema.parse(result);
5654
+ }
5655
+ catch (error) {
5656
+ throw new Error(`Response validation failed: ${error}`);
5657
+ }
5658
+ return result;
5659
+ }
5660
+ /** Queries client node configuration */
5661
+ async function clientConfig(client, params) {
5662
+ // Validate request parameters
5663
+ const requestSchema = RpcClientConfigRequestSchema();
5664
+ if (params !== undefined) {
5665
+ try {
5666
+ requestSchema.parse(params);
5667
+ }
5668
+ catch (error) {
5669
+ throw new Error(`Request validation failed: ${error}`);
5670
+ }
5671
+ }
5672
+ // Call the base function
5673
+ const result = await clientConfig$1(client, params);
5674
+ // Validate response
5675
+ const responseSchema = RpcClientConfigResponseSchema();
5676
+ try {
5677
+ // Wrap in JSON-RPC response format for validation
5678
+ responseSchema.parse(result);
5679
+ }
5680
+ catch (error) {
5681
+ throw new Error(`Response validation failed: ${error}`);
5682
+ }
5683
+ return result;
5684
+ }
5685
+ /**
5686
+ * Returns gas price for a specific block_height or block_hash. Using [null]
5687
+ * will return the most recent block's gas price.
5688
+ */
5689
+ async function gasPrice(client, params) {
5690
+ // Validate request parameters
5691
+ const requestSchema = RpcGasPriceRequestSchema();
5692
+ if (params !== undefined) {
5693
+ try {
5694
+ requestSchema.parse(params);
5695
+ }
5696
+ catch (error) {
5697
+ throw new Error(`Request validation failed: ${error}`);
5698
+ }
5699
+ }
5700
+ // Call the base function
5701
+ const result = await gasPrice$1(client, params);
5702
+ // Validate response
5703
+ const responseSchema = RpcGasPriceResponseSchema();
5704
+ try {
5705
+ // Wrap in JSON-RPC response format for validation
5706
+ responseSchema.parse(result);
5707
+ }
5708
+ catch (error) {
5709
+ throw new Error(`Response validation failed: ${error}`);
5710
+ }
5711
+ return result;
5712
+ }
5713
+ /** Get initial state and parameters for the genesis block */
5714
+ async function genesisConfig(client, params) {
5715
+ // Validate request parameters
5716
+ const requestSchema = GenesisConfigRequestSchema();
5717
+ if (params !== undefined) {
5718
+ try {
5719
+ requestSchema.parse(params);
5720
+ }
5721
+ catch (error) {
5722
+ throw new Error(`Request validation failed: ${error}`);
5723
+ }
5724
+ }
5725
+ // Call the base function
5726
+ const result = await genesisConfig$1(client, params);
5727
+ // Validate response
5728
+ const responseSchema = GenesisConfigSchema();
5729
+ try {
5730
+ // Wrap in JSON-RPC response format for validation
5731
+ responseSchema.parse(result);
5732
+ }
5733
+ catch (error) {
5734
+ throw new Error(`Response validation failed: ${error}`);
5735
+ }
5736
+ return result;
5737
+ }
5738
+ /** Returns the current health status of the RPC node the client connects to. */
5739
+ async function health(client, params) {
5740
+ // Validate request parameters
5741
+ const requestSchema = RpcHealthRequestSchema();
5742
+ if (params !== undefined) {
5743
+ try {
5744
+ requestSchema.parse(params);
5745
+ }
5746
+ catch (error) {
5747
+ throw new Error(`Request validation failed: ${error}`);
5748
+ }
5749
+ }
5750
+ // Call the base function
5751
+ const result = await health$1(client, params);
5752
+ // Validate response
5753
+ const responseSchema = RpcHealthResponseSchema();
5754
+ try {
5755
+ // Wrap in JSON-RPC response format for validation
5756
+ responseSchema.parse(result);
5757
+ }
5758
+ catch (error) {
5759
+ throw new Error(`Response validation failed: ${error}`);
5760
+ }
5761
+ return result;
5762
+ }
5763
+ /** Returns the proofs for a transaction execution. */
5764
+ async function lightClientProof(client, params) {
5765
+ // Validate request parameters
5766
+ const requestSchema = RpcLightClientExecutionProofRequestSchema();
5767
+ if (params !== undefined) {
5768
+ try {
5769
+ requestSchema.parse(params);
5770
+ }
5771
+ catch (error) {
5772
+ throw new Error(`Request validation failed: ${error}`);
5773
+ }
5774
+ }
5775
+ // Call the base function
5776
+ const result = await lightClientProof$1(client, params);
5777
+ // Validate response
5778
+ const responseSchema = RpcLightClientExecutionProofResponseSchema();
5779
+ try {
5780
+ // Wrap in JSON-RPC response format for validation
5781
+ responseSchema.parse(result);
5782
+ }
5783
+ catch (error) {
5784
+ throw new Error(`Response validation failed: ${error}`);
5785
+ }
5786
+ return result;
5787
+ }
5788
+ /**
5789
+ * Returns the future windows for maintenance in current epoch for the
5790
+ * specified account. In the maintenance windows, the node will not be block
5791
+ * producer or chunk producer.
5792
+ */
5793
+ async function maintenanceWindows(client, params) {
5794
+ // Validate request parameters
5795
+ const requestSchema = RpcMaintenanceWindowsRequestSchema();
5796
+ if (params !== undefined) {
5797
+ try {
5798
+ requestSchema.parse(params);
5799
+ }
5800
+ catch (error) {
5801
+ throw new Error(`Request validation failed: ${error}`);
5802
+ }
5803
+ }
5804
+ // Call the base function (no response validation needed)
5805
+ return maintenanceWindows$1(client, params);
5806
+ }
5807
+ /**
5808
+ * Queries the current state of node network connections. This includes
5809
+ * information about active peers, transmitted data, known producers, etc.
5810
+ */
5811
+ async function networkInfo(client, params) {
5812
+ // Validate request parameters
5813
+ const requestSchema = RpcNetworkInfoRequestSchema();
5814
+ if (params !== undefined) {
5815
+ try {
5816
+ requestSchema.parse(params);
5817
+ }
5818
+ catch (error) {
5819
+ throw new Error(`Request validation failed: ${error}`);
5820
+ }
5821
+ }
5822
+ // Call the base function
5823
+ const result = await networkInfo$1(client, params);
5824
+ // Validate response
5825
+ const responseSchema = RpcNetworkInfoResponseSchema();
5826
+ try {
5827
+ // Wrap in JSON-RPC response format for validation
5828
+ responseSchema.parse(result);
5829
+ }
5830
+ catch (error) {
5831
+ throw new Error(`Response validation failed: ${error}`);
5832
+ }
5833
+ return result;
5834
+ }
5835
+ /** Returns the next light client block. */
5836
+ async function nextLightClientBlock(client, params) {
5837
+ // Validate request parameters
5838
+ const requestSchema = RpcLightClientNextBlockRequestSchema();
5839
+ if (params !== undefined) {
5840
+ try {
5841
+ requestSchema.parse(params);
5842
+ }
5843
+ catch (error) {
5844
+ throw new Error(`Request validation failed: ${error}`);
5845
+ }
5846
+ }
5847
+ // Call the base function
5848
+ const result = await nextLightClientBlock$1(client, params);
5849
+ // Validate response
5850
+ const responseSchema = RpcLightClientNextBlockResponseSchema();
5851
+ try {
5852
+ // Wrap in JSON-RPC response format for validation
5853
+ responseSchema.parse(result);
5854
+ }
5855
+ catch (error) {
5856
+ throw new Error(`Response validation failed: ${error}`);
5857
+ }
5858
+ return result;
5859
+ }
5860
+ /**
5861
+ * This module allows you to make generic requests to the network. The
5862
+ * `RpcQueryRequest` struct takes in a
5863
+ * [`BlockReference`](https://docs.rs/near-primitives/0.12.0/near_primitives/types/enum.BlockReference.html)
5864
+ * and a
5865
+ * [`QueryRequest`](https://docs.rs/near-primitives/0.12.0/near_primitives/views/enum.QueryRequest.html).
5866
+ * The `BlockReference` enum allows you to specify a block by `Finality`,
5867
+ * `BlockId` or `SyncCheckpoint`. The `QueryRequest` enum provides multiple
5868
+ * variants for performing the following actions: - View an account's details
5869
+ * - View a contract's code - View the state of an account - View the
5870
+ * `AccessKey` of an account - View the `AccessKeyList` of an account - Call a
5871
+ * function in a contract deployed on the network.
5872
+ */
5873
+ async function query(client, params) {
5874
+ // Validate request parameters
5875
+ const requestSchema = RpcQueryRequestSchema();
5876
+ if (params !== undefined) {
5877
+ try {
5878
+ requestSchema.parse(params);
5879
+ }
5880
+ catch (error) {
5881
+ throw new Error(`Request validation failed: ${error}`);
5882
+ }
5883
+ }
5884
+ // Call the base function
5885
+ const result = await query$1(client, params);
5886
+ // Validate response
5887
+ const responseSchema = RpcQueryResponseSchema();
5888
+ try {
5889
+ // Wrap in JSON-RPC response format for validation
5890
+ responseSchema.parse(result);
5891
+ }
5892
+ catch (error) {
5893
+ throw new Error(`Response validation failed: ${error}`);
5894
+ }
5895
+ return result;
5896
+ }
5897
+ /**
5898
+ * Sends transaction. Returns the guaranteed execution status and the results
5899
+ * the blockchain can provide at the moment.
5900
+ */
5901
+ async function sendTx(client, params) {
5902
+ // Validate request parameters
5903
+ const requestSchema = RpcSendTransactionRequestSchema();
5904
+ if (params !== undefined) {
5905
+ try {
5906
+ requestSchema.parse(params);
5907
+ }
5908
+ catch (error) {
5909
+ throw new Error(`Request validation failed: ${error}`);
5910
+ }
5911
+ }
5912
+ // Call the base function
5913
+ const result = await sendTx$1(client, params);
5914
+ // Validate response
5915
+ const responseSchema = RpcTransactionResponseSchema();
5916
+ try {
5917
+ // Wrap in JSON-RPC response format for validation
5918
+ responseSchema.parse(result);
5919
+ }
5920
+ catch (error) {
5921
+ throw new Error(`Response validation failed: ${error}`);
5922
+ }
5923
+ return result;
5924
+ }
5925
+ /**
5926
+ * Requests the status of the connected RPC node. This includes information
5927
+ * about sync status, nearcore node version, protocol version, the current set
5928
+ * of validators, etc.
5929
+ */
5930
+ async function status(client, params) {
5931
+ // Validate request parameters
5932
+ const requestSchema = RpcStatusRequestSchema();
5933
+ if (params !== undefined) {
5934
+ try {
5935
+ requestSchema.parse(params);
5936
+ }
5937
+ catch (error) {
5938
+ throw new Error(`Request validation failed: ${error}`);
5939
+ }
5940
+ }
5941
+ // Call the base function
5942
+ const result = await status$1(client, params);
5943
+ // Validate response
5944
+ const responseSchema = RpcStatusResponseSchema();
5945
+ try {
5946
+ // Wrap in JSON-RPC response format for validation
5947
+ responseSchema.parse(result);
5948
+ }
5949
+ catch (error) {
5950
+ throw new Error(`Response validation failed: ${error}`);
5951
+ }
5952
+ return result;
5953
+ }
5954
+ /**
5955
+ * Queries status of a transaction by hash and returns the final transaction
5956
+ * result.
5957
+ */
5958
+ async function tx(client, params) {
5959
+ // Validate request parameters
5960
+ const requestSchema = RpcTransactionStatusRequestSchema();
5961
+ if (params !== undefined) {
5962
+ try {
5963
+ requestSchema.parse(params);
5964
+ }
5965
+ catch (error) {
5966
+ throw new Error(`Request validation failed: ${error}`);
5967
+ }
5968
+ }
5969
+ // Call the base function
5970
+ const result = await tx$1(client, params);
5971
+ // Validate response
5972
+ const responseSchema = RpcTransactionResponseSchema();
5973
+ try {
5974
+ // Wrap in JSON-RPC response format for validation
5975
+ responseSchema.parse(result);
5976
+ }
5977
+ catch (error) {
5978
+ throw new Error(`Response validation failed: ${error}`);
5979
+ }
5980
+ return result;
5981
+ }
5982
+ /**
5983
+ * Queries active validators on the network. Returns details and the state of
5984
+ * validation on the blockchain.
5985
+ */
5986
+ async function validators(client, params) {
5987
+ // Validate request parameters
5988
+ const requestSchema = RpcValidatorRequestSchema();
5989
+ if (params !== undefined) {
5990
+ try {
5991
+ requestSchema.parse(params);
5992
+ }
5993
+ catch (error) {
5994
+ throw new Error(`Request validation failed: ${error}`);
5995
+ }
5996
+ }
5997
+ // Call the base function
5998
+ const result = await validators$1(client, params);
5999
+ // Validate response
6000
+ const responseSchema = RpcValidatorResponseSchema();
6001
+ try {
6002
+ // Wrap in JSON-RPC response format for validation
6003
+ responseSchema.parse(result);
6004
+ }
6005
+ catch (error) {
6006
+ throw new Error(`Response validation failed: ${error}`);
6007
+ }
6008
+ return result;
6009
+ }
5068
6010
 
5069
6011
  // Optional validation for client - only imported when explicitly enabled
5070
6012
  /**
@@ -5138,4 +6080,4 @@ function enableValidation() {
5138
6080
  };
5139
6081
  }
5140
6082
 
5141
- export { JsonRpcClientError, JsonRpcNetworkError, JsonRpcRequestSchema, JsonRpcResponseSchema, NearRpcClient, NearRpcError, RPC_METHODS, block, blockEffects, broadcastTxAsync, broadcastTxCommit, changes, chunk, clientConfig, NearRpcClient as default, defaultClient, enableValidation, experimentalChanges, experimentalChangesInBlock, experimentalCongestionLevel, experimentalGenesisConfig, experimentalLightClientBlockProof, experimentalLightClientProof, experimentalMaintenanceWindows, experimentalProtocolConfig, experimentalReceipt, experimentalSplitStorageInfo, experimentalTxStatus, experimentalValidatorsOrdered, gasPrice, genesisConfig, health, lightClientProof, maintenanceWindows, networkInfo, nextLightClientBlock, query, sendTx, status, tx, validators, viewAccessKey, viewAccount, viewFunction };
6083
+ export { JsonRpcClientError, JsonRpcNetworkError, JsonRpcRequestSchema, JsonRpcResponseSchema, NearRpcClient, NearRpcError, RPC_METHODS, block, blockEffects, broadcastTxAsync, broadcastTxCommit, changes, chunk, clientConfig, NearRpcClient as default, defaultClient, enableValidation, experimentalChanges, experimentalChangesInBlock, experimentalCongestionLevel, experimentalGenesisConfig, experimentalLightClientBlockProof, experimentalLightClientProof, experimentalMaintenanceWindows, experimentalProtocolConfig, experimentalReceipt, experimentalSplitStorageInfo, experimentalTxStatus, experimentalValidatorsOrdered, gasPrice, genesisConfig, health, lightClientProof, maintenanceWindows, networkInfo, nextLightClientBlock, parseCallResultToJson, query, sendTx, status, tx, validators, viewAccessKey, viewAccount, viewFunction, viewFunctionAsJson };