@dignetwork/dig-sdk 0.0.1-alpha.102 → 0.0.1-alpha.104

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.
@@ -1 +1 @@
1
- {"version":3,"file":"FullNodePeer.d.ts","sourceRoot":"","sources":["../../src/blockchain/FullNodePeer.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAqBpD,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAC,UAAU,CAAkD;IAC3E,OAAO,CAAC,MAAM,CAAC,uBAAuB,CAA0B;IAChE,OAAO,CAAC,IAAI,CAAO;IACnB,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAA0B;IAMzD,OAAO;WAIa,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAK5C,OAAO,CAAC,MAAM,CAAC,eAAe;IAiB9B,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAM/B;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,kBAAkB;mBASZ,eAAe;mBA2Df,UAAU;IA2B/B,OAAO,CAAC,MAAM,CAAC,eAAe;mBAkDT,WAAW;IAuGzB,OAAO,IAAI,IAAI;WAIF,mBAAmB,CACrC,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,OAAO,CAAC;CAwBpB"}
1
+ {"version":3,"file":"FullNodePeer.d.ts","sourceRoot":"","sources":["../../src/blockchain/FullNodePeer.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAO,MAAM,8BAA8B,CAAC;AAoBzD,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAC,UAAU,CAAkD;IAC3E,OAAO,CAAC,MAAM,CAAC,uBAAuB,CAA0B;IAChE,OAAO,CAAC,IAAI,CAAO;IACnB,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAA0B;IAQzD,OAAO;WAIa,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAK5C,OAAO,CAAC,MAAM,CAAC,eAAe;IAiB9B,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAM/B;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,kBAAkB;mBASZ,eAAe;mBA6Df,UAAU;IA2B/B,OAAO,CAAC,MAAM,CAAC,eAAe;mBAyDT,WAAW;IAsGzB,OAAO,IAAI,IAAI;WAIF,mBAAmB,CACrC,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,OAAO,CAAC;CAwBpB"}
@@ -8,7 +8,6 @@ const path_1 = __importDefault(require("path"));
8
8
  const os_1 = __importDefault(require("os"));
9
9
  const fs_1 = __importDefault(require("fs"));
10
10
  const datalayer_driver_1 = require("@dignetwork/datalayer-driver");
11
- const chia_server_coin_1 = require("chia-server-coin");
12
11
  const promises_1 = require("dns/promises");
13
12
  const net_1 = __importDefault(require("net"));
14
13
  const lodash_1 = require("lodash");
@@ -158,7 +157,8 @@ class FullNodePeer {
158
157
  }
159
158
  catch (error) {
160
159
  // If the error is WebSocket-related or timeout, reset the peer
161
- if (error.message.includes("WebSocket") || error.message.includes("Operation timed out")) {
160
+ if (error.message.includes("WebSocket") ||
161
+ error.message.includes("Operation timed out")) {
162
162
  FullNodePeer.cachedPeer = null;
163
163
  // @ts-ignore
164
164
  FullNodePeer.memoizedFetchNewPeerIPs.cache.clear();
@@ -187,7 +187,7 @@ class FullNodePeer {
187
187
  if (!fs_1.default.existsSync(sslFolder)) {
188
188
  fs_1.default.mkdirSync(sslFolder, { recursive: true });
189
189
  }
190
- new chia_server_coin_1.Tls(certFile, keyFile);
190
+ const tls = new datalayer_driver_1.Tls(certFile, keyFile);
191
191
  const peerIPs = await FullNodePeer.getPeerIPs();
192
192
  const trustedNodeIp = Environment_1.Environment.TRUSTED_FULLNODE || null;
193
193
  const peers = await Promise.all(peerIPs.map(async (ip) => {
@@ -201,7 +201,7 @@ class FullNodePeer {
201
201
  }
202
202
  }
203
203
  try {
204
- const peer = await datalayer_driver_1.Peer.new(`${ip}:${port}`, false, certFile, keyFile);
204
+ const peer = await datalayer_driver_1.Peer.new(`${ip}:${port}`, false, tls);
205
205
  return FullNodePeer.createPeerProxy(peer);
206
206
  }
207
207
  catch (error) {
@@ -230,7 +230,9 @@ class FullNodePeer {
230
230
  // Prioritize LOCALHOST, TRUSTED_NODE_IP, and CHIA_NODES_HOST if they have the highest peak height
231
231
  let bestPeerIndex = validHeights.findIndex((height, index) => height === highestPeak &&
232
232
  !FullNodePeer.deprioritizedIps.has(peerIPs[index]) && // Exclude deprioritized IPs
233
- (peerIPs[index] === LOCALHOST || peerIPs[index] === trustedNodeIp || peerIPs[index] === CHIA_NODES_HOST));
233
+ (peerIPs[index] === LOCALHOST ||
234
+ peerIPs[index] === trustedNodeIp ||
235
+ peerIPs[index] === CHIA_NODES_HOST));
234
236
  // If LOCALHOST, TRUSTED_NODE_IP, or CHIA_NODES_HOST don't have the highest peak, select any peer with the highest peak
235
237
  if (bestPeerIndex === -1) {
236
238
  bestPeerIndex = validHeights.findIndex((height) => height === highestPeak);
@@ -11,4 +11,5 @@ export * from './spinnerUtils';
11
11
  export * from './ssl';
12
12
  export * from './validationUtils';
13
13
  export * from './Environment';
14
+ export * from './asyncPool';
14
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,OAAO,CAAC;AACtB,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,OAAO,CAAC;AACtB,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC"}
@@ -27,3 +27,4 @@ __exportStar(require("./spinnerUtils"), exports);
27
27
  __exportStar(require("./ssl"), exports);
28
28
  __exportStar(require("./validationUtils"), exports);
29
29
  __exportStar(require("./Environment"), exports);
30
+ __exportStar(require("./asyncPool"), exports);
package/dist/utils/ssl.js CHANGED
@@ -26,7 +26,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.getOrCreateSSLCerts = void 0;
27
27
  const fs = __importStar(require("fs"));
28
28
  const path = __importStar(require("path"));
29
- const chia_server_coin_1 = require("chia-server-coin");
29
+ const datalayer_driver_1 = require("@dignetwork/datalayer-driver");
30
30
  const config_1 = require("./config");
31
31
  const getOrCreateSSLCerts = () => {
32
32
  const sslDir = path.join(config_1.USER_DIR_PATH, "ssl");
@@ -38,7 +38,7 @@ const getOrCreateSSLCerts = () => {
38
38
  }
39
39
  // Check if the certificate and key exist, if not, generate them
40
40
  if (!fs.existsSync(certPath) || !fs.existsSync(keyPath)) {
41
- new chia_server_coin_1.Tls(certPath, keyPath);
41
+ new datalayer_driver_1.Tls(certPath, keyPath);
42
42
  console.log("Client certificate and key generated successfully.");
43
43
  }
44
44
  // Return the paths to the cert and key files
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dignetwork/dig-sdk",
3
- "version": "0.0.1-alpha.102",
3
+ "version": "0.0.1-alpha.104",
4
4
  "description": "",
5
5
  "type": "commonjs",
6
6
  "main": "./dist/index.js",
@@ -25,14 +25,13 @@
25
25
  "LICENSE"
26
26
  ],
27
27
  "dependencies": {
28
- "@dignetwork/datalayer-driver": "^0.1.25",
28
+ "@dignetwork/datalayer-driver": "^0.1.28",
29
29
  "archiver": "^7.0.1",
30
30
  "axios": "^1.7.7",
31
31
  "bip39": "^3.1.0",
32
32
  "chia-bls": "^1.0.2",
33
33
  "chia-config-loader": "^1.0.1",
34
34
  "chia-root-resolver": "^1.0.0",
35
- "chia-server-coin": "^0.0.5",
36
35
  "chia-wallet": "^1.0.18",
37
36
  "cli-progress": "^3.12.0",
38
37
  "colorette": "^2.0.20",