@olane/o-node 0.7.12-alpha.72 → 0.7.12-alpha.73

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":"o-node-connection.manager.d.ts","sourceRoot":"","sources":["../../../src/connection/o-node-connection.manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,MAAM,EAAE,UAAU,EAAU,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,4BAA4B,EAAE,MAAM,kDAAkD,CAAC;AAEhG,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAGzD,qBAAa,sBAAuB,SAAQ,kBAAkB;IAMhD,QAAQ,CAAC,MAAM,EAAE,4BAA4B;IALzD,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC;IAC1B,OAAO,CAAC,oBAAoB,CAAC,CAAS;IACtC,OAAO,CAAC,qBAAqB,CAAC,CAAS;IACvC,OAAO,CAAC,WAAW,CAAsC;gBAEpC,MAAM,EAAE,4BAA4B;IAOnD,qBAAqB,CACzB,cAAc,EAAE,QAAQ,EACxB,OAAO,EAAE,QAAQ,GAChB,OAAO,CAAC,UAAU,CAAC;IA6BtB;;;;OAIG;IACG,OAAO,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,eAAe,CAAC;IA8BlE;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO;IA4BpC;;;;OAIG;IACH,yBAAyB,CAAC,OAAO,EAAE,QAAQ,GAAG,UAAU,GAAG,IAAI;CAehE"}
1
+ {"version":3,"file":"o-node-connection.manager.d.ts","sourceRoot":"","sources":["../../../src/connection/o-node-connection.manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,MAAM,EAAE,UAAU,EAAU,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,4BAA4B,EAAE,MAAM,kDAAkD,CAAC;AAEhG,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAGzD,qBAAa,sBAAuB,SAAQ,kBAAkB;IAMhD,QAAQ,CAAC,MAAM,EAAE,4BAA4B;IALzD,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC;IAC1B,OAAO,CAAC,oBAAoB,CAAC,CAAS;IACtC,OAAO,CAAC,qBAAqB,CAAC,CAAS;IACvC,OAAO,CAAC,WAAW,CAAsC;gBAEpC,MAAM,EAAE,4BAA4B;IAOnD,qBAAqB,CACzB,cAAc,EAAE,QAAQ,EACxB,OAAO,EAAE,QAAQ,GAChB,OAAO,CAAC,UAAU,CAAC;IAoCtB;;;;OAIG;IACG,OAAO,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,eAAe,CAAC;IA8BlE;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO;IA4BpC;;;;OAIG;IACH,yBAAyB,CAAC,OAAO,EAAE,QAAQ,GAAG,UAAU,GAAG,IAAI;CAuBhE"}
@@ -23,7 +23,12 @@ export class oNodeConnectionManager extends oConnectionManager {
23
23
  this.logger.debug('Dialing new connection for address: ' + address.toString());
24
24
  p2pConnection = await this.p2pNode.dial(nextHopAddress.libp2pTransports.map((ma) => ma.toMultiaddr()));
25
25
  }
26
- this.connections.set(nextHopAddress.toString(), p2pConnection);
26
+ if (nextHopAddress.libp2pTransports.length) {
27
+ const peerIdString = nextHopAddress.libp2pTransports[0].toPeerId();
28
+ if (peerIdString) {
29
+ this.connections.set(peerIdString, p2pConnection);
30
+ }
31
+ }
27
32
  return p2pConnection;
28
33
  }
29
34
  /**
@@ -84,7 +89,14 @@ export class oNodeConnectionManager extends oConnectionManager {
84
89
  getCachedLibp2pConnection(address) {
85
90
  try {
86
91
  const nodeAddress = address;
87
- const connection = this.connections.get(nodeAddress.toString());
92
+ if (!nodeAddress.libp2pTransports.length) {
93
+ return null;
94
+ }
95
+ const peerIdString = nodeAddress.libp2pTransports[0].toPeerId();
96
+ if (!peerIdString) {
97
+ return null;
98
+ }
99
+ const connection = this.connections.get(peerIdString);
88
100
  if (connection?.status === 'open') {
89
101
  return connection;
90
102
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olane/o-node",
3
- "version": "0.7.12-alpha.72",
3
+ "version": "0.7.12-alpha.73",
4
4
  "type": "module",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",
@@ -54,12 +54,12 @@
54
54
  "typescript": "5.4.5"
55
55
  },
56
56
  "dependencies": {
57
- "@olane/o-config": "0.7.12-alpha.72",
58
- "@olane/o-core": "0.7.12-alpha.72",
59
- "@olane/o-protocol": "0.7.12-alpha.72",
60
- "@olane/o-tool": "0.7.12-alpha.72",
57
+ "@olane/o-config": "0.7.12-alpha.73",
58
+ "@olane/o-core": "0.7.12-alpha.73",
59
+ "@olane/o-protocol": "0.7.12-alpha.73",
60
+ "@olane/o-tool": "0.7.12-alpha.73",
61
61
  "debug": "^4.4.1",
62
62
  "dotenv": "^16.5.0"
63
63
  },
64
- "gitHead": "69b76ea2f2298b8487235c4e5eb882fc6372d8b9"
64
+ "gitHead": "1fc100e9f575b957c9d6c6480eb3a3db10999e94"
65
65
  }