@pioneer-platform/nodes 8.1.28 → 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.
Files changed (2) hide show
  1. package/lib/index.js +16 -17
  2. 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
- // for loop to combine .ws and .https by type
87
- var combinedNodes = [];
88
+ // build final output
89
+ var nodes = [];
88
90
  for (var i in unchaineds) {
89
91
  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
- });
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
- // build final output
100
- var finalOutput = {
101
- caip: caip,
102
- nodes: combinedNodes
103
- };
104
- return finalOutput.nodes;
103
+ return nodes;
105
104
  }
106
105
  catch (e) {
107
106
  console.error(tag, "e: ", e);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pioneer-platform/nodes",
3
- "version": "8.1.28",
3
+ "version": "8.1.29",
4
4
  "main": "./lib/index.js",
5
5
  "types": "./lib/index.d.ts",
6
6
  "scripts": {