@chainflip/rpc 1.10.3 → 1.10.4
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.cjs +4 -4
- package/dist/Client.d.cts +2 -1
- package/dist/Client.d.ts +2 -1
- package/dist/Client.mjs +3 -3
- package/package.json +1 -1
package/dist/Client.cjs
CHANGED
|
@@ -3,9 +3,8 @@ var _async = require('@chainflip/utils/async');
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
var _commoncjs = require('./common.cjs');
|
|
6
|
-
var Client = (_class = class
|
|
7
|
-
constructor(url, opts = {}) {
|
|
8
|
-
super();_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);;
|
|
6
|
+
var Client = (_class = class {
|
|
7
|
+
constructor(url, opts = {}) {;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this);
|
|
9
8
|
this.url = url;
|
|
10
9
|
this.archiveNodeUrl = opts.archiveNodeUrl;
|
|
11
10
|
}
|
|
@@ -13,6 +12,7 @@ var Client = (_class = class extends EventTarget {
|
|
|
13
12
|
__init2() {this.timer = null}
|
|
14
13
|
__init3() {this.requestMap = /* @__PURE__ */ new Map()}
|
|
15
14
|
|
|
15
|
+
__init4() {this.eventTarget = new EventTarget()}
|
|
16
16
|
getRequestId() {
|
|
17
17
|
try {
|
|
18
18
|
return crypto.randomUUID();
|
|
@@ -72,7 +72,7 @@ var Client = (_class = class extends EventTarget {
|
|
|
72
72
|
return deferred.promise.catch((error) => {
|
|
73
73
|
if (error instanceof Error) {
|
|
74
74
|
if (this.archiveNodeUrl && error.message.includes("Unknown block: State already discarded")) {
|
|
75
|
-
this.dispatchEvent(
|
|
75
|
+
this.eventTarget.dispatchEvent(
|
|
76
76
|
new CustomEvent("archiveNodeFallback", { detail: { method, params } })
|
|
77
77
|
);
|
|
78
78
|
return new this.constructor(
|
package/dist/Client.d.cts
CHANGED
|
@@ -21,12 +21,13 @@ type RequestMap = Map<string, {
|
|
|
21
21
|
type ClientOpts = {
|
|
22
22
|
archiveNodeUrl?: string;
|
|
23
23
|
};
|
|
24
|
-
declare abstract class Client
|
|
24
|
+
declare abstract class Client {
|
|
25
25
|
protected readonly url: string;
|
|
26
26
|
private lastRequestId;
|
|
27
27
|
private timer;
|
|
28
28
|
private requestMap;
|
|
29
29
|
private readonly archiveNodeUrl?;
|
|
30
|
+
readonly eventTarget: EventTarget;
|
|
30
31
|
constructor(url: string, opts?: ClientOpts);
|
|
31
32
|
protected abstract send<const T extends RpcMethod>(data: JsonRpcRequest<T>[], clonedMap: RequestMap): Promise<void>;
|
|
32
33
|
private getRequestId;
|
package/dist/Client.d.ts
CHANGED
|
@@ -21,12 +21,13 @@ type RequestMap = Map<string, {
|
|
|
21
21
|
type ClientOpts = {
|
|
22
22
|
archiveNodeUrl?: string;
|
|
23
23
|
};
|
|
24
|
-
declare abstract class Client
|
|
24
|
+
declare abstract class Client {
|
|
25
25
|
protected readonly url: string;
|
|
26
26
|
private lastRequestId;
|
|
27
27
|
private timer;
|
|
28
28
|
private requestMap;
|
|
29
29
|
private readonly archiveNodeUrl?;
|
|
30
|
+
readonly eventTarget: EventTarget;
|
|
30
31
|
constructor(url: string, opts?: ClientOpts);
|
|
31
32
|
protected abstract send<const T extends RpcMethod>(data: JsonRpcRequest<T>[], clonedMap: RequestMap): Promise<void>;
|
|
32
33
|
private getRequestId;
|
package/dist/Client.mjs
CHANGED
|
@@ -3,9 +3,8 @@ import { deferredPromise } from "@chainflip/utils/async";
|
|
|
3
3
|
import {
|
|
4
4
|
rpcResult
|
|
5
5
|
} from "./common.mjs";
|
|
6
|
-
var Client = class
|
|
6
|
+
var Client = class {
|
|
7
7
|
constructor(url, opts = {}) {
|
|
8
|
-
super();
|
|
9
8
|
this.url = url;
|
|
10
9
|
this.archiveNodeUrl = opts.archiveNodeUrl;
|
|
11
10
|
}
|
|
@@ -13,6 +12,7 @@ var Client = class extends EventTarget {
|
|
|
13
12
|
timer = null;
|
|
14
13
|
requestMap = /* @__PURE__ */ new Map();
|
|
15
14
|
archiveNodeUrl;
|
|
15
|
+
eventTarget = new EventTarget();
|
|
16
16
|
getRequestId() {
|
|
17
17
|
try {
|
|
18
18
|
return crypto.randomUUID();
|
|
@@ -72,7 +72,7 @@ var Client = class extends EventTarget {
|
|
|
72
72
|
return deferred.promise.catch((error) => {
|
|
73
73
|
if (error instanceof Error) {
|
|
74
74
|
if (this.archiveNodeUrl && error.message.includes("Unknown block: State already discarded")) {
|
|
75
|
-
this.dispatchEvent(
|
|
75
|
+
this.eventTarget.dispatchEvent(
|
|
76
76
|
new CustomEvent("archiveNodeFallback", { detail: { method, params } })
|
|
77
77
|
);
|
|
78
78
|
return new this.constructor(
|