@pioneer-platform/nodes 8.1.27 → 8.1.29
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 +16 -17
- package/package.json +1 -1
package/lib/index.js
CHANGED
@@ -77,31 +77,30 @@ var get_unchaineds = function () {
|
|
77
77
|
console.log(tag, "unchaineds: ", unchaineds);
|
78
78
|
// get caip for blockchain
|
79
79
|
var caip = {};
|
80
|
+
var uniqueCaips = new Set();
|
80
81
|
for (var i in unchaineds) {
|
81
82
|
var node = unchaineds[i];
|
82
|
-
if (shortListNameToCaip[node.network]) {
|
83
|
+
if (shortListNameToCaip[node.network] && !uniqueCaips.has(shortListNameToCaip[node.network])) {
|
83
84
|
caip[node.network] = shortListNameToCaip[node.network];
|
85
|
+
uniqueCaips.add(shortListNameToCaip[node.network]);
|
84
86
|
}
|
85
87
|
}
|
86
|
-
//
|
87
|
-
var
|
88
|
+
// build final output
|
89
|
+
var nodes = [];
|
88
90
|
for (var i in unchaineds) {
|
89
91
|
var node = unchaineds[i];
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
92
|
+
if (caip[node.network]) {
|
93
|
+
nodes.push({
|
94
|
+
type: "unchained",
|
95
|
+
caip: caip[node.network],
|
96
|
+
service: node.value.startsWith("https://") ? node.value : "https://" + node.value,
|
97
|
+
swagger: (node.value.startsWith("https://") ? node.value : "https://" + node.value) + "/swagger",
|
98
|
+
blockchain: node.network,
|
99
|
+
websocket: node.value.replace("https://", "wss://").replace("/v2", "/v2/ws")
|
100
|
+
});
|
101
|
+
}
|
98
102
|
}
|
99
|
-
|
100
|
-
var finalOutput = {
|
101
|
-
caip: caip,
|
102
|
-
nodes: combinedNodes
|
103
|
-
};
|
104
|
-
return finalOutput;
|
103
|
+
return nodes;
|
105
104
|
}
|
106
105
|
catch (e) {
|
107
106
|
console.error(tag, "e: ", e);
|