@psalomo/jsonrpc-client 0.4.0 → 1.0.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
@@ -10,18 +10,18 @@ pnpm add @near-js/jsonrpc-client
10
10
 
11
11
  ## Usage
12
12
 
13
- Create a new client instance and call any of the available RPC methods:
13
+ Create a new client instance and use the available RPC functions:
14
14
 
15
15
  ```typescript
16
- import { NearRpcClient } from '@near-js/jsonrpc-client';
16
+ import { NearRpcClient, status } from '@near-js/jsonrpc-client';
17
17
 
18
18
  const client = new NearRpcClient({
19
- endpoint: 'https://rpc.mainnet.near.org'
19
+ endpoint: 'https://rpc.mainnet.near.org',
20
20
  });
21
21
 
22
22
  async function getNetworkStatus() {
23
- const status = await client.status();
24
- console.log('Network status:', status);
23
+ const result = await status(client);
24
+ console.log('Network status:', result);
25
25
  }
26
26
 
27
27
  getNetworkStatus();
@@ -32,15 +32,15 @@ getNetworkStatus();
32
32
  All method calls return a promise that resolves to a fully typed result object based on the JSON-RPC API specification.
33
33
 
34
34
  ```typescript
35
- import { NearRpcClient } from '@near-js/jsonrpc-client';
35
+ import { NearRpcClient, block } from '@near-js/jsonrpc-client';
36
36
 
37
37
  const client = new NearRpcClient({
38
- endpoint: 'https://rpc.mainnet.near.org'
38
+ endpoint: 'https://rpc.mainnet.near.org',
39
39
  });
40
40
 
41
41
  async function getLatestBlock() {
42
- const block = await client.block({ finality: 'final' });
43
- console.log('Latest block height:', block.header?.height);
42
+ const result = await block(client, { finality: 'final' });
43
+ console.log('Latest block height:', result.header?.height);
44
44
  }
45
45
 
46
46
  getLatestBlock();
@@ -54,7 +54,7 @@ The client includes convenience methods for common query operations:
54
54
  // View account information
55
55
  const account = await client.viewAccount({
56
56
  accountId: 'example.near',
57
- finality: 'final'
57
+ finality: 'final',
58
58
  });
59
59
  console.log('Account balance:', account.amount);
60
60
  console.log('Storage used:', account.storageUsage);
@@ -63,14 +63,14 @@ console.log('Storage used:', account.storageUsage);
63
63
  const result = await client.viewFunction({
64
64
  accountId: 'contract.near',
65
65
  methodName: 'get_balance',
66
- finality: 'final'
66
+ finality: 'final',
67
67
  });
68
68
 
69
69
  // View access keys
70
70
  const accessKey = await client.viewAccessKey({
71
71
  accountId: 'example.near',
72
72
  publicKey: 'ed25519:...',
73
- finality: 'final'
73
+ finality: 'final',
74
74
  });
75
75
  ```
76
76
 
@@ -0,0 +1,5 @@
1
+ export declare function camelToSnake(str: string): string;
2
+ export declare function snakeToCamel(str: string): string;
3
+ export declare function convertKeysToSnakeCase(obj: any): any;
4
+ export declare function convertKeysToCamelCase(obj: any): any;
5
+ //# sourceMappingURL=test-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-utils.d.ts","sourceRoot":"","sources":["../../src/__tests__/test-utils.ts"],"names":[],"mappings":"AAGA,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,CAepD;AAED,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,CAepD"}