@asyncswap/jsonrpc 0.4.10 → 0.4.12

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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@asyncswap/jsonrpc",
3
3
  "description": "A minimal jsonrpc spec implementation.",
4
4
  "author": "Meek Msaki",
5
- "version": "0.4.10",
5
+ "version": "0.4.12",
6
6
  "license": "MIT",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.mjs",
@@ -13,6 +13,10 @@
13
13
  "rpc",
14
14
  "bun"
15
15
  ],
16
+ "files": [
17
+ "dist",
18
+ "src"
19
+ ],
16
20
  "homepage": "https://github.com/asyncswap/eth-libs/tree/main/packages/jsonrpc",
17
21
  "repository": {
18
22
  "type": "git",
package/CHANGELOG.md DELETED
@@ -1,88 +0,0 @@
1
- # @asyncswap/jsonrpc
2
-
3
- ## 0.4.10
4
-
5
- ### Patch Changes
6
-
7
- - 69a2d7e: patch types updates
8
-
9
- ## 0.4.9
10
-
11
- ### Patch Changes
12
-
13
- - dc792b1: (refactor): change to `withHeaders` option and update BaseClient source
14
-
15
- ## 0.4.8
16
-
17
- ### Patch Changes
18
-
19
- - e9fc1df: remove biome dep
20
-
21
- ## 0.4.7
22
-
23
- ### Patch Changes
24
-
25
- - 882f94f: new params typing
26
-
27
- ## 0.4.6
28
-
29
- ### Patch Changes
30
-
31
- - 07c284d: update handle type
32
-
33
- ## 0.4.5
34
-
35
- ### Patch Changes
36
-
37
- - 0d61f89: simplify method type and export error codes
38
-
39
- ## 0.4.4
40
-
41
- ### Patch Changes
42
-
43
- - f7d28d9: (fix): error code now generated in build
44
-
45
- ## 0.4.3
46
-
47
- ### Patch Changes
48
-
49
- - 40a79dc: add support for batcing and streamlined error methods
50
-
51
- ## 0.4.2
52
-
53
- ### Patch Changes
54
-
55
- - 9512db5: update documentation
56
-
57
- ## 0.4.0
58
-
59
- ### Minor Changes
60
-
61
- - 7e8300c: changes api for jsonrpc construction
62
-
63
- ### Patch Changes
64
-
65
- - 43de065: update docs
66
- - 7126afa: add `otherHeaders` to initializedClient calls
67
-
68
- ## 0.3.1
69
-
70
- ### Patch Changes
71
-
72
- - 1c3a46e: fix example
73
-
74
- ## 0.3.0
75
-
76
- ### Minor Changes
77
-
78
- - dc1718c: refactor of types dir to global types
79
- - 00ba692: - Converts error codes as enums
80
- - Uses generic types on rpc request and response methods, and results
81
- - 07dc4e5: improve docs example and updates to build config
82
-
83
- ### Patch Changes
84
-
85
- - e15733c: update scripts and make changeset in monorepo
86
- - e3ac747: patch
87
- - abddcdc: add source map to typescript build build
88
- - ded3e6b: update
package/example.ts DELETED
@@ -1,39 +0,0 @@
1
- import { JsonRpcServer } from "./src";
2
-
3
- const server = new JsonRpcServer();
4
-
5
- server.register("eth_add", async ([a, b]: [number, number]) => a + b);
6
- server.register("eth_ping", async () => "pong");
7
-
8
- Bun.serve({
9
- port: 4444,
10
- async fetch(req) {
11
- if (req.method !== "POST") {
12
- return new Response("JSON-RPC only", { status: 405 });
13
- }
14
- const payload = await req.json();
15
- const response = await server.handle(payload);
16
- if (!response) {
17
- return new Response(null, { status: 204 });
18
- }
19
- return Response.json(response);
20
- },
21
- });
22
-
23
- console.log("JSON-RPC running on http://localhost:4444");
24
-
25
- import { JsonRpcClient } from "./src";
26
-
27
- const url = "http://localhost:4444";
28
- const client = new JsonRpcClient(url);
29
- const result = await client.call(client.buildRequest("eth_ping", []));
30
- console.log(result); // pong
31
-
32
- const response = await server.handle({
33
- jsonrpc: "2.0",
34
- method: "eth_add",
35
- params: [2, 3],
36
- id: 1,
37
- });
38
-
39
- console.log(response); // { jsonrpc: '2.0', result: 5, id: 1 }
package/tsconfig.json DELETED
@@ -1,33 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- // Environment setup & latest features
4
- "lib": ["ESNext"],
5
- "target": "ESNext",
6
- "module": "Preserve",
7
- "moduleDetection": "force",
8
- "jsx": "react-jsx",
9
- "allowJs": true,
10
- // Bundler mode
11
- "sourceMap": true,
12
- "declaration": true,
13
- "declarationMap": true,
14
- "moduleResolution": "bundler",
15
- "outDir": "dist",
16
- "rootDir": "src",
17
- "allowImportingTsExtensions": false,
18
- "verbatimModuleSyntax": true,
19
- "noEmit": false,
20
- // Best practices
21
- "strict": true,
22
- "skipLibCheck": true,
23
- "noFallthroughCasesInSwitch": true,
24
- "noUncheckedIndexedAccess": true,
25
- "noImplicitOverride": true,
26
- // Some stricter flags (disabled by default)
27
- "noUnusedLocals": false,
28
- "noUnusedParameters": false,
29
- "noPropertyAccessFromIndexSignature": false
30
- },
31
- "include": ["src/**/*", "global.d.ts"],
32
- "exclude": ["example.ts"]
33
- }