@leofcoin/chain 1.7.80 → 1.7.81

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,4 +1,4 @@
1
- import { L as LittlePubSub } from './node-browser-CMsWOKW1.js';
1
+ import { L as LittlePubSub } from './node-browser-BKkQNXGr.js';
2
2
  import './identity-Cn0iQbY3-CeW0giQS.js';
3
3
  import './index-DUfUgiQY.js';
4
4
 
@@ -526,6 +526,22 @@ class Client {
526
526
  }
527
527
  debug(`peer ${id} left`);
528
528
  };
529
+ connect(peerId, star, initiator = true) {
530
+ if (this.#connections[peerId]) {
531
+ debug(`peer ${peerId} already connected`);
532
+ return;
533
+ }
534
+ if (this.#stars[star]?.connectionState() !== 'open') {
535
+ console.warn(`Star ${star} is not connected, cannot reconnect to peer ${peerId}`);
536
+ return;
537
+ }
538
+ this.#createRTCPeerConnection(peerId, star, this.version, initiator);
539
+ }
540
+ reconnect(peerId, star, initiator = true) {
541
+ delete this.#connections[peerId];
542
+ debug(`reconnecting to peer ${peerId}`);
543
+ return this.connect(peerId, star, initiator);
544
+ }
529
545
  #createRTCPeerConnection = (peerId, star, version, initiator = false) => {
530
546
  const peer = new Peer({
531
547
  initiator: initiator,
@@ -1,4 +1,4 @@
1
- import { F as FormatInterface } from './node-browser-CMsWOKW1.js';
1
+ import { F as FormatInterface } from './node-browser-BKkQNXGr.js';
2
2
  import './identity-Cn0iQbY3-CeW0giQS.js';
3
3
  import './index-DUfUgiQY.js';
4
4
 
@@ -8495,7 +8495,7 @@ class Peernet {
8495
8495
  this.root = options.root;
8496
8496
  const { RequestMessage, ResponseMessage, PeerMessage, PeerMessageResponse, PeernetMessage, DHTMessage, DHTMessageResponse, DataMessage, DataMessageResponse, PsMessage, ChatMessage, PeernetFile
8497
8497
  // FolderMessageResponse
8498
- } = await import(/* webpackChunkName: "messages" */ './messages-D9OyBKBu-D43yTTSZ.js');
8498
+ } = await import(/* webpackChunkName: "messages" */ './messages-CWqbyda0-C1443uum.js');
8499
8499
  /**
8500
8500
  * proto Object containing protos
8501
8501
  * @type {Object}
@@ -8589,7 +8589,7 @@ class Peernet {
8589
8589
  if (this.#starting || this.#started)
8590
8590
  return;
8591
8591
  this.#starting = true;
8592
- const importee = await import('./client-D7CuvpPv-YmUgOecm.js');
8592
+ const importee = await import('./client-D9SOK3zV-QaAScGtB.js');
8593
8593
  /**
8594
8594
  * @access public
8595
8595
  * @type {PeernetClient}
@@ -1,3 +1,3 @@
1
- export { N as default } from './node-browser-CMsWOKW1.js';
1
+ export { N as default } from './node-browser-BKkQNXGr.js';
2
2
  import './identity-Cn0iQbY3-CeW0giQS.js';
3
3
  import './index-DUfUgiQY.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/chain",
3
- "version": "1.7.80",
3
+ "version": "1.7.81",
4
4
  "description": "Official javascript implementation",
5
5
  "private": false,
6
6
  "exports": {
@@ -69,7 +69,7 @@
69
69
  "@leofcoin/messages": "^1.4.40",
70
70
  "@leofcoin/multi-wallet": "^3.1.8",
71
71
  "@leofcoin/networks": "^1.1.25",
72
- "@leofcoin/peernet": "^1.1.88",
72
+ "@leofcoin/peernet": "^1.1.90",
73
73
  "@leofcoin/storage": "^3.5.38",
74
74
  "@leofcoin/utils": "^1.1.39",
75
75
  "@leofcoin/workers": "^1.5.23",