@psalomo/jsonrpc-client 1.1.0 → 1.2.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,168 @@ 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-07-31T19:21:47.589Z
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
4898
  // EXPERIMENTAL_changes static function
4899
- async function experimentalChanges(client, params) {
4899
+ async function experimentalChanges$1(client, params) {
4900
4900
  return client.makeRequest('EXPERIMENTAL_changes', params);
4901
4901
  }
4902
4902
  // EXPERIMENTAL_changes_in_block static function
4903
- async function experimentalChangesInBlock(client, params) {
4903
+ async function experimentalChangesInBlock$1(client, params) {
4904
4904
  return client.makeRequest('EXPERIMENTAL_changes_in_block', params);
4905
4905
  }
4906
4906
  // EXPERIMENTAL_congestion_level static function
4907
- async function experimentalCongestionLevel(client, params) {
4907
+ async function experimentalCongestionLevel$1(client, params) {
4908
4908
  return client.makeRequest('EXPERIMENTAL_congestion_level', params);
4909
4909
  }
4910
4910
  // EXPERIMENTAL_genesis_config static function
4911
- async function experimentalGenesisConfig(client, params) {
4911
+ async function experimentalGenesisConfig$1(client, params) {
4912
4912
  return client.makeRequest('EXPERIMENTAL_genesis_config', params);
4913
4913
  }
4914
4914
  // EXPERIMENTAL_light_client_block_proof static function
4915
- async function experimentalLightClientBlockProof(client, params) {
4915
+ async function experimentalLightClientBlockProof$1(client, params) {
4916
4916
  return client.makeRequest('EXPERIMENTAL_light_client_block_proof', params);
4917
4917
  }
4918
4918
  // EXPERIMENTAL_light_client_proof static function
4919
- async function experimentalLightClientProof(client, params) {
4919
+ async function experimentalLightClientProof$1(client, params) {
4920
4920
  return client.makeRequest('EXPERIMENTAL_light_client_proof', params);
4921
4921
  }
4922
4922
  // EXPERIMENTAL_maintenance_windows static function
4923
- async function experimentalMaintenanceWindows(client, params) {
4923
+ async function experimentalMaintenanceWindows$1(client, params) {
4924
4924
  return client.makeRequest('EXPERIMENTAL_maintenance_windows', params);
4925
4925
  }
4926
4926
  // EXPERIMENTAL_protocol_config static function
4927
- async function experimentalProtocolConfig(client, params) {
4927
+ async function experimentalProtocolConfig$1(client, params) {
4928
4928
  return client.makeRequest('EXPERIMENTAL_protocol_config', params);
4929
4929
  }
4930
4930
  // EXPERIMENTAL_receipt static function
4931
- async function experimentalReceipt(client, params) {
4931
+ async function experimentalReceipt$1(client, params) {
4932
4932
  return client.makeRequest('EXPERIMENTAL_receipt', params);
4933
4933
  }
4934
4934
  // EXPERIMENTAL_split_storage_info static function
4935
- async function experimentalSplitStorageInfo(client, params) {
4935
+ async function experimentalSplitStorageInfo$1(client, params) {
4936
4936
  return client.makeRequest('EXPERIMENTAL_split_storage_info', params);
4937
4937
  }
4938
4938
  // EXPERIMENTAL_tx_status static function
4939
- async function experimentalTxStatus(client, params) {
4939
+ async function experimentalTxStatus$1(client, params) {
4940
4940
  return client.makeRequest('EXPERIMENTAL_tx_status', params);
4941
4941
  }
4942
4942
  // EXPERIMENTAL_validators_ordered static function
4943
- async function experimentalValidatorsOrdered(client, params) {
4943
+ async function experimentalValidatorsOrdered$1(client, params) {
4944
4944
  return client.makeRequest('EXPERIMENTAL_validators_ordered', params);
4945
4945
  }
4946
4946
  // block static function
4947
- async function block(client, params) {
4947
+ async function block$1(client, params) {
4948
4948
  return client.makeRequest('block', params);
4949
4949
  }
4950
4950
  // block_effects static function
4951
- async function blockEffects(client, params) {
4951
+ async function blockEffects$1(client, params) {
4952
4952
  return client.makeRequest('block_effects', params);
4953
4953
  }
4954
4954
  // broadcast_tx_async static function
4955
- async function broadcastTxAsync(client, params) {
4955
+ async function broadcastTxAsync$1(client, params) {
4956
4956
  return client.makeRequest('broadcast_tx_async', params);
4957
4957
  }
4958
4958
  // broadcast_tx_commit static function
4959
- async function broadcastTxCommit(client, params) {
4959
+ async function broadcastTxCommit$1(client, params) {
4960
4960
  return client.makeRequest('broadcast_tx_commit', params);
4961
4961
  }
4962
4962
  // changes static function
4963
- async function changes(client, params) {
4963
+ async function changes$1(client, params) {
4964
4964
  return client.makeRequest('changes', params);
4965
4965
  }
4966
4966
  // chunk static function
4967
- async function chunk(client, params) {
4967
+ async function chunk$1(client, params) {
4968
4968
  return client.makeRequest('chunk', params);
4969
4969
  }
4970
4970
  // client_config static function
4971
- async function clientConfig(client, params) {
4971
+ async function clientConfig$1(client, params) {
4972
4972
  return client.makeRequest('client_config', params);
4973
4973
  }
4974
4974
  // gas_price static function
4975
- async function gasPrice(client, params) {
4975
+ async function gasPrice$1(client, params) {
4976
4976
  return client.makeRequest('gas_price', params);
4977
4977
  }
4978
4978
  // genesis_config static function
4979
- async function genesisConfig(client, params) {
4979
+ async function genesisConfig$1(client, params) {
4980
4980
  return client.makeRequest('genesis_config', params);
4981
4981
  }
4982
4982
  // health static function
4983
- async function health(client, params) {
4983
+ async function health$1(client, params) {
4984
4984
  return client.makeRequest('health', params);
4985
4985
  }
4986
4986
  // light_client_proof static function
4987
- async function lightClientProof(client, params) {
4987
+ async function lightClientProof$1(client, params) {
4988
4988
  return client.makeRequest('light_client_proof', params);
4989
4989
  }
4990
4990
  // maintenance_windows static function
4991
- async function maintenanceWindows(client, params) {
4991
+ async function maintenanceWindows$1(client, params) {
4992
4992
  return client.makeRequest('maintenance_windows', params);
4993
4993
  }
4994
4994
  // network_info static function
4995
- async function networkInfo(client, params) {
4995
+ async function networkInfo$1(client, params) {
4996
4996
  return client.makeRequest('network_info', params);
4997
4997
  }
4998
4998
  // next_light_client_block static function
4999
- async function nextLightClientBlock(client, params) {
4999
+ async function nextLightClientBlock$1(client, params) {
5000
5000
  return client.makeRequest('next_light_client_block', params);
5001
5001
  }
5002
5002
  // query static function
5003
- async function query(client, params) {
5003
+ async function query$1(client, params) {
5004
5004
  return client.makeRequest('query', params);
5005
5005
  }
5006
5006
  // send_tx static function
5007
- async function sendTx(client, params) {
5007
+ async function sendTx$1(client, params) {
5008
5008
  return client.makeRequest('send_tx', params);
5009
5009
  }
5010
5010
  // status static function
5011
- async function status(client, params) {
5011
+ async function status$1(client, params) {
5012
5012
  return client.makeRequest('status', params);
5013
5013
  }
5014
5014
  // tx static function
5015
- async function tx(client, params) {
5015
+ async function tx$1(client, params) {
5016
5016
  return client.makeRequest('tx', params);
5017
5017
  }
5018
5018
  // validators static function
5019
- async function validators(client, params) {
5019
+ async function validators$1(client, params) {
5020
5020
  return client.makeRequest('validators', params);
5021
5021
  }
5022
5022
 
5023
- async function viewAccount(client, params) {
5023
+ async function viewFunction$1(client, params) {
5024
5024
  // Construct query parameters: use blockId if provided, otherwise use finality (default 'final')
5025
+ const baseParams = {
5026
+ requestType: 'call_function',
5027
+ accountId: params.accountId,
5028
+ methodName: params.methodName,
5029
+ argsBase64: params.argsBase64 ?? '', // Default to empty string if no arguments
5030
+ };
5031
+ const queryParams = params.blockId
5032
+ ? { ...baseParams, blockId: params.blockId }
5033
+ : { ...baseParams, finality: params.finality || 'final' };
5034
+ return query$1(client, queryParams);
5035
+ }
5036
+ function parseCallResultToJson(callResult) {
5037
+ const bytes = new Uint8Array(callResult.result);
5038
+ const text = new TextDecoder().decode(bytes);
5039
+ return JSON.parse(text);
5040
+ }
5041
+ async function viewFunctionAsJson(client, params) {
5042
+ const result = await viewFunction$1(client, params);
5043
+ return parseCallResultToJson(result);
5044
+ }
5045
+
5046
+ // Auto-generated validation wrapper functions
5047
+ // Generated at: 2025-07-31T19:21:47.592Z
5048
+ // Total functions: 31
5049
+ //
5050
+ // This file is automatically generated by tools/codegen/generate-validation-wrappers.ts
5051
+ // Do not edit manually - changes will be overwritten
5052
+ // Convenience function wrappers with validation
5053
+ async function viewAccount(client, params) {
5054
+ // Use the validated query function
5025
5055
  const queryParams = params.blockId
5026
5056
  ? {
5027
5057
  requestType: 'view_account',
@@ -5036,12 +5066,12 @@ async function viewAccount(client, params) {
5036
5066
  return query(client, queryParams);
5037
5067
  }
5038
5068
  async function viewFunction(client, params) {
5039
- // Construct query parameters: use blockId if provided, otherwise use finality (default 'final')
5069
+ // Use the validated query function
5040
5070
  const baseParams = {
5041
5071
  requestType: 'call_function',
5042
5072
  accountId: params.accountId,
5043
5073
  methodName: params.methodName,
5044
- argsBase64: params.argsBase64 ?? '', // Default to empty string if no arguments
5074
+ argsBase64: params.argsBase64 ?? '',
5045
5075
  };
5046
5076
  const queryParams = params.blockId
5047
5077
  ? { ...baseParams, blockId: params.blockId }
@@ -5049,7 +5079,7 @@ async function viewFunction(client, params) {
5049
5079
  return query(client, queryParams);
5050
5080
  }
5051
5081
  async function viewAccessKey(client, params) {
5052
- // Construct query parameters: use blockId if provided, otherwise use finality (default 'final')
5082
+ // Use the validated query function
5053
5083
  const queryParams = params.blockId
5054
5084
  ? {
5055
5085
  requestType: 'view_access_key',
@@ -5065,6 +5095,721 @@ async function viewAccessKey(client, params) {
5065
5095
  };
5066
5096
  return query(client, queryParams);
5067
5097
  }
5098
+ // Validation wrapper functions
5099
+ async function experimentalChanges(client, params) {
5100
+ // Validate request parameters
5101
+ const requestSchema = RpcStateChangesInBlockByTypeRequestSchema();
5102
+ if (params !== undefined) {
5103
+ try {
5104
+ requestSchema.parse(params);
5105
+ }
5106
+ catch (error) {
5107
+ throw new Error(`Request validation failed: ${error}`);
5108
+ }
5109
+ }
5110
+ // Call the base function
5111
+ const result = await experimentalChanges$1(client, params);
5112
+ // Validate response
5113
+ const responseSchema = RpcStateChangesInBlockResponseSchema();
5114
+ try {
5115
+ // Wrap in JSON-RPC response format for validation
5116
+ responseSchema.parse(result);
5117
+ }
5118
+ catch (error) {
5119
+ throw new Error(`Response validation failed: ${error}`);
5120
+ }
5121
+ return result;
5122
+ }
5123
+ async function experimentalChangesInBlock(client, params) {
5124
+ // Validate request parameters
5125
+ const requestSchema = RpcStateChangesInBlockRequestSchema();
5126
+ if (params !== undefined) {
5127
+ try {
5128
+ requestSchema.parse(params);
5129
+ }
5130
+ catch (error) {
5131
+ throw new Error(`Request validation failed: ${error}`);
5132
+ }
5133
+ }
5134
+ // Call the base function
5135
+ const result = await experimentalChangesInBlock$1(client, params);
5136
+ // Validate response
5137
+ const responseSchema = RpcStateChangesInBlockByTypeResponseSchema();
5138
+ try {
5139
+ // Wrap in JSON-RPC response format for validation
5140
+ responseSchema.parse(result);
5141
+ }
5142
+ catch (error) {
5143
+ throw new Error(`Response validation failed: ${error}`);
5144
+ }
5145
+ return result;
5146
+ }
5147
+ async function experimentalCongestionLevel(client, params) {
5148
+ // Validate request parameters
5149
+ const requestSchema = RpcCongestionLevelRequestSchema();
5150
+ if (params !== undefined) {
5151
+ try {
5152
+ requestSchema.parse(params);
5153
+ }
5154
+ catch (error) {
5155
+ throw new Error(`Request validation failed: ${error}`);
5156
+ }
5157
+ }
5158
+ // Call the base function
5159
+ const result = await experimentalCongestionLevel$1(client, params);
5160
+ // Validate response
5161
+ const responseSchema = RpcCongestionLevelResponseSchema();
5162
+ try {
5163
+ // Wrap in JSON-RPC response format for validation
5164
+ responseSchema.parse(result);
5165
+ }
5166
+ catch (error) {
5167
+ throw new Error(`Response validation failed: ${error}`);
5168
+ }
5169
+ return result;
5170
+ }
5171
+ async function experimentalGenesisConfig(client, params) {
5172
+ // Validate request parameters
5173
+ const requestSchema = GenesisConfigRequestSchema();
5174
+ if (params !== undefined) {
5175
+ try {
5176
+ requestSchema.parse(params);
5177
+ }
5178
+ catch (error) {
5179
+ throw new Error(`Request validation failed: ${error}`);
5180
+ }
5181
+ }
5182
+ // Call the base function
5183
+ const result = await experimentalGenesisConfig$1(client, params);
5184
+ // Validate response
5185
+ const responseSchema = GenesisConfigSchema();
5186
+ try {
5187
+ // Wrap in JSON-RPC response format for validation
5188
+ responseSchema.parse(result);
5189
+ }
5190
+ catch (error) {
5191
+ throw new Error(`Response validation failed: ${error}`);
5192
+ }
5193
+ return result;
5194
+ }
5195
+ async function experimentalLightClientBlockProof(client, params) {
5196
+ // Validate request parameters
5197
+ const requestSchema = RpcLightClientBlockProofRequestSchema();
5198
+ if (params !== undefined) {
5199
+ try {
5200
+ requestSchema.parse(params);
5201
+ }
5202
+ catch (error) {
5203
+ throw new Error(`Request validation failed: ${error}`);
5204
+ }
5205
+ }
5206
+ // Call the base function
5207
+ const result = await experimentalLightClientBlockProof$1(client, params);
5208
+ // Validate response
5209
+ const responseSchema = RpcLightClientBlockProofResponseSchema();
5210
+ try {
5211
+ // Wrap in JSON-RPC response format for validation
5212
+ responseSchema.parse(result);
5213
+ }
5214
+ catch (error) {
5215
+ throw new Error(`Response validation failed: ${error}`);
5216
+ }
5217
+ return result;
5218
+ }
5219
+ async function experimentalLightClientProof(client, params) {
5220
+ // Validate request parameters
5221
+ const requestSchema = RpcLightClientExecutionProofRequestSchema();
5222
+ if (params !== undefined) {
5223
+ try {
5224
+ requestSchema.parse(params);
5225
+ }
5226
+ catch (error) {
5227
+ throw new Error(`Request validation failed: ${error}`);
5228
+ }
5229
+ }
5230
+ // Call the base function
5231
+ const result = await experimentalLightClientProof$1(client, params);
5232
+ // Validate response
5233
+ const responseSchema = RpcLightClientExecutionProofResponseSchema();
5234
+ try {
5235
+ // Wrap in JSON-RPC response format for validation
5236
+ responseSchema.parse(result);
5237
+ }
5238
+ catch (error) {
5239
+ throw new Error(`Response validation failed: ${error}`);
5240
+ }
5241
+ return result;
5242
+ }
5243
+ async function experimentalMaintenanceWindows(client, params) {
5244
+ // Validate request parameters
5245
+ const requestSchema = RpcMaintenanceWindowsRequestSchema();
5246
+ if (params !== undefined) {
5247
+ try {
5248
+ requestSchema.parse(params);
5249
+ }
5250
+ catch (error) {
5251
+ throw new Error(`Request validation failed: ${error}`);
5252
+ }
5253
+ }
5254
+ // Call the base function (no response validation needed)
5255
+ return experimentalMaintenanceWindows$1(client, params);
5256
+ }
5257
+ async function experimentalProtocolConfig(client, params) {
5258
+ // Validate request parameters
5259
+ const requestSchema = RpcProtocolConfigRequestSchema();
5260
+ if (params !== undefined) {
5261
+ try {
5262
+ requestSchema.parse(params);
5263
+ }
5264
+ catch (error) {
5265
+ throw new Error(`Request validation failed: ${error}`);
5266
+ }
5267
+ }
5268
+ // Call the base function
5269
+ const result = await experimentalProtocolConfig$1(client, params);
5270
+ // Validate response
5271
+ const responseSchema = RpcProtocolConfigResponseSchema();
5272
+ try {
5273
+ // Wrap in JSON-RPC response format for validation
5274
+ responseSchema.parse(result);
5275
+ }
5276
+ catch (error) {
5277
+ throw new Error(`Response validation failed: ${error}`);
5278
+ }
5279
+ return result;
5280
+ }
5281
+ async function experimentalReceipt(client, params) {
5282
+ // Validate request parameters
5283
+ const requestSchema = RpcReceiptRequestSchema();
5284
+ if (params !== undefined) {
5285
+ try {
5286
+ requestSchema.parse(params);
5287
+ }
5288
+ catch (error) {
5289
+ throw new Error(`Request validation failed: ${error}`);
5290
+ }
5291
+ }
5292
+ // Call the base function
5293
+ const result = await experimentalReceipt$1(client, params);
5294
+ // Validate response
5295
+ const responseSchema = RpcReceiptResponseSchema();
5296
+ try {
5297
+ // Wrap in JSON-RPC response format for validation
5298
+ responseSchema.parse(result);
5299
+ }
5300
+ catch (error) {
5301
+ throw new Error(`Response validation failed: ${error}`);
5302
+ }
5303
+ return result;
5304
+ }
5305
+ async function experimentalSplitStorageInfo(client, params) {
5306
+ // Validate request parameters
5307
+ const requestSchema = RpcSplitStorageInfoRequestSchema();
5308
+ if (params !== undefined) {
5309
+ try {
5310
+ requestSchema.parse(params);
5311
+ }
5312
+ catch (error) {
5313
+ throw new Error(`Request validation failed: ${error}`);
5314
+ }
5315
+ }
5316
+ // Call the base function
5317
+ const result = await experimentalSplitStorageInfo$1(client, params);
5318
+ // Validate response
5319
+ const responseSchema = RpcSplitStorageInfoResponseSchema();
5320
+ try {
5321
+ // Wrap in JSON-RPC response format for validation
5322
+ responseSchema.parse(result);
5323
+ }
5324
+ catch (error) {
5325
+ throw new Error(`Response validation failed: ${error}`);
5326
+ }
5327
+ return result;
5328
+ }
5329
+ async function experimentalTxStatus(client, params) {
5330
+ // Validate request parameters
5331
+ const requestSchema = RpcTransactionStatusRequestSchema();
5332
+ if (params !== undefined) {
5333
+ try {
5334
+ requestSchema.parse(params);
5335
+ }
5336
+ catch (error) {
5337
+ throw new Error(`Request validation failed: ${error}`);
5338
+ }
5339
+ }
5340
+ // Call the base function
5341
+ const result = await experimentalTxStatus$1(client, params);
5342
+ // Validate response
5343
+ const responseSchema = RpcTransactionResponseSchema();
5344
+ try {
5345
+ // Wrap in JSON-RPC response format for validation
5346
+ responseSchema.parse(result);
5347
+ }
5348
+ catch (error) {
5349
+ throw new Error(`Response validation failed: ${error}`);
5350
+ }
5351
+ return result;
5352
+ }
5353
+ async function experimentalValidatorsOrdered(client, params) {
5354
+ // Validate request parameters
5355
+ const requestSchema = RpcValidatorsOrderedRequestSchema();
5356
+ if (params !== undefined) {
5357
+ try {
5358
+ requestSchema.parse(params);
5359
+ }
5360
+ catch (error) {
5361
+ throw new Error(`Request validation failed: ${error}`);
5362
+ }
5363
+ }
5364
+ // Call the base function (no response validation needed)
5365
+ return experimentalValidatorsOrdered$1(client, params);
5366
+ }
5367
+ async function block(client, params) {
5368
+ // Validate request parameters
5369
+ const requestSchema = RpcBlockRequestSchema();
5370
+ if (params !== undefined) {
5371
+ try {
5372
+ requestSchema.parse(params);
5373
+ }
5374
+ catch (error) {
5375
+ throw new Error(`Request validation failed: ${error}`);
5376
+ }
5377
+ }
5378
+ // Call the base function
5379
+ const result = await block$1(client, params);
5380
+ // Validate response
5381
+ const responseSchema = RpcBlockResponseSchema();
5382
+ try {
5383
+ // Wrap in JSON-RPC response format for validation
5384
+ responseSchema.parse(result);
5385
+ }
5386
+ catch (error) {
5387
+ throw new Error(`Response validation failed: ${error}`);
5388
+ }
5389
+ return result;
5390
+ }
5391
+ async function blockEffects(client, params) {
5392
+ // Validate request parameters
5393
+ const requestSchema = RpcStateChangesInBlockRequestSchema();
5394
+ if (params !== undefined) {
5395
+ try {
5396
+ requestSchema.parse(params);
5397
+ }
5398
+ catch (error) {
5399
+ throw new Error(`Request validation failed: ${error}`);
5400
+ }
5401
+ }
5402
+ // Call the base function
5403
+ const result = await blockEffects$1(client, params);
5404
+ // Validate response
5405
+ const responseSchema = RpcStateChangesInBlockByTypeResponseSchema();
5406
+ try {
5407
+ // Wrap in JSON-RPC response format for validation
5408
+ responseSchema.parse(result);
5409
+ }
5410
+ catch (error) {
5411
+ throw new Error(`Response validation failed: ${error}`);
5412
+ }
5413
+ return result;
5414
+ }
5415
+ async function broadcastTxAsync(client, params) {
5416
+ // Validate request parameters
5417
+ const requestSchema = RpcSendTransactionRequestSchema();
5418
+ if (params !== undefined) {
5419
+ try {
5420
+ requestSchema.parse(params);
5421
+ }
5422
+ catch (error) {
5423
+ throw new Error(`Request validation failed: ${error}`);
5424
+ }
5425
+ }
5426
+ // Call the base function
5427
+ const result = await broadcastTxAsync$1(client, params);
5428
+ // Validate response
5429
+ const responseSchema = CryptoHashSchema();
5430
+ try {
5431
+ // Wrap in JSON-RPC response format for validation
5432
+ responseSchema.parse(result);
5433
+ }
5434
+ catch (error) {
5435
+ throw new Error(`Response validation failed: ${error}`);
5436
+ }
5437
+ return result;
5438
+ }
5439
+ async function broadcastTxCommit(client, params) {
5440
+ // Validate request parameters
5441
+ const requestSchema = RpcSendTransactionRequestSchema();
5442
+ if (params !== undefined) {
5443
+ try {
5444
+ requestSchema.parse(params);
5445
+ }
5446
+ catch (error) {
5447
+ throw new Error(`Request validation failed: ${error}`);
5448
+ }
5449
+ }
5450
+ // Call the base function
5451
+ const result = await broadcastTxCommit$1(client, params);
5452
+ // Validate response
5453
+ const responseSchema = RpcTransactionResponseSchema();
5454
+ try {
5455
+ // Wrap in JSON-RPC response format for validation
5456
+ responseSchema.parse(result);
5457
+ }
5458
+ catch (error) {
5459
+ throw new Error(`Response validation failed: ${error}`);
5460
+ }
5461
+ return result;
5462
+ }
5463
+ async function changes(client, params) {
5464
+ // Validate request parameters
5465
+ const requestSchema = RpcStateChangesInBlockByTypeRequestSchema();
5466
+ if (params !== undefined) {
5467
+ try {
5468
+ requestSchema.parse(params);
5469
+ }
5470
+ catch (error) {
5471
+ throw new Error(`Request validation failed: ${error}`);
5472
+ }
5473
+ }
5474
+ // Call the base function
5475
+ const result = await changes$1(client, params);
5476
+ // Validate response
5477
+ const responseSchema = RpcStateChangesInBlockResponseSchema();
5478
+ try {
5479
+ // Wrap in JSON-RPC response format for validation
5480
+ responseSchema.parse(result);
5481
+ }
5482
+ catch (error) {
5483
+ throw new Error(`Response validation failed: ${error}`);
5484
+ }
5485
+ return result;
5486
+ }
5487
+ async function chunk(client, params) {
5488
+ // Validate request parameters
5489
+ const requestSchema = RpcChunkRequestSchema();
5490
+ if (params !== undefined) {
5491
+ try {
5492
+ requestSchema.parse(params);
5493
+ }
5494
+ catch (error) {
5495
+ throw new Error(`Request validation failed: ${error}`);
5496
+ }
5497
+ }
5498
+ // Call the base function
5499
+ const result = await chunk$1(client, params);
5500
+ // Validate response
5501
+ const responseSchema = RpcChunkResponseSchema();
5502
+ try {
5503
+ // Wrap in JSON-RPC response format for validation
5504
+ responseSchema.parse(result);
5505
+ }
5506
+ catch (error) {
5507
+ throw new Error(`Response validation failed: ${error}`);
5508
+ }
5509
+ return result;
5510
+ }
5511
+ async function clientConfig(client, params) {
5512
+ // Validate request parameters
5513
+ const requestSchema = RpcClientConfigRequestSchema();
5514
+ if (params !== undefined) {
5515
+ try {
5516
+ requestSchema.parse(params);
5517
+ }
5518
+ catch (error) {
5519
+ throw new Error(`Request validation failed: ${error}`);
5520
+ }
5521
+ }
5522
+ // Call the base function
5523
+ const result = await clientConfig$1(client, params);
5524
+ // Validate response
5525
+ const responseSchema = RpcClientConfigResponseSchema();
5526
+ try {
5527
+ // Wrap in JSON-RPC response format for validation
5528
+ responseSchema.parse(result);
5529
+ }
5530
+ catch (error) {
5531
+ throw new Error(`Response validation failed: ${error}`);
5532
+ }
5533
+ return result;
5534
+ }
5535
+ async function gasPrice(client, params) {
5536
+ // Validate request parameters
5537
+ const requestSchema = RpcGasPriceRequestSchema();
5538
+ if (params !== undefined) {
5539
+ try {
5540
+ requestSchema.parse(params);
5541
+ }
5542
+ catch (error) {
5543
+ throw new Error(`Request validation failed: ${error}`);
5544
+ }
5545
+ }
5546
+ // Call the base function
5547
+ const result = await gasPrice$1(client, params);
5548
+ // Validate response
5549
+ const responseSchema = RpcGasPriceResponseSchema();
5550
+ try {
5551
+ // Wrap in JSON-RPC response format for validation
5552
+ responseSchema.parse(result);
5553
+ }
5554
+ catch (error) {
5555
+ throw new Error(`Response validation failed: ${error}`);
5556
+ }
5557
+ return result;
5558
+ }
5559
+ async function genesisConfig(client, params) {
5560
+ // Validate request parameters
5561
+ const requestSchema = GenesisConfigRequestSchema();
5562
+ if (params !== undefined) {
5563
+ try {
5564
+ requestSchema.parse(params);
5565
+ }
5566
+ catch (error) {
5567
+ throw new Error(`Request validation failed: ${error}`);
5568
+ }
5569
+ }
5570
+ // Call the base function
5571
+ const result = await genesisConfig$1(client, params);
5572
+ // Validate response
5573
+ const responseSchema = GenesisConfigSchema();
5574
+ try {
5575
+ // Wrap in JSON-RPC response format for validation
5576
+ responseSchema.parse(result);
5577
+ }
5578
+ catch (error) {
5579
+ throw new Error(`Response validation failed: ${error}`);
5580
+ }
5581
+ return result;
5582
+ }
5583
+ async function health(client, params) {
5584
+ // Validate request parameters
5585
+ const requestSchema = RpcHealthRequestSchema();
5586
+ if (params !== undefined) {
5587
+ try {
5588
+ requestSchema.parse(params);
5589
+ }
5590
+ catch (error) {
5591
+ throw new Error(`Request validation failed: ${error}`);
5592
+ }
5593
+ }
5594
+ // Call the base function
5595
+ const result = await health$1(client, params);
5596
+ // Validate response
5597
+ const responseSchema = RpcHealthResponseSchema();
5598
+ try {
5599
+ // Wrap in JSON-RPC response format for validation
5600
+ responseSchema.parse(result);
5601
+ }
5602
+ catch (error) {
5603
+ throw new Error(`Response validation failed: ${error}`);
5604
+ }
5605
+ return result;
5606
+ }
5607
+ async function lightClientProof(client, params) {
5608
+ // Validate request parameters
5609
+ const requestSchema = RpcLightClientExecutionProofRequestSchema();
5610
+ if (params !== undefined) {
5611
+ try {
5612
+ requestSchema.parse(params);
5613
+ }
5614
+ catch (error) {
5615
+ throw new Error(`Request validation failed: ${error}`);
5616
+ }
5617
+ }
5618
+ // Call the base function
5619
+ const result = await lightClientProof$1(client, params);
5620
+ // Validate response
5621
+ const responseSchema = RpcLightClientExecutionProofResponseSchema();
5622
+ try {
5623
+ // Wrap in JSON-RPC response format for validation
5624
+ responseSchema.parse(result);
5625
+ }
5626
+ catch (error) {
5627
+ throw new Error(`Response validation failed: ${error}`);
5628
+ }
5629
+ return result;
5630
+ }
5631
+ async function maintenanceWindows(client, params) {
5632
+ // Validate request parameters
5633
+ const requestSchema = RpcMaintenanceWindowsRequestSchema();
5634
+ if (params !== undefined) {
5635
+ try {
5636
+ requestSchema.parse(params);
5637
+ }
5638
+ catch (error) {
5639
+ throw new Error(`Request validation failed: ${error}`);
5640
+ }
5641
+ }
5642
+ // Call the base function (no response validation needed)
5643
+ return maintenanceWindows$1(client, params);
5644
+ }
5645
+ async function networkInfo(client, params) {
5646
+ // Validate request parameters
5647
+ const requestSchema = RpcNetworkInfoRequestSchema();
5648
+ if (params !== undefined) {
5649
+ try {
5650
+ requestSchema.parse(params);
5651
+ }
5652
+ catch (error) {
5653
+ throw new Error(`Request validation failed: ${error}`);
5654
+ }
5655
+ }
5656
+ // Call the base function
5657
+ const result = await networkInfo$1(client, params);
5658
+ // Validate response
5659
+ const responseSchema = RpcNetworkInfoResponseSchema();
5660
+ try {
5661
+ // Wrap in JSON-RPC response format for validation
5662
+ responseSchema.parse(result);
5663
+ }
5664
+ catch (error) {
5665
+ throw new Error(`Response validation failed: ${error}`);
5666
+ }
5667
+ return result;
5668
+ }
5669
+ async function nextLightClientBlock(client, params) {
5670
+ // Validate request parameters
5671
+ const requestSchema = RpcLightClientNextBlockRequestSchema();
5672
+ if (params !== undefined) {
5673
+ try {
5674
+ requestSchema.parse(params);
5675
+ }
5676
+ catch (error) {
5677
+ throw new Error(`Request validation failed: ${error}`);
5678
+ }
5679
+ }
5680
+ // Call the base function
5681
+ const result = await nextLightClientBlock$1(client, params);
5682
+ // Validate response
5683
+ const responseSchema = RpcLightClientNextBlockResponseSchema();
5684
+ try {
5685
+ // Wrap in JSON-RPC response format for validation
5686
+ responseSchema.parse(result);
5687
+ }
5688
+ catch (error) {
5689
+ throw new Error(`Response validation failed: ${error}`);
5690
+ }
5691
+ return result;
5692
+ }
5693
+ async function query(client, params) {
5694
+ // Validate request parameters
5695
+ const requestSchema = RpcQueryRequestSchema();
5696
+ if (params !== undefined) {
5697
+ try {
5698
+ requestSchema.parse(params);
5699
+ }
5700
+ catch (error) {
5701
+ throw new Error(`Request validation failed: ${error}`);
5702
+ }
5703
+ }
5704
+ // Call the base function
5705
+ const result = await query$1(client, params);
5706
+ // Validate response
5707
+ const responseSchema = RpcQueryResponseSchema();
5708
+ try {
5709
+ // Wrap in JSON-RPC response format for validation
5710
+ responseSchema.parse(result);
5711
+ }
5712
+ catch (error) {
5713
+ throw new Error(`Response validation failed: ${error}`);
5714
+ }
5715
+ return result;
5716
+ }
5717
+ async function sendTx(client, params) {
5718
+ // Validate request parameters
5719
+ const requestSchema = RpcSendTransactionRequestSchema();
5720
+ if (params !== undefined) {
5721
+ try {
5722
+ requestSchema.parse(params);
5723
+ }
5724
+ catch (error) {
5725
+ throw new Error(`Request validation failed: ${error}`);
5726
+ }
5727
+ }
5728
+ // Call the base function
5729
+ const result = await sendTx$1(client, params);
5730
+ // Validate response
5731
+ const responseSchema = RpcTransactionResponseSchema();
5732
+ try {
5733
+ // Wrap in JSON-RPC response format for validation
5734
+ responseSchema.parse(result);
5735
+ }
5736
+ catch (error) {
5737
+ throw new Error(`Response validation failed: ${error}`);
5738
+ }
5739
+ return result;
5740
+ }
5741
+ async function status(client, params) {
5742
+ // Validate request parameters
5743
+ const requestSchema = RpcStatusRequestSchema();
5744
+ if (params !== undefined) {
5745
+ try {
5746
+ requestSchema.parse(params);
5747
+ }
5748
+ catch (error) {
5749
+ throw new Error(`Request validation failed: ${error}`);
5750
+ }
5751
+ }
5752
+ // Call the base function
5753
+ const result = await status$1(client, params);
5754
+ // Validate response
5755
+ const responseSchema = RpcStatusResponseSchema();
5756
+ try {
5757
+ // Wrap in JSON-RPC response format for validation
5758
+ responseSchema.parse(result);
5759
+ }
5760
+ catch (error) {
5761
+ throw new Error(`Response validation failed: ${error}`);
5762
+ }
5763
+ return result;
5764
+ }
5765
+ async function tx(client, params) {
5766
+ // Validate request parameters
5767
+ const requestSchema = RpcTransactionStatusRequestSchema();
5768
+ if (params !== undefined) {
5769
+ try {
5770
+ requestSchema.parse(params);
5771
+ }
5772
+ catch (error) {
5773
+ throw new Error(`Request validation failed: ${error}`);
5774
+ }
5775
+ }
5776
+ // Call the base function
5777
+ const result = await tx$1(client, params);
5778
+ // Validate response
5779
+ const responseSchema = RpcTransactionResponseSchema();
5780
+ try {
5781
+ // Wrap in JSON-RPC response format for validation
5782
+ responseSchema.parse(result);
5783
+ }
5784
+ catch (error) {
5785
+ throw new Error(`Response validation failed: ${error}`);
5786
+ }
5787
+ return result;
5788
+ }
5789
+ async function validators(client, params) {
5790
+ // Validate request parameters
5791
+ const requestSchema = RpcValidatorRequestSchema();
5792
+ if (params !== undefined) {
5793
+ try {
5794
+ requestSchema.parse(params);
5795
+ }
5796
+ catch (error) {
5797
+ throw new Error(`Request validation failed: ${error}`);
5798
+ }
5799
+ }
5800
+ // Call the base function
5801
+ const result = await validators$1(client, params);
5802
+ // Validate response
5803
+ const responseSchema = RpcValidatorResponseSchema();
5804
+ try {
5805
+ // Wrap in JSON-RPC response format for validation
5806
+ responseSchema.parse(result);
5807
+ }
5808
+ catch (error) {
5809
+ throw new Error(`Response validation failed: ${error}`);
5810
+ }
5811
+ return result;
5812
+ }
5068
5813
 
5069
5814
  // Optional validation for client - only imported when explicitly enabled
5070
5815
  /**
@@ -5138,4 +5883,4 @@ function enableValidation() {
5138
5883
  };
5139
5884
  }
5140
5885
 
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 };
5886
+ 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 };