@chainflip/rpc 2.1.0-beta.0 → 2.1.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/dist/{Client.d.ts → Client.d.cts} +1 -1
- package/dist/Client.d.mts +40 -0
- package/dist/{HttpClient.d.ts → HttpClient.d.cts} +2 -2
- package/dist/HttpClient.d.mts +9 -0
- package/dist/{WsClient.d.ts → WsClient.d.cts} +2 -2
- package/dist/WsClient.d.mts +26 -0
- package/dist/_virtual/{rolldown_runtime.cjs → _rolldown/runtime.cjs} +3 -3
- package/dist/_virtual/{rolldown_runtime.mjs → _rolldown/runtime.mjs} +3 -3
- package/dist/common.cjs +1 -0
- package/dist/{common.d.ts → common.d.cts} +1 -499
- package/dist/common.d.mts +30630 -0
- package/dist/constants.cjs +3 -2
- package/dist/constants.d.mts +11 -0
- package/dist/constants.mjs +1 -1
- package/dist/index.cjs +1 -0
- package/dist/{index.d.ts → index.d.cts} +6 -6
- package/dist/index.d.mts +7 -0
- package/dist/parsers.cjs +1 -4
- package/dist/{parsers.d.ts → parsers.d.cts} +0 -684
- package/dist/parsers.d.mts +36369 -0
- package/dist/parsers.mjs +0 -4
- package/dist/{types.d.ts → types.d.cts} +2 -2
- package/dist/types.d.mts +84 -0
- package/package.json +7 -7
- /package/dist/{constants.d.ts → constants.d.cts} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { JsonRpcRequest, JsonRpcResponse, RpcMethod, RpcRequest, RpcResult } from "./common.
|
|
1
|
+
import { JsonRpcRequest, JsonRpcResponse, RpcMethod, RpcRequest, RpcResult } from "./common.cjs";
|
|
2
2
|
import { DeferredPromise } from "@chainflip/utils/async";
|
|
3
3
|
|
|
4
4
|
//#region src/Client.d.ts
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { JsonRpcRequest, JsonRpcResponse, RpcMethod, RpcRequest, RpcResult } from "./common.mjs";
|
|
2
|
+
import { DeferredPromise } from "@chainflip/utils/async";
|
|
3
|
+
|
|
4
|
+
//#region src/Client.d.ts
|
|
5
|
+
type Response = {
|
|
6
|
+
success: true;
|
|
7
|
+
id: string;
|
|
8
|
+
result: JsonRpcResponse;
|
|
9
|
+
} | {
|
|
10
|
+
success: false;
|
|
11
|
+
id: string;
|
|
12
|
+
error: Error;
|
|
13
|
+
};
|
|
14
|
+
type RequestMap = Map<string, {
|
|
15
|
+
deferred: DeferredPromise<RpcResult<RpcMethod>>;
|
|
16
|
+
body: JsonRpcRequest<RpcMethod>;
|
|
17
|
+
method: RpcMethod;
|
|
18
|
+
}>;
|
|
19
|
+
type ClientOpts = {
|
|
20
|
+
archiveNodeUrl?: string;
|
|
21
|
+
};
|
|
22
|
+
declare abstract class Client {
|
|
23
|
+
protected readonly url: string;
|
|
24
|
+
private lastRequestId;
|
|
25
|
+
private timer;
|
|
26
|
+
private requestMap;
|
|
27
|
+
private readonly archiveNodeUrl?;
|
|
28
|
+
readonly eventTarget: EventTarget;
|
|
29
|
+
constructor(url: string, opts?: ClientOpts);
|
|
30
|
+
protected abstract send<const T extends RpcMethod>(data: JsonRpcRequest<T>[], clonedMap: RequestMap): Promise<void>;
|
|
31
|
+
private getRequestId;
|
|
32
|
+
private formatRequest;
|
|
33
|
+
protected handleResponse(response: Response, clonedMap: RequestMap): void;
|
|
34
|
+
protected handleErrorResponse(error: Error, clonedMap: RequestMap): void;
|
|
35
|
+
private handleBatch;
|
|
36
|
+
sendRequest<const T extends RpcMethod>(method: T, ...params: RpcRequest[T]): Promise<RpcResult<T>>;
|
|
37
|
+
methods(): RpcMethod[];
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
export { ClientOpts, RequestMap, Response, Client as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { JsonRpcRequest, RpcMethod } from "./common.
|
|
2
|
-
import Client, { RequestMap } from "./Client.
|
|
1
|
+
import { JsonRpcRequest, RpcMethod } from "./common.cjs";
|
|
2
|
+
import Client, { RequestMap } from "./Client.cjs";
|
|
3
3
|
|
|
4
4
|
//#region src/HttpClient.d.ts
|
|
5
5
|
declare class HttpClient extends Client {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { JsonRpcRequest, RpcMethod } from "./common.mjs";
|
|
2
|
+
import Client, { RequestMap } from "./Client.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/HttpClient.d.ts
|
|
5
|
+
declare class HttpClient extends Client {
|
|
6
|
+
protected send<const T extends RpcMethod>(request: JsonRpcRequest<T>[], requestMap: RequestMap): Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { HttpClient as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { JsonRpcRequest, RpcMethod } from "./common.
|
|
2
|
-
import Client, { ClientOpts, RequestMap } from "./Client.
|
|
1
|
+
import { JsonRpcRequest, RpcMethod } from "./common.cjs";
|
|
2
|
+
import Client, { ClientOpts, RequestMap } from "./Client.cjs";
|
|
3
3
|
|
|
4
4
|
//#region src/WsClient.d.ts
|
|
5
5
|
declare class WsClient extends Client {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { JsonRpcRequest, RpcMethod } from "./common.mjs";
|
|
2
|
+
import Client, { ClientOpts, RequestMap } from "./Client.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/WsClient.d.ts
|
|
5
|
+
declare class WsClient extends Client {
|
|
6
|
+
private ws?;
|
|
7
|
+
private reconnectAttempts;
|
|
8
|
+
private emitter;
|
|
9
|
+
private inFlightRequestMap;
|
|
10
|
+
private readonly timeout;
|
|
11
|
+
private shouldConnect;
|
|
12
|
+
constructor(url: string, {
|
|
13
|
+
timeout,
|
|
14
|
+
...opts
|
|
15
|
+
}?: {
|
|
16
|
+
timeout?: number;
|
|
17
|
+
} & ClientOpts);
|
|
18
|
+
close(): Promise<void>;
|
|
19
|
+
private connectionReady;
|
|
20
|
+
private handleDisconnect;
|
|
21
|
+
private handleMessage;
|
|
22
|
+
private connect;
|
|
23
|
+
protected send(requests: JsonRpcRequest<RpcMethod>[], requestMap: RequestMap): Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
export { WsClient as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
//#region
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __exportAll = (all,
|
|
3
|
+
var __exportAll = (all, no_symbols) => {
|
|
4
4
|
let target = {};
|
|
5
5
|
for (var name in all) {
|
|
6
6
|
__defProp(target, name, {
|
|
@@ -8,7 +8,7 @@ var __exportAll = (all, symbols) => {
|
|
|
8
8
|
enumerable: true
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
|
-
if (
|
|
11
|
+
if (!no_symbols) {
|
|
12
12
|
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
13
13
|
}
|
|
14
14
|
return target;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
//#region
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __exportAll = (all,
|
|
3
|
+
var __exportAll = (all, no_symbols) => {
|
|
4
4
|
let target = {};
|
|
5
5
|
for (var name in all) {
|
|
6
6
|
__defProp(target, name, {
|
|
@@ -8,7 +8,7 @@ var __exportAll = (all, symbols) => {
|
|
|
8
8
|
enumerable: true
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
|
-
if (
|
|
11
|
+
if (!no_symbols) {
|
|
12
12
|
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
13
13
|
}
|
|
14
14
|
return target;
|
package/dist/common.cjs
CHANGED