@chainflip/rpc 1.8.5 → 1.8.7

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.
@@ -4,10 +4,9 @@ var _Clientcjs = require('./Client.cjs'); var _Clientcjs2 = _interopRequireDefau
4
4
 
5
5
 
6
6
  var _commoncjs = require('./common.cjs');
7
- var HttpClient = (_class = class extends _Clientcjs2.default {constructor(...args) { super(...args); _class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this); }
7
+ var HttpClient = (_class = class extends _Clientcjs2.default {constructor(...args) { super(...args); _class.prototype.__init.call(this);_class.prototype.__init2.call(this); }
8
8
  __init() {this.timer = null}
9
- __init2() {this.batchDuration = 100}
10
- __init3() {this.requestMap = /* @__PURE__ */ new Map()}
9
+ __init2() {this.requestMap = /* @__PURE__ */ new Map()}
11
10
  async send(request) {
12
11
  let res;
13
12
  try {
@@ -47,8 +46,12 @@ var HttpClient = (_class = class extends _Clientcjs2.default {constructor(...arg
47
46
  const deferred = _async.deferredPromise.call(void 0, );
48
47
  const body = this.formatRequest(method, params);
49
48
  this.requestMap.set(body.id, { deferred, body, method });
50
- if (this.timer) clearTimeout(this.timer);
51
- this.timer = setTimeout(() => this.sendBatch(), this.batchDuration);
49
+ if (!this.timer) {
50
+ this.timer = setTimeout(() => {
51
+ this.timer = null;
52
+ void this.sendBatch();
53
+ }, 0);
54
+ }
52
55
  return deferred.promise;
53
56
  }
54
57
  async sendBatch() {
@@ -6,7 +6,6 @@ import './parsers.cjs';
6
6
 
7
7
  declare class HttpClient extends Client {
8
8
  private timer;
9
- private batchDuration;
10
9
  private requestMap;
11
10
  protected send<const T extends RpcMethod>(request: JsonRpcRequest<T>[]): Promise<Response[]>;
12
11
  sendRequest<const T extends RpcMethod>(method: T, ...params: RpcRequest[T]): Promise<RpcResult<T>>;
@@ -6,7 +6,6 @@ import './parsers.js';
6
6
 
7
7
  declare class HttpClient extends Client {
8
8
  private timer;
9
- private batchDuration;
10
9
  private requestMap;
11
10
  protected send<const T extends RpcMethod>(request: JsonRpcRequest<T>[]): Promise<Response[]>;
12
11
  sendRequest<const T extends RpcMethod>(method: T, ...params: RpcRequest[T]): Promise<RpcResult<T>>;
@@ -6,7 +6,6 @@ import {
6
6
  } from "./common.mjs";
7
7
  var HttpClient = class extends Client {
8
8
  timer = null;
9
- batchDuration = 100;
10
9
  requestMap = /* @__PURE__ */ new Map();
11
10
  async send(request) {
12
11
  let res;
@@ -47,8 +46,12 @@ var HttpClient = class extends Client {
47
46
  const deferred = deferredPromise();
48
47
  const body = this.formatRequest(method, params);
49
48
  this.requestMap.set(body.id, { deferred, body, method });
50
- if (this.timer) clearTimeout(this.timer);
51
- this.timer = setTimeout(() => this.sendBatch(), this.batchDuration);
49
+ if (!this.timer) {
50
+ this.timer = setTimeout(() => {
51
+ this.timer = null;
52
+ void this.sendBatch();
53
+ }, 0);
54
+ }
52
55
  return deferred.promise;
53
56
  }
54
57
  async sendBatch() {
package/dist/common.cjs CHANGED
@@ -20,6 +20,7 @@
20
20
 
21
21
 
22
22
 
23
+
23
24
 
24
25
 
25
26
  var _parserscjs = require('./parsers.cjs');
@@ -47,7 +48,8 @@ var rpcResult = {
47
48
  cf_boost_pool_details: _parserscjs.cfBoostPoolDetails,
48
49
  cf_boost_pool_pending_fees: _parserscjs.cfBoostPoolPendingFees,
49
50
  state_getMetadata: _parserscjs.stateGetMetadata,
50
- state_getRuntimeVersion: _parserscjs.stateGetRuntimeVersion
51
+ state_getRuntimeVersion: _parserscjs.stateGetRuntimeVersion,
52
+ lp_total_balances: _parserscjs.lpTotalBalances
51
53
  };
52
54
 
53
55