@bithomp/xrpl-api 2.7.5 → 2.7.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.
package/lib/client.js CHANGED
@@ -118,9 +118,19 @@ function findConnection(type, url, strongFilter, hash, networkID) {
118
118
  }
119
119
  return true;
120
120
  });
121
- if (!strongFilter) {
121
+ if (strongFilter === undefined || strongFilter === false) {
122
122
  if (connections.length === 0) {
123
- connections = [...clientConnections];
123
+ connections = clientConnections.filter((con) => {
124
+ if (!con.isConnected()) {
125
+ return false;
126
+ }
127
+ if (typeof networkID === "number" && typeof con.getNetworkID() === "number") {
128
+ if (con.getNetworkID() !== networkID) {
129
+ return false;
130
+ }
131
+ }
132
+ return true;
133
+ });
124
134
  }
125
135
  }
126
136
  if (loadBalancing) {
@@ -32,7 +32,7 @@ declare class Connection extends EventEmitter {
32
32
  latency: LatencyInfo[];
33
33
  readonly logger?: any;
34
34
  readonly timeout?: number;
35
- readonly connectionTimeout?: number;
35
+ readonly connectionTimeout: number;
36
36
  readonly hash?: string;
37
37
  private networkID?;
38
38
  private serverInfoUpdating;
package/lib/connection.js CHANGED
@@ -33,7 +33,7 @@ class Connection extends events_1.EventEmitter {
33
33
  this.client = null;
34
34
  this.logger = options.logger;
35
35
  this.timeout = options.timeout;
36
- this.connectionTimeout = options.connectionTimeout;
36
+ this.connectionTimeout = options.connectionTimeout || RECONNECT_TIMEOUT;
37
37
  this.hash = crypto_1.default.createHash("sha256").update(url).digest("hex");
38
38
  if (typeof options.networkID === "number") {
39
39
  this.networkID = options.networkID;
@@ -45,6 +45,7 @@ async function getAccountOffers(account, options = {}) {
45
45
  account,
46
46
  ledger_index: options.ledgerIndex || "validated",
47
47
  limit: options.limit,
48
+ marker: options.marker,
48
49
  });
49
50
  if (!response) {
50
51
  return {
@@ -99,6 +100,9 @@ async function getAccountAllOffers(account, options = {}) {
99
100
  response.limit = accountOffers.length;
100
101
  break;
101
102
  }
103
+ if (response.offers.length === 0) {
104
+ break;
105
+ }
102
106
  if (response.marker) {
103
107
  options.marker = response.marker;
104
108
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bithomp/xrpl-api",
3
- "version": "2.7.5",
3
+ "version": "2.7.7",
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",
@@ -39,7 +39,7 @@
39
39
  "format": "prettier --write \"src/**/*.ts\" \"src/**/*.js\"",
40
40
  "lint": "tslint -p tsconfig.json",
41
41
  "prepare": "npm run build",
42
- "-prepublishOnly": "npm test && npm run lint",
42
+ "prepublishOnly": "npm test && npm run lint",
43
43
  "preversion": "npm run lint",
44
44
  "version": "npm run format && git add -A src",
45
45
  "postversion": "git push && git push --tags"