@psalomo/jsonrpc-client 1.3.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.
- package/dist/browser-standalone.js +5 -863
- package/dist/browser-standalone.min.js +1 -1
- package/dist/{chunk-GCIU6ZLN.mjs → chunk-ABZUXHR5.mjs} +1 -29
- package/dist/client.d.ts +0 -3
- package/dist/client.d.ts.map +1 -1
- package/dist/{convenience-5WSFl5pu.d.mts → convenience-CzETQz3b.d.mts} +1 -16
- package/dist/{convenience-5WSFl5pu.d.ts → convenience-CzETQz3b.d.ts} +1 -16
- package/dist/index.d.mts +4 -3
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -101
- package/dist/index.mjs +7 -77
- package/dist/no-validation/index.d.mts +1 -1
- package/dist/no-validation/index.js +1 -29
- package/dist/no-validation/index.mjs +1 -1
- package/package.json +3 -3
- package/dist/validation.d.ts +0 -14
- package/dist/validation.d.ts.map +0 -1
@@ -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(),
|
@@ -5132,6 +4342,10 @@ async function viewFunctionAsJson(client, params) {
|
|
5132
4342
|
//
|
5133
4343
|
// This file is automatically generated by tools/codegen/generate-validation-wrappers.ts
|
5134
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
|
+
}
|
5135
4349
|
// Convenience function wrappers with validation
|
5136
4350
|
async function viewAccount(client, params) {
|
5137
4351
|
// Use the validated query function
|
@@ -6008,76 +5222,4 @@ async function validators(client, params) {
|
|
6008
5222
|
return result;
|
6009
5223
|
}
|
6010
5224
|
|
6011
|
-
// Optional validation for client - only imported when explicitly enabled
|
6012
|
-
/**
|
6013
|
-
* Enable validation for the client
|
6014
|
-
* This function should only be called if you want to include schema validation
|
6015
|
-
* Calling this function will include Zod schemas in your bundle
|
6016
|
-
*/
|
6017
|
-
function enableValidation() {
|
6018
|
-
const requestSchema = JsonRpcRequestSchema();
|
6019
|
-
const responseSchema = JsonRpcResponseSchema();
|
6020
|
-
return {
|
6021
|
-
validateRequest: (request) => {
|
6022
|
-
try {
|
6023
|
-
requestSchema.parse(request);
|
6024
|
-
}
|
6025
|
-
catch (error) {
|
6026
|
-
throw new JsonRpcNetworkError(`Invalid request format: ${error instanceof Error ? error.message : 'Unknown error'}`, error);
|
6027
|
-
}
|
6028
|
-
},
|
6029
|
-
validateResponse: (response) => {
|
6030
|
-
try {
|
6031
|
-
responseSchema.parse(response);
|
6032
|
-
}
|
6033
|
-
catch (error) {
|
6034
|
-
throw new JsonRpcClientError(`Invalid response format: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
6035
|
-
}
|
6036
|
-
},
|
6037
|
-
validateMethodRequest: (method, request) => {
|
6038
|
-
try {
|
6039
|
-
// First validate basic JSON-RPC structure
|
6040
|
-
requestSchema.parse(request);
|
6041
|
-
// Then validate method-specific structure if schema exists
|
6042
|
-
const methodSchemas = VALIDATION_SCHEMA_MAP[method];
|
6043
|
-
if (methodSchemas?.requestSchema) {
|
6044
|
-
const methodRequestSchema = methodSchemas.requestSchema();
|
6045
|
-
methodRequestSchema.parse(request);
|
6046
|
-
}
|
6047
|
-
}
|
6048
|
-
catch (error) {
|
6049
|
-
throw new JsonRpcNetworkError(`Invalid ${method} request: ${error instanceof Error ? error.message : 'Unknown error'}`, error);
|
6050
|
-
}
|
6051
|
-
},
|
6052
|
-
validateMethodResponse: (method, response) => {
|
6053
|
-
try {
|
6054
|
-
// First validate basic JSON-RPC structure
|
6055
|
-
responseSchema.parse(response);
|
6056
|
-
// Check if the result contains an error field before validating the schema
|
6057
|
-
// This provides a better error message when NEAR RPC returns non-standard errors
|
6058
|
-
if (response.result &&
|
6059
|
-
typeof response.result === 'object' &&
|
6060
|
-
'error' in response.result) {
|
6061
|
-
const serverError = response.result.error;
|
6062
|
-
throw new JsonRpcClientError(`Server error: ${serverError}`, -32000, response.result);
|
6063
|
-
}
|
6064
|
-
// Then validate method-specific response structure if schema exists
|
6065
|
-
const methodSchemas = VALIDATION_SCHEMA_MAP[method];
|
6066
|
-
if (methodSchemas?.responseSchema) {
|
6067
|
-
const methodResponseSchema = methodSchemas.responseSchema();
|
6068
|
-
methodResponseSchema.parse(response);
|
6069
|
-
}
|
6070
|
-
}
|
6071
|
-
catch (error) {
|
6072
|
-
// If it's already a JsonRpcClientError (from server error check), re-throw it
|
6073
|
-
if (error instanceof JsonRpcClientError) {
|
6074
|
-
throw error;
|
6075
|
-
}
|
6076
|
-
// Otherwise, it's a validation error
|
6077
|
-
throw new JsonRpcClientError(`Invalid ${method} response: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
6078
|
-
}
|
6079
|
-
},
|
6080
|
-
};
|
6081
|
-
}
|
6082
|
-
|
6083
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 };
|