@pioneer-platform/nodes 8.1.24 → 8.1.26
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/index.js +41 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
@@ -53,6 +53,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
53
53
|
Object.defineProperty(exports, "__esModule", { value: true });
|
54
54
|
var TAG = " | Pioneer Nodes | ";
|
55
55
|
var log = require('@pioneer-platform/loggerdog')();
|
56
|
+
var _a = require("@pioneer-platform/pioneer-caip"), shortListNameToCaip = _a.shortListNameToCaip, shortListSymbolToCaip = _a.shortListSymbolToCaip, evmCaips = _a.evmCaips;
|
56
57
|
var seeds_1 = require("./seeds");
|
57
58
|
module.exports = {
|
58
59
|
init: function (type, config, isTestnet) {
|
@@ -65,7 +66,46 @@ module.exports = {
|
|
65
66
|
return seeds_1.blockbooks;
|
66
67
|
},
|
67
68
|
getUnchaineds: function () {
|
68
|
-
return
|
69
|
+
return get_unchaineds();
|
70
|
+
}
|
71
|
+
};
|
72
|
+
var get_unchaineds = function () {
|
73
|
+
var tag = TAG + " | get_unchaineds | ";
|
74
|
+
try {
|
75
|
+
// unchaineds filter
|
76
|
+
var unchaineds = seeds_1.shapeshift.filter(function (node) { return node.type === "unchained"; });
|
77
|
+
console.log(tag, "unchaineds: ", unchaineds);
|
78
|
+
// get caip for blockchain
|
79
|
+
var caip = {};
|
80
|
+
for (var i in unchaineds) {
|
81
|
+
var node = unchaineds[i];
|
82
|
+
if (shortListNameToCaip[node.network]) {
|
83
|
+
caip[node.network] = shortListNameToCaip[node.network];
|
84
|
+
}
|
85
|
+
}
|
86
|
+
// for loop to combine .ws and .https by type
|
87
|
+
var combinedNodes = [];
|
88
|
+
for (var i in unchaineds) {
|
89
|
+
var node = unchaineds[i];
|
90
|
+
combinedNodes.push({
|
91
|
+
type: "unchained",
|
92
|
+
caip: caip[node.network],
|
93
|
+
service: node.value,
|
94
|
+
swagger: node.value + "/swagger",
|
95
|
+
blockchain: node.network,
|
96
|
+
websocket: node.value.replace("https://", "wss://").replace("/v2", "/v2/ws")
|
97
|
+
});
|
98
|
+
}
|
99
|
+
// build final output
|
100
|
+
var finalOutput = {
|
101
|
+
caip: caip,
|
102
|
+
nodes: combinedNodes
|
103
|
+
};
|
104
|
+
return finalOutput;
|
105
|
+
}
|
106
|
+
catch (e) {
|
107
|
+
console.error(tag, "e: ", e);
|
108
|
+
throw e;
|
69
109
|
}
|
70
110
|
};
|
71
111
|
var get_node = function (network, serviceId) {
|