@psalomo/jsonrpc-client 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # `@near-js/jsonrpc-client`
2
2
 
3
- This package provides a fully-typed client for the NEAR Protocol JSON-RPC API.
3
+ This package provides a fully-typed, dynamic client for the NEAR Protocol JSON-RPC API. All methods and types are automatically generated from the official OpenAPI specification.
4
4
 
5
5
  ## Installation
6
6
 
@@ -13,9 +13,11 @@ pnpm add @near-js/jsonrpc-client
13
13
  Create a new client instance and call any of the available RPC methods:
14
14
 
15
15
  ```typescript
16
- import { JsonRpcClient } from '@near-js/jsonrpc-client';
16
+ import { NearRpcClient } from '@near-js/jsonrpc-client';
17
17
 
18
- const client = new JsonRpcClient({ url: 'https://rpc.mainnet.near.org' });
18
+ const client = new NearRpcClient({
19
+ endpoint: 'https://rpc.mainnet.near.org'
20
+ });
19
21
 
20
22
  async function getNetworkStatus() {
21
23
  const status = await client.status();
@@ -27,17 +29,55 @@ getNetworkStatus();
27
29
 
28
30
  ### Handling Responses
29
31
 
30
- All method calls return a promise that resolves to a result object. The result object is fully typed based on the JSON-RPC API specification.
32
+ All method calls return a promise that resolves to a fully typed result object based on the JSON-RPC API specification.
31
33
 
32
34
  ```typescript
33
- import { JsonRpcClient } from '@near-js/jsonrpc-client';
35
+ import { NearRpcClient } from '@near-js/jsonrpc-client';
34
36
 
35
- const client = new JsonRpcClient({ url: 'https://rpc.mainnet.near.org' });
37
+ const client = new NearRpcClient({
38
+ endpoint: 'https://rpc.mainnet.near.org'
39
+ });
36
40
 
37
41
  async function getLatestBlock() {
38
42
  const block = await client.block({ finality: 'final' });
39
- console.log('Latest block:', block);
43
+ console.log('Latest block height:', block.header?.height);
40
44
  }
41
45
 
42
46
  getLatestBlock();
