@psalomo/jsonrpc-client 1.0.1 → 1.0.2

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
  }
@@ -119,23 +121,29 @@ class NearRpcClient {
119
121
  signal: controller.signal,
120
122
  });
121
123
  clearTimeout(timeoutId);
122
- if (!response.ok) {
123
- throw new JsonRpcNetworkError(`HTTP error! status: ${response.status}`);
124
- }
125
124
  let jsonResponse;
126
125
  try {
127
126
  jsonResponse = await response.json();
128
127
  }
129
128
  catch (parseError) {
129
+ // If we can't parse JSON and it's not a 2xx response, include status info
130
+ if (!response.ok) {
131
+ throw new JsonRpcNetworkError(`HTTP error! status: ${response.status} - Failed to parse JSON response`, parseError);
132
+ }
130
133
  throw new JsonRpcNetworkError('Failed to parse JSON response', parseError);
131
134
  }
132
- // Validate basic JSON-RPC response structure first
133
- if (this.validation) {
134
- this.validation.validateResponse(jsonResponse);
135
- }
135
+ // Check for JSON-RPC error in the response
136
136
  if (jsonResponse.error) {
137
137
  throw new JsonRpcClientError(jsonResponse.error.message, jsonResponse.error.code, jsonResponse.error.data);
138
138
  }
139
+ // If it's not a 2xx status and no JSON-RPC error, throw network error with body
140
+ if (!response.ok) {
141
+ throw new JsonRpcNetworkError(`HTTP error! status: ${response.status}`, undefined, jsonResponse);
142
+ }
143
+ // Validate basic JSON-RPC response structure
144
+ if (this.validation) {
145
+ this.validation.validateResponse(jsonResponse);
146
+ }
139
147
  // Convert snake_case response back to camelCase
140
148
  const camelCaseResult = jsonResponse.result
141
149
  ? convertKeysToCamelCase(jsonResponse.result)
@@ -2762,190 +2770,328 @@ var JsonRpcRequestForValidatorsSchema = () => object({
2762
2770
  method: _enum(["validators"]),
2763
2771
  params: _lazy(() => RpcValidatorRequestSchema())
2764
2772
  });
