@psalomo/jsonrpc-client 1.2.0 → 1.3.1

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.
@@ -1,3 +1,4 @@
1
+ // JSON-RPC client with static function architecture (configuration only)
1
2
  // Case conversion utilities
2
3
  function camelToSnake(str) {
3
4
  return str.replace(/[A-Z]/g, letter => `_${letter.toLowerCase()}`);
@@ -66,7 +67,6 @@ class NearRpcClient {
66
67
  headers;
67
68
  timeout;
68
69
  retries;
69
- validation;
70
70
  constructor(config) {
71
71
  if (typeof config === 'string') {
72
72
  this.endpoint = config;
@@ -79,9 +79,6 @@ class NearRpcClient {
79
79
  this.headers = config.headers || {};
80
80
  this.timeout = config.timeout || 30000;
81
81
  this.retries = config.retries || 3;
82
- if (config.validation) {
83
- this.validation = config.validation;
84
- }
85
82
  }
86
83
  }
87
84
  /**
@@ -89,22 +86,6 @@ class NearRpcClient {
89
86
  * This is used internally by the standalone RPC functions
90
87
  */
91
88
  async makeRequest(method, params) {
92
- // Create request with original camelCase params for validation
93
- const requestForValidation = {
94
- jsonrpc: '2.0',
95
- id: REQUEST_ID,
96
- method,
97
- params: params !== undefined ? params : null,
98
- };
99
- // Validate request if validation is enabled (before snake_case conversion)
100
- if (this.validation) {
101
- if ('validateMethodRequest' in this.validation) {
102
- this.validation.validateMethodRequest(method, requestForValidation);
103
- }
104
- else {
105
- this.validation.validateRequest(requestForValidation);
106
- }
107
- }
108
89
  // Convert camelCase params to snake_case for the RPC call
109
90
  // Also convert undefined to null for methods that expect null params
110
91
  const snakeCaseParams = params !== undefined ? convertKeysToSnakeCase(params) : null;
@@ -148,10 +129,6 @@ class NearRpcClient {
148
129
  if (!response.ok) {
149
130
  throw new JsonRpcNetworkError(`HTTP error! status: ${response.status}`, undefined, jsonResponse);
150
131
  }
151
- // Validate basic JSON-RPC response structure
152
- if (this.validation) {
153
- this.validation.validateResponse(jsonResponse);
154
- }
155
132
  // Convert snake_case response back to camelCase
156
133
  const camelCaseResult = jsonResponse.result
157
134
  ? convertKeysToCamelCase(jsonResponse.result)
@@ -165,15 +142,6 @@ class NearRpcClient {
165
142
  throw new JsonRpcClientError(`RPC Error: ${errorMessage}`, -32000, // Generic RPC error code
166
143
  camelCaseResult);
167
144
  }
168
- // Validate method-specific response structure after camelCase conversion
169
- if (this.validation && 'validateMethodResponse' in this.validation) {
170
- // Create a camelCase version of the response for validation
171
- const camelCaseResponse = {
172
- ...jsonResponse,
173
- result: camelCaseResult,
174
- };
175
- this.validation.validateMethodResponse(method, camelCaseResponse);
176
- }
177
145
  return camelCaseResult;
178
146
  }
179
147
  catch (error) {
@@ -201,11 +169,6 @@ class NearRpcClient {
201
169
  headers: config.headers ?? this.headers,
202
170
  timeout: config.timeout ?? this.timeout,
203
171
  retries: config.retries ?? this.retries,
204
- ...(config.validation !== undefined
205
- ? { validation: config.validation }
206
- : this.validation !== undefined
207
- ? { validation: this.validation }
208
- : {}),
209
172
  });
210
173
  }
211
174
  }
@@ -2639,508 +2602,6 @@ var InvalidTxErrorSchema = () => union([
2639
2602
  })
2640
2603
  })
2641
2604
  ]);