43
47
  ```
48
+
49
+ ### Convenience Methods
50
+
51
+ The client includes convenience methods for common query operations:
52
+
53
+ ```typescript
54
+ // View account information
55
+ const account = await client.viewAccount({
56
+ accountId: 'example.near',
57
+ finality: 'final'
58
+ });
59
+ console.log('Account balance:', account.amount);
60
+ console.log('Storage used:', account.storageUsage);
61
+
62
+ // Call view functions
63
+ const result = await client.viewFunction({
64
+ accountId: 'contract.near',
65
+ methodName: 'get_balance',
66
+ finality: 'final'
67
+ });
68
+
69
+ // View access keys
70
+ const accessKey = await client.viewAccessKey({
71
+ accountId: 'example.near',
72
+ publicKey: 'ed25519:...',
73
+ finality: 'final'
74
+ });
75
+ ```
76
+
77
+ ## Features
78
+
79
+ - **🔧 Dynamic methods**: All 28+ RPC methods automatically available
80
+ - **📝 Fully typed**: Complete TypeScript support with proper request/response types
81
+ - **🔄 Auto-updating**: New API methods appear automatically without code changes
82
+ - **✅ Runtime validation**: Built-in parameter validation with helpful error messages
83
+ - **🎯 Convenience methods**: Simplified methods for common operations like `viewAccount`
@@ -14292,6 +14292,7 @@ var NearRpcClient = class {
14292
14292
  }
14293
14293
  /**
14294
14294
  * Make a raw JSON-RPC call
14295
+ * This method is public to allow dynamic calls to any RPC method
14295
14296
  */
14296
14297
  async call(method, params) {
14297
14298
  const requestId = this.generateRequestId();
@@ -14364,162 +14365,38 @@ var NearRpcClient = class {
14364
14365
  lastError
14365
14366
  );
14366
14367
  }
14367
- // Generated RPC methods will be added here
14368
- // This section will be auto-generated based on the OpenAPI spec
14369
- /**
14370
- * Get node status
14371
- */
14372
- async status() {
14373
- return this.call("status");
14374
- }
14375
- /**
14376
- * Get block information
14377
- */
14378
- async block(params) {
14379
- return this.call("block", params);
14380
- }
14381
- /**
14382
- * Get current gas price
14383
- */
14384
- async gasPrice(params) {
14385
- return this.call("gas_price", params);
14386
- }
14387
- /**
14388
- * Get chunk information
14389
- */
14390
- async chunk(params) {
14391
- return this.call("chunk", params);
14392
- }
14393
- /**
14394
- * Health check
14395
- */
14396
- async health() {
14397
- return this.call("health");
14398
- }
14399
- /**
14400
- * Get network information
14401
- */
14402
- async networkInfo() {
14403
- return this.call("network_info");
14404
- }
14405
- /**
14406
- * Get current validators
14407
- */
14408
- async validators(params) {
14409
- return this.call("validators", params);
14410
- }
14411
- /**
14412
- * Get client configuration
14413
- */
14414
- async clientConfig() {
14415
- return this.call("client_config");
14416
- }
14417
- /**
14418
- * Broadcast transaction asynchronously
14419
- */
14420
- async broadcastTxAsync(params) {
14421
- return this.call("broadcast_tx_async", params);
14422
- }
14423
- /**
14424
- * Broadcast transaction and wait for commit
14425
- */
14426
- async broadcastTxCommit(params) {
14427
- return this.call("broadcast_tx_commit", params);
14428
- }
14429
- /**
14430
- * Send transaction
14431
- */
14432
- async sendTx(params) {
14433
- return await this.call("send_tx", params);
14434
- }
14435
- /**
14436
- * Get transaction status
14437
- */
14438
- async tx(params) {
14439
- return this.call("tx", params);
14440
- }
14441
- /**
14442
- * Query account/contract state
14443
- */
14444
- async query(params) {
14445
- return this.call("query", params);
14446
- }
14447
- /**
14448
- * View account information (convenience method)
14449
- */
14450
- async viewAccount(params) {
14451
- return this.query({
14452
- requestType: "view_account",
14453
- ...params
14454
- });
14455
- }
14456
- /**
14457
- * View function call (convenience method)
14458
- */
14459
- async viewFunction(params) {
14460
- return this.query({
14461
- requestType: "call_function",
14462
- ...params
14463
- });
14464
- }
14465
- /**
14466
- * View access key (convenience method)
14467
- */
14468
- async viewAccessKey(params) {
14469
- return this.query({
14470
- requestType: "view_access_key",
14471
- ...params
14472
- });
14473
- }
14474
- /**
14475
- * Get light client proof
14476
- */
14477
- async lightClientProof(params) {
14478
- return this.call("light_client_proof", params);
14479
- }
14480
- // Experimental methods
14481
- /**
14482
- * Get state changes (experimental)
14483
- */
14484
- async experimentalChanges(params) {
14485
- return this.call("EXPERIMENTAL_changes", params);
14486
- }
14487
- /**
14488
- * Get state changes in block (experimental)
14489
- */
14490
- async experimentalChangesInBlock(params) {
14491
- return this.call("EXPERIMENTAL_changes_in_block", params);
14492
- }
14493
- /**
14494
- * Get ordered validators (experimental)
14495
- */
14496
- async experimentalValidatorsOrdered(params) {
14497
- return this.call("EXPERIMENTAL_validators_ordered", params);
14498
- }
14499
- /**
14500
- * Get protocol configuration (experimental)
14501
- */
14502
- async experimentalProtocolConfig(params) {
14503
- return this.call("EXPERIMENTAL_protocol_config", params);
14504
- }
14505
- /**
14506
- * Get genesis configuration (experimental)
14507
- */
14508
- async experimentalGenesisConfig() {
14509
- return this.call("EXPERIMENTAL_genesis_config");
14510
- }
14511
- /**
14512
- * Get receipt information (experimental)
14513
- */
14514
- async experimentalReceipt(params) {
14515
- return this.call("EXPERIMENTAL_receipt", params);
14516
- }
14517
- /**
14518
- * Get transaction status (experimental)
14519
- */
14520
- async experimentalTxStatus(params) {
14521
- return this.call("EXPERIMENTAL_tx_status", params);
14368
+ };
14369
+ RPC_METHODS.forEach((method) => {
14370
+ let methodName = method;
14371
+ if (methodName.startsWith("EXPERIMENTAL_")) {
14372
+ methodName = "experimental" + methodName.substring(13).replace(/_([a-z])/g, (_, letter) => letter.toUpperCase()).replace(/^([a-z])/, (_, letter) => letter.toUpperCase());
14373
+ } else {
14374
+ methodName = methodName.replace(
14375
+ /_([a-z])/g,
14376
+ (_, letter) => letter.toUpperCase()
14377
+ );
14522
14378
  }
14379
+ NearRpcClient.prototype[methodName] = function(params) {
14380
+ return this.call(method, params);
14381
+ };
14382
+ });
14383
+ NearRpcClient.prototype.viewAccount = function(params) {
14384
+ return this.query({
14385
+ requestType: "view_account",
14386
+ ...params
14387
+ });
14388
+ };
14389
+ NearRpcClient.prototype.viewFunction = function(params) {
14390
+ return this.query({
14391
+ requestType: "call_function",
14392
+ ...params
14393
+ });
14394
+ };
14395
+ NearRpcClient.prototype.viewAccessKey = function(params) {
14396
+ return this.query({
14397
+ requestType: "view_access_key",
14398
+ ...params
14399
+ });
14523
14400
  };
14524
14401
 
14525
14402
  // src/types.ts
@@ -14534,6 +14411,8 @@ var NearRpcError = class extends Error {
14534
14411
  export {
14535
14412
  JsonRpcClientError,
14536
14413
  JsonRpcNetworkError,
14414
+ JsonRpcRequestSchema,
14415
+ JsonRpcResponseSchema,
14537
14416
  NearRpcClient,
14538
14417
  NearRpcError,
14539
14418
  RPC_METHODS,
package/dist/index.d.mts CHANGED
@@ -1,5 +1,61 @@
1
- export { JsonRpcErrorSchema, JsonRpcRequestSchema, JsonRpcResponseSchema, RPC_METHODS } from '@near-js/jsonrpc-types';
1
+ import { RpcStateChangesInBlockByTypeRequest, RpcStateChangesInBlockResponse, RpcStateChangesInBlockRequest, RpcStateChangesInBlockByTypeResponse, RpcCongestionLevelRequest, RpcCongestionLevelResponse, GenesisConfigRequest, GenesisConfig, RpcLightClientBlockProofRequest, RpcLightClientBlockProofResponse, RpcLightClientExecutionProofRequest, RpcLightClientExecutionProofResponse, RpcMaintenanceWindowsRequest, EXPERIMENTALMaintenanceWindowsResponse, RpcProtocolConfigRequest, RpcProtocolConfigResponse, RpcReceiptRequest, RpcReceiptResponse, RpcSplitStorageInfoRequest, RpcSplitStorageInfoResponse, RpcTransactionStatusRequest, RpcTransactionResponse, RpcValidatorsOrderedRequest, EXPERIMENTALValidatorsOrderedResponse, RpcBlockRequest, RpcBlockResponse, RpcSendTransactionRequest, CryptoHash, RpcChunkRequest, RpcChunkResponse, RpcClientConfigRequest, RpcClientConfigResponse, RpcGasPriceRequest, RpcGasPriceResponse, RpcHealthRequest, RpcHealthResponse, RpcNetworkInfoRequest, RpcNetworkInfoResponse, RpcLightClientNextBlockRequest, RpcLightClientNextBlockResponse, RpcQueryRequest, RpcQueryResponse, RpcStatusRequest, RpcStatusResponse, RpcValidatorRequest, RpcValidatorResponse, AccountView, CallResult, AccessKeyView, RPC_METHODS } from '@near-js/jsonrpc-types';
2
+ export { JsonRpcRequestSchema, JsonRpcResponseSchema, RPC_METHODS } from '@near-js/jsonrpc-types';
2
3
 
4
+ interface DynamicRpcMethods {
5
+ experimentalChanges(params?: RpcStateChangesInBlockByTypeRequest): Promise<RpcStateChangesInBlockResponse>;
6
+ experimentalChangesInBlock(params?: RpcStateChangesInBlockRequest): Promise<RpcStateChangesInBlockByTypeResponse>;
7
+ experimentalCongestionLevel(params?: RpcCongestionLevelRequest): Promise<RpcCongestionLevelResponse>;
8
+ experimentalGenesisConfig(params?: GenesisConfigRequest): Promise<GenesisConfig>;
9
+ experimentalLightClientBlockProof(params?: RpcLightClientBlockProofRequest): Promise<RpcLightClientBlockProofResponse>;
10
+ experimentalLightClientProof(params?: RpcLightClientExecutionProofRequest): Promise<RpcLightClientExecutionProofResponse>;
11
+ experimentalMaintenanceWindows(params?: RpcMaintenanceWindowsRequest): Promise<EXPERIMENTALMaintenanceWindowsResponse>;
12
+ experimentalProtocolConfig(params?: RpcProtocolConfigRequest): Promise<RpcProtocolConfigResponse>;
13
+ experimentalReceipt(params?: RpcReceiptRequest): Promise<RpcReceiptResponse>;
14
+ experimentalSplitStorageInfo(params?: RpcSplitStorageInfoRequest): Promise<RpcSplitStorageInfoResponse>;
15
+ experimentalTxStatus(params?: RpcTransactionStatusRequest): Promise<RpcTransactionResponse>;
16
+ experimentalValidatorsOrdered(params?: RpcValidatorsOrderedRequest): Promise<EXPERIMENTALValidatorsOrderedResponse>;
17
+ block(params?: RpcBlockRequest): Promise<RpcBlockResponse>;
18
+ broadcastTxAsync(params?: RpcSendTransactionRequest): Promise<CryptoHash>;
19
+ broadcastTxCommit(params?: RpcSendTransactionRequest): Promise<RpcTransactionResponse>;
20
+ changes(params?: RpcStateChangesInBlockByTypeRequest): Promise<RpcStateChangesInBlockResponse>;
21
+ chunk(params?: RpcChunkRequest): Promise<RpcChunkResponse>;
22
+ clientConfig(params?: RpcClientConfigRequest): Promise<RpcClientConfigResponse>;
23
+ gasPrice(params?: RpcGasPriceRequest): Promise<RpcGasPriceResponse>;
24
+ health(params?: RpcHealthRequest): Promise<RpcHealthResponse>;
25
+ lightClientProof(params?: RpcLightClientExecutionProofRequest): Promise<RpcLightClientExecutionProofResponse>;
26
+ networkInfo(params?: RpcNetworkInfoRequest): Promise<RpcNetworkInfoResponse>;
27
+ nextLightClientBlock(params?: RpcLightClientNextBlockRequest): Promise<RpcLightClientNextBlockResponse>;
28
+ query(params?: RpcQueryRequest): Promise<RpcQueryResponse>;
29
+ sendTx(params?: RpcSendTransactionRequest): Promise<RpcTransactionResponse>;
30
+ status(params?: RpcStatusRequest): Promise<RpcStatusResponse>;
31
+ tx(params?: RpcTransactionStatusRequest): Promise<RpcTransactionResponse>;
32
+ validators(params?: RpcValidatorRequest): Promise<RpcValidatorResponse>;
33
+ }
34
+ interface ConvenienceMethods {
35
+ viewAccount(params: {
36
+ accountId: string;
37
+ finality?: 'final' | 'near-final' | 'optimistic';
38
+ blockId?: string | number;
39
+ }): Promise<AccountView>;
40
+ viewFunction(params: {
41
+ accountId: string;
42
+ methodName: string;
43
+ argsBase64?: string;
44
+ finality?: 'final' | 'near-final' | 'optimistic';
45
+ blockId?: string | number;
46
+ }): Promise<CallResult>;
47
+ viewAccessKey(params: {
48
+ accountId: string;
49
+ publicKey: string;
50
+ finality?: 'final' | 'near-final' | 'optimistic';
51
+ blockId?: string | number;
52
+ }): Promise<AccessKeyView>;
53
+ }
54
+ interface CompleteClientInterface extends DynamicRpcMethods, ConvenienceMethods {
55
+ call<TParams = unknown, TResult = unknown>(method: string, params?: TParams): Promise<TResult>;
56
+ }
57
+
58
+ type RpcMethod = (typeof RPC_METHODS)[number];
3
59
  interface ClientConfig {
4
60
  endpoint: string;
5
61
  headers?: Record<string, string>;
@@ -33,6 +89,7 @@ declare class JsonRpcNetworkError extends Error {
33
89
  originalError: Error;
34
90
  constructor(message: string, originalError: Error);
35
91
  }
92
+
36
93
  declare class NearRpcClient {
37
94
  private endpoint;
38
95
  private headers;
@@ -47,172 +104,11 @@ declare class NearRpcClient {
47
104
  private generateRequestId;
48
105
  /**
49
106
  * Make a raw JSON-RPC call
107
+ * This method is public to allow dynamic calls to any RPC method
50
108
  */
51
- private call;
52
- /**
53
- * Get node status
54
- */
55
- status(): Promise<any>;
56
- /**
57
- * Get block information
58
- */
59
- block(params?: {
60
- blockId?: string | number;
61
- finality?: 'final' | 'near-final' | 'optimistic';
62
- }): Promise<any>;
63
- /**
64
- * Get current gas price
65
- */
66
- gasPrice(params?: {
67
- blockId?: string | number;
68
- }): Promise<any>;
69
- /**
70
- * Get chunk information
71
- */
72
- chunk(params: {
73
- chunkId: string;
74
- } | {
75
- blockId: string | number;
76
- shardId: number;
77
- }): Promise<any>;
78
- /**
79
- * Health check
80
- */
81
- health(): Promise<any>;
82
- /**
83
- * Get network information
84
- */
85
- networkInfo(): Promise<any>;
86
- /**
87
- * Get current validators
88
- */
89
- validators(params?: {
90
- blockId?: string | number;
91
- }): Promise<any>;
92
- /**
93
- * Get client configuration
94
- */
95
- clientConfig(): Promise<any>;
96
- /**
97
- * Broadcast transaction asynchronously
98
- */
99
- broadcastTxAsync(params: {
100
- signedTxBase64: string;
101
- }): Promise<any>;
102
- /**
103
- * Broadcast transaction and wait for commit
104
- */
105
- broadcastTxCommit(params: {
106
- signedTxBase64: string;
107
- }): Promise<any>;
108
- /**
109
- * Send transaction
110
- */
111
- sendTx(params: {
112
- signedTxBase64: string;
113
- }): Promise<any>;
114
- /**
115
- * Get transaction status
116
- */
117
- tx(params: {
118
- txHash: string;
119
- senderAccountId: string;
120
- }): Promise<any>;
121
- /**
122
- * Query account/contract state
123
- */
124
- query(params: {
125
- requestType: string;
126
- finality?: 'final' | 'near-final' | 'optimistic';
127
- blockId?: string | number;
128
- accountId?: string;
129
- methodName?: string;
130
- argsBase64?: string;
131
- publicKey?: string;
132
- keyType?: string;
133
- }): Promise<any>;
134
- /**
135
- * View account information (convenience method)
136
- */
137
- viewAccount(params: {
138
- accountId: string;
139
- finality?: 'final' | 'near-final' | 'optimistic';
140
- blockId?: string | number;
141
- }): Promise<any>;
142
- /**
143
- * View function call (convenience method)
144
- */
145
- viewFunction(params: {
146
- accountId: string;
147
- methodName: string;
148
- argsBase64?: string;
149
- finality?: 'final' | 'near-final' | 'optimistic';
150
- blockId?: string | number;
151
- }): Promise<any>;
152
- /**
153
- * View access key (convenience method)
154
- */
155
- viewAccessKey(params: {
156
- accountId: string;
157
- publicKey: string;
158
- finality?: 'final' | 'near-final' | 'optimistic';
159
- blockId?: string | number;
160
- }): Promise<any>;
161
- /**
162
- * Get light client proof
163
- */
164
- lightClientProof(params: {
165
- type: string;
166
- lightClientHead: string;
167
- transactionHash?: string;
168
- senderId?: string;
169
- receiptId?: string;
170
- }): Promise<any>;
171
- /**
172
- * Get state changes (experimental)
173
- */
174
- experimentalChanges(params: {
175
- changesType: string;
176
- accountIds?: string[];
177
- keyPrefixBase64?: string;
178
- blockId?: string | number;
179
- }): Promise<any>;
180
- /**
181
- * Get state changes in block (experimental)
182
- */
183
- experimentalChangesInBlock(params: {
184
- blockId: string | number;
185
- }): Promise<any>;
186
- /**
187
- * Get ordered validators (experimental)
188
- */
189
- experimentalValidatorsOrdered(params?: {
190
- blockId?: string | number;
191
- }): Promise<any>;
192
- /**
193
- * Get protocol configuration (experimental)
194
- */
195
- experimentalProtocolConfig(params?: {
196
- blockId?: string | number;
197
- finality?: 'final' | 'near-final' | 'optimistic';
198
- }): Promise<any>;
199
- /**
200
- * Get genesis configuration (experimental)
201
- */
202
- experimentalGenesisConfig(): Promise<any>;
203
- /**
204
- * Get receipt information (experimental)
205
- */
206
- experimentalReceipt(params: {
207
- receiptId: string;
208
- }): Promise<any>;
209
- /**
210
- * Get transaction status (experimental)
211
- */
212
- experimentalTxStatus(params: {
213
- txHash: string;
214
- senderAccountId: string;
215
- }): Promise<any>;
109
+ call<TParams = unknown, TResult = unknown>(method: RpcMethod, params?: TParams): Promise<TResult>;
110
+ }
111
+ interface NearRpcClient extends DynamicRpcMethods, ConvenienceMethods {
216
112
  }
217
113
 
218
114
  interface RpcRequest {
@@ -238,4 +134,4 @@ declare class NearRpcError extends Error {
238
134
  constructor(code: number, message: string, data?: unknown | undefined);
239
135
  }
240
136
 
241
- export { type ClientConfig, JsonRpcClientError, type JsonRpcError, JsonRpcNetworkError, type JsonRpcRequest, type JsonRpcResponse, NearRpcClient, NearRpcError, type RpcError, type RpcRequest, type RpcResponse, NearRpcClient as default };
137
+ export { type ClientConfig, type CompleteClientInterface, type ConvenienceMethods, type DynamicRpcMethods, JsonRpcClientError, type JsonRpcError, JsonRpcNetworkError, type JsonRpcRequest, type JsonRpcResponse, NearRpcClient, NearRpcError, type RpcError, type RpcRequest, type RpcResponse, NearRpcClient as default };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,61 @@
1
- export { JsonRpcErrorSchema, JsonRpcRequestSchema, JsonRpcResponseSchema, RPC_METHODS } from '@near-js/jsonrpc-types';
1
+ import { RpcStateChangesInBlockByTypeRequest, RpcStateChangesInBlockResponse, RpcStateChangesInBlockRequest, RpcStateChangesInBlockByTypeResponse, RpcCongestionLevelRequest, RpcCongestionLevelResponse, GenesisConfigRequest, GenesisConfig, RpcLightClientBlockProofRequest, RpcLightClientBlockProofResponse, RpcLightClientExecutionProofRequest, RpcLightClientExecutionProofResponse, RpcMaintenanceWindowsRequest, EXPERIMENTALMaintenanceWindowsResponse, RpcProtocolConfigRequest, RpcProtocolConfigResponse, RpcReceiptRequest, RpcReceiptResponse, RpcSplitStorageInfoRequest, RpcSplitStorageInfoResponse, RpcTransactionStatusRequest, RpcTransactionResponse, RpcValidatorsOrderedRequest, EXPERIMENTALValidatorsOrderedResponse, RpcBlockRequest, RpcBlockResponse, RpcSendTransactionRequest, CryptoHash, RpcChunkRequest, RpcChunkResponse, RpcClientConfigRequest, RpcClientConfigResponse, RpcGasPriceRequest, RpcGasPriceResponse, RpcHealthRequest, RpcHealthResponse, RpcNetworkInfoRequest, RpcNetworkInfoResponse, RpcLightClientNextBlockRequest, RpcLightClientNextBlockResponse, RpcQueryRequest, RpcQueryResponse, RpcStatusRequest, RpcStatusResponse, RpcValidatorRequest, RpcValidatorResponse, AccountView, CallResult, AccessKeyView, RPC_METHODS } from '@near-js/jsonrpc-types';
2
+ export { JsonRpcRequestSchema, JsonRpcResponseSchema, RPC_METHODS } from '@near-js/jsonrpc-types';
2
3
 
4
+ interface DynamicRpcMethods {
5
+ experimentalChanges(params?: RpcStateChangesInBlockByTypeRequest): Promise<RpcStateChangesInBlockResponse>;
6
+ experimentalChangesInBlock(params?: RpcStateChangesInBlockRequest): Promise<RpcStateChangesInBlockByTypeResponse>;
7
+ experimentalCongestionLevel(params?: RpcCongestionLevelRequest): Promise<RpcCongestionLevelResponse>;
8
+ experimentalGenesisConfig(params?: GenesisConfigRequest): Promise<GenesisConfig>;
9
+ experimentalLightClientBlockProof(params?: RpcLightClientBlockProofRequest): Promise<RpcLightClientBlockProofResponse>;
10
+ experimentalLightClientProof(params?: RpcLightClientExecutionProofRequest): Promise<RpcLightClientExecutionProofResponse>;
11
+ experimentalMaintenanceWindows(params?: RpcMaintenanceWindowsRequest): Promise<EXPERIMENTALMaintenanceWindowsResponse>;
12
+ experimentalProtocolConfig(params?: RpcProtocolConfigRequest): Promise<RpcProtocolConfigResponse>;
13
+ experimentalReceipt(params?: RpcReceiptRequest): Promise<RpcReceiptResponse>;
14
+ experimentalSplitStorageInfo(params?: RpcSplitStorageInfoRequest): Promise<RpcSplitStorageInfoResponse>;
15
+ experimentalTxStatus(params?: RpcTransactionStatusRequest): Promise<RpcTransactionResponse>;
16
+ experimentalValidatorsOrdered(params?: RpcValidatorsOrderedRequest): Promise<EXPERIMENTALValidatorsOrderedResponse>;
17
+ block(params?: RpcBlockRequest): Promise<RpcBlockResponse>;
18
+ broadcastTxAsync(params?: RpcSendTransactionRequest): Promise<CryptoHash>;
19
+ broadcastTxCommit(params?: RpcSendTransactionRequest): Promise<RpcTransactionResponse>;
20
+ changes(params?: RpcStateChangesInBlockByTypeRequest): Promise<RpcStateChangesInBlockResponse>;
21
+ chunk(params?: RpcChunkRequest): Promise<RpcChunkResponse>;
22
+ clientConfig(params?: RpcClientConfigRequest): Promise<RpcClientConfigResponse>;
23
+ gasPrice(params?: RpcGasPriceRequest): Promise<RpcGasPriceResponse>;
24
+ health(params?: RpcHealthRequest): Promise<RpcHealthResponse>;
25
+ lightClientProof(params?: RpcLightClientExecutionProofRequest): Promise<RpcLightClientExecutionProofResponse>;
26
+ networkInfo(params?: RpcNetworkInfoRequest): Promise<RpcNetworkInfoResponse>;
27
+ nextLightClientBlock(params?: RpcLightClientNextBlockRequest): Promise<RpcLightClientNextBlockResponse>;
28
+ query(params?: RpcQueryRequest): Promise<RpcQueryResponse>;
29
+ sendTx(params?: RpcSendTransactionRequest): Promise<RpcTransactionResponse>;
30
+ status(params?: RpcStatusRequest): Promise<RpcStatusResponse>;
31
+ tx(params?: RpcTransactionStatusRequest): Promise<RpcTransactionResponse>;
32
+ validators(params?: RpcValidatorRequest): Promise<RpcValidatorResponse>;
33
+ }
34
+ interface ConvenienceMethods {
35
+ viewAccount(params: {
36
+ accountId: string;
37
+ finality?: 'final' | 'near-final' | 'optimistic';
38
+ blockId?: string | number;
39
+ }): Promise<AccountView>;
40
+ viewFunction(params: {
41
+ accountId: string;
42
+ methodName: string;
43
+ argsBase64?: string;
44
+ finality?: 'final' | 'near-final' | 'optimistic';
45
+ blockId?: string | number;
46
+ }): Promise<CallResult>;
47
+ viewAccessKey(params: {
48
+ accountId: string;
49
+ publicKey: string;
50
+ finality?: 'final' | 'near-final' | 'optimistic';
51
+ blockId?: string | number;
52
+ }): Promise<AccessKeyView>;
53
+ }
54
+ interface CompleteClientInterface extends DynamicRpcMethods, ConvenienceMethods {
55
+ call<TParams = unknown, TResult = unknown>(method: string, params?: TParams): Promise<TResult>;
56
+ }
57
+
58
+ type RpcMethod = (typeof RPC_METHODS)[number];
3
59
  interface ClientConfig {
4
60
  endpoint: string;
5
61
  headers?: Record<string, string>;
@@ -33,6 +89,7 @@ declare class JsonRpcNetworkError extends Error {
33
89
  originalError: Error;
34
90
  constructor(message: string, originalError: Error);
35
91
  }
92
+
36
93
  declare class NearRpcClient {
37
94
  private endpoint;
38
95
  private headers;
@@ -47,172 +104,11 @@ declare class NearRpcClient {
47
104
  private generateRequestId;
48
105
  /**
49
106
  * Make a raw JSON-RPC call
107
+ * This method is public to allow dynamic calls to any RPC method
50
108
  */
51
- private call;
52
- /**
53
- * Get node status
54
- */
55
- status(): Promise<any>;
56
- /**
57
- * Get block information
58
- */
59
- block(params?: {
60
- blockId?: string | number;
61
- finality?: 'final' | 'near-final' | 'optimistic';
62
- }): Promise<any>;
63
- /**
64
- * Get current gas price
65
- */
66
- gasPrice(params?: {
67
- blockId?: string | number;
68
- }): Promise<any>;
69
- /**
70
- * Get chunk information
71
- */
72
- chunk(params: {
73
- chunkId: string;
74
- } | {
75
- blockId: string | number;
76
- shardId: number;
77
- }): Promise<any>;
78
- /**
79
- * Health check
80
- */
81
- health(): Promise<any>;
82
- /**
83
- * Get network information
84
- */
85
- networkInfo(): Promise<any>;
86
- /**
87
- * Get current validators
88
- */
89
- validators(params?: {
90
- blockId?: string | number;
91
- }): Promise<any>;
92
- /**
93
- * Get client configuration
94
- */
95
- clientConfig(): Promise<any>;
96
- /**
97
- * Broadcast transaction asynchronously
98
- */
99
- broadcastTxAsync(params: {
100
- signedTxBase64: string;
101
- }): Promise<any>;
102
- /**
103
- * Broadcast transaction and wait for commit
104
- */
105
- broadcastTxCommit(params: {
106
- signedTxBase64: string;
107
- }): Promise<any>;
108
- /**
109
- * Send transaction
110
- */
111
- sendTx(params: {
112
- signedTxBase64: string;
113
- }): Promise<any>;
114
- /**
115
- * Get transaction status
116
- */
117
- tx(params: {
118
- txHash: string;
119
- senderAccountId: string;
120
- }): Promise<any>;
121
- /**
122
- * Query account/contract state
123
- */
124
- query(params: {
125
- requestType: string;
126
- finality?: 'final' | 'near-final' | 'optimistic';
127
- blockId?: string | number;
128
- accountId?: string;
129
- methodName?: string;
130
- argsBase64?: string;
131
- publicKey?: string;
132
- keyType?: string;
133
- }): Promise<any>;
134
- /**
135
- * View account information (convenience method)
136
- */
137
- viewAccount(params: {
138
- accountId: string;
139
- finality?: 'final' | 'near-final' | 'optimistic';
140
- blockId?: string | number;
141
- }): Promise<any>;
142
- /**
143
- * View function call (convenience method)
144
- */
145
- viewFunction(params: {
146
- accountId: string;
147
- methodName: string;
148
- argsBase64?: string;
149
- finality?: 'final' | 'near-final' | 'optimistic';
150
- blockId?: string | number;
151
- }): Promise<any>;
152
- /**
153
- * View access key (convenience method)
154
- */
155
- viewAccessKey(params: {
156
- accountId: string;
157
- publicKey: string;
158
- finality?: 'final' | 'near-final' | 'optimistic';
159
- blockId?: string | number;
160
- }): Promise<any>;
161
- /**
162
- * Get light client proof
163
- */
164
- lightClientProof(params: {
165
- type: string;
166
- lightClientHead: string;
167
- transactionHash?: string;
168
- senderId?: string;
169
- receiptId?: string;
170
- }): Promise<any>;
171
- /**
172
- * Get state changes (experimental)
173
- */
174
- experimentalChanges(params: {
175
- changesType: string;
176
- accountIds?: string[];
177
- keyPrefixBase64?: string;
178
- blockId?: string | number;
179
- }): Promise<any>;
180
- /**
181
- * Get state changes in block (experimental)
182
- */
183
- experimentalChangesInBlock(params: {
184
- blockId: string | number;
185
- }): Promise<any>;
186
- /**
187
- * Get ordered validators (experimental)
188
- */
189
- experimentalValidatorsOrdered(params?: {
190
- blockId?: string | number;
191
- }): Promise<any>;
192
- /**
193
- * Get protocol configuration (experimental)
194
- */
195
- experimentalProtocolConfig(params?: {
196
- blockId?: string | number;
197
- finality?: 'final' | 'near-final' | 'optimistic';
198
- }): Promise<any>;
199
- /**
200
- * Get genesis configuration (experimental)
201
- */
202
- experimentalGenesisConfig(): Promise<any>;
203
- /**
204
- * Get receipt information (experimental)
205
- */
206
- experimentalReceipt(params: {
207
- receiptId: string;
208
- }): Promise<any>;
209
- /**
210
- * Get transaction status (experimental)
211
- */
212
- experimentalTxStatus(params: {
213
- txHash: string;
214
- senderAccountId: string;
215
- }): Promise<any>;
109
+ call<TParams = unknown, TResult = unknown>(method: RpcMethod, params?: TParams): Promise<TResult>;
110
+ }
111
+ interface NearRpcClient extends DynamicRpcMethods, ConvenienceMethods {
216
112
  }
217
113
 
218
114
  interface RpcRequest {
@@ -238,4 +134,4 @@ declare class NearRpcError extends Error {
238
134
  constructor(code: number, message: string, data?: unknown | undefined);
239
135
  }
240
136
 
241
- export { type ClientConfig, JsonRpcClientError, type JsonRpcError, JsonRpcNetworkError, type JsonRpcRequest, type JsonRpcResponse, NearRpcClient, NearRpcError, type RpcError, type RpcRequest, type RpcResponse, NearRpcClient as default };
137
+ export { type ClientConfig, type CompleteClientInterface, type ConvenienceMethods, type DynamicRpcMethods, JsonRpcClientError, type JsonRpcError, JsonRpcNetworkError, type JsonRpcRequest, type JsonRpcResponse, NearRpcClient, NearRpcError, type RpcError, type RpcRequest, type RpcResponse, NearRpcClient as default };
package/dist/index.js CHANGED
@@ -22,9 +22,11 @@ var index_exports = {};
22
22
  __export(index_exports, {
23
23
  JsonRpcClientError: () => JsonRpcClientError,
24
24
  JsonRpcNetworkError: () => JsonRpcNetworkError,
25
+ JsonRpcRequestSchema: () => import_jsonrpc_types2.JsonRpcRequestSchema,
26
+ JsonRpcResponseSchema: () => import_jsonrpc_types2.JsonRpcResponseSchema,
25
27
  NearRpcClient: () => NearRpcClient,
26
28
  NearRpcError: () => NearRpcError,
27
- RPC_METHODS: () => import_jsonrpc_types2.RPC_METHODS,
29
+ RPC_METHODS: () => import_jsonrpc_types3.RPC_METHODS,
28
30
  default: () => NearRpcClient
29
31
  });
30
32
  module.exports = __toCommonJS(index_exports);
@@ -115,6 +117,7 @@ var NearRpcClient = class {
115
117
  }
116
118
  /**
117
119
  * Make a raw JSON-RPC call
120
+ * This method is public to allow dynamic calls to any RPC method
118
121
  */
119
122
  async call(method, params) {
120
123
  const requestId = this.generateRequestId();
@@ -187,162 +190,38 @@ var NearRpcClient = class {
187
190
  lastError
188
191
  );
189
192
  }
190
- // Generated RPC methods will be added here
191
- // This section will be auto-generated based on the OpenAPI spec
192
- /**
193
- * Get node status
194
- */
195
- async status() {
196
- return this.call("status");
197
- }
198
- /**
199
- * Get block information
200
- */
201
- async block(params) {
202
- return this.call("block", params);
203
- }
204
- /**
205
- * Get current gas price
206
- */
207
- async gasPrice(params) {
208
- return this.call("gas_price", params);
209
- }
210
- /**
211
- * Get chunk information
212
- */
213
- async chunk(params) {
214
- return this.call("chunk", params);
215
- }
216
- /**
217
- * Health check
218
- */
219
- async health() {
220
- return this.call("health");
221
- }
222
- /**
223
- * Get network information
224
- */
225
- async networkInfo() {
226
- return this.call("network_info");
227
- }
228
- /**
229
- * Get current validators
230
- */
231
- async validators(params) {
232
- return this.call("validators", params);
233
- }
234
- /**
235
- * Get client configuration
236
- */
237
- async clientConfig() {
238
- return this.call("client_config");
239
- }
240
- /**
241
- * Broadcast transaction asynchronously
242
- */
243
- async broadcastTxAsync(params) {
244
- return this.call("broadcast_tx_async", params);
245
- }
246
- /**
247
- * Broadcast transaction and wait for commit
248
- */
249
- async broadcastTxCommit(params) {
250
- return this.call("broadcast_tx_commit", params);
251
- }
252
- /**
253
- * Send transaction
254
- */
255
- async sendTx(params) {
256
- return await this.call("send_tx", params);
257
- }
258
- /**
259
- * Get transaction status
260
- */
261
- async tx(params) {
262
- return this.call("tx", params);
263
- }
264
- /**
265
- * Query account/contract state
266
- */
267
- async query(params) {
268
- return this.call("query", params);
269
- }
270
- /**
271
- * View account information (convenience method)
272
- */
273
- async viewAccount(params) {
274
- return this.query({
275
- requestType: "view_account",
276
- ...params
277
- });
278
- }
279
- /**
280
- * View function call (convenience method)
281
- */
282
- async viewFunction(params) {
283
- return this.query({
284
- requestType: "call_function",
285
- ...params
286
- });
287
- }
288
- /**
289
- * View access key (convenience method)
290
- */
291
- async viewAccessKey(params) {
292
- return this.query({
293
- requestType: "view_access_key",
294
- ...params
295
- });
296
- }
297
- /**
298
- * Get light client proof
299
- */
300
- async lightClientProof(params) {
301
- return this.call("light_client_proof", params);
302
- }
303
- // Experimental methods
304
- /**
305
- * Get state changes (experimental)
306
- */
307
- async experimentalChanges(params) {
308
- return this.call("EXPERIMENTAL_changes", params);
309
- }
310
- /**
311
- * Get state changes in block (experimental)
312
- */
313
- async experimentalChangesInBlock(params) {
314
- return this.call("EXPERIMENTAL_changes_in_block", params);
315
- }
316
- /**
317
- * Get ordered validators (experimental)
318
- */
319
- async experimentalValidatorsOrdered(params) {
320
- return this.call("EXPERIMENTAL_validators_ordered", params);
321
- }
322
- /**
323
- * Get protocol configuration (experimental)
324
- */
325
- async experimentalProtocolConfig(params) {
326
- return this.call("EXPERIMENTAL_protocol_config", params);
327
- }
328
- /**
329
- * Get genesis configuration (experimental)
330
- */
331
- async experimentalGenesisConfig() {
332
- return this.call("EXPERIMENTAL_genesis_config");
333
- }
334
- /**
335
- * Get receipt information (experimental)
336
- */
337
- async experimentalReceipt(params) {
338
- return this.call("EXPERIMENTAL_receipt", params);
339
- }
340
- /**
341
- * Get transaction status (experimental)
342
- */
343
- async experimentalTxStatus(params) {
344
- return this.call("EXPERIMENTAL_tx_status", params);
193
+ };
194
+ import_jsonrpc_types.RPC_METHODS.forEach((method) => {
195
+ let methodName = method;
196
+ if (methodName.startsWith("EXPERIMENTAL_")) {
197
+ methodName = "experimental" + methodName.substring(13).replace(/_([a-z])/g, (_, letter) => letter.toUpperCase()).replace(/^([a-z])/, (_, letter) => letter.toUpperCase());
198
+ } else {
199
+ methodName = methodName.replace(
200
+ /_([a-z])/g,
201
+ (_, letter) => letter.toUpperCase()
202
+ );
345
203
  }
204
+ NearRpcClient.prototype[methodName] = function(params) {
205
+ return this.call(method, params);
206
+ };
207
+ });
208
+ NearRpcClient.prototype.viewAccount = function(params) {
209
+ return this.query({
210
+ requestType: "view_account",
211
+ ...params
212
+ });
213
+ };
214
+ NearRpcClient.prototype.viewFunction = function(params) {
215
+ return this.query({
216
+ requestType: "call_function",
217
+ ...params
218
+ });
219
+ };
220
+ NearRpcClient.prototype.viewAccessKey = function(params) {
221
+ return this.query({
222
+ requestType: "view_access_key",
223
+ ...params
224
+ });
346
225
  };
347
226
 
348
227
  // src/types.ts
@@ -357,10 +236,13 @@ var NearRpcError = class extends Error {
357
236
 
358
237
  // src/index.ts
359
238
  var import_jsonrpc_types2 = require("@psalomo/jsonrpc-types");
239
+ var import_jsonrpc_types3 = require("@psalomo/jsonrpc-types");
360
240
  // Annotate the CommonJS export names for ESM import in node:
361
241
  0 && (module.exports = {
362
242
  JsonRpcClientError,
363
243
  JsonRpcNetworkError,
244
+ JsonRpcRequestSchema,
245
+ JsonRpcResponseSchema,
364
246
  NearRpcClient,
365
247
  NearRpcError,
366
248
  RPC_METHODS
package/dist/index.mjs CHANGED
@@ -1,7 +1,8 @@
1
1
  // src/client.ts
2
2
  import {
3
3
  JsonRpcRequestSchema,
4
- JsonRpcResponseSchema
4
+ JsonRpcResponseSchema,
5
+ RPC_METHODS
5
6
  } from "@psalomo/jsonrpc-types";
6
7
  var JsonRpcClientError = class extends Error {
7
8
  constructor(message, code, data) {
@@ -87,6 +88,7 @@ var NearRpcClient = class {
87
88
  }
88
89
  /**
89
90
  * Make a raw JSON-RPC call
91
+ * This method is public to allow dynamic calls to any RPC method
90
92
  */
91
93
  async call(method, params) {
92
94
  const requestId = this.generateRequestId();
@@ -159,162 +161,38 @@ var NearRpcClient = class {
159
161
  lastError
160
162
  );
161
163
  }
162
- // Generated RPC methods will be added here
163
- // This section will be auto-generated based on the OpenAPI spec
164
- /**
165
- * Get node status
166
- */
167
- async status() {
168
- return this.call("status");
169
- }
170
- /**
171
- * Get block information
172
- */
173
- async block(params) {
174
- return this.call("block", params);
175
- }
176
- /**
177
- * Get current gas price
178
- */
179
- async gasPrice(params) {
180
- return this.call("gas_price", params);
181
- }
182
- /**
183
- * Get chunk information
184
- */
185
- async chunk(params) {
186
- return this.call("chunk", params);
187
- }
188
- /**
189
- * Health check
190
- */
191
- async health() {
192
- return this.call("health");
193
- }
194
- /**
195
- * Get network information
196
- */
197
- async networkInfo() {
198
- return this.call("network_info");
199
- }
200
- /**
201
- * Get current validators
202
- */
203
- async validators(params) {
204
- return this.call("validators", params);
205
- }
206
- /**
207
- * Get client configuration
208
- */
209
- async clientConfig() {
210
- return this.call("client_config");
211
- }
212
- /**
213
- * Broadcast transaction asynchronously
214
- */
215
- async broadcastTxAsync(params) {
216
- return this.call("broadcast_tx_async", params);
217
- }
218
- /**
219
- * Broadcast transaction and wait for commit
220
- */
221
- async broadcastTxCommit(params) {
222
- return this.call("broadcast_tx_commit", params);
223
- }
224
- /**
225
- * Send transaction
226
- */
227
- async sendTx(params) {
228
- return await this.call("send_tx", params);
229
- }
230
- /**
231
- * Get transaction status
232
- */
233
- async tx(params) {
234
- return this.call("tx", params);
235
- }
236
- /**
237
- * Query account/contract state
238
- */
239
- async query(params) {
240
- return this.call("query", params);
241
- }
242
- /**
243
- * View account information (convenience method)
244
- */
245
- async viewAccount(params) {
246
- return this.query({
247
- requestType: "view_account",
248
- ...params
249
- });
250
- }
251
- /**
252
- * View function call (convenience method)
253
- */
254
- async viewFunction(params) {
255
- return this.query({
256
- requestType: "call_function",
257
- ...params
258
- });
259
- }
260
- /**
261
- * View access key (convenience method)
262
- */
263
- async viewAccessKey(params) {
264
- return this.query({
265
- requestType: "view_access_key",
266
- ...params
267
- });
268
- }
269
- /**
270
- * Get light client proof
271
- */
272
- async lightClientProof(params) {
273
- return this.call("light_client_proof", params);
274
- }
275
- // Experimental methods
276
- /**
277
- * Get state changes (experimental)
278
- */
279
- async experimentalChanges(params) {
280
- return this.call("EXPERIMENTAL_changes", params);
281
- }
282
- /**
283
- * Get state changes in block (experimental)
284
- */
285
- async experimentalChangesInBlock(params) {
286
- return this.call("EXPERIMENTAL_changes_in_block", params);
287
- }
288
- /**
289
- * Get ordered validators (experimental)
290
- */
291
- async experimentalValidatorsOrdered(params) {
292
- return this.call("EXPERIMENTAL_validators_ordered", params);
293
- }
294
- /**
295
- * Get protocol configuration (experimental)
296
- */
297
- async experimentalProtocolConfig(params) {
298
- return this.call("EXPERIMENTAL_protocol_config", params);
299
- }
300
- /**
301
- * Get genesis configuration (experimental)
302
- */
303
- async experimentalGenesisConfig() {
304
- return this.call("EXPERIMENTAL_genesis_config");
305
- }
306
- /**
307
- * Get receipt information (experimental)
308
- */
309
- async experimentalReceipt(params) {
310
- return this.call("EXPERIMENTAL_receipt", params);
311
- }
312
- /**
313
- * Get transaction status (experimental)
314
- */
315
- async experimentalTxStatus(params) {
316
- return this.call("EXPERIMENTAL_tx_status", params);
164
+ };
165
+ RPC_METHODS.forEach((method) => {
166
+ let methodName = method;
167
+ if (methodName.startsWith("EXPERIMENTAL_")) {
168
+ methodName = "experimental" + methodName.substring(13).replace(/_([a-z])/g, (_, letter) => letter.toUpperCase()).replace(/^([a-z])/, (_, letter) => letter.toUpperCase());
169
+ } else {
170
+ methodName = methodName.replace(
171
+ /_([a-z])/g,
172
+ (_, letter) => letter.toUpperCase()
173
+ );
317
174
  }
175
+ NearRpcClient.prototype[methodName] = function(params) {
176
+ return this.call(method, params);
177
+ };
178
+ });
179
+ NearRpcClient.prototype.viewAccount = function(params) {
180
+ return this.query({
181
+ requestType: "view_account",
182
+ ...params
183
+ });
184
+ };
185
+ NearRpcClient.prototype.viewFunction = function(params) {
186
+ return this.query({
187
+ requestType: "call_function",
188
+ ...params
189
+ });
190
+ };
191
+ NearRpcClient.prototype.viewAccessKey = function(params) {
192
+ return this.query({
193
+ requestType: "view_access_key",
194
+ ...params
195
+ });
318
196
  };
319
197
 
320
198
  // src/types.ts
@@ -328,10 +206,16 @@ var NearRpcError = class extends Error {
328
206
  };
329
207
 
330
208
  // src/index.ts
209
+ import {
210
+ JsonRpcRequestSchema as JsonRpcRequestSchema2,
211
+ JsonRpcResponseSchema as JsonRpcResponseSchema2
212
+ } from "@psalomo/jsonrpc-types";
331
213
  import { RPC_METHODS as RPC_METHODS2 } from "@psalomo/jsonrpc-types";
332
214
  export {
333
215
  JsonRpcClientError,
334
216
  JsonRpcNetworkError,
217
+ JsonRpcRequestSchema2 as JsonRpcRequestSchema,
218
+ JsonRpcResponseSchema2 as JsonRpcResponseSchema,
335
219
  NearRpcClient,
336
220
  NearRpcError,
337
221
  RPC_METHODS2 as RPC_METHODS,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@psalomo/jsonrpc-client",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "TypeScript client for NEAR Protocol JSON-RPC API",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -16,6 +16,7 @@
16
16
  "dist"
17
17
  ],
18
18
  "scripts": {
19
+ "prebuild": "cd ../../tools/codegen && npx tsx generate-client-interface.ts",
19
20
  "build": "tsup",
20
21
  "dev": "tsup src/index.ts --format cjs,esm --dts --watch",
21
22
  "clean": "rm -rf dist",