@bithomp/xrpl-api 3.7.14 → 3.7.15

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.
@@ -61,6 +61,7 @@ declare class Connection extends EventEmitter {
61
61
  private updateLatency;
62
62
  private reconnect;
63
63
  private removeClient;
64
+ private removeWatchTimer;
64
65
  private setupEmitter;
65
66
  private resetTypes;
66
67
  private updateSubscriptions;
package/lib/connection.js CHANGED
@@ -88,10 +88,7 @@ class Connection extends events_1.EventEmitter {
88
88
  url: this.url,
89
89
  shutdown: this.shutdown,
90
90
  });
91
- if (this.connectionWatchTimer !== null) {
92
- clearTimeout(this.connectionWatchTimer);
93
- this.connectionWatchTimer = null;
94
- }
91
+ this.removeWatchTimer();
95
92
  this.removeClient();
96
93
  this.client = new XRPLConnection.Connection(this.url, (0, common_1.removeUndefined)({ timeout: this.timeout, connectionTimeout: this.connectionTimeout }));
97
94
  this.setupEmitter();
@@ -107,8 +104,9 @@ class Connection extends events_1.EventEmitter {
107
104
  url: this.url,
108
105
  error: err?.message || err?.name || err,
109
106
  });
107
+ this.removeWatchTimer();
110
108
  this.removeClient();
111
- this.connectionWatchTimer = setTimeout(this.bindConnectionWatchTimeout, RECONNECT_TIMEOUT);
109
+ this.connectionWatchTimer = setTimeout(this.bindConnectionWatchTimeout, LEDGER_CLOSED_TIMEOUT);
112
110
  }
113
111
  }
114
112
  async disconnect() {
@@ -121,10 +119,7 @@ class Connection extends events_1.EventEmitter {
121
119
  if (this.isConnected()) {
122
120
  await this.unsubscribe();
123
121
  }
124
- if (this.connectionWatchTimer !== null) {
125
- clearTimeout(this.connectionWatchTimer);
126
- this.connectionWatchTimer = null;
127
- }
122
+ this.removeWatchTimer();
128
123
  this.removeClient();
129
124
  }
130
125
  async request(request, options) {
@@ -344,6 +339,12 @@ class Connection extends events_1.EventEmitter {
344
339
  catch (_err) {
345
340
  }
346
341
  }
342
+ removeWatchTimer() {
343
+ if (this.connectionWatchTimer !== null) {
344
+ clearTimeout(this.connectionWatchTimer);
345
+ this.connectionWatchTimer = null;
346
+ }
347
+ }
347
348
  setupEmitter() {
348
349
  if (!this.client) {
349
350
  return;
@@ -583,10 +584,7 @@ class Connection extends events_1.EventEmitter {
583
584
  url: this.url,
584
585
  shutdown: this.shutdown,
585
586
  });
586
- if (this.connectionWatchTimer !== null) {
587
- clearTimeout(this.connectionWatchTimer);
588
- this.connectionWatchTimer = null;
589
- }
587
+ this.removeWatchTimer();
590
588
  if (this.shutdown) {
591
589
  this.removeClient();
592
590
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bithomp/xrpl-api",
3
- "version": "3.7.14",
3
+ "version": "3.7.15",
4
4
  "description": "A Bithomp JavaScript/TypeScript library for interacting with the XRP Ledger",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",