@bithomp/xrpl-api 3.1.10 → 3.1.11
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/connection.d.ts +2 -1
- package/lib/connection.js +12 -6
- package/lib/ledger/vl.js +5 -1
- package/package.json +1 -1
package/lib/connection.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ declare class Connection extends EventEmitter {
|
|
|
29
29
|
private client?;
|
|
30
30
|
readonly url: string;
|
|
31
31
|
readonly type?: string;
|
|
32
|
-
|
|
32
|
+
types: string[];
|
|
33
33
|
latency: LatencyInfo[];
|
|
34
34
|
readonly logger?: any;
|
|
35
35
|
readonly timeout?: number;
|
|
@@ -59,6 +59,7 @@ declare class Connection extends EventEmitter {
|
|
|
59
59
|
private reconnect;
|
|
60
60
|
private removeClient;
|
|
61
61
|
private setupEmitter;
|
|
62
|
+
private updateTypes;
|
|
62
63
|
private updateSubscriptions;
|
|
63
64
|
private subscribe;
|
|
64
65
|
private unsubscribe;
|
package/lib/connection.js
CHANGED
|
@@ -18,6 +18,7 @@ exports.DEFAULT_API_VERSION = xrpl_1.RIPPLED_API_V1;
|
|
|
18
18
|
class Connection extends events_1.EventEmitter {
|
|
19
19
|
constructor(url, type, options = {}) {
|
|
20
20
|
super();
|
|
21
|
+
this.types = [];
|
|
21
22
|
this.latency = [];
|
|
22
23
|
this.onlineSince = null;
|
|
23
24
|
this.serverInfo = {};
|
|
@@ -26,12 +27,7 @@ class Connection extends events_1.EventEmitter {
|
|
|
26
27
|
this.shutdown = false;
|
|
27
28
|
this.url = url;
|
|
28
29
|
this.type = type;
|
|
29
|
-
|
|
30
|
-
this.types = this.type.split(",").map((v) => v.trim());
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
this.types = [];
|
|
34
|
-
}
|
|
30
|
+
this.updateTypes();
|
|
35
31
|
this.client = null;
|
|
36
32
|
this.logger = options.logger;
|
|
37
33
|
this.timeout = options.timeout;
|
|
@@ -200,6 +196,8 @@ class Connection extends events_1.EventEmitter {
|
|
|
200
196
|
try {
|
|
201
197
|
await this.removeClient();
|
|
202
198
|
await (0, utils_1.sleep)(RECONNECT_TIMEOUT);
|
|
199
|
+
this.updateTypes();
|
|
200
|
+
this.serverInfoUpdating = false;
|
|
203
201
|
await this.connect();
|
|
204
202
|
}
|
|
205
203
|
catch (e) {
|
|
@@ -291,6 +289,14 @@ class Connection extends events_1.EventEmitter {
|
|
|
291
289
|
this.emit("path_find", path);
|
|
292
290
|
});
|
|
293
291
|
}
|
|
292
|
+
updateTypes() {
|
|
293
|
+
if (typeof this.type === "string") {
|
|
294
|
+
this.types = this.type.split(",").map((v) => v.trim());
|
|
295
|
+
}
|
|
296
|
+
else {
|
|
297
|
+
this.types = [];
|
|
298
|
+
}
|
|
299
|
+
}
|
|
294
300
|
async updateSubscriptions(request) {
|
|
295
301
|
if (request.command === "subscribe") {
|
|
296
302
|
const addStreams = [];
|
package/lib/ledger/vl.js
CHANGED
|
@@ -26,7 +26,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports.createVL = createVL;
|
|
27
27
|
exports.createVLBlob = createVLBlob;
|
|
28
28
|
exports.getVLBlobValidatorsManifest = getVLBlobValidatorsManifest;
|
|
29
|
+
const ripple_address_codec_1 = require("ripple-address-codec");
|
|
29
30
|
const Client = __importStar(require("../client"));
|
|
31
|
+
const utils_1 = require("../parse/utils");
|
|
30
32
|
const vl_1 = require("../models/vl");
|
|
31
33
|
const manifest_1 = require("../models/manifest");
|
|
32
34
|
const ledger_1 = require("../models/ledger");
|
|
@@ -101,9 +103,11 @@ async function getVLBlobValidatorsManifest(validatorsPublicKeys) {
|
|
|
101
103
|
}));
|
|
102
104
|
const validators = validatorsManifests.map((info) => {
|
|
103
105
|
const validationPublicKey = info.requested;
|
|
106
|
+
const publicKeyBuffer = (0, ripple_address_codec_1.decodeNodePublic)(validationPublicKey);
|
|
107
|
+
const publicKey = (0, utils_1.bytesToHex)(publicKeyBuffer.buffer);
|
|
104
108
|
const manifest = info.manifest;
|
|
105
109
|
return {
|
|
106
|
-
validation_public_key:
|
|
110
|
+
validation_public_key: publicKey,
|
|
107
111
|
manifest,
|
|
108
112
|
};
|
|
109
113
|
});
|