2765
- var JsonRpcResponseFor_ArrayOf_RangeOfUint64And_RpcErrorSchema = () => union([
2766
- object({
2767
- result: array(_lazy(() => RangeOfUint64Schema()))
2768
- }),
2773
+ var JsonRpcResponseFor_ArrayOf_RangeOfUint64And_RpcErrorSchema = () => intersection(
2774
+ union([
2775
+ object({
2776
+ result: array(_lazy(() => RangeOfUint64Schema()))
2777
+ }),
2778
+ object({
2779
+ error: _lazy(() => RpcErrorSchema())
2780
+ })
2781
+ ]),
2769
2782
  object({
2770
- error: _lazy(() => RpcErrorSchema())
2783
+ id: string(),
2784
+ jsonrpc: string()
2771
2785
  })
2772
- ]);
2773
- var JsonRpcResponseFor_ArrayOf_ValidatorStakeViewAnd_RpcErrorSchema = () => union([
2774
- object({
2775
- result: array(_lazy(() => ValidatorStakeViewSchema()))
2776
- }),
2786
+ );
2787
+ var JsonRpcResponseFor_ArrayOf_ValidatorStakeViewAnd_RpcErrorSchema = () => intersection(
2788
+ union([
2789
+ object({
2790
+ result: array(_lazy(() => ValidatorStakeViewSchema()))
2791
+ }),
2792
+ object({
2793
+ error: _lazy(() => RpcErrorSchema())
2794
+ })
2795
+ ]),
2777
2796
  object({
2778
- error: _lazy(() => RpcErrorSchema())
2797
+ id: string(),
2798
+ jsonrpc: string()
2779
2799
  })
2780
- ]);
2781
- var JsonRpcResponseFor_CryptoHashAnd_RpcErrorSchema = () => union([
2782
- object({
2783
- result: _lazy(() => CryptoHashSchema())
2784
- }),
2800
+ );
2801
+ var JsonRpcResponseFor_CryptoHashAnd_RpcErrorSchema = () => intersection(
2802
+ union([
2803
+ object({
2804
+ result: _lazy(() => CryptoHashSchema())
2805
+ }),
2806
+ object({
2807
+ error: _lazy(() => RpcErrorSchema())
2808
+ })
2809
+ ]),
2785
2810
  object({
2786
- error: _lazy(() => RpcErrorSchema())
2811
+ id: string(),
2812
+ jsonrpc: string()
2787
2813
  })
2788
- ]);
2789
- var JsonRpcResponseFor_GenesisConfigAnd_RpcErrorSchema = () => union([
2790
- object({
2791
- result: _lazy(() => GenesisConfigSchema())
2792
- }),
2814
+ );
2815
+ var JsonRpcResponseFor_GenesisConfigAnd_RpcErrorSchema = () => intersection(
2816
+ union([
2817
+ object({
2818
+ result: _lazy(() => GenesisConfigSchema())
2819
+ }),
2820
+ object({
2821
+ error: _lazy(() => RpcErrorSchema())
2822
+ })
2823
+ ]),
2793
2824
  object({
2794
- error: _lazy(() => RpcErrorSchema())
2825
+ id: string(),
2826
+ jsonrpc: string()
2795
2827
  })
2796
- ]);
2797
- var JsonRpcResponseFor_Nullable_RpcHealthResponseAnd_RpcErrorSchema = () => union([
2798
- object({
2799
- result: union([_lazy(() => RpcHealthResponseSchema()), _null()])
2800
- }),
2828
+ );
2829
+ var JsonRpcResponseFor_Nullable_RpcHealthResponseAnd_RpcErrorSchema = () => intersection(
2830
+ union([
2831
+ object({
2832
+ result: union([_lazy(() => RpcHealthResponseSchema()), _null()])
2833
+ }),
2834
+ object({
2835
+ error: _lazy(() => RpcErrorSchema())
2836
+ })
2837
+ ]),
2801
2838
  object({
2802
- error: _lazy(() => RpcErrorSchema())
2839
+ id: string(),
2840
+ jsonrpc: string()
2803
2841
  })
2804
- ]);
2805
- var JsonRpcResponseFor_RpcBlockResponseAnd_RpcErrorSchema = () => union([
2806
- object({
2807
- result: _lazy(() => RpcBlockResponseSchema())
2808
- }),
2842
+ );
2843
+ var JsonRpcResponseFor_RpcBlockResponseAnd_RpcErrorSchema = () => intersection(
2844
+ union([
2845
+ object({
2846
+ result: _lazy(() => RpcBlockResponseSchema())
2847
+ }),
2848
+ object({
2849
+ error: _lazy(() => RpcErrorSchema())
2850
+ })
2851
+ ]),
2809
2852
  object({
2810
- error: _lazy(() => RpcErrorSchema())
2853
+ id: string(),
2854
+ jsonrpc: string()
2811
2855
  })
2812
- ]);
2813
- var JsonRpcResponseFor_RpcChunkResponseAnd_RpcErrorSchema = () => union([
2814
- object({
2815
- result: _lazy(() => RpcChunkResponseSchema())
2816
- }),
2856
+ );
2857
+ var JsonRpcResponseFor_RpcChunkResponseAnd_RpcErrorSchema = () => intersection(
2858
+ union([
2859
+ object({
2860
+ result: _lazy(() => RpcChunkResponseSchema())
2861
+ }),
2862
+ object({
2863
+ error: _lazy(() => RpcErrorSchema())
2864
+ })
2865
+ ]),
2817
2866
  object({
2818
- error: _lazy(() => RpcErrorSchema())
2867
+ id: string(),
2868
+ jsonrpc: string()
2819
2869
  })
2820
- ]);
2821
- var JsonRpcResponseFor_RpcClientConfigResponseAnd_RpcErrorSchema = () => union([
2822
- object({
2823
- result: _lazy(() => RpcClientConfigResponseSchema())
2824
- }),
2870
+ );
2871
+ var JsonRpcResponseFor_RpcClientConfigResponseAnd_RpcErrorSchema = () => intersection(
2872
+ union([
2873
+ object({
2874
+ result: _lazy(() => RpcClientConfigResponseSchema())
2875
+ }),
2876
+ object({
2877
+ error: _lazy(() => RpcErrorSchema())
2878
+ })
2879
+ ]),
2825
2880
  object({
2826
- error: _lazy(() => RpcErrorSchema())
2881
+ id: string(),
2882
+ jsonrpc: string()
2827
2883
  })
2828
- ]);
2829
- var JsonRpcResponseFor_RpcCongestionLevelResponseAnd_RpcErrorSchema = () => union([
2830
- object({
2831
- result: _lazy(() => RpcCongestionLevelResponseSchema())
2832
- }),
2884
+ );
2885
+ var JsonRpcResponseFor_RpcCongestionLevelResponseAnd_RpcErrorSchema = () => intersection(
2886
+ union([
2887
+ object({
2888
+ result: _lazy(() => RpcCongestionLevelResponseSchema())
2889
+ }),
2890
+ object({
2891
+ error: _lazy(() => RpcErrorSchema())
2892
+ })
2893
+ ]),
2833
2894
  object({
2834
- error: _lazy(() => RpcErrorSchema())
2895
+ id: string(),
2896
+ jsonrpc: string()
2835
2897
  })
2836
- ]);
2837
- var JsonRpcResponseFor_RpcGasPriceResponseAnd_RpcErrorSchema = () => union([
2838
- object({
2839
- result: _lazy(() => RpcGasPriceResponseSchema())
2840
- }),
2898
+ );
2899
+ var JsonRpcResponseFor_RpcGasPriceResponseAnd_RpcErrorSchema = () => intersection(
2900
+ union([
2901
+ object({
2902
+ result: _lazy(() => RpcGasPriceResponseSchema())
2903
+ }),
2904
+ object({
2905
+ error: _lazy(() => RpcErrorSchema())
2906
+ })
2907
+ ]),
2841
2908
  object({
2842
- error: _lazy(() => RpcErrorSchema())
2909
+ id: string(),
2910
+ jsonrpc: string()
2843
2911
  })
2844
- ]);
2845
- var JsonRpcResponseFor_RpcLightClientBlockProofResponseAnd_RpcErrorSchema = () => union([
2846
- object({
2847
- result: _lazy(() => RpcLightClientBlockProofResponseSchema())
2848
- }),
2912
+ );
2913
+ var JsonRpcResponseFor_RpcLightClientBlockProofResponseAnd_RpcErrorSchema = () => intersection(
2914
+ union([
2915
+ object({
2916
+ result: _lazy(() => RpcLightClientBlockProofResponseSchema())
2917
+ }),
2918
+ object({
2919
+ error: _lazy(() => RpcErrorSchema())
2920
+ })
2921
+ ]),
2849
2922
  object({
2850
- error: _lazy(() => RpcErrorSchema())
2923
+ id: string(),
2924
+ jsonrpc: string()
2851
2925
  })
2852
- ]);
2853
- var JsonRpcResponseFor_RpcLightClientExecutionProofResponseAnd_RpcErrorSchema = () => union([
2854
- object({
2855
- result: _lazy(() => RpcLightClientExecutionProofResponseSchema())
2856
- }),
2926
+ );
2927
+ var JsonRpcResponseFor_RpcLightClientExecutionProofResponseAnd_RpcErrorSchema = () => intersection(
2928
+ union([
2929
+ object({
2930
+ result: _lazy(() => RpcLightClientExecutionProofResponseSchema())
2931
+ }),
2932
+ object({
2933
+ error: _lazy(() => RpcErrorSchema())
2934
+ })
2935
+ ]),
2857
2936
  object({
2858
- error: _lazy(() => RpcErrorSchema())
2937
+ id: string(),
2938
+ jsonrpc: string()
2859
2939
  })
2860
- ]);
2861
- var JsonRpcResponseFor_RpcLightClientNextBlockResponseAnd_RpcErrorSchema = () => union([
2862
- object({
2863
- result: _lazy(() => RpcLightClientNextBlockResponseSchema())
2864
- }),
2940
+ );
2941
+ var JsonRpcResponseFor_RpcLightClientNextBlockResponseAnd_RpcErrorSchema = () => intersection(
2942
+ union([
2943
+ object({
2944
+ result: _lazy(() => RpcLightClientNextBlockResponseSchema())
2945
+ }),
2946
+ object({
2947
+ error: _lazy(() => RpcErrorSchema())
2948
+ })
2949
+ ]),
2865
2950
  object({
2866
- error: _lazy(() => RpcErrorSchema())
2951
+ id: string(),
2952
+ jsonrpc: string()
2867
2953
  })
2868
- ]);
2869
- var JsonRpcResponseFor_RpcNetworkInfoResponseAnd_RpcErrorSchema = () => union([
2870
- object({
2871
- result: _lazy(() => RpcNetworkInfoResponseSchema())
2872
- }),
2954
+ );
2955
+ var JsonRpcResponseFor_RpcNetworkInfoResponseAnd_RpcErrorSchema = () => intersection(
2956
+ union([
2957
+ object({
2958
+ result: _lazy(() => RpcNetworkInfoResponseSchema())
2959
+ }),
2960
+ object({
2961
+ error: _lazy(() => RpcErrorSchema())
2962
+ })
2963
+ ]),
2873
2964
  object({
2874
- error: _lazy(() => RpcErrorSchema())
2965
+ id: string(),
2966
+ jsonrpc: string()
2875
2967
  })
2876
- ]);
2877
- var JsonRpcResponseFor_RpcProtocolConfigResponseAnd_RpcErrorSchema = () => union([
2878
- object({
2879
- result: _lazy(() => RpcProtocolConfigResponseSchema())
2880
- }),
2968
+ );
2969
+ var JsonRpcResponseFor_RpcProtocolConfigResponseAnd_RpcErrorSchema = () => intersection(
2970
+ union([
2971
+ object({
2972
+ result: _lazy(() => RpcProtocolConfigResponseSchema())
2973
+ }),
2974
+ object({
2975
+ error: _lazy(() => RpcErrorSchema())
2976
+ })
2977
+ ]),
2881
2978
  object({
2882
- error: _lazy(() => RpcErrorSchema())
2979
+ id: string(),
2980
+ jsonrpc: string()
2883
2981
  })
2884
- ]);
2885
- var JsonRpcResponseFor_RpcQueryResponseAnd_RpcErrorSchema = () => union([
2886
- object({
2887
- result: _lazy(() => RpcQueryResponseSchema())
2888
- }),
2982
+ );
2983
+ var JsonRpcResponseFor_RpcQueryResponseAnd_RpcErrorSchema = () => intersection(
2984
+ union([
2985
+ object({
2986
+ result: _lazy(() => RpcQueryResponseSchema())
2987
+ }),
2988
+ object({
2989
+ error: _lazy(() => RpcErrorSchema())
2990
+ })
2991
+ ]),
2889
2992
  object({
2890
- error: _lazy(() => RpcErrorSchema())
2993
+ id: string(),
2994
+ jsonrpc: string()
2891
2995
  })
2892
- ]);
2893
- var JsonRpcResponseFor_RpcReceiptResponseAnd_RpcErrorSchema = () => union([
2894
- object({
2895
- result: _lazy(() => RpcReceiptResponseSchema())
2896
- }),
2996
+ );
2997
+ var JsonRpcResponseFor_RpcReceiptResponseAnd_RpcErrorSchema = () => intersection(
2998
+ union([
2999
+ object({
3000
+ result: _lazy(() => RpcReceiptResponseSchema())
3001
+ }),
3002
+ object({
3003
+ error: _lazy(() => RpcErrorSchema())
3004
+ })
3005
+ ]),
2897
3006
  object({
2898
- error: _lazy(() => RpcErrorSchema())
3007
+ id: string(),
3008
+ jsonrpc: string()
2899
3009
  })
2900
- ]);
2901
- var JsonRpcResponseFor_RpcSplitStorageInfoResponseAnd_RpcErrorSchema = () => union([
2902
- object({
2903
- result: _lazy(() => RpcSplitStorageInfoResponseSchema())
2904
- }),
3010
+ );
3011
+ var JsonRpcResponseFor_RpcSplitStorageInfoResponseAnd_RpcErrorSchema = () => intersection(
3012
+ union([
3013
+ object({
3014
+ result: _lazy(() => RpcSplitStorageInfoResponseSchema())
3015
+ }),
3016
+ object({
3017
+ error: _lazy(() => RpcErrorSchema())
3018
+ })
3019
+ ]),
2905
3020
  object({
2906
- error: _lazy(() => RpcErrorSchema())
3021
+ id: string(),
3022
+ jsonrpc: string()
2907
3023
  })
2908
- ]);
2909
- var JsonRpcResponseFor_RpcStateChangesInBlockByTypeResponseAnd_RpcErrorSchema = () => union([
2910
- object({
2911
- result: _lazy(() => RpcStateChangesInBlockByTypeResponseSchema())
2912
- }),
3024
+ );
3025
+ var JsonRpcResponseFor_RpcStateChangesInBlockByTypeResponseAnd_RpcErrorSchema = () => intersection(
3026
+ union([
3027
+ object({
3028
+ result: _lazy(() => RpcStateChangesInBlockByTypeResponseSchema())
3029
+ }),
3030
+ object({
3031
+ error: _lazy(() => RpcErrorSchema())
3032
+ })
3033
+ ]),
2913
3034
  object({
2914
- error: _lazy(() => RpcErrorSchema())
3035
+ id: string(),
3036
+ jsonrpc: string()
2915
3037
  })
2916
- ]);
2917
- var JsonRpcResponseFor_RpcStateChangesInBlockResponseAnd_RpcErrorSchema = () => union([
2918
- object({
2919
- result: _lazy(() => RpcStateChangesInBlockResponseSchema())
2920
- }),
3038
+ );
3039
+ var JsonRpcResponseFor_RpcStateChangesInBlockResponseAnd_RpcErrorSchema = () => intersection(
3040
+ union([
3041
+ object({
3042
+ result: _lazy(() => RpcStateChangesInBlockResponseSchema())
3043
+ }),
3044
+ object({
3045
+ error: _lazy(() => RpcErrorSchema())
3046
+ })
3047
+ ]),
2921
3048
  object({
2922
- error: _lazy(() => RpcErrorSchema())
3049
+ id: string(),
3050
+ jsonrpc: string()
2923
3051
  })
2924
- ]);
2925
- var JsonRpcResponseFor_RpcStatusResponseAnd_RpcErrorSchema = () => union([
2926
- object({
2927
- result: _lazy(() => RpcStatusResponseSchema())
2928
- }),
3052
+ );
3053
+ var JsonRpcResponseFor_RpcStatusResponseAnd_RpcErrorSchema = () => intersection(
3054
+ union([
3055
+ object({
3056
+ result: _lazy(() => RpcStatusResponseSchema())
3057
+ }),
3058
+ object({
3059
+ error: _lazy(() => RpcErrorSchema())
3060
+ })
3061
+ ]),
2929
3062
  object({
2930
- error: _lazy(() => RpcErrorSchema())
3063
+ id: string(),
3064
+ jsonrpc: string()
2931
3065
  })
2932
- ]);
2933
- var JsonRpcResponseFor_RpcTransactionResponseAnd_RpcErrorSchema = () => union([
2934
- object({
2935
- result: _lazy(() => RpcTransactionResponseSchema())
2936
- }),
3066
+ );
3067
+ var JsonRpcResponseFor_RpcTransactionResponseAnd_RpcErrorSchema = () => intersection(
3068
+ union([
3069
+ object({
3070
+ result: _lazy(() => RpcTransactionResponseSchema())
3071
+ }),
3072
+ object({
3073
+ error: _lazy(() => RpcErrorSchema())
3074
+ })
3075
+ ]),
2937
3076
  object({
2938
- error: _lazy(() => RpcErrorSchema())
3077
+ id: string(),
3078
+ jsonrpc: string()
2939
3079
  })
2940
- ]);
2941
- var JsonRpcResponseFor_RpcValidatorResponseAnd_RpcErrorSchema = () => union([
2942
- object({
2943
- result: _lazy(() => RpcValidatorResponseSchema())
2944
- }),
3080
+ );
3081
+ var JsonRpcResponseFor_RpcValidatorResponseAnd_RpcErrorSchema = () => intersection(
3082
+ union([
3083
+ object({
3084
+ result: _lazy(() => RpcValidatorResponseSchema())
3085
+ }),
3086
+ object({
3087
+ error: _lazy(() => RpcErrorSchema())
3088
+ })
3089
+ ]),
2945
3090
  object({
2946
- error: _lazy(() => RpcErrorSchema())
3091
+ id: string(),
3092
+ jsonrpc: string()
2947
3093
  })
2948
- ]);
3094
+ );
2949
3095
  var KnownProducerViewSchema = () => object({
2950
3096
  accountId: _lazy(() => AccountIdSchema()),
2951
3097
  nextHops: optional(array(_lazy(() => PublicKeySchema()))),
@@ -3243,20 +3389,29 @@ var RpcCongestionLevelRequestSchema = () => union([
3243
3389
  var RpcCongestionLevelResponseSchema = () => object({
3244
3390
  congestionLevel: number()
3245
3391
  });
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
- }),
3392
+ var RpcErrorSchema = () => intersection(
3393
+ union([
3394
+ object({
3395
+ cause: _lazy(() => RpcRequestValidationErrorKindSchema()),
3396
+ name: _enum(["REQUEST_VALIDATION_ERROR"])
3397
+ }),
3398
+ object({
3399
+ cause: unknown(),
3400
+ name: _enum(["HANDLER_ERROR"])
3401
+ }),
3402
+ object({
3403
+ cause: unknown(),
3404
+ name: _enum(["INTERNAL_ERROR"])
3405
+ })
3406
+ ]),
3255
3407
  object({
3256
- cause: unknown(),
3257
- name: _enum(["INTERNAL_ERROR"])
3408
+ cause: optional(unknown()),
3409
+ code: number(),
3410
+ data: optional(unknown()),
3411
+ message: string(),
3412
+ name: optional(unknown())
3258
3413
  })
3259
- ]);
3414
+ );
3260
3415
  var RpcGasPriceRequestSchema = () => object({
3261
3416
  blockId: optional(union([_lazy(() => BlockIdSchema()), _null()]))
3262
3417
  });
