@asyncswap/jsonrpc 0.4.7 → 0.4.8
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/CHANGELOG.md +6 -0
- package/README.md +3 -3
- package/example.ts +3 -3
- package/package.json +1 -2
- package/tsconfig.json +3 -10
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -53,7 +53,7 @@ await client.notify('log', ['Hello world']);
|
|
|
53
53
|
|
|
54
54
|
#### Methods
|
|
55
55
|
|
|
56
|
-
- `register<Result>(method:
|
|
56
|
+
- `register<Method, Params, Result>(method: Method, handler: Handler<Params, Result>)` - Register a method handler
|
|
57
57
|
- `handle(request: any)` - Process a JSON-RPC request
|
|
58
58
|
|
|
59
59
|
***Types***:
|
|
@@ -85,8 +85,8 @@ enum JsonRpcErrorCodes {
|
|
|
85
85
|
|
|
86
86
|
#### Methods
|
|
87
87
|
|
|
88
|
-
- `call
|
|
89
|
-
- `notify(method, params?)` - Send a JSON-RPC notification
|
|
88
|
+
- `call(request, headers?)` - Make a JSON-RPC call
|
|
89
|
+
- `notify(method: Method, params?)` - Send a JSON-RPC notification
|
|
90
90
|
- `buildRequest(method, params?)` - Build a JSON-RPC request object
|
|
91
91
|
|
|
92
92
|
## Examples
|
package/example.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { JsonRpcServer } from "./src";
|
|
|
2
2
|
|
|
3
3
|
const server = new JsonRpcServer();
|
|
4
4
|
|
|
5
|
-
server.register("
|
|
6
|
-
server.register("
|
|
5
|
+
server.register("eth_add", async ([a, b]: [number, number]) => a + b);
|
|
6
|
+
server.register("eth_ping", async () => "pong");
|
|
7
7
|
|
|
8
8
|
Bun.serve({
|
|
9
9
|
port: 4444,
|
|
@@ -26,5 +26,5 @@ import { JsonRpcClient } from "./src";
|
|
|
26
26
|
|
|
27
27
|
const url = "http://localhost:4444";
|
|
28
28
|
const client = new JsonRpcClient(url);
|
|
29
|
-
const result = await client.call(client.buildRequest("
|
|
29
|
+
const result = await client.call(client.buildRequest("eth_ping", []));
|
|
30
30
|
console.log(result);
|
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.
|
|
5
|
+
"version": "0.4.8",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"module": "dist/index.mjs",
|
|
@@ -32,7 +32,6 @@
|
|
|
32
32
|
"format": "bun biome format --write"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@biomejs/biome": "2.3.11",
|
|
36
35
|
"@types/bun": "latest"
|
|
37
36
|
},
|
|
38
37
|
"peerDependencies": {
|
package/tsconfig.json
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
// Environment setup & latest features
|
|
4
|
-
"lib": [
|
|
5
|
-
"ESNext"
|
|
6
|
-
],
|
|
4
|
+
"lib": ["ESNext"],
|
|
7
5
|
"target": "ESNext",
|
|
8
6
|
"module": "Preserve",
|
|
9
7
|
"moduleDetection": "force",
|
|
@@ -30,11 +28,6 @@
|
|
|
30
28
|
"noUnusedParameters": false,
|
|
31
29
|
"noPropertyAccessFromIndexSignature": false
|
|
32
30
|
},
|
|
33
|
-
"include": [
|
|
34
|
-
|
|
35
|
-
"global.d.ts"
|
|
36
|
-
],
|
|
37
|
-
"exclude": [
|
|
38
|
-
"example.ts"
|
|
39
|
-
]
|
|
31
|
+
"include": ["src/**/*", "global.d.ts"],
|
|
32
|
+
"exclude": ["example.ts"]
|
|
40
33
|
}
|