@psalomo/jsonrpc-client 1.0.1 → 1.0.3

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.
@@ -48,9 +48,11 @@ class JsonRpcClientError extends Error {
48
48
  }
49
49
  class JsonRpcNetworkError extends Error {
50
50
  originalError;
51
- constructor(message, originalError) {
51
+ responseBody;
52
+ constructor(message, originalError, responseBody) {
52
53
  super(message);
53
54
  this.originalError = originalError;
55
+ this.responseBody = responseBody;
54
56
  this.name = 'JsonRpcNetworkError';
55
57
  }
56
58
  }
@@ -87,23 +89,31 @@ class NearRpcClient {
87
89
  * This is used internally by the standalone RPC functions
88
90
  */
89
91
  async makeRequest(method, params) {
90
- // Convert camelCase params to snake_case for the RPC call
91
- const snakeCaseParams = params ? convertKeysToSnakeCase(params) : params;
92
- const request = {
92
+ // Create request with original camelCase params for validation
93
+ const requestForValidation = {
93
94
  jsonrpc: '2.0',
94
95
  id: REQUEST_ID,
95
96
  method,
96
- params: snakeCaseParams,
97
+ params: params !== undefined ? params : null,
97
98
  };
98
- // Validate request if validation is enabled
99
+ // Validate request if validation is enabled (before snake_case conversion)
99
100
  if (this.validation) {
100
101
  if ('validateMethodRequest' in this.validation) {
101
- this.validation.validateMethodRequest(method, request);
102
+ this.validation.validateMethodRequest(method, requestForValidation);
102
103
  }
103
104
  else {
104
- this.validation.validateRequest(request);
105
+ this.validation.validateRequest(requestForValidation);
105
106
  }
106
107
  }
108
+ // Convert camelCase params to snake_case for the RPC call
109
+ // Also convert undefined to null for methods that expect null params
110
+ const snakeCaseParams = params !== undefined ? convertKeysToSnakeCase(params) : null;
111
+ const request = {
112
+ jsonrpc: '2.0',
113
+ id: REQUEST_ID,
114
+ method,
115
+ params: snakeCaseParams,
116
+ };
107
117
  let lastError = null;
108
118
  for (let attempt = 0; attempt <= this.retries; attempt++) {
109
119
  try {
@@ -119,23 +129,29 @@ class NearRpcClient {
119
129
  signal: controller.signal,
120
130
  });
121
131
  clearTimeout(timeoutId);
122
- if (!response.ok) {
123
- throw new JsonRpcNetworkError(`HTTP error! status: ${response.status}`);
124
- }
125
132
  let jsonResponse;
126
133
  try {
127
134
  jsonResponse = await response.json();
128
135
  }
129
136
  catch (parseError) {
137
+ // If we can't parse JSON and it's not a 2xx response, include status info
138
+ if (!response.ok) {
139
+ throw new JsonRpcNetworkError(`HTTP error! status: ${response.status} - Failed to parse JSON response`, parseError);
140
+ }
130
141
  throw new JsonRpcNetworkError('Failed to parse JSON response', parseError);
131
142
  }
132
- // Validate basic JSON-RPC response structure first
133
- if (this.validation) {
134
- this.validation.validateResponse(jsonResponse);
135
- }
143
+ // Check for JSON-RPC error in the response
136
144
  if (jsonResponse.error) {
137
145
  throw new JsonRpcClientError(jsonResponse.error.message, jsonResponse.error.code, jsonResponse.error.data);
138
146
  }
147
+ // If it's not a 2xx status and no JSON-RPC error, throw network error with body
148
+ if (!response.ok) {
149
+ throw new JsonRpcNetworkError(`HTTP error! status: ${response.status}`, undefined, jsonResponse);
150
+ }
151
+ // Validate basic JSON-RPC response structure
152
+ if (this.validation) {
153
+ this.validation.validateResponse(jsonResponse);
154
+ }
139
155
  // Convert snake_case response back to camelCase
140
156
  const camelCaseResult = jsonResponse.result
141
157
  ? convertKeysToCamelCase(jsonResponse.result)
@@ -1514,7 +1530,9 @@ var AccessKeyPermissionViewSchema = () => union([
1514
1530
  _enum(["FullAccess"]),
1515
1531
  object({
1516
1532
  FunctionCall: object({
1517
- allowance: optional(string()),
1533
+ allowance: optional(
1534
+ union([union([string(), _null()]), _null()])
1535
+ ),
1518
1536
  methodNames: array(string()),
1519
1537
  receiverId: string()
1520
1538
  })
@@ -1607,7 +1625,7 @@ var ActionCreationConfigViewSchema = () => object({
1607
1625
  transferCost: _lazy(() => FeeSchema())
1608
1626
  });
1609
1627
  var ActionErrorSchema = () => object({
1610
- index: optional(number()),
1628
+ index: optional(union([union([number(), _null()]), _null()])),
1611
1629
  kind: _lazy(() => ActionErrorKindSchema())
1612
1630
  });
1613
1631
  var ActionErrorKindSchema = () => union([
@@ -1895,10 +1913,14 @@ var BlockHeaderViewSchema = () => object({
1895
1913
  union([_lazy(() => CryptoHashSchema()), _null()])
1896
1914
  ),
1897
1915
  blockMerkleRoot: _lazy(() => CryptoHashSchema()),
1898
- blockOrdinal: optional(number()),
1916
+ blockOrdinal: optional(
1917
+ union([union([number(), _null()]), _null()])
1918
+ ),
1899
1919
  challengesResult: array(_lazy(() => SlashedValidatorSchema())),
1900
1920
  challengesRoot: _lazy(() => CryptoHashSchema()),
1901
- chunkEndorsements: optional(array(array(number()))),
1921
+ chunkEndorsements: optional(
1922
+ union([union([array(array(number())), _null()]), _null()])
1923
+ ),
1902
1924
  chunkHeadersRoot: _lazy(() => CryptoHashSchema()),
1903
1925
  chunkMask: array(boolean()),
1904
1926
  chunkReceiptsRoot: _lazy(() => CryptoHashSchema()),
@@ -1918,7 +1940,9 @@ var BlockHeaderViewSchema = () => object({
1918
1940
  nextEpochId: _lazy(() => CryptoHashSchema()),
1919
1941
  outcomeRoot: _lazy(() => CryptoHashSchema()),
1920
1942
  prevHash: _lazy(() => CryptoHashSchema()),
1921
- prevHeight: optional(number()),
1943
+ prevHeight: optional(
1944
+ union([union([number(), _null()]), _null()])
1945
+ ),
1922
1946
  prevStateRoot: _lazy(() => CryptoHashSchema()),
1923
1947
  randomValue: _lazy(() => CryptoHashSchema()),
1924
1948
  rentPaid: string(),
@@ -2081,12 +2105,19 @@ var DetailedDebugStatusSchema = () => object({
2081
2105
  });
2082
2106
  var DirectionSchema = () => _enum(["Left", "Right"]);
2083
2107
  var DumpConfigSchema = () => object({
2084
- credentialsFile: optional(string()),
2108
+ credentialsFile: optional(
2109
+ union([union([string(), _null()]), _null()])
2110
+ ),
2085
2111
  iterationDelay: optional(
2086
2112
  union([_lazy(() => DurationAsStdSchemaProviderSchema()), _null()])
2087
2113
  ),
2088
2114
  location: _lazy(() => ExternalStorageLocationSchema()),
2089
- restartDumpForShards: optional(array(_lazy(() => ShardIdSchema())))
2115
+ restartDumpForShards: optional(
2116
+ union([
2117
+ union([array(_lazy(() => ShardIdSchema())), _null()]),
2118
+ _null()
2119
+ ])
2120
+ )
2090
2121
  });
2091
2122
  var DurationAsStdSchemaProviderSchema = () => object({
2092
2123
  nanos: number(),
@@ -2100,7 +2131,12 @@ var EpochSyncConfigSchema = () => object({
2100
2131
  timeoutForEpochSync: _lazy(() => DurationAsStdSchemaProviderSchema())
2101
2132
  });
2102
2133
  var ExecutionMetadataViewSchema = () => object({
2103
- gasProfile: optional(array(_lazy(() => CostGasUsedSchema()))),
2134
+ gasProfile: optional(
2135
+ union([
2136
+ union([array(_lazy(() => CostGasUsedSchema())), _null()]),
2137
+ _null()
2138
+ ])
2139
+ ),
2104
2140
  version: number()
2105
2141
  });
2106
2142
  var ExecutionOutcomeViewSchema = () => object({
@@ -2303,7 +2339,7 @@ var FunctionCallErrorSchema = () => union([
2303
2339
  })
2304
2340
  ]);
2305
2341
  var FunctionCallPermissionSchema = () => object({
2306
- allowance: optional(string()),
2342
+ allowance: optional(union([union([string(), _null()]), _null()])),
2307
2343
  methodNames: array(string()),
2308
2344
  receiverId: string()
2309
2345
  });
@@ -2672,6 +2708,12 @@ var JsonRpcRequestForBlockSchema = () => object({
2672
2708
  method: _enum(["block"]),
2673
2709
  params: _lazy(() => RpcBlockRequestSchema())
2674
2710
  });
2711
+ var JsonRpcRequestForBlockEffectsSchema = () => object({
2712
+ id: string(),
2713
+ jsonrpc: string(),
2714
+ method: _enum(["block_effects"]),
2715
+ params: _lazy(() => RpcStateChangesInBlockRequestSchema())
2716
+ });
2675
2717
  var JsonRpcRequestForBroadcastTxAsyncSchema = () => object({
2676
2718
  id: string(),
2677
2719
  jsonrpc: string(),
@@ -2720,6 +2762,12 @@ var JsonRpcRequestForLightClientProofSchema = () => object({
2720
2762
  method: _enum(["light_client_proof"]),
2721
2763
  params: _lazy(() => RpcLightClientExecutionProofRequestSchema())
2722
2764
  });
2765
+ var JsonRpcRequestForMaintenanceWindowsSchema = () => object({
2766
+ id: string(),
2767
+ jsonrpc: string(),
2768
+ method: _enum(["maintenance_windows"]),
2769
+ params: _lazy(() => RpcMaintenanceWindowsRequestSchema())
2770
+ });
2723
2771
  var JsonRpcRequestForNetworkInfoSchema = () => object({
2724
2772
  id: string(),
2725
2773
  jsonrpc: string(),
@@ -2762,193 +2810,336 @@ var JsonRpcRequestForValidatorsSchema = () => object({
2762
2810
  method: _enum(["validators"]),
2763
2811
  params: _lazy(() => RpcValidatorRequestSchema())
2764
2812
  });
2765
- var JsonRpcResponseFor_ArrayOf_RangeOfUint64And_RpcErrorSchema = () => union([
2766
- object({
2767
- result: array(_lazy(() => RangeOfUint64Schema()))
2768
- }),
2813
+ var JsonRpcResponseFor_ArrayOf_RangeOfUint64And_RpcErrorSchema = () => intersection(
2814
+ union([
2815
+ object({
2816
+ result: array(_lazy(() => RangeOfUint64Schema()))
2817
+ }),
2818
+ object({
2819
+ error: _lazy(() => RpcErrorSchema())
2820
+ })
2821
+ ]),
2769
2822
  object({
2770
- error: _lazy(() => RpcErrorSchema())
2823
+ id: string(),
2824
+ jsonrpc: string()
2771
2825
  })
2772
- ]);
2773
- var JsonRpcResponseFor_ArrayOf_ValidatorStakeViewAnd_RpcErrorSchema = () => union([
2774
- object({
2775
- result: array(_lazy(() => ValidatorStakeViewSchema()))
2776
- }),
2826
+ );
2827
+ var JsonRpcResponseFor_ArrayOf_ValidatorStakeViewAnd_RpcErrorSchema = () => intersection(
2828
+ union([
2829
+ object({
2830
+ result: array(_lazy(() => ValidatorStakeViewSchema()))
2831
+ }),
2832
+ object({
2833
+ error: _lazy(() => RpcErrorSchema())
2834
+ })
2835
+ ]),
2777
2836
  object({
2778
- error: _lazy(() => RpcErrorSchema())
2837
+ id: string(),
2838
+ jsonrpc: string()
2779
2839
  })
2780
- ]);
2781
- var JsonRpcResponseFor_CryptoHashAnd_RpcErrorSchema = () => union([
2782
- object({
2783
- result: _lazy(() => CryptoHashSchema())
2784
- }),
2840
+ );
2841
+ var JsonRpcResponseFor_CryptoHashAnd_RpcErrorSchema = () => intersection(
2842
+ union([
2843
+ object({
2844
+ result: _lazy(() => CryptoHashSchema())
2845
+ }),
2846
+ object({
2847
+ error: _lazy(() => RpcErrorSchema())
2848
+ })
2849
+ ]),
2785
2850
  object({
2786
- error: _lazy(() => RpcErrorSchema())
2851
+ id: string(),
2852
+ jsonrpc: string()
2787
2853
  })
2788
- ]);
2789
- var JsonRpcResponseFor_GenesisConfigAnd_RpcErrorSchema = () => union([
2790
- object({
2791
- result: _lazy(() => GenesisConfigSchema())
2792
- }),
2854
+ );
2855
+ var JsonRpcResponseFor_GenesisConfigAnd_RpcErrorSchema = () => intersection(
2856
+ union([
2857
+ object({
2858
+ result: _lazy(() => GenesisConfigSchema())
2859
+ }),
2860
+ object({
2861
+ error: _lazy(() => RpcErrorSchema())
2862
+ })
2863
+ ]),
2793
2864
  object({
2794
- error: _lazy(() => RpcErrorSchema())
2865
+ id: string(),
2866
+ jsonrpc: string()
2795
2867
  })
2796
- ]);
2797
- var JsonRpcResponseFor_Nullable_RpcHealthResponseAnd_RpcErrorSchema = () => union([
2798
- object({
2799
- result: union([_lazy(() => RpcHealthResponseSchema()), _null()])
2800
- }),
2868
+ );
2869
+ var JsonRpcResponseFor_Nullable_RpcHealthResponseAnd_RpcErrorSchema = () => intersection(
2870
+ union([
2871
+ object({
2872
+ result: union([_lazy(() => RpcHealthResponseSchema()), _null()])
2873
+ }),
2874
+ object({
2875
+ error: _lazy(() => RpcErrorSchema())
2876
+ })
2877
+ ]),
2801
2878
  object({
2802
- error: _lazy(() => RpcErrorSchema())
2879
+ id: string(),
2880
+ jsonrpc: string()
2803
2881
  })
2804
- ]);
2805
- var JsonRpcResponseFor_RpcBlockResponseAnd_RpcErrorSchema = () => union([
2806
- object({
2807
- result: _lazy(() => RpcBlockResponseSchema())
2808
- }),
2882
+ );
2883
+ var JsonRpcResponseFor_RpcBlockResponseAnd_RpcErrorSchema = () => intersection(
2884
+ union([
2885
+ object({
2886
+ result: _lazy(() => RpcBlockResponseSchema())
2887
+ }),
2888
+ object({
2889
+ error: _lazy(() => RpcErrorSchema())
2890
+ })
2891
+ ]),
2809
2892
  object({
2810
- error: _lazy(() => RpcErrorSchema())
2893
+ id: string(),
2894
+ jsonrpc: string()
2811
2895
  })
2812
- ]);
2813
- var JsonRpcResponseFor_RpcChunkResponseAnd_RpcErrorSchema = () => union([
2814
- object({
2815
- result: _lazy(() => RpcChunkResponseSchema())
2816
- }),
2896
+ );
2897
+ var JsonRpcResponseFor_RpcChunkResponseAnd_RpcErrorSchema = () => intersection(
2898
+ union([
2899
+ object({
2900
+ result: _lazy(() => RpcChunkResponseSchema())
2901
+ }),
2902
+ object({
2903
+ error: _lazy(() => RpcErrorSchema())
2904
+ })
2905
+ ]),
2817
2906
  object({
2818
- error: _lazy(() => RpcErrorSchema())
2907
+ id: string(),
2908
+ jsonrpc: string()
2819
2909
  })
2820
- ]);
2821
- var JsonRpcResponseFor_RpcClientConfigResponseAnd_RpcErrorSchema = () => union([
2822
- object({
2823
- result: _lazy(() => RpcClientConfigResponseSchema())
2824
- }),
2910
+ );
2911
+ var JsonRpcResponseFor_RpcClientConfigResponseAnd_RpcErrorSchema = () => intersection(
2912
+ union([
2913
+ object({
2914
+ result: _lazy(() => RpcClientConfigResponseSchema())
2915
+ }),
2916
+ object({
2917
+ error: _lazy(() => RpcErrorSchema())
2918
+ })
2919
+ ]),
2825
2920
  object({
2826
- error: _lazy(() => RpcErrorSchema())
2921
+ id: string(),
2922
+ jsonrpc: string()
2827
2923
  })
2828
- ]);
2829
- var JsonRpcResponseFor_RpcCongestionLevelResponseAnd_RpcErrorSchema = () => union([
2830
- object({
2831
- result: _lazy(() => RpcCongestionLevelResponseSchema())
2832
- }),
2924
+ );
2925
+ var JsonRpcResponseFor_RpcCongestionLevelResponseAnd_RpcErrorSchema = () => intersection(
2926
+ union([
2927
+ object({
2928
+ result: _lazy(() => RpcCongestionLevelResponseSchema())
2929
+ }),
2930
+ object({
2931
+ error: _lazy(() => RpcErrorSchema())
2932
+ })
2933
+ ]),
2833
2934
  object({
2834
- error: _lazy(() => RpcErrorSchema())
2935
+ id: string(),
2936
+ jsonrpc: string()
2835
2937
  })
2836
- ]);
2837
- var JsonRpcResponseFor_RpcGasPriceResponseAnd_RpcErrorSchema = () => union([
2838
- object({
2839
- result: _lazy(() => RpcGasPriceResponseSchema())
2840
- }),
2938
+ );
2939
+ var JsonRpcResponseFor_RpcGasPriceResponseAnd_RpcErrorSchema = () => intersection(
2940
+ union([
2941
+ object({
2942
+ result: _lazy(() => RpcGasPriceResponseSchema())
2943
+ }),
2944
+ object({
2945
+ error: _lazy(() => RpcErrorSchema())
2946
+ })
2947
+ ]),
2841
2948
  object({
2842
- error: _lazy(() => RpcErrorSchema())
2949
+ id: string(),
2950
+ jsonrpc: string()
2843
2951
  })
2844
- ]);
2845
- var JsonRpcResponseFor_RpcLightClientBlockProofResponseAnd_RpcErrorSchema = () => union([
2846
- object({
2847
- result: _lazy(() => RpcLightClientBlockProofResponseSchema())
2848
- }),
2952
+ );
2953
+ var JsonRpcResponseFor_RpcLightClientBlockProofResponseAnd_RpcErrorSchema = () => intersection(
2954
+ union([
2955
+ object({
2956
+ result: _lazy(() => RpcLightClientBlockProofResponseSchema())
2957
+ }),
2958
+ object({
2959
+ error: _lazy(() => RpcErrorSchema())
2960
+ })
2961
+ ]),
2849
2962
  object({
2850
- error: _lazy(() => RpcErrorSchema())
2963
+ id: string(),
2964
+ jsonrpc: string()
2851
2965
  })
2852
- ]);
2853
- var JsonRpcResponseFor_RpcLightClientExecutionProofResponseAnd_RpcErrorSchema = () => union([
2854
- object({
2855
- result: _lazy(() => RpcLightClientExecutionProofResponseSchema())
2856
- }),
2966
+ );
2967
+ var JsonRpcResponseFor_RpcLightClientExecutionProofResponseAnd_RpcErrorSchema = () => intersection(
2968
+ union([
2969
+ object({
2970
+ result: _lazy(() => RpcLightClientExecutionProofResponseSchema())
2971
+ }),
2972
+ object({
2973
+ error: _lazy(() => RpcErrorSchema())
2974
+ })
2975
+ ]),
2857
2976
  object({
2858
- error: _lazy(() => RpcErrorSchema())
2977
+ id: string(),
2978
+ jsonrpc: string()
2859
2979
  })
2860
- ]);
2861
- var JsonRpcResponseFor_RpcLightClientNextBlockResponseAnd_RpcErrorSchema = () => union([
2862
- object({
2863
- result: _lazy(() => RpcLightClientNextBlockResponseSchema())
2864
- }),
2980
+ );
2981
+ var JsonRpcResponseFor_RpcLightClientNextBlockResponseAnd_RpcErrorSchema = () => intersection(
2982
+ union([
2983
+ object({
2984
+ result: _lazy(() => RpcLightClientNextBlockResponseSchema())
2985
+ }),
2986
+ object({
2987
+ error: _lazy(() => RpcErrorSchema())
2988
+ })
2989
+ ]),
2865
2990
  object({
2866
- error: _lazy(() => RpcErrorSchema())
2991
+ id: string(),
2992
+ jsonrpc: string()
2867
2993
  })
2868
- ]);
2869
- var JsonRpcResponseFor_RpcNetworkInfoResponseAnd_RpcErrorSchema = () => union([
2870
- object({
2871
- result: _lazy(() => RpcNetworkInfoResponseSchema())
2872
- }),
2994
+ );
2995
+ var JsonRpcResponseFor_RpcNetworkInfoResponseAnd_RpcErrorSchema = () => intersection(
2996
+ union([
2997
+ object({
2998
+ result: _lazy(() => RpcNetworkInfoResponseSchema())
2999
+ }),
3000
+ object({
3001
+ error: _lazy(() => RpcErrorSchema())
3002
+ })
3003
+ ]),
2873
3004
  object({
2874
- error: _lazy(() => RpcErrorSchema())
3005
+ id: string(),
3006
+ jsonrpc: string()
2875
3007
  })
2876
- ]);
2877
- var JsonRpcResponseFor_RpcProtocolConfigResponseAnd_RpcErrorSchema = () => union([
2878
- object({
2879
- result: _lazy(() => RpcProtocolConfigResponseSchema())
2880
- }),
3008
+ );
3009
+ var JsonRpcResponseFor_RpcProtocolConfigResponseAnd_RpcErrorSchema = () => intersection(
3010
+ union([
3011
+ object({
3012
+ result: _lazy(() => RpcProtocolConfigResponseSchema())
3013
+ }),
3014
+ object({
3015
+ error: _lazy(() => RpcErrorSchema())
3016
+ })
3017
+ ]),
2881
3018
  object({
2882
- error: _lazy(() => RpcErrorSchema())
3019
+ id: string(),
3020
+ jsonrpc: string()
2883
3021
  })
2884
- ]);
2885
- var JsonRpcResponseFor_RpcQueryResponseAnd_RpcErrorSchema = () => union([
2886
- object({
2887
- result: _lazy(() => RpcQueryResponseSchema())
2888
- }),
3022
+ );
3023
+ var JsonRpcResponseFor_RpcQueryResponseAnd_RpcErrorSchema = () => intersection(
3024
+ union([
3025
+ object({
3026
+ result: _lazy(() => RpcQueryResponseSchema())
3027
+ }),
3028
+ object({
3029
+ error: _lazy(() => RpcErrorSchema())
3030
+ })
3031
+ ]),
2889
3032
  object({
2890
- error: _lazy(() => RpcErrorSchema())
3033
+ id: string(),
3034
+ jsonrpc: string()
2891
3035
  })
2892
- ]);
2893
- var JsonRpcResponseFor_RpcReceiptResponseAnd_RpcErrorSchema = () => union([
2894
- object({
2895
- result: _lazy(() => RpcReceiptResponseSchema())
2896
- }),
3036
+ );
3037
+ var JsonRpcResponseFor_RpcReceiptResponseAnd_RpcErrorSchema = () => intersection(
3038
+ union([
3039
+ object({
3040
+ result: _lazy(() => RpcReceiptResponseSchema())
3041
+ }),
3042
+ object({
3043
+ error: _lazy(() => RpcErrorSchema())
3044
+ })
3045
+ ]),
2897
3046
  object({
2898
- error: _lazy(() => RpcErrorSchema())
3047
+ id: string(),
3048
+ jsonrpc: string()
2899
3049
  })
2900
- ]);
2901
- var JsonRpcResponseFor_RpcSplitStorageInfoResponseAnd_RpcErrorSchema = () => union([
2902
- object({
2903
- result: _lazy(() => RpcSplitStorageInfoResponseSchema())
2904
- }),
3050
+ );
3051
+ var JsonRpcResponseFor_RpcSplitStorageInfoResponseAnd_RpcErrorSchema = () => intersection(
3052
+ union([
3053
+ object({
3054
+ result: _lazy(() => RpcSplitStorageInfoResponseSchema())
3055
+ }),
3056
+ object({
3057
+ error: _lazy(() => RpcErrorSchema())
3058
+ })
3059
+ ]),
2905
3060
  object({
2906
- error: _lazy(() => RpcErrorSchema())
3061
+ id: string(),
3062
+ jsonrpc: string()
2907
3063
  })
2908
- ]);
2909
- var JsonRpcResponseFor_RpcStateChangesInBlockByTypeResponseAnd_RpcErrorSchema = () => union([
2910
- object({
2911
- result: _lazy(() => RpcStateChangesInBlockByTypeResponseSchema())
2912
- }),
3064
+ );
3065
+ var JsonRpcResponseFor_RpcStateChangesInBlockByTypeResponseAnd_RpcErrorSchema = () => intersection(
3066
+ union([
3067
+ object({
3068
+ result: _lazy(() => RpcStateChangesInBlockByTypeResponseSchema())
3069
+ }),
3070
+ object({
3071
+ error: _lazy(() => RpcErrorSchema())
3072
+ })
3073
+ ]),
2913
3074
  object({
2914
- error: _lazy(() => RpcErrorSchema())
3075
+ id: string(),
3076
+ jsonrpc: string()
2915
3077
  })
2916
- ]);
2917
- var JsonRpcResponseFor_RpcStateChangesInBlockResponseAnd_RpcErrorSchema = () => union([
2918
- object({
2919
- result: _lazy(() => RpcStateChangesInBlockResponseSchema())
2920
- }),
3078
+ );
3079
+ var JsonRpcResponseFor_RpcStateChangesInBlockResponseAnd_RpcErrorSchema = () => intersection(
3080
+ union([
3081
+ object({
3082
+ result: _lazy(() => RpcStateChangesInBlockResponseSchema())
3083
+ }),
3084
+ object({
3085
+ error: _lazy(() => RpcErrorSchema())
3086
+ })
3087
+ ]),
2921
3088
  object({
2922
- error: _lazy(() => RpcErrorSchema())
3089
+ id: string(),
3090
+ jsonrpc: string()
2923
3091
  })
2924
- ]);
2925
- var JsonRpcResponseFor_RpcStatusResponseAnd_RpcErrorSchema = () => union([
2926
- object({
2927
- result: _lazy(() => RpcStatusResponseSchema())
2928
- }),
3092
+ );
3093
+ var JsonRpcResponseFor_RpcStatusResponseAnd_RpcErrorSchema = () => intersection(
3094
+ union([
3095
+ object({
3096
+ result: _lazy(() => RpcStatusResponseSchema())
3097
+ }),
3098
+ object({
3099
+ error: _lazy(() => RpcErrorSchema())
3100
+ })
3101
+ ]),
2929
3102
  object({
2930
- error: _lazy(() => RpcErrorSchema())
3103
+ id: string(),
3104
+ jsonrpc: string()
2931
3105
  })
2932
- ]);
2933
- var JsonRpcResponseFor_RpcTransactionResponseAnd_RpcErrorSchema = () => union([
2934
- object({
2935
- result: _lazy(() => RpcTransactionResponseSchema())
2936
- }),
3106
+ );
3107
+ var JsonRpcResponseFor_RpcTransactionResponseAnd_RpcErrorSchema = () => intersection(
3108
+ union([
3109
+ object({
3110
+ result: _lazy(() => RpcTransactionResponseSchema())
3111
+ }),
3112
+ object({
3113
+ error: _lazy(() => RpcErrorSchema())
3114
+ })
3115
+ ]),
2937
3116
  object({
2938
- error: _lazy(() => RpcErrorSchema())
3117
+ id: string(),
3118
+ jsonrpc: string()
2939
3119
  })
2940
- ]);
2941
- var JsonRpcResponseFor_RpcValidatorResponseAnd_RpcErrorSchema = () => union([
2942
- object({
2943
- result: _lazy(() => RpcValidatorResponseSchema())
2944
- }),
3120
+ );
3121
+ var JsonRpcResponseFor_RpcValidatorResponseAnd_RpcErrorSchema = () => intersection(
3122
+ union([
3123
+ object({
3124
+ result: _lazy(() => RpcValidatorResponseSchema())
3125
+ }),
3126
+ object({
3127
+ error: _lazy(() => RpcErrorSchema())
3128
+ })
3129
+ ]),
2945
3130
  object({
2946
- error: _lazy(() => RpcErrorSchema())
3131
+ id: string(),
3132
+ jsonrpc: string()
2947
3133
  })
2948
- ]);
3134
+ );
2949
3135
  var KnownProducerViewSchema = () => object({
2950
3136
  accountId: _lazy(() => AccountIdSchema()),
2951
- nextHops: optional(array(_lazy(() => PublicKeySchema()))),
3137
+ nextHops: optional(
3138
+ union([
3139
+ union([array(_lazy(() => PublicKeySchema())), _null()]),
3140
+ _null()
3141
+ ])
3142
+ ),
2952
3143
  peerId: _lazy(() => PublicKeySchema())
2953
3144
  });
2954
3145
  var LightClientBlockLiteViewSchema = () => object({
@@ -2964,13 +3155,17 @@ var LimitConfigSchema = () => object({
2964
3155
  maxActionsPerReceipt: number(),
2965
3156
  maxArgumentsLength: number(),
2966
3157
  maxContractSize: number(),
2967
- maxFunctionsNumberPerContract: optional(number()),
3158
+ maxFunctionsNumberPerContract: optional(
3159
+ union([union([number(), _null()]), _null()])
3160
+ ),
2968
3161
  maxGasBurnt: number(),
2969
3162
  maxLengthMethodName: number(),
2970
3163
  maxLengthReturnedData: number(),
2971
3164
  maxLengthStorageKey: number(),
2972
3165
  maxLengthStorageValue: number(),
2973
- maxLocalsPerContract: optional(number()),
3166
+ maxLocalsPerContract: optional(
3167
+ union([union([number(), _null()]), _null()])
3168
+ ),
2974
3169
  maxMemoryPages: number(),
2975
3170
  maxNumberBytesMethodNames: number(),
2976
3171
  maxNumberInputDataDependencies: number(),
@@ -3030,7 +3225,7 @@ var PeerInfoViewSchema = () => object({
3030
3225
  union([_lazy(() => CryptoHashSchema()), _null()])
3031
3226
  ),
3032
3227
  connectionEstablishedTimeMillis: number(),
3033
- height: optional(number()),
3228
+ height: optional(union([union([number(), _null()]), _null()])),
3034
3229
  isHighestBlockInvalid: boolean(),
3035
3230
  isOutboundPeer: boolean(),
3036
3231
  lastTimePeerRequestedMillis: number(),
@@ -3071,7 +3266,7 @@ var ReceiptEnumViewSchema = () => union([
3071
3266
  }),
3072
3267
  object({
3073
3268
  Data: object({
3074
- data: optional(string()),
3269
+ data: optional(union([union([string(), _null()]), _null()])),
3075
3270
  dataId: _lazy(() => CryptoHashSchema()),
3076
3271
  isPromiseResume: optional(boolean())
3077
3272
  })
@@ -3178,6 +3373,7 @@ var RpcClientConfigResponseSchema = () => object({
3178
3373
  union([_lazy(() => ChunkDistributionNetworkConfigSchema()), _null()])
3179
3374
  ),
3180
3375
  chunkRequestRetryPeriod: array(number()),
3376
+ chunkValidationThreads: number(),
3181
3377
  chunkWaitMult: array(number()),
3182
3378
  clientBackgroundMigrationThreads: number(),
3183
3379
  doomslugStepPeriod: array(number()),
@@ -3195,7 +3391,9 @@ var RpcClientConfigResponseSchema = () => object({
3195
3391
  logSummaryStyle: _lazy(() => LogSummaryStyleSchema()),
3196
3392
  maxBlockProductionDelay: array(number()),
3197
3393
  maxBlockWaitDelay: array(number()),
3198
- maxGasBurntView: optional(number()),
3394
+ maxGasBurntView: optional(
3395
+ union([union([number(), _null()]), _null()])
3396
+ ),
3199
3397
  minBlockProductionDelay: array(number()),
3200
3398
  minNumPeers: number(),
3201
3399
  numBlockProducerSeats: number(),
@@ -3204,12 +3402,15 @@ var RpcClientConfigResponseSchema = () => object({
3204
3402
  produceChunkAddTransactionsTimeLimit: string(),
3205
3403
  produceEmptyBlocks: boolean(),
3206
3404
  reshardingConfig: _lazy(() => MutableConfigValueSchema()),
3207
- rpcAddr: optional(string()),
3405
+ rpcAddr: optional(union([union([string(), _null()]), _null()])),
3208
3406
  saveInvalidWitnesses: boolean(),
3209
3407
  saveLatestWitnesses: boolean(),
3210
3408
  saveTrieChanges: boolean(),
3211
3409
  saveTxOutcomes: boolean(),
3212
3410
  skipSyncWait: boolean(),
3411
+ stateRequestServerThreads: number(),
3412
+ stateRequestThrottlePeriod: array(number()),
3413
+ stateRequestsPerThrottlePeriod: number(),
3213
3414
  stateSync: _lazy(() => StateSyncConfigSchema()),
3214
3415
  stateSyncEnabled: boolean(),
3215
3416
  stateSyncExternalBackoff: array(number()),
@@ -3221,15 +3422,17 @@ var RpcClientConfigResponseSchema = () => object({
3221
3422
  syncMaxBlockRequests: number(),
3222
3423
  syncStepPeriod: array(number()),
3223
3424
  trackedShardsConfig: _lazy(() => TrackedShardsConfigSchema()),
3224
- transactionPoolSizeLimit: optional(number()),
3425
+ transactionPoolSizeLimit: optional(
3426
+ union([union([number(), _null()]), _null()])
3427
+ ),
3225
3428
  transactionRequestHandlerThreads: number(),
3226
- trieViewerStateSizeLimit: optional(number()),
3429
+ trieViewerStateSizeLimit: optional(
3430
+ union([union([number(), _null()]), _null()])
3431
+ ),
3227
3432
  ttlAccountIdRouter: array(number()),
3228
3433
  txRoutingHeightHorizon: number(),
3229
3434
  version: _lazy(() => VersionSchema()),
3230
- viewClientNumStateRequestsPerThrottlePeriod: number(),
3231
- viewClientThreads: number(),
3232
- viewClientThrottlePeriod: array(number())
3435
+ viewClientThreads: number()
3233
3436
  });
3234
3437
  var RpcCongestionLevelRequestSchema = () => union([
3235
3438
  object({
@@ -3243,20 +3446,29 @@ var RpcCongestionLevelRequestSchema = () => union([
3243
3446
  var RpcCongestionLevelResponseSchema = () => object({
3244
3447
  congestionLevel: number()
3245
3448
  });
3246
- var RpcErrorSchema = () => union([
3247
- object({
3248
- cause: _lazy(() => RpcRequestValidationErrorKindSchema()),
3249
- name: _enum(["REQUEST_VALIDATION_ERROR"])
3250
- }),
3251
- object({
3252
- cause: unknown(),
3253
- name: _enum(["HANDLER_ERROR"])
3254
- }),
3449
+ var RpcErrorSchema = () => intersection(
3450
+ union([
3451
+ object({
3452
+ cause: _lazy(() => RpcRequestValidationErrorKindSchema()),
3453
+ name: _enum(["REQUEST_VALIDATION_ERROR"])
3454
+ }),
3455
+ object({
3456
+ cause: unknown(),
3457
+ name: _enum(["HANDLER_ERROR"])
3458
+ }),
3459
+ object({
3460
+ cause: unknown(),
3461
+ name: _enum(["INTERNAL_ERROR"])
3462
+ })
3463
+ ]),
3255
3464
  object({
3256
- cause: unknown(),
3257
- name: _enum(["INTERNAL_ERROR"])
3465
+ cause: optional(unknown()),
3466
+ code: number(),
3467
+ data: optional(unknown()),
3468
+ message: string(),
3469
+ name: optional(unknown())
3258
3470
  })
3259
- ]);
3471
+ );
3260
3472
  var RpcGasPriceRequestSchema = () => object({
3261
3473
  blockId: optional(union([_lazy(() => BlockIdSchema()), _null()]))
3262
3474
  });
@@ -3267,7 +3479,7 @@ var RpcHealthRequestSchema = () => _null();
3267
3479
  var RpcHealthResponseSchema = () => _null();
3268
3480
  var RpcKnownProducerSchema = () => object({
3269
3481
  accountId: _lazy(() => AccountIdSchema()),
3270
- addr: optional(string()),
3482
+ addr: optional(union([union([string(), _null()]), _null()])),
3271
3483
  peerId: _lazy(() => PeerIdSchema())
3272
3484
  });
3273
3485
  var RpcLightClientBlockProofRequestSchema = () => object({
@@ -3278,18 +3490,23 @@ var RpcLightClientBlockProofResponseSchema = () => object({
3278
3490
  blockHeaderLite: _lazy(() => LightClientBlockLiteViewSchema()),
3279
3491
  blockProof: array(_lazy(() => MerklePathItemSchema()))
3280
3492
  });
3281
- var RpcLightClientExecutionProofRequestSchema = () => union([
3282
- object({
3283
- senderId: _lazy(() => AccountIdSchema()),
3284
- transactionHash: _lazy(() => CryptoHashSchema()),
3285
- type: _enum(["transaction"])
3286
- }),
3493
+ var RpcLightClientExecutionProofRequestSchema = () => intersection(
3494
+ union([
3495
+ object({
3496
+ senderId: _lazy(() => AccountIdSchema()),
3497
+ transactionHash: _lazy(() => CryptoHashSchema()),
3498
+ type: _enum(["transaction"])
3499
+ }),
3500
+ object({
3501
+ receiptId: _lazy(() => CryptoHashSchema()),
3502
+ receiverId: _lazy(() => AccountIdSchema()),
3503
+ type: _enum(["receipt"])
3504
+ })
3505
+ ]),
3287
3506
  object({
3288
- receiptId: _lazy(() => CryptoHashSchema()),
3289
- receiverId: _lazy(() => AccountIdSchema()),
3290
- type: _enum(["receipt"])
3507
+ lightClientHead: _lazy(() => CryptoHashSchema())
3291
3508
  })
3292
- ]);
3509
+ );
3293
3510
  var RpcLightClientExecutionProofResponseSchema = () => object({
3294
3511
  blockHeaderLite: _lazy(() => LightClientBlockLiteViewSchema()),
3295
3512
  blockProof: array(_lazy(() => MerklePathItemSchema())),
@@ -3306,7 +3523,12 @@ var RpcLightClientNextBlockResponseSchema = () => object({
3306
3523
  innerLite: optional(_lazy(() => BlockHeaderInnerLiteViewSchema())),
3307
3524
  innerRestHash: optional(_lazy(() => CryptoHashSchema())),
3308
3525
  nextBlockInnerHash: optional(_lazy(() => CryptoHashSchema())),
3309
- nextBps: optional(array(_lazy(() => ValidatorStakeViewSchema()))),
3526
+ nextBps: optional(
3527
+ union([
3528
+ union([array(_lazy(() => ValidatorStakeViewSchema())), _null()]),
3529
+ _null()
3530
+ ])
3531
+ ),
3310
3532
  prevBlockHash: optional(_lazy(() => CryptoHashSchema()))
3311
3533
  });
3312
3534
  var RpcMaintenanceWindowsRequestSchema = () => object({
@@ -3323,7 +3545,7 @@ var RpcNetworkInfoResponseSchema = () => object({
3323
3545
  });
3324
3546
  var RpcPeerInfoSchema = () => object({
3325
3547
  accountId: optional(union([_lazy(() => AccountIdSchema()), _null()])),
3326
- addr: optional(string()),
3548
+ addr: optional(union([union([string(), _null()]), _null()])),
3327
3549
  id: _lazy(() => PeerIdSchema())
3328
3550
  });
3329
3551
  var RpcProtocolConfigRequestSchema = () => union([
@@ -3643,10 +3865,16 @@ var RpcSendTransactionRequestSchema = () => object({
3643
3865
  });
3644
3866
  var RpcSplitStorageInfoRequestSchema = () => record(string(), unknown());
3645
3867
  var RpcSplitStorageInfoResponseSchema = () => object({
3646
- coldHeadHeight: optional(number()),
3647
- finalHeadHeight: optional(number()),
3648
- headHeight: optional(number()),
3649
- hotDbKind: optional(string())
3868
+ coldHeadHeight: optional(
3869
+ union([union([number(), _null()]), _null()])
3870
+ ),
3871
+ finalHeadHeight: optional(
3872
+ union([union([number(), _null()]), _null()])
3873
+ ),
3874
+ headHeight: optional(
3875
+ union([union([number(), _null()]), _null()])
3876
+ ),
3877
+ hotDbKind: optional(union([union([string(), _null()]), _null()]))
3650
3878
  });
3651
3879
  var RpcStateChangesInBlockByTypeRequestSchema = () => union([
3652
3880
  intersection(
@@ -3872,7 +4100,7 @@ var RpcStatusResponseSchema = () => object({
3872
4100
  nodeKey: optional(union([_lazy(() => PublicKeySchema()), _null()])),
3873
4101
  nodePublicKey: _lazy(() => PublicKeySchema()),
3874
4102
  protocolVersion: number(),
3875
- rpcAddr: optional(string()),
4103
+ rpcAddr: optional(union([union([string(), _null()]), _null()])),
3876
4104
  syncInfo: _lazy(() => StatusSyncInfoSchema()),
3877
4105
  uptimeSec: number(),
3878
4106
  validatorAccountId: optional(
@@ -3955,8 +4183,18 @@ var ShardLayoutV0Schema = () => object({
3955
4183
  });
3956
4184
  var ShardLayoutV1Schema = () => object({
3957
4185
  boundaryAccounts: array(_lazy(() => AccountIdSchema())),
3958
- shardsSplitMap: optional(array(array(_lazy(() => ShardIdSchema())))),
3959
- toParentShardMap: optional(array(_lazy(() => ShardIdSchema()))),
4186
+ shardsSplitMap: optional(
4187
+ union([
4188
+ union([array(array(_lazy(() => ShardIdSchema()))), _null()]),
4189
+ _null()
4190
+ ])
4191
+ ),
4192
+ toParentShardMap: optional(
4193
+ union([
4194
+ union([array(_lazy(() => ShardIdSchema())), _null()]),
4195
+ _null()
4196
+ ])
4197
+ ),
3960
4198
  version: number()
3961
4199
  });
3962
4200
  var ShardLayoutV2Schema = () => object({
@@ -3968,13 +4206,25 @@ var ShardLayoutV2Schema = () => object({
3968
4206
  ),
3969
4207
  shardIds: array(_lazy(() => ShardIdSchema())),
3970
4208
  shardsParentMap: optional(
3971
- record(
3972
- string(),
3973
- _lazy(() => ShardIdSchema())
3974
- )
4209
+ union([
4210
+ union([
4211
+ record(
4212
+ string(),
4213
+ _lazy(() => ShardIdSchema())
4214
+ ),
4215
+ _null()
4216
+ ]),
4217
+ _null()
4218
+ ])
3975
4219
  ),
3976
4220
  shardsSplitMap: optional(
3977
- record(string(), array(_lazy(() => ShardIdSchema())))
4221
+ union([
4222
+ union([
4223
+ record(string(), array(_lazy(() => ShardIdSchema()))),
4224
+ _null()
4225
+ ]),
4226
+ _null()
4227
+ ])
3978
4228
  ),
3979
4229
  version: number()
3980
4230
  });
@@ -4006,6 +4256,46 @@ var StakeActionSchema = () => object({
4006
4256
  publicKey: _lazy(() => PublicKeySchema()),
4007
4257
  stake: string()
4008
4258
  });
4259
+ var StateChangeCauseViewSchema = () => union([
4260
+ object({
4261
+ type: _enum(["not_writable_to_disk"])
4262
+ }),
4263
+ object({
4264
+ type: _enum(["initial_state"])
4265
+ }),
4266
+ object({
4267
+ txHash: _lazy(() => CryptoHashSchema()),
4268
+ type: _enum(["transaction_processing"])
4269
+ }),
4270
+ object({
4271
+ receiptHash: _lazy(() => CryptoHashSchema()),
4272
+ type: _enum(["action_receipt_processing_started"])
4273
+ }),
4274
+ object({
4275
+ receiptHash: _lazy(() => CryptoHashSchema()),
4276
+ type: _enum(["action_receipt_gas_reward"])
4277
+ }),
4278
+ object({
4279
+ receiptHash: _lazy(() => CryptoHashSchema()),
4280
+ type: _enum(["receipt_processing"])
4281
+ }),
4282
+ object({
4283
+ receiptHash: _lazy(() => CryptoHashSchema()),
4284
+ type: _enum(["postponed_receipt"])
4285
+ }),
4286
+ object({
4287
+ type: _enum(["updated_delayed_receipts"])
4288
+ }),
4289
+ object({
4290
+ type: _enum(["validator_accounts_update"])
4291
+ }),
4292
+ object({
4293
+ type: _enum(["migration"])
4294
+ }),
4295
+ object({
4296
+ type: _enum(["bandwidth_scheduler_state_update"])
4297
+ })
4298
+ ]);
4009
4299
  var StateChangeKindViewSchema = () => union([
4010
4300
  object({
4011
4301
  accountId: _lazy(() => AccountIdSchema()),
@@ -4024,98 +4314,103 @@ var StateChangeKindViewSchema = () => union([
4024
4314
  type: _enum(["contract_code_touched"])
4025
4315
  })
4026
4316
  ]);
4027
- var StateChangeWithCauseViewSchema = () => union([
4028
- object({
4029
- change: object({
4030
- accountId: _lazy(() => AccountIdSchema()),
4031
- amount: string(),
4032
- codeHash: _lazy(() => CryptoHashSchema()),
4033
- globalContractAccountId: optional(
4034
- union([_lazy(() => AccountIdSchema()), _null()])
4035
- ),
4036
- globalContractHash: optional(
4037
- union([_lazy(() => CryptoHashSchema()), _null()])
4038
- ),
4039
- locked: string(),
4040
- storagePaidAt: optional(number()),
4041
- storageUsage: number()
4317
+ var StateChangeWithCauseViewSchema = () => intersection(
4318
+ union([
4319
+ object({
4320
+ change: object({
4321
+ accountId: _lazy(() => AccountIdSchema()),
4322
+ amount: string(),
4323
+ codeHash: _lazy(() => CryptoHashSchema()),
4324
+ globalContractAccountId: optional(
4325
+ union([_lazy(() => AccountIdSchema()), _null()])
4326
+ ),
4327
+ globalContractHash: optional(
4328
+ union([_lazy(() => CryptoHashSchema()), _null()])
4329
+ ),
4330
+ locked: string(),
4331
+ storagePaidAt: optional(number()),
4332
+ storageUsage: number()
4333
+ }),
4334
+ type: _enum(["account_update"])
4042
4335
  }),
4043
- type: _enum(["account_update"])
4044
- }),
4045
- object({
4046
- change: object({
4047
- accountId: _lazy(() => AccountIdSchema())
4336
+ object({
4337
+ change: object({
4338
+ accountId: _lazy(() => AccountIdSchema())
4339
+ }),
4340
+ type: _enum(["account_deletion"])
4048
4341
  }),
4049
- type: _enum(["account_deletion"])
4050
- }),
4051
- object({
4052
- change: object({
4053
- accessKey: _lazy(() => AccessKeyViewSchema()),
4054
- accountId: _lazy(() => AccountIdSchema()),
4055
- publicKey: _lazy(() => PublicKeySchema())
4342
+ object({
4343
+ change: object({
4344
+ accessKey: _lazy(() => AccessKeyViewSchema()),
4345
+ accountId: _lazy(() => AccountIdSchema()),
4346
+ publicKey: _lazy(() => PublicKeySchema())
4347
+ }),
4348
+ type: _enum(["access_key_update"])
4056
4349
  }),
4057
- type: _enum(["access_key_update"])
4058
- }),
4059
- object({
4060
- change: object({
4061
- accountId: _lazy(() => AccountIdSchema()),
4062
- publicKey: _lazy(() => PublicKeySchema())
4350
+ object({
4351
+ change: object({
4352
+ accountId: _lazy(() => AccountIdSchema()),
4353
+ publicKey: _lazy(() => PublicKeySchema())
4354
+ }),
4355
+ type: _enum(["access_key_deletion"])
4063
4356
  }),
4064
- type: _enum(["access_key_deletion"])
4065
- }),
4066
- object({
4067
- change: object({
4068
- accountId: _lazy(() => AccountIdSchema()),
4069
- gasKey: _lazy(() => GasKeyViewSchema()),
4070
- publicKey: _lazy(() => PublicKeySchema())
4357
+ object({
4358
+ change: object({
4359
+ accountId: _lazy(() => AccountIdSchema()),
4360
+ gasKey: _lazy(() => GasKeyViewSchema()),
4361
+ publicKey: _lazy(() => PublicKeySchema())
4362
+ }),
4363
+ type: _enum(["gas_key_update"])
4071
4364
  }),
4072
- type: _enum(["gas_key_update"])
4073
- }),
4074
- object({
4075
- change: object({
4076
- accountId: _lazy(() => AccountIdSchema()),
4077
- index: number(),
4078
- nonce: number(),
4079
- publicKey: _lazy(() => PublicKeySchema())
4365
+ object({
4366
+ change: object({
4367
+ accountId: _lazy(() => AccountIdSchema()),
4368
+ index: number(),
4369
+ nonce: number(),
4370
+ publicKey: _lazy(() => PublicKeySchema())
4371
+ }),
4372
+ type: _enum(["gas_key_nonce_update"])
4080
4373
  }),
4081
- type: _enum(["gas_key_nonce_update"])
4082
- }),
4083
- object({
4084
- change: object({
4085
- accountId: _lazy(() => AccountIdSchema()),
4086
- publicKey: _lazy(() => PublicKeySchema())
4374
+ object({
4375
+ change: object({
4376
+ accountId: _lazy(() => AccountIdSchema()),
4377
+ publicKey: _lazy(() => PublicKeySchema())
4378
+ }),
4379
+ type: _enum(["gas_key_deletion"])
4087
4380
  }),
4088
- type: _enum(["gas_key_deletion"])
4089
- }),
4090
- object({
4091
- change: object({
4092
- accountId: _lazy(() => AccountIdSchema()),
4093
- keyBase64: _lazy(() => StoreKeySchema()),
4094
- valueBase64: _lazy(() => StoreValueSchema())
4381
+ object({
4382
+ change: object({
4383
+ accountId: _lazy(() => AccountIdSchema()),
4384
+ keyBase64: _lazy(() => StoreKeySchema()),
4385
+ valueBase64: _lazy(() => StoreValueSchema())
4386
+ }),
4387
+ type: _enum(["data_update"])
4095
4388
  }),
4096
- type: _enum(["data_update"])
4097
- }),
4098
- object({
4099
- change: object({
4100
- accountId: _lazy(() => AccountIdSchema()),
4101
- keyBase64: _lazy(() => StoreKeySchema())
4389
+ object({
4390
+ change: object({
4391
+ accountId: _lazy(() => AccountIdSchema()),
4392
+ keyBase64: _lazy(() => StoreKeySchema())
4393
+ }),
4394
+ type: _enum(["data_deletion"])
4102
4395
  }),
4103
- type: _enum(["data_deletion"])
4104
- }),
4105
- object({
4106
- change: object({
4107
- accountId: _lazy(() => AccountIdSchema()),
4108
- codeBase64: string()
4396
+ object({
4397
+ change: object({
4398
+ accountId: _lazy(() => AccountIdSchema()),
4399
+ codeBase64: string()
4400
+ }),
4401
+ type: _enum(["contract_code_update"])
4109
4402
  }),
4110
- type: _enum(["contract_code_update"])
4111
- }),
4403
+ object({
4404
+ change: object({
4405
+ accountId: _lazy(() => AccountIdSchema())
4406
+ }),
4407
+ type: _enum(["contract_code_deletion"])
4408
+ })
4409
+ ]),
4112
4410
  object({
4113
- change: object({
4114
- accountId: _lazy(() => AccountIdSchema())
4115
- }),
4116
- type: _enum(["contract_code_deletion"])
4411
+ cause: _lazy(() => StateChangeCauseViewSchema())
4117
4412
  })
4118
- ]);
4413
+ );
4119
4414
  var StateItemSchema = () => object({
4120
4415
  key: _lazy(() => StoreKeySchema()),
4121
4416
  value: _lazy(() => StoreValueSchema())
@@ -4129,10 +4424,16 @@ var StatusSyncInfoSchema = () => object({
4129
4424
  earliestBlockHash: optional(
4130
4425
  union([_lazy(() => CryptoHashSchema()), _null()])
4131
4426
  ),
4132
- earliestBlockHeight: optional(number()),
4133
- earliestBlockTime: optional(string()),
4427
+ earliestBlockHeight: optional(
4428
+ union([union([number(), _null()]), _null()])
4429
+ ),
4430
+ earliestBlockTime: optional(
4431
+ union([union([string(), _null()]), _null()])
4432
+ ),
4134
4433
  epochId: optional(union([_lazy(() => EpochIdSchema()), _null()])),
4135
- epochStartHeight: optional(number()),
4434
+ epochStartHeight: optional(
4435
+ union([union([number(), _null()]), _null()])
4436
+ ),
4136
4437
  latestBlockHash: _lazy(() => CryptoHashSchema()),
4137
4438
  latestBlockHeight: number(),
4138
4439
  latestBlockTime: string(),
@@ -4355,6 +4656,10 @@ var EXPERIMENTALValidatorsOrderedResponseSchema = () => _lazy(
4355
4656
  );
4356
4657
  var BlockRequestSchema = () => _lazy(() => JsonRpcRequestForBlockSchema());
4357
4658
  var BlockResponseSchema = () => _lazy(() => JsonRpcResponseFor_RpcBlockResponseAnd_RpcErrorSchema());
4659
+ var BlockEffectsRequestSchema = () => _lazy(() => JsonRpcRequestForBlockEffectsSchema());
4660
+ var BlockEffectsResponseSchema = () => _lazy(
4661
+ () => JsonRpcResponseFor_RpcStateChangesInBlockByTypeResponseAnd_RpcErrorSchema()
4662
+ );
4358
4663
  var BroadcastTxAsyncRequestSchema = () => _lazy(() => JsonRpcRequestForBroadcastTxAsyncSchema());
4359
4664
  var BroadcastTxAsyncResponseSchema = () => _lazy(() => JsonRpcResponseFor_CryptoHashAnd_RpcErrorSchema());
4360
4665
  var BroadcastTxCommitRequestSchema = () => _lazy(() => JsonRpcRequestForBroadcastTxCommitSchema());
@@ -4369,6 +4674,7 @@ var ClientConfigRequestSchema = () => _lazy(() => JsonRpcRequestForClientConfigS
4369
4674
  var ClientConfigResponseSchema = () => _lazy(() => JsonRpcResponseFor_RpcClientConfigResponseAnd_RpcErrorSchema());
4370
4675
  var GasPriceRequestSchema = () => _lazy(() => JsonRpcRequestForGasPriceSchema());
4371
4676
  var GasPriceResponseSchema = () => _lazy(() => JsonRpcResponseFor_RpcGasPriceResponseAnd_RpcErrorSchema());
4677
+ var GenesisConfigResponseSchema = () => _lazy(() => JsonRpcResponseFor_GenesisConfigAnd_RpcErrorSchema());
4372
4678
  var HealthRequestSchema = () => _lazy(() => JsonRpcRequestForHealthSchema());
4373
4679
  var HealthResponseSchema = () => _lazy(
4374
4680
  () => JsonRpcResponseFor_Nullable_RpcHealthResponseAnd_RpcErrorSchema()
@@ -4377,6 +4683,8 @@ var LightClientProofRequestSchema = () => _lazy(() => JsonRpcRequestForLightClie
4377
4683
  var LightClientProofResponseSchema = () => _lazy(
4378
4684
  () => JsonRpcResponseFor_RpcLightClientExecutionProofResponseAnd_RpcErrorSchema()
4379
4685
  );
4686
+ var MaintenanceWindowsRequestSchema = () => _lazy(() => JsonRpcRequestForMaintenanceWindowsSchema());
4687
+ var MaintenanceWindowsResponseSchema = () => _lazy(() => JsonRpcResponseFor_ArrayOf_RangeOfUint64And_RpcErrorSchema());
4380
4688
  var NetworkInfoRequestSchema = () => _lazy(() => JsonRpcRequestForNetworkInfoSchema());
4381
4689
  var NetworkInfoResponseSchema = () => _lazy(() => JsonRpcResponseFor_RpcNetworkInfoResponseAnd_RpcErrorSchema());
4382
4690
  var NextLightClientBlockRequestSchema = () => _lazy(() => JsonRpcRequestForNextLightClientBlockSchema());
@@ -4446,6 +4754,10 @@ var VALIDATION_SCHEMA_MAP = {
4446
4754
  requestSchema: BlockRequestSchema,
4447
4755
  responseSchema: BlockResponseSchema
4448
4756
  },
4757
+ block_effects: {
4758
+ requestSchema: BlockEffectsRequestSchema,
4759
+ responseSchema: BlockEffectsResponseSchema
4760
+ },
4449
4761
  broadcast_tx_async: {
4450
4762
  requestSchema: BroadcastTxAsyncRequestSchema,
4451
4763
  responseSchema: BroadcastTxAsyncResponseSchema
@@ -4470,6 +4782,10 @@ var VALIDATION_SCHEMA_MAP = {
4470
4782
  requestSchema: GasPriceRequestSchema,
4471
4783
  responseSchema: GasPriceResponseSchema
4472
4784
  },
4785
+ genesis_config: {
4786
+ requestSchema: GenesisConfigRequestSchema,
4787
+ responseSchema: GenesisConfigResponseSchema
4788
+ },
4473
4789
  health: {
4474
4790
  requestSchema: HealthRequestSchema,
4475
4791
  responseSchema: HealthResponseSchema
@@ -4478,6 +4794,10 @@ var VALIDATION_SCHEMA_MAP = {
4478
4794
  requestSchema: LightClientProofRequestSchema,
4479
4795
  responseSchema: LightClientProofResponseSchema
4480
4796
  },
4797
+ maintenance_windows: {
4798
+ requestSchema: MaintenanceWindowsRequestSchema,
4799
+ responseSchema: MaintenanceWindowsResponseSchema
4800
+ },
4481
4801
  network_info: {
4482
4802
  requestSchema: NetworkInfoRequestSchema,
4483
4803
  responseSchema: NetworkInfoResponseSchema
@@ -4537,14 +4857,17 @@ var PATH_TO_METHOD_MAP = {
4537
4857
  "/EXPERIMENTAL_tx_status": "EXPERIMENTAL_tx_status",
4538
4858
  "/EXPERIMENTAL_validators_ordered": "EXPERIMENTAL_validators_ordered",
4539
4859
  "/block": "block",
4860
+ "/block_effects": "block_effects",
4540
4861
  "/broadcast_tx_async": "broadcast_tx_async",
4541
4862
  "/broadcast_tx_commit": "broadcast_tx_commit",
4542
4863
  "/changes": "changes",
4543
4864
  "/chunk": "chunk",
4544
4865
  "/client_config": "client_config",
4545
4866
  "/gas_price": "gas_price",
4867
+ "/genesis_config": "genesis_config",
4546
4868
  "/health": "health",
4547
4869
  "/light_client_proof": "light_client_proof",
4870
+ "/maintenance_windows": "maintenance_windows",
4548
4871
  "/network_info": "network_info",
4549
4872
  "/next_light_client_block": "next_light_client_block",
4550
4873
  "/query": "query",
@@ -4558,8 +4881,8 @@ Object.entries(PATH_TO_METHOD_MAP).forEach(([path, method]) => {
4558
4881
  var RPC_METHODS = Object.values(PATH_TO_METHOD_MAP);
4559
4882
 
4560
4883
  // Auto-generated static RPC functions for tree-shaking
4561
- // Generated at: 2025-07-26T17:05:05.177Z
4562
- // Total functions: 28
4884
+ // Generated at: 2025-07-29T20:18:38.221Z
4885
+ // Total functions: 31
4563
4886
  //
4564
4887
  // This file is automatically generated by tools/codegen/generate-client-interface.ts
4565
4888
  // Do not edit manually - changes will be overwritten
@@ -4615,6 +4938,10 @@ async function experimentalValidatorsOrdered(client, params) {
4615
4938
  async function block(client, params) {
4616
4939
  return client.makeRequest('block', params);
4617
4940
  }
4941
+ // block_effects static function
4942
+ async function blockEffects(client, params) {
4943
+ return client.makeRequest('block_effects', params);
4944
+ }
4618
4945
  // broadcast_tx_async static function
4619
4946
  async function broadcastTxAsync(client, params) {
4620
4947
  return client.makeRequest('broadcast_tx_async', params);
@@ -4639,6 +4966,10 @@ async function clientConfig(client, params) {
4639
4966
  async function gasPrice(client, params) {
4640
4967
  return client.makeRequest('gas_price', params);
4641
4968
  }
4969
+ // genesis_config static function
4970
+ async function genesisConfig(client, params) {
4971
+ return client.makeRequest('genesis_config', params);
4972
+ }
4642
4973
  // health static function
4643
4974
  async function health(client, params) {
4644
4975
  return client.makeRequest('health', params);
@@ -4647,6 +4978,10 @@ async function health(client, params) {
4647
4978
  async function lightClientProof(client, params) {
4648
4979
  return client.makeRequest('light_client_proof', params);
4649
4980
  }
4981
+ // maintenance_windows static function
4982
+ async function maintenanceWindows(client, params) {
4983
+ return client.makeRequest('maintenance_windows', params);
4984
+ }
4650
4985
  // network_info static function
4651
4986
  async function networkInfo(client, params) {
4652
4987
  return client.makeRequest('network_info', params);
@@ -4781,4 +5116,4 @@ function enableValidation() {
4781
5116
  };
4782
5117
  }
4783
5118
 
4784
- export { JsonRpcClientError, JsonRpcNetworkError, JsonRpcRequestSchema, JsonRpcResponseSchema, NearRpcClient, NearRpcError, RPC_METHODS, block, broadcastTxAsync, broadcastTxCommit, changes, chunk, clientConfig, NearRpcClient as default, defaultClient, enableValidation, experimentalChanges, experimentalChangesInBlock, experimentalCongestionLevel, experimentalGenesisConfig, experimentalLightClientBlockProof, experimentalLightClientProof, experimentalMaintenanceWindows, experimentalProtocolConfig, experimentalReceipt, experimentalSplitStorageInfo, experimentalTxStatus, experimentalValidatorsOrdered, gasPrice, health, lightClientProof, networkInfo, nextLightClientBlock, query, sendTx, status, tx, validators, viewAccessKey, viewAccount, viewFunction };
5119
+ 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 };