@@ -3278,18 +3433,23 @@ var RpcLightClientBlockProofResponseSchema = () => object({
3278
3433
  blockHeaderLite: _lazy(() => LightClientBlockLiteViewSchema()),
3279
3434
  blockProof: array(_lazy(() => MerklePathItemSchema()))
3280
3435
  });
3281
- var RpcLightClientExecutionProofRequestSchema = () => union([
3282
- object({
3283
- senderId: _lazy(() => AccountIdSchema()),
3284
- transactionHash: _lazy(() => CryptoHashSchema()),
3285
- type: _enum(["transaction"])
3286
- }),
3436
+ var RpcLightClientExecutionProofRequestSchema = () => intersection(
3437
+ union([
3438
+ object({
3439
+ senderId: _lazy(() => AccountIdSchema()),
3440
+ transactionHash: _lazy(() => CryptoHashSchema()),
3441
+ type: _enum(["transaction"])
3442
+ }),
3443
+ object({
3444
+ receiptId: _lazy(() => CryptoHashSchema()),
3445
+ receiverId: _lazy(() => AccountIdSchema()),
3446
+ type: _enum(["receipt"])
3447
+ })
3448
+ ]),
3287
3449
  object({
3288
- receiptId: _lazy(() => CryptoHashSchema()),
3289
- receiverId: _lazy(() => AccountIdSchema()),
3290
- type: _enum(["receipt"])
3450
+ lightClientHead: _lazy(() => CryptoHashSchema())
3291
3451
  })
3292
- ]);
3452
+ );
3293
3453
  var RpcLightClientExecutionProofResponseSchema = () => object({
3294
3454
  blockHeaderLite: _lazy(() => LightClientBlockLiteViewSchema()),
3295
3455
  blockProof: array(_lazy(() => MerklePathItemSchema())),
@@ -4006,6 +4166,46 @@ var StakeActionSchema = () => object({
4006
4166
  publicKey: _lazy(() => PublicKeySchema()),
4007
4167
  stake: string()
4008
4168
  });
4169
+ var StateChangeCauseViewSchema = () => union([
4170
+ object({
4171
+ type: _enum(["not_writable_to_disk"])
4172
+ }),
4173
+ object({
4174
+ type: _enum(["initial_state"])
4175
+ }),
4176
+ object({
4177
+ txHash: _lazy(() => CryptoHashSchema()),
4178
+ type: _enum(["transaction_processing"])
4179
+ }),
4180
+ object({
4181
+ receiptHash: _lazy(() => CryptoHashSchema()),
4182
+ type: _enum(["action_receipt_processing_started"])
4183
+ }),
4184
+ object({
4185
+ receiptHash: _lazy(() => CryptoHashSchema()),
4186
+ type: _enum(["action_receipt_gas_reward"])
4187
+ }),
4188
+ object({
4189
+ receiptHash: _lazy(() => CryptoHashSchema()),
4190
+ type: _enum(["receipt_processing"])
4191
+ }),
4192
+ object({
4193
+ receiptHash: _lazy(() => CryptoHashSchema()),
4194
+ type: _enum(["postponed_receipt"])
4195
+ }),
4196
+ object({
4197
+ type: _enum(["updated_delayed_receipts"])
4198
+ }),
4199
+ object({
4200
+ type: _enum(["validator_accounts_update"])
4201
+ }),
4202
+ object({
4203
+ type: _enum(["migration"])
4204
+ }),
4205
+ object({
4206
+ type: _enum(["bandwidth_scheduler_state_update"])
4207
+ })
4208
+ ]);
4009
4209
  var StateChangeKindViewSchema = () => union([
4010
4210
  object({
4011
4211
  accountId: _lazy(() => AccountIdSchema()),
@@ -4024,98 +4224,103 @@ var StateChangeKindViewSchema = () => union([
4024
4224
  type: _enum(["contract_code_touched"])
4025
4225
  })
4026
4226
  ]);
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()
4227
+ var StateChangeWithCauseViewSchema = () => intersection(
4228
+ union([
4229
+ object({
4230
+ change: object({
4231
+ accountId: _lazy(() => AccountIdSchema()),
4232
+ amount: string(),
4233
+ codeHash: _lazy(() => CryptoHashSchema()),
4234
+ globalContractAccountId: optional(
4235
+ union([_lazy(() => AccountIdSchema()), _null()])
4236
+ ),
4237
+ globalContractHash: optional(
4238
+ union([_lazy(() => CryptoHashSchema()), _null()])
4239
+ ),
4240
+ locked: string(),
4241
+ storagePaidAt: optional(number()),
4242
+ storageUsage: number()
4243
+ }),
4244
+ type: _enum(["account_update"])
4042
4245
  }),
4043
- type: _enum(["account_update"])
4044
- }),
4045
- object({
4046
- change: object({
4047
- accountId: _lazy(() => AccountIdSchema())
4246
+ object({
4247
+ change: object({
4248
+ accountId: _lazy(() => AccountIdSchema())
4249
+ }),
4250
+ type: _enum(["account_deletion"])
4048
4251
  }),
4049
- type: _enum(["account_deletion"])
4050
- }),
4051
- object({
4052
- change: object({
4053
- accessKey: _lazy(() => AccessKeyViewSchema()),
4054
- accountId: _lazy(() => AccountIdSchema()),
4055
- publicKey: _lazy(() => PublicKeySchema())
4252
+ object({
4253
+ change: object({
4254
+ accessKey: _lazy(() => AccessKeyViewSchema()),
4255
+ accountId: _lazy(() => AccountIdSchema()),
4256
+ publicKey: _lazy(() => PublicKeySchema())
4257
+ }),
4258
+ type: _enum(["access_key_update"])
4056
4259
  }),
4057
- type: _enum(["access_key_update"])
4058
- }),
4059
- object({
4060
- change: object({
4061
- accountId: _lazy(() => AccountIdSchema()),
4062
- publicKey: _lazy(() => PublicKeySchema())
4260
+ object({
4261
+ change: object({
4262
+ accountId: _lazy(() => AccountIdSchema()),
4263
+ publicKey: _lazy(() => PublicKeySchema())
4264
+ }),
4265
+ type: _enum(["access_key_deletion"])
4063
4266
  }),
4064
- type: _enum(["access_key_deletion"])
4065
- }),
4066
- object({
4067
- change: object({
4068
- accountId: _lazy(() => AccountIdSchema()),
4069
- gasKey: _lazy(() => GasKeyViewSchema()),
4070
- publicKey: _lazy(() => PublicKeySchema())
4267
+ object({
4268
+ change: object({
4269
+ accountId: _lazy(() => AccountIdSchema()),
4270
+ gasKey: _lazy(() => GasKeyViewSchema()),
4271
+ publicKey: _lazy(() => PublicKeySchema())
4272
+ }),
4273
+ type: _enum(["gas_key_update"])
4071
4274
  }),
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())
4275
+ object({
4276
+ change: object({
4277
+ accountId: _lazy(() => AccountIdSchema()),
4278
+ index: number(),
4279
+ nonce: number(),
4280
+ publicKey: _lazy(() => PublicKeySchema())
4281
+ }),
4282
+ type: _enum(["gas_key_nonce_update"])
4080
4283
  }),
4081
- type: _enum(["gas_key_nonce_update"])
4082
- }),
4083
- object({
4084
- change: object({
4085
- accountId: _lazy(() => AccountIdSchema()),
4086
- publicKey: _lazy(() => PublicKeySchema())
4284
+ object({
4285
+ change: object({
4286
+ accountId: _lazy(() => AccountIdSchema()),
4287
+ publicKey: _lazy(() => PublicKeySchema())
4288
+ }),
4289
+ type: _enum(["gas_key_deletion"])
4087
4290
  }),
4088
- type: _enum(["gas_key_deletion"])
4089
- }),
4090
- object({
4091
- change: object({
4092
- accountId: _lazy(() => AccountIdSchema()),
4093
- keyBase64: _lazy(() => StoreKeySchema()),
4094
- valueBase64: _lazy(() => StoreValueSchema())
4291
+ object({
4292
+ change: object({
4293
+ accountId: _lazy(() => AccountIdSchema()),
4294
+ keyBase64: _lazy(() => StoreKeySchema()),
4295
+ valueBase64: _lazy(() => StoreValueSchema())
4296
+ }),
4297
+ type: _enum(["data_update"])
4095
4298
  }),
4096
- type: _enum(["data_update"])
4097
- }),
4098
- object({
4099
- change: object({
4100
- accountId: _lazy(() => AccountIdSchema()),
4101
- keyBase64: _lazy(() => StoreKeySchema())
4299
+ object({
4300
+ change: object({
4301
+ accountId: _lazy(() => AccountIdSchema()),
4302
+ keyBase64: _lazy(() => StoreKeySchema())
4303
+ }),
4304
+ type: _enum(["data_deletion"])
4102
4305
  }),
4103
- type: _enum(["data_deletion"])
4104
- }),
4105
- object({
4106
- change: object({
4107
- accountId: _lazy(() => AccountIdSchema()),
4108
- codeBase64: string()
4306
+ object({
4307
+ change: object({
4308
+ accountId: _lazy(() => AccountIdSchema()),
4309
+ codeBase64: string()
4310
+ }),
4311
+ type: _enum(["contract_code_update"])
4109
4312
  }),
4110
- type: _enum(["contract_code_update"])
4111
- }),
4313
+ object({
4314
+ change: object({
4315
+ accountId: _lazy(() => AccountIdSchema())
4316
+ }),
4317
+ type: _enum(["contract_code_deletion"])
4318
+ })
4319
+ ]),
4112
4320
  object({
4113
- change: object({
4114
- accountId: _lazy(() => AccountIdSchema())
4115
- }),
4116
- type: _enum(["contract_code_deletion"])
4321
+ cause: _lazy(() => StateChangeCauseViewSchema())
4117
4322
  })
4118
- ]);
4323
+ );
4119
4324
  var StateItemSchema = () => object({
4120
4325
  key: _lazy(() => StoreKeySchema()),
4121
4326
  value: _lazy(() => StoreValueSchema())
@@ -4558,7 +4763,7 @@ Object.entries(PATH_TO_METHOD_MAP).forEach(([path, method]) => {
4558
4763
  var RPC_METHODS = Object.values(PATH_TO_METHOD_MAP);
4559
4764
 
4560
4765
  // Auto-generated static RPC functions for tree-shaking
4561
- // Generated at: 2025-07-26T17:05:05.177Z
4766
+ // Generated at: 2025-07-28T13:29:57.104Z
4562
4767
  // Total functions: 28
4563
4768
  //
4564
4769
  // This file is automatically generated by tools/codegen/generate-client-interface.ts