2642
- var JsonRpcRequestFor_EXPERIMENTALChangesSchema = () => object({
2643
- id: string(),
2644
- jsonrpc: string(),
2645
- method: _enum(["EXPERIMENTAL_changes"]),
2646
- params: _lazy(() => RpcStateChangesInBlockByTypeRequestSchema())
2647
- });
2648
- var JsonRpcRequestFor_EXPERIMENTALChangesInBlockSchema = () => object({
2649
- id: string(),
2650
- jsonrpc: string(),
2651
- method: _enum(["EXPERIMENTAL_changes_in_block"]),
2652
- params: _lazy(() => RpcStateChangesInBlockRequestSchema())
2653
- });
2654
- var JsonRpcRequestFor_EXPERIMENTALCongestionLevelSchema = () => object({
2655
- id: string(),
2656
- jsonrpc: string(),
2657
- method: _enum(["EXPERIMENTAL_congestion_level"]),
2658
- params: _lazy(() => RpcCongestionLevelRequestSchema())
2659
- });
2660
- var JsonRpcRequestFor_EXPERIMENTALGenesisConfigSchema = () => object({
2661
- id: string(),
2662
- jsonrpc: string(),
2663
- method: _enum(["EXPERIMENTAL_genesis_config"]),
2664
- params: _lazy(() => GenesisConfigRequestSchema())
2665
- });
2666
- var JsonRpcRequestFor_EXPERIMENTALLightClientBlockProofSchema = () => object({
2667
- id: string(),
2668
- jsonrpc: string(),
2669
- method: _enum(["EXPERIMENTAL_light_client_block_proof"]),
2670
- params: _lazy(() => RpcLightClientBlockProofRequestSchema())
2671
- });
2672
- var JsonRpcRequestFor_EXPERIMENTALLightClientProofSchema = () => object({
2673
- id: string(),
2674
- jsonrpc: string(),
2675
- method: _enum(["EXPERIMENTAL_light_client_proof"]),
2676
- params: _lazy(() => RpcLightClientExecutionProofRequestSchema())
2677
- });
2678
- var JsonRpcRequestFor_EXPERIMENTALMaintenanceWindowsSchema = () => object({
2679
- id: string(),
2680
- jsonrpc: string(),
2681
- method: _enum(["EXPERIMENTAL_maintenance_windows"]),
2682
- params: _lazy(() => RpcMaintenanceWindowsRequestSchema())
2683
- });
2684
- var JsonRpcRequestFor_EXPERIMENTALProtocolConfigSchema = () => object({
2685
- id: string(),
2686
- jsonrpc: string(),
2687
- method: _enum(["EXPERIMENTAL_protocol_config"]),
2688
- params: _lazy(() => RpcProtocolConfigRequestSchema())
2689
- });
2690
- var JsonRpcRequestFor_EXPERIMENTALReceiptSchema = () => object({
2691
- id: string(),
2692
- jsonrpc: string(),
2693
- method: _enum(["EXPERIMENTAL_receipt"]),
2694
- params: _lazy(() => RpcReceiptRequestSchema())
2695
- });
2696
- var JsonRpcRequestFor_EXPERIMENTALSplitStorageInfoSchema = () => object({
2697
- id: string(),
2698
- jsonrpc: string(),
2699
- method: _enum(["EXPERIMENTAL_split_storage_info"]),
2700
- params: _lazy(() => RpcSplitStorageInfoRequestSchema())
2701
- });
2702
- var JsonRpcRequestFor_EXPERIMENTALTxStatusSchema = () => object({
2703
- id: string(),
2704
- jsonrpc: string(),
2705
- method: _enum(["EXPERIMENTAL_tx_status"]),
2706
- params: _lazy(() => RpcTransactionStatusRequestSchema())
2707
- });
2708
- var JsonRpcRequestFor_EXPERIMENTALValidatorsOrderedSchema = () => object({
2709
- id: string(),
2710
- jsonrpc: string(),
2711
- method: _enum(["EXPERIMENTAL_validators_ordered"]),
2712
- params: _lazy(() => RpcValidatorsOrderedRequestSchema())
2713
- });
2714
- var JsonRpcRequestForBlockSchema = () => object({
2715
- id: string(),
2716
- jsonrpc: string(),
2717
- method: _enum(["block"]),
2718
- params: _lazy(() => RpcBlockRequestSchema())
2719
- });
2720
- var JsonRpcRequestForBlockEffectsSchema = () => object({
2721
- id: string(),
2722
- jsonrpc: string(),
2723
- method: _enum(["block_effects"]),
2724
- params: _lazy(() => RpcStateChangesInBlockRequestSchema())
2725
- });
2726
- var JsonRpcRequestForBroadcastTxAsyncSchema = () => object({
2727
- id: string(),
2728
- jsonrpc: string(),
2729
- method: _enum(["broadcast_tx_async"]),
2730
- params: _lazy(() => RpcSendTransactionRequestSchema())
2731
- });
2732
- var JsonRpcRequestForBroadcastTxCommitSchema = () => object({
2733
- id: string(),
2734
- jsonrpc: string(),
2735
- method: _enum(["broadcast_tx_commit"]),
2736
- params: _lazy(() => RpcSendTransactionRequestSchema())
2737
- });
2738
- var JsonRpcRequestForChangesSchema = () => object({
2739
- id: string(),
2740
- jsonrpc: string(),
2741
- method: _enum(["changes"]),
2742
- params: _lazy(() => RpcStateChangesInBlockByTypeRequestSchema())
2743
- });
2744
- var JsonRpcRequestForChunkSchema = () => object({
2745
- id: string(),
2746
- jsonrpc: string(),
2747
- method: _enum(["chunk"]),
2748
- params: _lazy(() => RpcChunkRequestSchema())
2749
- });
2750
- var JsonRpcRequestForClientConfigSchema = () => object({
2751
- id: string(),
2752
- jsonrpc: string(),
2753
- method: _enum(["client_config"]),
2754
- params: _lazy(() => RpcClientConfigRequestSchema())
2755
- });
2756
- var JsonRpcRequestForGasPriceSchema = () => object({
2757
- id: string(),
2758
- jsonrpc: string(),
2759
- method: _enum(["gas_price"]),
2760
- params: _lazy(() => RpcGasPriceRequestSchema())
2761
- });
2762
- var JsonRpcRequestForHealthSchema = () => object({
2763
- id: string(),
2764
- jsonrpc: string(),
2765
- method: _enum(["health"]),
2766
- params: _lazy(() => RpcHealthRequestSchema())
2767
- });
2768
- var JsonRpcRequestForLightClientProofSchema = () => object({
2769
- id: string(),
2770
- jsonrpc: string(),
2771
- method: _enum(["light_client_proof"]),
2772
- params: _lazy(() => RpcLightClientExecutionProofRequestSchema())
2773
- });
2774
- var JsonRpcRequestForMaintenanceWindowsSchema = () => object({
2775
- id: string(),
2776
- jsonrpc: string(),
2777
- method: _enum(["maintenance_windows"]),
2778
- params: _lazy(() => RpcMaintenanceWindowsRequestSchema())
2779
- });
2780
- var JsonRpcRequestForNetworkInfoSchema = () => object({
2781
- id: string(),
2782
- jsonrpc: string(),
2783
- method: _enum(["network_info"]),
2784
- params: _lazy(() => RpcNetworkInfoRequestSchema())
2785
- });
2786
- var JsonRpcRequestForNextLightClientBlockSchema = () => object({
2787
- id: string(),
2788
- jsonrpc: string(),
2789
- method: _enum(["next_light_client_block"]),
2790
- params: _lazy(() => RpcLightClientNextBlockRequestSchema())
2791
- });
2792
- var JsonRpcRequestForQuerySchema = () => object({
2793
- id: string(),
2794
- jsonrpc: string(),
2795
- method: _enum(["query"]),
2796
- params: _lazy(() => RpcQueryRequestSchema())
2797
- });
2798
- var JsonRpcRequestForSendTxSchema = () => object({
2799
- id: string(),
2800
- jsonrpc: string(),
2801
- method: _enum(["send_tx"]),
2802
- params: _lazy(() => RpcSendTransactionRequestSchema())
2803
- });
2804
- var JsonRpcRequestForStatusSchema = () => object({
2805
- id: string(),
2806
- jsonrpc: string(),
2807
- method: _enum(["status"]),
2808
- params: _lazy(() => RpcStatusRequestSchema())
2809
- });
2810
- var JsonRpcRequestForTxSchema = () => object({
2811
- id: string(),
2812
- jsonrpc: string(),
2813
- method: _enum(["tx"]),
2814
- params: _lazy(() => RpcTransactionStatusRequestSchema())
2815
- });
2816
- var JsonRpcRequestForValidatorsSchema = () => object({
2817
- id: string(),
2818
- jsonrpc: string(),
2819
- method: _enum(["validators"]),
2820
- params: _lazy(() => RpcValidatorRequestSchema())
2821
- });
2822
- var JsonRpcResponseFor_ArrayOf_RangeOfUint64And_RpcErrorSchema = () => intersection(
2823
- union([
2824
- object({
2825
- result: array(_lazy(() => RangeOfUint64Schema()))
2826
- }),
2827
- object({
2828
- error: _lazy(() => RpcErrorSchema())
2829
- })
2830
- ]),
2831
- object({
2832
- id: string(),
2833
- jsonrpc: string()
2834
- })
2835
- );
2836
- var JsonRpcResponseFor_ArrayOf_ValidatorStakeViewAnd_RpcErrorSchema = () => intersection(
2837
- union([
2838
- object({
2839
- result: array(_lazy(() => ValidatorStakeViewSchema()))
2840
- }),
2841
- object({
2842
- error: _lazy(() => RpcErrorSchema())
2843
- })
2844
- ]),
2845
- object({
2846
- id: string(),
2847
- jsonrpc: string()
2848
- })
2849
- );
2850
- var JsonRpcResponseFor_CryptoHashAnd_RpcErrorSchema = () => intersection(
2851
- union([
2852
- object({
2853
- result: _lazy(() => CryptoHashSchema())
2854
- }),
2855
- object({
2856
- error: _lazy(() => RpcErrorSchema())
2857
- })
2858
- ]),
2859
- object({
2860
- id: string(),
2861
- jsonrpc: string()
2862
- })
2863
- );
2864
- var JsonRpcResponseFor_GenesisConfigAnd_RpcErrorSchema = () => intersection(
2865
- union([
2866
- object({
2867
- result: _lazy(() => GenesisConfigSchema())
2868
- }),
2869
- object({
2870
- error: _lazy(() => RpcErrorSchema())
2871
- })
2872
- ]),
2873
- object({
2874
- id: string(),
2875
- jsonrpc: string()
2876
- })
2877
- );
2878
- var JsonRpcResponseFor_Nullable_RpcHealthResponseAnd_RpcErrorSchema = () => intersection(
2879
- union([
2880
- object({
2881
- result: union([_lazy(() => RpcHealthResponseSchema()), _null()])
2882
- }),
2883
- object({
2884
- error: _lazy(() => RpcErrorSchema())
2885
- })
2886
- ]),
2887
- object({
2888
- id: string(),
2889
- jsonrpc: string()
2890
- })
2891
- );
2892
- var JsonRpcResponseFor_RpcBlockResponseAnd_RpcErrorSchema = () => intersection(
2893
- union([
2894
- object({
2895
- result: _lazy(() => RpcBlockResponseSchema())
2896
- }),
2897
- object({
2898
- error: _lazy(() => RpcErrorSchema())
2899
- })
2900
- ]),
2901
- object({
2902
- id: string(),
2903
- jsonrpc: string()
2904
- })
2905
- );
2906
- var JsonRpcResponseFor_RpcChunkResponseAnd_RpcErrorSchema = () => intersection(
2907
- union([
2908
- object({
2909
- result: _lazy(() => RpcChunkResponseSchema())
2910
- }),
2911
- object({
2912
- error: _lazy(() => RpcErrorSchema())
2913
- })
2914
- ]),
2915
- object({
2916
- id: string(),
2917
- jsonrpc: string()
2918
- })
2919
- );
2920
- var JsonRpcResponseFor_RpcClientConfigResponseAnd_RpcErrorSchema = () => intersection(
2921
- union([
2922
- object({
2923
- result: _lazy(() => RpcClientConfigResponseSchema())
2924
- }),
2925
- object({
2926
- error: _lazy(() => RpcErrorSchema())
2927
- })
2928
- ]),
2929
- object({
2930
- id: string(),
2931
- jsonrpc: string()
2932
- })
2933
- );
2934
- var JsonRpcResponseFor_RpcCongestionLevelResponseAnd_RpcErrorSchema = () => intersection(
2935
- union([
2936
- object({
2937
- result: _lazy(() => RpcCongestionLevelResponseSchema())
2938
- }),
2939
- object({
2940
- error: _lazy(() => RpcErrorSchema())
2941
- })
2942
- ]),
2943
- object({
2944
- id: string(),
2945
- jsonrpc: string()
2946
- })
2947
- );
2948
- var JsonRpcResponseFor_RpcGasPriceResponseAnd_RpcErrorSchema = () => intersection(
2949
- union([
2950
- object({
2951
- result: _lazy(() => RpcGasPriceResponseSchema())
2952
- }),
2953
- object({
2954
- error: _lazy(() => RpcErrorSchema())
2955
- })
2956
- ]),
2957
- object({
2958
- id: string(),
2959
- jsonrpc: string()
2960
- })
2961
- );
2962
- var JsonRpcResponseFor_RpcLightClientBlockProofResponseAnd_RpcErrorSchema = () => intersection(
2963
- union([
2964
- object({
2965
- result: _lazy(() => RpcLightClientBlockProofResponseSchema())
2966
- }),
2967
- object({
2968
- error: _lazy(() => RpcErrorSchema())
2969
- })
2970
- ]),
2971
- object({
2972
- id: string(),
2973
- jsonrpc: string()
2974
- })
2975
- );
2976
- var JsonRpcResponseFor_RpcLightClientExecutionProofResponseAnd_RpcErrorSchema = () => intersection(
2977
- union([
2978
- object({
2979
- result: _lazy(() => RpcLightClientExecutionProofResponseSchema())
2980
- }),
2981
- object({
2982
- error: _lazy(() => RpcErrorSchema())
2983
- })
2984
- ]),
2985
- object({
2986
- id: string(),
2987
- jsonrpc: string()
2988
- })
2989
- );
2990
- var JsonRpcResponseFor_RpcLightClientNextBlockResponseAnd_RpcErrorSchema = () => intersection(
2991
- union([
2992
- object({
2993
- result: _lazy(() => RpcLightClientNextBlockResponseSchema())
2994
- }),
2995
- object({
2996
- error: _lazy(() => RpcErrorSchema())
2997
- })
2998
- ]),
2999
- object({
3000
- id: string(),
3001
- jsonrpc: string()
3002
- })
3003
- );
3004
- var JsonRpcResponseFor_RpcNetworkInfoResponseAnd_RpcErrorSchema = () => intersection(
3005
- union([
3006
- object({
3007
- result: _lazy(() => RpcNetworkInfoResponseSchema())
3008
- }),
3009
- object({
3010
- error: _lazy(() => RpcErrorSchema())
3011
- })
3012
- ]),
3013
- object({
3014
- id: string(),
3015
- jsonrpc: string()
3016
- })
3017
- );
3018
- var JsonRpcResponseFor_RpcProtocolConfigResponseAnd_RpcErrorSchema = () => intersection(
3019
- union([
3020
- object({
3021
- result: _lazy(() => RpcProtocolConfigResponseSchema())
3022
- }),
3023
- object({
3024
- error: _lazy(() => RpcErrorSchema())
3025
- })
3026
- ]),
3027
- object({
3028
- id: string(),
3029
- jsonrpc: string()
3030
- })
3031
- );
3032
- var JsonRpcResponseFor_RpcQueryResponseAnd_RpcErrorSchema = () => intersection(
3033
- union([
3034
- object({
3035
- result: _lazy(() => RpcQueryResponseSchema())
3036
- }),
3037
- object({
3038
- error: _lazy(() => RpcErrorSchema())
3039
- })
3040
- ]),
3041
- object({
3042
- id: string(),
3043
- jsonrpc: string()
3044
- })
3045
- );
3046
- var JsonRpcResponseFor_RpcReceiptResponseAnd_RpcErrorSchema = () => intersection(
3047
- union([
3048
- object({
3049
- result: _lazy(() => RpcReceiptResponseSchema())
3050
- }),
3051
- object({
3052
- error: _lazy(() => RpcErrorSchema())
3053
- })
3054
- ]),
3055
- object({
3056
- id: string(),
3057
- jsonrpc: string()
3058
- })
3059
- );
3060
- var JsonRpcResponseFor_RpcSplitStorageInfoResponseAnd_RpcErrorSchema = () => intersection(
3061
- union([
3062
- object({
3063
- result: _lazy(() => RpcSplitStorageInfoResponseSchema())
3064
- }),
3065
- object({
3066
- error: _lazy(() => RpcErrorSchema())
3067
- })
3068
- ]),
3069
- object({
3070
- id: string(),
3071
- jsonrpc: string()
3072
- })
3073
- );
3074
- var JsonRpcResponseFor_RpcStateChangesInBlockByTypeResponseAnd_RpcErrorSchema = () => intersection(
3075
- union([
3076
- object({
3077
- result: _lazy(() => RpcStateChangesInBlockByTypeResponseSchema())
3078
- }),
3079
- object({
3080
- error: _lazy(() => RpcErrorSchema())
3081
- })
3082
- ]),
3083
- object({
3084
- id: string(),
3085
- jsonrpc: string()
3086
- })
3087
- );
3088
- var JsonRpcResponseFor_RpcStateChangesInBlockResponseAnd_RpcErrorSchema = () => intersection(
3089
- union([
3090
- object({
3091
- result: _lazy(() => RpcStateChangesInBlockResponseSchema())
3092
- }),
3093
- object({
3094
- error: _lazy(() => RpcErrorSchema())
3095
- })
3096
- ]),
3097
- object({
3098
- id: string(),
3099
- jsonrpc: string()
3100
- })
3101
- );
3102
- var JsonRpcResponseFor_RpcStatusResponseAnd_RpcErrorSchema = () => intersection(
3103
- union([
3104
- object({
3105
- result: _lazy(() => RpcStatusResponseSchema())
3106
- }),
3107
- object({
3108
- error: _lazy(() => RpcErrorSchema())
3109
- })
3110
- ]),
3111
- object({
3112
- id: string(),
3113
- jsonrpc: string()
3114
- })
3115
- );
3116
- var JsonRpcResponseFor_RpcTransactionResponseAnd_RpcErrorSchema = () => intersection(
3117
- union([
3118
- object({
3119
- result: _lazy(() => RpcTransactionResponseSchema())
3120
- }),
3121
- object({
3122
- error: _lazy(() => RpcErrorSchema())
3123
- })
3124
- ]),
3125
- object({
3126
- id: string(),
3127
- jsonrpc: string()
3128
- })
3129
- );
3130
- var JsonRpcResponseFor_RpcValidatorResponseAnd_RpcErrorSchema = () => intersection(
3131
- union([
3132
- object({
3133
- result: _lazy(() => RpcValidatorResponseSchema())
3134
- }),
3135
- object({
3136
- error: _lazy(() => RpcErrorSchema())
3137
- })
3138
- ]),
3139
- object({
3140
- id: string(),
3141
- jsonrpc: string()
3142
- })
3143
- );
3144
2605
  var KnownProducerViewSchema = () => object({
3145
2606
  accountId: _lazy(() => AccountIdSchema()),
3146
2607
  nextHops: optional(
@@ -3257,10 +2718,6 @@ var PrepareErrorSchema = () => union([
3257
2718
  _enum(["TooManyLocals"])
3258
2719
  ]);
3259
2720
  var PublicKeySchema = () => string();
3260
- var RangeOfUint64Schema = () => object({
3261
- end: number(),
3262
- start: number()
3263
- });
3264
2721
  var ReceiptEnumViewSchema = () => union([
3265
2722
  object({
3266
2723
  Action: object({
@@ -3455,29 +2912,6 @@ var RpcCongestionLevelRequestSchema = () => union([
3455
2912
  var RpcCongestionLevelResponseSchema = () => object({
3456
2913
  congestionLevel: number()
3457
2914
  });
3458
- var RpcErrorSchema = () => intersection(
3459
- union([
3460
- object({
3461
- cause: _lazy(() => RpcRequestValidationErrorKindSchema()),
3462
- name: _enum(["REQUEST_VALIDATION_ERROR"])
3463
- }),
3464
- object({
3465
- cause: unknown(),
3466
- name: _enum(["HANDLER_ERROR"])
3467
- }),
3468
- object({
3469
- cause: unknown(),
3470
- name: _enum(["INTERNAL_ERROR"])
3471
- })
3472
- ]),
3473
- object({
3474
- cause: optional(unknown()),
3475
- code: number(),
3476
- data: optional(unknown()),
3477
- message: string(),
3478
- name: optional(unknown())
3479
- })
3480
- );
3481
2915
  var RpcGasPriceRequestSchema = () => object({
3482
2916
  blockId: optional(union([_lazy(() => BlockIdSchema()), _null()]))
3483
2917
  });
@@ -3854,20 +3288,6 @@ var RpcReceiptResponseSchema = () => object({
3854
3288
  receiptId: _lazy(() => CryptoHashSchema()),
3855
3289
  receiverId: _lazy(() => AccountIdSchema())
3856
3290
  });
3857
- var RpcRequestValidationErrorKindSchema = () => union([
3858
- object({
3859
- info: object({
3860
- methodName: string()
3861
- }),
3862
- name: _enum(["METHOD_NOT_FOUND"])
3863
- }),
3864
- object({
3865
- info: object({
3866
- errorMessage: string()
3867
- }),
3868
- name: _enum(["PARSE_ERROR"])
3869
- })
3870
- ]);
3871
3291
  var RpcSendTransactionRequestSchema = () => object({
3872
3292
  signedTxBase64: _lazy(() => SignedTransactionSchema()),
3873
3293
  waitUntil: optional(_lazy(() => TxExecutionStatusSchema()))
@@ -4623,216 +4043,6 @@ var WitnessConfigViewSchema = () => object({
4623
4043
  mainStorageProofSizeSoftLimit: number(),
4624
4044
  newTransactionsValidationStateSizeSoftLimit: number()
4625
4045
  });
4626
- var EXPERIMENTALChangesRequestSchema = () => _lazy(() => JsonRpcRequestFor_EXPERIMENTALChangesSchema());
4627
- var EXPERIMENTALChangesResponseSchema = () => _lazy(
4628
- () => JsonRpcResponseFor_RpcStateChangesInBlockResponseAnd_RpcErrorSchema()
4629
- );
4630
- var EXPERIMENTALChangesInBlockRequestSchema = () => _lazy(() => JsonRpcRequestFor_EXPERIMENTALChangesInBlockSchema());
4631
- var EXPERIMENTALChangesInBlockResponseSchema = () => _lazy(
4632
- () => JsonRpcResponseFor_RpcStateChangesInBlockByTypeResponseAnd_RpcErrorSchema()
4633
- );
4634
- var EXPERIMENTALCongestionLevelRequestSchema = () => _lazy(() => JsonRpcRequestFor_EXPERIMENTALCongestionLevelSchema());
4635
- var EXPERIMENTALCongestionLevelResponseSchema = () => _lazy(
4636
- () => JsonRpcResponseFor_RpcCongestionLevelResponseAnd_RpcErrorSchema()
4637
- );
4638
- var EXPERIMENTALGenesisConfigRequestSchema = () => _lazy(() => JsonRpcRequestFor_EXPERIMENTALGenesisConfigSchema());
4639
- var EXPERIMENTALGenesisConfigResponseSchema = () => _lazy(() => JsonRpcResponseFor_GenesisConfigAnd_RpcErrorSchema());
4640
- var EXPERIMENTALLightClientBlockProofRequestSchema = () => _lazy(() => JsonRpcRequestFor_EXPERIMENTALLightClientBlockProofSchema());
4641
- var EXPERIMENTALLightClientBlockProofResponseSchema = () => _lazy(
4642
- () => JsonRpcResponseFor_RpcLightClientBlockProofResponseAnd_RpcErrorSchema()
4643
- );
4644
- var EXPERIMENTALLightClientProofRequestSchema = () => _lazy(() => JsonRpcRequestFor_EXPERIMENTALLightClientProofSchema());
4645
- var EXPERIMENTALLightClientProofResponseSchema = () => _lazy(
4646
- () => JsonRpcResponseFor_RpcLightClientExecutionProofResponseAnd_RpcErrorSchema()
4647
- );
4648
- var EXPERIMENTALMaintenanceWindowsRequestSchema = () => _lazy(() => JsonRpcRequestFor_EXPERIMENTALMaintenanceWindowsSchema());
4649
- var EXPERIMENTALMaintenanceWindowsResponseSchema = () => _lazy(() => JsonRpcResponseFor_ArrayOf_RangeOfUint64And_RpcErrorSchema());
4650
- var EXPERIMENTALProtocolConfigRequestSchema = () => _lazy(() => JsonRpcRequestFor_EXPERIMENTALProtocolConfigSchema());
4651
- var EXPERIMENTALProtocolConfigResponseSchema = () => _lazy(
4652
- () => JsonRpcResponseFor_RpcProtocolConfigResponseAnd_RpcErrorSchema()
4653
- );
4654
- var EXPERIMENTALReceiptRequestSchema = () => _lazy(() => JsonRpcRequestFor_EXPERIMENTALReceiptSchema());
4655
- var EXPERIMENTALReceiptResponseSchema = () => _lazy(() => JsonRpcResponseFor_RpcReceiptResponseAnd_RpcErrorSchema());
4656
- var EXPERIMENTALSplitStorageInfoRequestSchema = () => _lazy(() => JsonRpcRequestFor_EXPERIMENTALSplitStorageInfoSchema());
4657
- var EXPERIMENTALSplitStorageInfoResponseSchema = () => _lazy(
4658
- () => JsonRpcResponseFor_RpcSplitStorageInfoResponseAnd_RpcErrorSchema()
4659
- );
4660
- var EXPERIMENTALTxStatusRequestSchema = () => _lazy(() => JsonRpcRequestFor_EXPERIMENTALTxStatusSchema());
4661
- var EXPERIMENTALTxStatusResponseSchema = () => _lazy(() => JsonRpcResponseFor_RpcTransactionResponseAnd_RpcErrorSchema());
4662
- var EXPERIMENTALValidatorsOrderedRequestSchema = () => _lazy(() => JsonRpcRequestFor_EXPERIMENTALValidatorsOrderedSchema());
4663
- var EXPERIMENTALValidatorsOrderedResponseSchema = () => _lazy(
4664
- () => JsonRpcResponseFor_ArrayOf_ValidatorStakeViewAnd_RpcErrorSchema()
4665
- );
4666
- var BlockRequestSchema = () => _lazy(() => JsonRpcRequestForBlockSchema());
4667
- var BlockResponseSchema = () => _lazy(() => JsonRpcResponseFor_RpcBlockResponseAnd_RpcErrorSchema());
4668
- var BlockEffectsRequestSchema = () => _lazy(() => JsonRpcRequestForBlockEffectsSchema());
4669
- var BlockEffectsResponseSchema = () => _lazy(
4670
- () => JsonRpcResponseFor_RpcStateChangesInBlockByTypeResponseAnd_RpcErrorSchema()
4671
- );
4672
- var BroadcastTxAsyncRequestSchema = () => _lazy(() => JsonRpcRequestForBroadcastTxAsyncSchema());
4673
- var BroadcastTxAsyncResponseSchema = () => _lazy(() => JsonRpcResponseFor_CryptoHashAnd_RpcErrorSchema());
4674
- var BroadcastTxCommitRequestSchema = () => _lazy(() => JsonRpcRequestForBroadcastTxCommitSchema());
4675
- var BroadcastTxCommitResponseSchema = () => _lazy(() => JsonRpcResponseFor_RpcTransactionResponseAnd_RpcErrorSchema());
4676
- var ChangesRequestSchema = () => _lazy(() => JsonRpcRequestForChangesSchema());
4677
- var ChangesResponseSchema = () => _lazy(
4678
- () => JsonRpcResponseFor_RpcStateChangesInBlockResponseAnd_RpcErrorSchema()
4679
- );
4680
- var ChunkRequestSchema = () => _lazy(() => JsonRpcRequestForChunkSchema());
4681
- var ChunkResponseSchema = () => _lazy(() => JsonRpcResponseFor_RpcChunkResponseAnd_RpcErrorSchema());
4682
- var ClientConfigRequestSchema = () => _lazy(() => JsonRpcRequestForClientConfigSchema());
4683
- var ClientConfigResponseSchema = () => _lazy(() => JsonRpcResponseFor_RpcClientConfigResponseAnd_RpcErrorSchema());
4684
- var GasPriceRequestSchema = () => _lazy(() => JsonRpcRequestForGasPriceSchema());
4685
- var GasPriceResponseSchema = () => _lazy(() => JsonRpcResponseFor_RpcGasPriceResponseAnd_RpcErrorSchema());
4686
- var GenesisConfigResponseSchema = () => _lazy(() => JsonRpcResponseFor_GenesisConfigAnd_RpcErrorSchema());
4687
- var HealthRequestSchema = () => _lazy(() => JsonRpcRequestForHealthSchema());
4688
- var HealthResponseSchema = () => _lazy(
4689
- () => JsonRpcResponseFor_Nullable_RpcHealthResponseAnd_RpcErrorSchema()
4690
- );
4691
- var LightClientProofRequestSchema = () => _lazy(() => JsonRpcRequestForLightClientProofSchema());
4692
- var LightClientProofResponseSchema = () => _lazy(
4693
- () => JsonRpcResponseFor_RpcLightClientExecutionProofResponseAnd_RpcErrorSchema()
4694
- );
4695
- var MaintenanceWindowsRequestSchema = () => _lazy(() => JsonRpcRequestForMaintenanceWindowsSchema());
4696
- var MaintenanceWindowsResponseSchema = () => _lazy(() => JsonRpcResponseFor_ArrayOf_RangeOfUint64And_RpcErrorSchema());
4697
- var NetworkInfoRequestSchema = () => _lazy(() => JsonRpcRequestForNetworkInfoSchema());
4698
- var NetworkInfoResponseSchema = () => _lazy(() => JsonRpcResponseFor_RpcNetworkInfoResponseAnd_RpcErrorSchema());
4699
- var NextLightClientBlockRequestSchema = () => _lazy(() => JsonRpcRequestForNextLightClientBlockSchema());
4700
- var NextLightClientBlockResponseSchema = () => _lazy(
4701
- () => JsonRpcResponseFor_RpcLightClientNextBlockResponseAnd_RpcErrorSchema()
4702
- );
4703
- var QueryRequestSchema = () => _lazy(() => JsonRpcRequestForQuerySchema());
4704
- var QueryResponseSchema = () => _lazy(() => JsonRpcResponseFor_RpcQueryResponseAnd_RpcErrorSchema());
4705
- var SendTxRequestSchema = () => _lazy(() => JsonRpcRequestForSendTxSchema());
4706
- var SendTxResponseSchema = () => _lazy(() => JsonRpcResponseFor_RpcTransactionResponseAnd_RpcErrorSchema());
4707
- var StatusRequestSchema = () => _lazy(() => JsonRpcRequestForStatusSchema());
4708
- var StatusResponseSchema = () => _lazy(() => JsonRpcResponseFor_RpcStatusResponseAnd_RpcErrorSchema());
4709
- var TxRequestSchema = () => _lazy(() => JsonRpcRequestForTxSchema());
4710
- var TxResponseSchema = () => _lazy(() => JsonRpcResponseFor_RpcTransactionResponseAnd_RpcErrorSchema());
4711
- var ValidatorsRequestSchema = () => _lazy(() => JsonRpcRequestForValidatorsSchema());
4712
- var ValidatorsResponseSchema = () => _lazy(() => JsonRpcResponseFor_RpcValidatorResponseAnd_RpcErrorSchema());
4713
- var VALIDATION_SCHEMA_MAP = {
4714
- EXPERIMENTAL_changes: {
4715
- requestSchema: EXPERIMENTALChangesRequestSchema,
4716
- responseSchema: EXPERIMENTALChangesResponseSchema
4717
- },
4718
- EXPERIMENTAL_changes_in_block: {
4719
- requestSchema: EXPERIMENTALChangesInBlockRequestSchema,
4720
- responseSchema: EXPERIMENTALChangesInBlockResponseSchema
4721
- },
4722
- EXPERIMENTAL_congestion_level: {
4723
- requestSchema: EXPERIMENTALCongestionLevelRequestSchema,
4724
- responseSchema: EXPERIMENTALCongestionLevelResponseSchema
4725
- },
4726
- EXPERIMENTAL_genesis_config: {
4727
- requestSchema: EXPERIMENTALGenesisConfigRequestSchema,
4728
- responseSchema: EXPERIMENTALGenesisConfigResponseSchema
4729
- },
4730
- EXPERIMENTAL_light_client_block_proof: {
4731
- requestSchema: EXPERIMENTALLightClientBlockProofRequestSchema,
4732
- responseSchema: EXPERIMENTALLightClientBlockProofResponseSchema
4733
- },
4734
- EXPERIMENTAL_light_client_proof: {
4735
- requestSchema: EXPERIMENTALLightClientProofRequestSchema,
4736
- responseSchema: EXPERIMENTALLightClientProofResponseSchema
4737
- },
4738
- EXPERIMENTAL_maintenance_windows: {
4739
- requestSchema: EXPERIMENTALMaintenanceWindowsRequestSchema,
4740
- responseSchema: EXPERIMENTALMaintenanceWindowsResponseSchema
4741
- },
4742
- EXPERIMENTAL_protocol_config: {
4743
- requestSchema: EXPERIMENTALProtocolConfigRequestSchema,
4744
- responseSchema: EXPERIMENTALProtocolConfigResponseSchema
4745
- },
4746
- EXPERIMENTAL_receipt: {
4747
- requestSchema: EXPERIMENTALReceiptRequestSchema,
4748
- responseSchema: EXPERIMENTALReceiptResponseSchema
4749
- },
4750
- EXPERIMENTAL_split_storage_info: {
4751
- requestSchema: EXPERIMENTALSplitStorageInfoRequestSchema,
4752
- responseSchema: EXPERIMENTALSplitStorageInfoResponseSchema
4753
- },
4754
- EXPERIMENTAL_tx_status: {
4755
- requestSchema: EXPERIMENTALTxStatusRequestSchema,
4756
- responseSchema: EXPERIMENTALTxStatusResponseSchema
4757
- },
4758
- EXPERIMENTAL_validators_ordered: {
4759
- requestSchema: EXPERIMENTALValidatorsOrderedRequestSchema,
4760
- responseSchema: EXPERIMENTALValidatorsOrderedResponseSchema
4761
- },
4762
- block: {
4763
- requestSchema: BlockRequestSchema,
4764
- responseSchema: BlockResponseSchema
4765
- },
4766
- block_effects: {
4767
- requestSchema: BlockEffectsRequestSchema,
4768
- responseSchema: BlockEffectsResponseSchema
4769
- },
4770
- broadcast_tx_async: {
4771
- requestSchema: BroadcastTxAsyncRequestSchema,
4772
- responseSchema: BroadcastTxAsyncResponseSchema
4773
- },
4774
- broadcast_tx_commit: {
4775
- requestSchema: BroadcastTxCommitRequestSchema,
4776
- responseSchema: BroadcastTxCommitResponseSchema
4777
- },
4778
- changes: {
4779
- requestSchema: ChangesRequestSchema,
4780
- responseSchema: ChangesResponseSchema
4781
- },
4782
- chunk: {
4783
- requestSchema: ChunkRequestSchema,
4784
- responseSchema: ChunkResponseSchema
4785
- },
4786
- client_config: {
4787
- requestSchema: ClientConfigRequestSchema,
4788
- responseSchema: ClientConfigResponseSchema
4789
- },
4790
- gas_price: {
4791
- requestSchema: GasPriceRequestSchema,
4792
- responseSchema: GasPriceResponseSchema
4793
- },
4794
- genesis_config: {
4795
- requestSchema: GenesisConfigRequestSchema,
4796
- responseSchema: GenesisConfigResponseSchema
4797
- },
4798
- health: {
4799
- requestSchema: HealthRequestSchema,
4800
- responseSchema: HealthResponseSchema
4801
- },
4802
- light_client_proof: {
4803
- requestSchema: LightClientProofRequestSchema,
4804
- responseSchema: LightClientProofResponseSchema
4805
- },
4806
- maintenance_windows: {
4807
- requestSchema: MaintenanceWindowsRequestSchema,
4808
- responseSchema: MaintenanceWindowsResponseSchema
4809
- },
4810
- network_info: {
4811
- requestSchema: NetworkInfoRequestSchema,
4812
- responseSchema: NetworkInfoResponseSchema
4813
- },
4814
- next_light_client_block: {
4815
- requestSchema: NextLightClientBlockRequestSchema,
4816
- responseSchema: NextLightClientBlockResponseSchema
4817
- },
4818
- query: {
4819
- requestSchema: QueryRequestSchema,
4820
- responseSchema: QueryResponseSchema
4821
- },
4822
- send_tx: {
4823
- requestSchema: SendTxRequestSchema,
4824
- responseSchema: SendTxResponseSchema
4825
- },
4826
- status: {
4827
- requestSchema: StatusRequestSchema,
4828
- responseSchema: StatusResponseSchema
4829
- },
4830
- tx: { requestSchema: TxRequestSchema, responseSchema: TxResponseSchema },
4831
- validators: {
4832
- requestSchema: ValidatorsRequestSchema,
4833
- responseSchema: ValidatorsResponseSchema
4834
- }
4835
- };
4836
4046
  var JsonRpcRequestSchema = () => object({
4837
4047
  jsonrpc: literal("2.0"),
4838
4048
  id: string(),
@@ -4890,132 +4100,215 @@ Object.entries(PATH_TO_METHOD_MAP).forEach(([path, method]) => {
4890
4100
  var RPC_METHODS = Object.values(PATH_TO_METHOD_MAP);
4891
4101
 
4892
4102
  // Auto-generated static RPC functions for tree-shaking
4893
- // Generated at: 2025-07-31T19:21:47.589Z
4103
+ // Generated at: 2025-08-03T18:51:29.359Z
4894
4104
  // Total functions: 31
4895
4105
  //
4896
4106
  // This file is automatically generated by tools/codegen/generate-client-interface.ts
4897
4107
  // Do not edit manually - changes will be overwritten
4898
- // EXPERIMENTAL_changes static function
4108
+ /**
4109
+ * [Deprecated] Returns changes for a given account, contract or contract code
4110
+ * for given block height or hash. Consider using changes instead.
4111
+ */
4899
4112
  async function experimentalChanges$1(client, params) {
4900
4113
  return client.makeRequest('EXPERIMENTAL_changes', params);
4901
4114
  }
4902
- // EXPERIMENTAL_changes_in_block static function
4115
+ /**
4116
+ * [Deprecated] Returns changes in block for given block height or hash over
4117
+ * all transactions for all the types. Includes changes like account_touched,
4118
+ * access_key_touched, data_touched, contract_code_touched. Consider using
4119
+ * block_effects instead
4120
+ */
4903
4121
  async function experimentalChangesInBlock$1(client, params) {
4904
4122
  return client.makeRequest('EXPERIMENTAL_changes_in_block', params);
4905
4123
  }
4906
- // EXPERIMENTAL_congestion_level static function
4124
+ /**
4125
+ * Queries the congestion level of a shard. More info about congestion
4126
+ * [here](https://near.github.io/nearcore/architecture/how/receipt-congestion.html?highlight=congestion#receipt-congestion)
4127
+ */
4907
4128
  async function experimentalCongestionLevel$1(client, params) {
4908
4129
  return client.makeRequest('EXPERIMENTAL_congestion_level', params);
4909
4130
  }
4910
- // EXPERIMENTAL_genesis_config static function
4131
+ /**
4132
+ * [Deprecated] Get initial state and parameters for the genesis block.
4133
+ * Consider genesis_config instead.
4134
+ */
4911
4135
  async function experimentalGenesisConfig$1(client, params) {
4912
4136
  return client.makeRequest('EXPERIMENTAL_genesis_config', params);
4913
4137
  }
4914
- // EXPERIMENTAL_light_client_block_proof static function
4138
+ /** Returns the proofs for a transaction execution. */
4915
4139
  async function experimentalLightClientBlockProof$1(client, params) {
4916
4140
  return client.makeRequest('EXPERIMENTAL_light_client_block_proof', params);
4917
4141
  }
4918
- // EXPERIMENTAL_light_client_proof static function
4142
+ /** Returns the proofs for a transaction execution. */
4919
4143
  async function experimentalLightClientProof$1(client, params) {
4920
4144
  return client.makeRequest('EXPERIMENTAL_light_client_proof', params);
4921
4145
  }
4922
- // EXPERIMENTAL_maintenance_windows static function
4146
+ /**
4147
+ * [Deprecated] Returns the future windows for maintenance in current epoch
4148
+ * for the specified account. In the maintenance windows, the node will not be
4149
+ * block producer or chunk producer. Consider using maintenance_windows
4150
+ * instead.
4151
+ */
4923
4152
  async function experimentalMaintenanceWindows$1(client, params) {
4924
4153
  return client.makeRequest('EXPERIMENTAL_maintenance_windows', params);
4925
4154
  }
4926
- // EXPERIMENTAL_protocol_config static function
4155
+ /**
4156
+ * A configuration that defines the protocol-level parameters such as
4157
+ * gas/storage costs, limits, feature flags, other settings
4158
+ */
4927
4159
  async function experimentalProtocolConfig$1(client, params) {
4928
4160
  return client.makeRequest('EXPERIMENTAL_protocol_config', params);
4929
4161
  }
4930
- // EXPERIMENTAL_receipt static function
4162
+ /** Fetches a receipt by its ID (as is, without a status or execution outcome) */
4931
4163
  async function experimentalReceipt$1(client, params) {
4932
4164
  return client.makeRequest('EXPERIMENTAL_receipt', params);
4933
4165
  }
4934
- // EXPERIMENTAL_split_storage_info static function
4166
+ /**
4167
+ * Contains the split storage information. More info on split storage
4168
+ * [here](https://near-nodes.io/archival/split-storage-archival)
4169
+ */
4935
4170
  async function experimentalSplitStorageInfo$1(client, params) {
4936
4171
  return client.makeRequest('EXPERIMENTAL_split_storage_info', params);
4937
4172
  }
4938
- // EXPERIMENTAL_tx_status static function
4173
+ /**
4174
+ * Queries status of a transaction by hash, returning the final transaction
4175
+ * result and details of all receipts.
4176
+ */
4939
4177
  async function experimentalTxStatus$1(client, params) {
4940
4178
  return client.makeRequest('EXPERIMENTAL_tx_status', params);
4941
4179
  }
4942
- // EXPERIMENTAL_validators_ordered static function
4180
+ /**
4181
+ * Returns the current epoch validators ordered in the block producer order
4182
+ * with repetition. This endpoint is solely used for bridge currently and is
4183
+ * not intended for other external use cases.
4184
+ */
4943
4185
  async function experimentalValidatorsOrdered$1(client, params) {
4944
4186
  return client.makeRequest('EXPERIMENTAL_validators_ordered', params);
4945
4187
  }
4946
- // block static function
4188
+ /** Returns block details for given height or hash */
4947
4189
  async function block$1(client, params) {
4948
4190
  return client.makeRequest('block', params);
4949
4191
  }
4950
- // block_effects static function
4192
+ /**
4193
+ * Returns changes in block for given block height or hash over all
4194
+ * transactions for all the types. Includes changes like account_touched,
4195
+ * access_key_touched, data_touched, contract_code_touched.
4196
+ */
4951
4197
  async function blockEffects$1(client, params) {
4952
4198
  return client.makeRequest('block_effects', params);
4953
4199
  }
4954
- // broadcast_tx_async static function
4200
+ /**
4201
+ * [Deprecated] Sends a transaction and immediately returns transaction hash.
4202
+ * Consider using send_tx instead.
4203
+ */
4955
4204
  async function broadcastTxAsync$1(client, params) {
4956
4205
  return client.makeRequest('broadcast_tx_async', params);
4957
4206
  }
4958
- // broadcast_tx_commit static function
4207
+ /**
4208
+ * [Deprecated] Sends a transaction and waits until transaction is fully
4209
+ * complete. (Has a 10 second timeout). Consider using send_tx instead.
4210
+ */
4959
4211
  async function broadcastTxCommit$1(client, params) {
4960
4212
  return client.makeRequest('broadcast_tx_commit', params);
4961
4213
  }
4962
- // changes static function
4214
+ /**
4215
+ * Returns changes for a given account, contract or contract code for given
4216
+ * block height or hash.
4217
+ */
4963
4218
  async function changes$1(client, params) {
4964
4219
  return client.makeRequest('changes', params);
4965
4220
  }
4966
- // chunk static function
4221
+ /**
4222
+ * Returns details of a specific chunk. You can run a block details query to
4223
+ * get a valid chunk hash.
4224
+ */
4967
4225
  async function chunk$1(client, params) {
4968
4226
  return client.makeRequest('chunk', params);
4969
4227
  }
4970
- // client_config static function
4228
+ /** Queries client node configuration */
4971
4229
  async function clientConfig$1(client, params) {
4972
4230
  return client.makeRequest('client_config', params);
4973
4231
  }
4974
- // gas_price static function
4232
+ /**
4233
+ * Returns gas price for a specific block_height or block_hash. Using [null]
4234
+ * will return the most recent block's gas price.
4235
+ */
4975
4236
  async function gasPrice$1(client, params) {
4976
4237
  return client.makeRequest('gas_price', params);
4977
4238
  }
4978
- // genesis_config static function
4239
+ /** Get initial state and parameters for the genesis block */
4979
4240
  async function genesisConfig$1(client, params) {
4980
4241
  return client.makeRequest('genesis_config', params);
4981
4242
  }
4982
- // health static function
4243
+ /** Returns the current health status of the RPC node the client connects to. */
4983
4244
  async function health$1(client, params) {
4984
4245
  return client.makeRequest('health', params);
4985
4246
  }
4986
- // light_client_proof static function
4247
+ /** Returns the proofs for a transaction execution. */
4987
4248
  async function lightClientProof$1(client, params) {
4988
4249
  return client.makeRequest('light_client_proof', params);
4989
4250
  }
4990
- // maintenance_windows static function
4251
+ /**
4252
+ * Returns the future windows for maintenance in current epoch for the
4253
+ * specified account. In the maintenance windows, the node will not be block
4254
+ * producer or chunk producer.
4255
+ */
4991
4256
  async function maintenanceWindows$1(client, params) {
4992
4257
  return client.makeRequest('maintenance_windows', params);
4993
4258
  }
4994
- // network_info static function
4259
+ /**
4260
+ * Queries the current state of node network connections. This includes
4261
+ * information about active peers, transmitted data, known producers, etc.
4262
+ */
4995
4263
  async function networkInfo$1(client, params) {
4996
4264
  return client.makeRequest('network_info', params);
4997
4265
  }
4998
- // next_light_client_block static function
4266
+ /** Returns the next light client block. */
4999
4267
  async function nextLightClientBlock$1(client, params) {
5000
4268
  return client.makeRequest('next_light_client_block', params);
5001
4269
  }
5002
- // query static function
4270
+ /**
4271
+ * This module allows you to make generic requests to the network. The
4272
+ * `RpcQueryRequest` struct takes in a
4273
+ * [`BlockReference`](https://docs.rs/near-primitives/0.12.0/near_primitives/types/enum.BlockReference.html)
4274
+ * and a
4275
+ * [`QueryRequest`](https://docs.rs/near-primitives/0.12.0/near_primitives/views/enum.QueryRequest.html).
4276
+ * The `BlockReference` enum allows you to specify a block by `Finality`,
4277
+ * `BlockId` or `SyncCheckpoint`. The `QueryRequest` enum provides multiple
4278
+ * variants for performing the following actions: - View an account's details
4279
+ * - View a contract's code - View the state of an account - View the
4280
+ * `AccessKey` of an account - View the `AccessKeyList` of an account - Call a
4281
+ * function in a contract deployed on the network.
4282
+ */
5003
4283
  async function query$1(client, params) {
5004
4284
  return client.makeRequest('query', params);
5005
4285
  }
5006
- // send_tx static function
4286
+ /**
4287
+ * Sends transaction. Returns the guaranteed execution status and the results
4288
+ * the blockchain can provide at the moment.
4289
+ */
5007
4290
  async function sendTx$1(client, params) {
5008
4291
  return client.makeRequest('send_tx', params);
5009
4292
  }
5010
- // status static function
4293
+ /**
4294
+ * Requests the status of the connected RPC node. This includes information
4295
+ * about sync status, nearcore node version, protocol version, the current set
4296
+ * of validators, etc.
4297
+ */
5011
4298
  async function status$1(client, params) {
5012
4299
  return client.makeRequest('status', params);
5013
4300
  }
5014
- // tx static function
4301
+ /**
4302
+ * Queries status of a transaction by hash and returns the final transaction
4303
+ * result.
4304
+ */
5015
4305
  async function tx$1(client, params) {
5016
4306
  return client.makeRequest('tx', params);
5017
4307
  }
5018
- // validators static function
4308
+ /**
4309
+ * Queries active validators on the network. Returns details and the state of
4310
+ * validation on the blockchain.
4311
+ */
5019
4312
  async function validators$1(client, params) {
5020
4313
  return client.makeRequest('validators', params);
5021
4314
  }
@@ -5044,11 +4337,15 @@ async function viewFunctionAsJson(client, params) {
5044
4337
  }
5045
4338
 
5046
4339
  // Auto-generated validation wrapper functions
5047
- // Generated at: 2025-07-31T19:21:47.592Z
4340
+ // Generated at: 2025-08-03T18:51:29.361Z
5048
4341
  // Total functions: 31
5049
4342
  //
5050
4343
  // This file is automatically generated by tools/codegen/generate-validation-wrappers.ts
5051
4344
  // Do not edit manually - changes will be overwritten
4345
+ // Empty enableValidation function (validation is always enabled in these exports)
4346
+ function enableValidation() {
4347
+ // Intentionally empty - validation is always enabled for these exports
4348
+ }
5052
4349
  // Convenience function wrappers with validation
5053
4350
  async function viewAccount(client, params) {
5054
4351
  // Use the validated query function
@@ -5096,6 +4393,10 @@ async function viewAccessKey(client, params) {
5096
4393
  return query(client, queryParams);
5097
4394
  }
5098
4395
  // Validation wrapper functions
4396
+ /**
4397
+ * [Deprecated] Returns changes for a given account, contract or contract code
4398
+ * for given block height or hash. Consider using changes instead.
4399
+ */
5099
4400
  async function experimentalChanges(client, params) {
5100
4401
  // Validate request parameters
5101
4402
  const requestSchema = RpcStateChangesInBlockByTypeRequestSchema();
@@ -5120,6 +4421,12 @@ async function experimentalChanges(client, params) {
5120
4421
  }
5121
4422
  return result;
5122
4423
  }
4424
+ /**
4425
+ * [Deprecated] Returns changes in block for given block height or hash over
4426
+ * all transactions for all the types. Includes changes like account_touched,
4427
+ * access_key_touched, data_touched, contract_code_touched. Consider using
4428
+ * block_effects instead
4429
+ */
5123
4430
  async function experimentalChangesInBlock(client, params) {
5124
4431
  // Validate request parameters
5125
4432
  const requestSchema = RpcStateChangesInBlockRequestSchema();
@@ -5144,6 +4451,10 @@ async function experimentalChangesInBlock(client, params) {
5144
4451
  }
5145
4452
  return result;
5146
4453
  }
4454
+ /**
4455
+ * Queries the congestion level of a shard. More info about congestion
4456
+ * [here](https://near.github.io/nearcore/architecture/how/receipt-congestion.html?highlight=congestion#receipt-congestion)
4457
+ */
5147
4458
  async function experimentalCongestionLevel(client, params) {
5148
4459
  // Validate request parameters
5149
4460
  const requestSchema = RpcCongestionLevelRequestSchema();
@@ -5168,6 +4479,10 @@ async function experimentalCongestionLevel(client, params) {
5168
4479
  }
5169
4480
  return result;
5170
4481
  }
4482
+ /**
4483
+ * [Deprecated] Get initial state and parameters for the genesis block.
4484
+ * Consider genesis_config instead.
4485
+ */
5171
4486
  async function experimentalGenesisConfig(client, params) {
5172
4487
  // Validate request parameters
5173
4488
  const requestSchema = GenesisConfigRequestSchema();
@@ -5192,6 +4507,7 @@ async function experimentalGenesisConfig(client, params) {
5192
4507
  }
5193
4508
  return result;
5194
4509
  }
4510
+ /** Returns the proofs for a transaction execution. */
5195
4511
  async function experimentalLightClientBlockProof(client, params) {
5196
4512
  // Validate request parameters
5197
4513
  const requestSchema = RpcLightClientBlockProofRequestSchema();
@@ -5216,6 +4532,7 @@ async function experimentalLightClientBlockProof(client, params) {
5216
4532
  }
5217
4533
  return result;
5218
4534
  }
4535
+ /** Returns the proofs for a transaction execution. */
5219
4536
  async function experimentalLightClientProof(client, params) {
5220
4537
  // Validate request parameters
5221
4538
  const requestSchema = RpcLightClientExecutionProofRequestSchema();
@@ -5240,6 +4557,12 @@ async function experimentalLightClientProof(client, params) {
5240
4557
  }
5241
4558
  return result;
5242
4559
  }
4560
+ /**
4561
+ * [Deprecated] Returns the future windows for maintenance in current epoch
4562
+ * for the specified account. In the maintenance windows, the node will not be
4563
+ * block producer or chunk producer. Consider using maintenance_windows
4564
+ * instead.
4565
+ */
5243
4566
  async function experimentalMaintenanceWindows(client, params) {
5244
4567
  // Validate request parameters
5245
4568
  const requestSchema = RpcMaintenanceWindowsRequestSchema();
@@ -5254,6 +4577,10 @@ async function experimentalMaintenanceWindows(client, params) {
5254
4577
  // Call the base function (no response validation needed)
5255
4578
  return experimentalMaintenanceWindows$1(client, params);
5256
4579
  }
4580
+ /**
4581
+ * A configuration that defines the protocol-level parameters such as
4582
+ * gas/storage costs, limits, feature flags, other settings
4583
+ */
5257
4584
  async function experimentalProtocolConfig(client, params) {
5258
4585
  // Validate request parameters
5259
4586
  const requestSchema = RpcProtocolConfigRequestSchema();
@@ -5278,6 +4605,7 @@ async function experimentalProtocolConfig(client, params) {
5278
4605
  }
5279
4606
  return result;
5280
4607
  }
4608
+ /** Fetches a receipt by its ID (as is, without a status or execution outcome) */
5281
4609
  async function experimentalReceipt(client, params) {
5282
4610
  // Validate request parameters
5283
4611
  const requestSchema = RpcReceiptRequestSchema();
@@ -5302,6 +4630,10 @@ async function experimentalReceipt(client, params) {
5302
4630
  }
5303
4631
  return result;
5304
4632
  }
4633
+ /**
4634
+ * Contains the split storage information. More info on split storage
4635
+ * [here](https://near-nodes.io/archival/split-storage-archival)
4636
+ */
5305
4637
  async function experimentalSplitStorageInfo(client, params) {
5306
4638
  // Validate request parameters
5307
4639
  const requestSchema = RpcSplitStorageInfoRequestSchema();
@@ -5326,6 +4658,10 @@ async function experimentalSplitStorageInfo(client, params) {
5326
4658
  }
5327
4659
  return result;
5328
4660
  }
4661
+ /**
4662
+ * Queries status of a transaction by hash, returning the final transaction
4663
+ * result and details of all receipts.
4664
+ */
5329
4665
  async function experimentalTxStatus(client, params) {
5330
4666
  // Validate request parameters
5331
4667
  const requestSchema = RpcTransactionStatusRequestSchema();
@@ -5350,6 +4686,11 @@ async function experimentalTxStatus(client, params) {
5350
4686
  }
5351
4687
  return result;
5352
4688
  }
4689
+ /**
4690
+ * Returns the current epoch validators ordered in the block producer order
4691
+ * with repetition. This endpoint is solely used for bridge currently and is
4692
+ * not intended for other external use cases.
4693
+ */
5353
4694
  async function experimentalValidatorsOrdered(client, params) {
5354
4695
  // Validate request parameters
5355
4696
  const requestSchema = RpcValidatorsOrderedRequestSchema();
@@ -5364,6 +4705,7 @@ async function experimentalValidatorsOrdered(client, params) {
5364
4705
  // Call the base function (no response validation needed)
5365
4706
  return experimentalValidatorsOrdered$1(client, params);
5366
4707
  }
4708
+ /** Returns block details for given height or hash */
5367
4709
  async function block(client, params) {
5368
4710
  // Validate request parameters
5369
4711
  const requestSchema = RpcBlockRequestSchema();
@@ -5388,6 +4730,11 @@ async function block(client, params) {
5388
4730
  }
5389
4731
  return result;
5390
4732
  }
4733
+ /**
4734
+ * Returns changes in block for given block height or hash over all
4735
+ * transactions for all the types. Includes changes like account_touched,
4736
+ * access_key_touched, data_touched, contract_code_touched.
4737
+ */
5391
4738
  async function blockEffects(client, params) {
5392
4739
  // Validate request parameters
5393
4740
  const requestSchema = RpcStateChangesInBlockRequestSchema();
@@ -5412,6 +4759,10 @@ async function blockEffects(client, params) {
5412
4759
  }
5413
4760
  return result;
5414
4761
  }
4762
+ /**
4763
+ * [Deprecated] Sends a transaction and immediately returns transaction hash.
4764
+ * Consider using send_tx instead.
4765
+ */
5415
4766
  async function broadcastTxAsync(client, params) {
5416
4767
  // Validate request parameters
5417
4768
  const requestSchema = RpcSendTransactionRequestSchema();
@@ -5436,6 +4787,10 @@ async function broadcastTxAsync(client, params) {
5436
4787
  }
5437
4788
  return result;
5438
4789
  }
4790
+ /**
4791
+ * [Deprecated] Sends a transaction and waits until transaction is fully
4792
+ * complete. (Has a 10 second timeout). Consider using send_tx instead.
4793
+ */
5439
4794
  async function broadcastTxCommit(client, params) {
5440
4795
  // Validate request parameters
5441
4796
  const requestSchema = RpcSendTransactionRequestSchema();
@@ -5460,6 +4815,10 @@ async function broadcastTxCommit(client, params) {
5460
4815
  }
5461
4816
  return result;
5462
4817
  }
4818
+ /**
4819
+ * Returns changes for a given account, contract or contract code for given
4820
+ * block height or hash.
4821
+ */
5463
4822
  async function changes(client, params) {
5464
4823
  // Validate request parameters
5465
4824
  const requestSchema = RpcStateChangesInBlockByTypeRequestSchema();
@@ -5484,6 +4843,10 @@ async function changes(client, params) {
5484
4843
  }
5485
4844
  return result;
5486
4845
  }
4846
+ /**
4847
+ * Returns details of a specific chunk. You can run a block details query to
4848
+ * get a valid chunk hash.
4849
+ */
5487
4850
  async function chunk(client, params) {
5488
4851
  // Validate request parameters
5489
4852
  const requestSchema = RpcChunkRequestSchema();
@@ -5508,6 +4871,7 @@ async function chunk(client, params) {
5508
4871
  }
5509
4872
  return result;
5510
4873
  }
4874
+ /** Queries client node configuration */
5511
4875
  async function clientConfig(client, params) {
5512
4876
  // Validate request parameters
5513
4877
  const requestSchema = RpcClientConfigRequestSchema();
@@ -5532,6 +4896,10 @@ async function clientConfig(client, params) {
5532
4896
  }
5533
4897
  return result;
5534
4898
  }
4899
+ /**
4900
+ * Returns gas price for a specific block_height or block_hash. Using [null]
4901
+ * will return the most recent block's gas price.
4902
+ */
5535
4903
  async function gasPrice(client, params) {
5536
4904
  // Validate request parameters
5537
4905
  const requestSchema = RpcGasPriceRequestSchema();
@@ -5556,6 +4924,7 @@ async function gasPrice(client, params) {
5556
4924
  }
5557
4925
  return result;
5558
4926
  }
4927
+ /** Get initial state and parameters for the genesis block */
5559
4928
  async function genesisConfig(client, params) {
5560
4929
  // Validate request parameters
5561
4930
  const requestSchema = GenesisConfigRequestSchema();
@@ -5580,6 +4949,7 @@ async function genesisConfig(client, params) {
5580
4949
  }
5581
4950
  return result;
5582
4951
  }
4952
+ /** Returns the current health status of the RPC node the client connects to. */
5583
4953
  async function health(client, params) {
5584
4954
  // Validate request parameters
5585
4955
  const requestSchema = RpcHealthRequestSchema();
@@ -5604,6 +4974,7 @@ async function health(client, params) {
5604
4974
  }
5605
4975
  return result;
5606
4976
  }
4977
+ /** Returns the proofs for a transaction execution. */
5607
4978
  async function lightClientProof(client, params) {
5608
4979
  // Validate request parameters
5609
4980
  const requestSchema = RpcLightClientExecutionProofRequestSchema();
@@ -5628,6 +4999,11 @@ async function lightClientProof(client, params) {
5628
4999
  }
5629
5000
  return result;
5630
5001
  }
5002
+ /**
5003
+ * Returns the future windows for maintenance in current epoch for the
5004
+ * specified account. In the maintenance windows, the node will not be block
5005
+ * producer or chunk producer.
5006
+ */
5631
5007
  async function maintenanceWindows(client, params) {
5632
5008
  // Validate request parameters
5633
5009
  const requestSchema = RpcMaintenanceWindowsRequestSchema();
@@ -5642,6 +5018,10 @@ async function maintenanceWindows(client, params) {
5642
5018
  // Call the base function (no response validation needed)
5643
5019
  return maintenanceWindows$1(client, params);
5644
5020
  }
5021
+ /**
5022
+ * Queries the current state of node network connections. This includes
5023
+ * information about active peers, transmitted data, known producers, etc.
5024
+ */
5645
5025
  async function networkInfo(client, params) {
5646
5026
  // Validate request parameters
5647
5027
  const requestSchema = RpcNetworkInfoRequestSchema();
@@ -5666,6 +5046,7 @@ async function networkInfo(client, params) {
5666
5046
  }
5667
5047
  return result;
5668
5048
  }
5049
+ /** Returns the next light client block. */
5669
5050
  async function nextLightClientBlock(client, params) {
5670
5051
  // Validate request parameters
5671
5052
  const requestSchema = RpcLightClientNextBlockRequestSchema();
@@ -5690,6 +5071,19 @@ async function nextLightClientBlock(client, params) {
5690
5071
  }
5691
5072
  return result;
5692
5073
  }
5074
+ /**
5075
+ * This module allows you to make generic requests to the network. The
5076
+ * `RpcQueryRequest` struct takes in a
5077
+ * [`BlockReference`](https://docs.rs/near-primitives/0.12.0/near_primitives/types/enum.BlockReference.html)
5078
+ * and a
5079
+ * [`QueryRequest`](https://docs.rs/near-primitives/0.12.0/near_primitives/views/enum.QueryRequest.html).
5080
+ * The `BlockReference` enum allows you to specify a block by `Finality`,
5081
+ * `BlockId` or `SyncCheckpoint`. The `QueryRequest` enum provides multiple
5082
+ * variants for performing the following actions: - View an account's details
5083
+ * - View a contract's code - View the state of an account - View the
5084
+ * `AccessKey` of an account - View the `AccessKeyList` of an account - Call a
5085
+ * function in a contract deployed on the network.
5086
+ */
5693
5087
  async function query(client, params) {
5694
5088
  // Validate request parameters
5695
5089
  const requestSchema = RpcQueryRequestSchema();
@@ -5714,6 +5108,10 @@ async function query(client, params) {
5714
5108
  }
5715
5109
  return result;
5716
5110
  }
5111
+ /**
5112
+ * Sends transaction. Returns the guaranteed execution status and the results
5113
+ * the blockchain can provide at the moment.
5114
+ */
5717
5115
  async function sendTx(client, params) {
5718
5116
  // Validate request parameters
5719
5117
  const requestSchema = RpcSendTransactionRequestSchema();
@@ -5738,6 +5136,11 @@ async function sendTx(client, params) {
5738
5136
  }
5739
5137
  return result;
5740
5138
  }
5139
+ /**
5140
+ * Requests the status of the connected RPC node. This includes information
5141
+ * about sync status, nearcore node version, protocol version, the current set
5142
+ * of validators, etc.
5143
+ */
5741
5144
  async function status(client, params) {
5742
5145
  // Validate request parameters
5743
5146
  const requestSchema = RpcStatusRequestSchema();
@@ -5762,6 +5165,10 @@ async function status(client, params) {
5762
5165
  }
5763
5166
  return result;
5764
5167
  }
5168
+ /**
5169
+ * Queries status of a transaction by hash and returns the final transaction
5170
+ * result.
5171
+ */
5765
5172
  async function tx(client, params) {
5766
5173
  // Validate request parameters
5767
5174
  const requestSchema = RpcTransactionStatusRequestSchema();
@@ -5786,6 +5193,10 @@ async function tx(client, params) {
5786
5193
  }
5787
5194
  return result;
5788
5195
  }
5196
+ /**
5197
+ * Queries active validators on the network. Returns details and the state of
5198
+ * validation on the blockchain.
5199
+ */
5789
5200
  async function validators(client, params) {
5790
5201
  // Validate request parameters
5791
5202
  const requestSchema = RpcValidatorRequestSchema();
@@ -5811,76 +5222,4 @@ async function validators(client, params) {
5811
5222
  return result;
5812
5223
  }
5813
5224
 
5814
- // Optional validation for client - only imported when explicitly enabled
5815
- /**
5816
- * Enable validation for the client
5817
- * This function should only be called if you want to include schema validation
5818
- * Calling this function will include Zod schemas in your bundle
5819
- */
5820
- function enableValidation() {
5821
- const requestSchema = JsonRpcRequestSchema();
5822
- const responseSchema = JsonRpcResponseSchema();
5823
- return {
5824
- validateRequest: (request) => {
5825
- try {
5826
- requestSchema.parse(request);
5827
- }
5828
- catch (error) {
5829
- throw new JsonRpcNetworkError(`Invalid request format: ${error instanceof Error ? error.message : 'Unknown error'}`, error);
5830
- }
5831
- },
5832
- validateResponse: (response) => {
5833
- try {
5834
- responseSchema.parse(response);
5835
- }
5836
- catch (error) {
5837
- throw new JsonRpcClientError(`Invalid response format: ${error instanceof Error ? error.message : 'Unknown error'}`);
5838
- }
5839
- },
5840
- validateMethodRequest: (method, request) => {
5841
- try {
5842
- // First validate basic JSON-RPC structure
5843
- requestSchema.parse(request);
5844
- // Then validate method-specific structure if schema exists
5845
- const methodSchemas = VALIDATION_SCHEMA_MAP[method];
5846
- if (methodSchemas?.requestSchema) {
5847
- const methodRequestSchema = methodSchemas.requestSchema();
5848
- methodRequestSchema.parse(request);
5849
- }
5850
- }
5851
- catch (error) {
5852
- throw new JsonRpcNetworkError(`Invalid ${method} request: ${error instanceof Error ? error.message : 'Unknown error'}`, error);
5853
- }
5854
- },
5855
- validateMethodResponse: (method, response) => {
5856
- try {
5857
- // First validate basic JSON-RPC structure
5858
- responseSchema.parse(response);
5859
- // Check if the result contains an error field before validating the schema
5860
- // This provides a better error message when NEAR RPC returns non-standard errors
5861
- if (response.result &&
5862
- typeof response.result === 'object' &&
5863
- 'error' in response.result) {
5864
- const serverError = response.result.error;
5865
- throw new JsonRpcClientError(`Server error: ${serverError}`, -32000, response.result);
5866
- }
5867
- // Then validate method-specific response structure if schema exists
5868
- const methodSchemas = VALIDATION_SCHEMA_MAP[method];
5869
- if (methodSchemas?.responseSchema) {
5870
- const methodResponseSchema = methodSchemas.responseSchema();
5871
- methodResponseSchema.parse(response);
5872
- }
5873
- }
5874
- catch (error) {
5875
- // If it's already a JsonRpcClientError (from server error check), re-throw it
5876
- if (error instanceof JsonRpcClientError) {
5877
- throw error;
5878
- }
5879
- // Otherwise, it's a validation error
5880
- throw new JsonRpcClientError(`Invalid ${method} response: ${error instanceof Error ? error.message : 'Unknown error'}`);
5881
- }
5882
- },
5883
- };
5884
- }
5885
-
5886
5225
  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 };