@leofcoin/peernet 1.1.20 → 1.1.21

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 { g as getDefaultExportFromCjs, c as commonjsGlobal } from './peernet-b366d9d4.js';
1
+ import { g as getDefaultExportFromCjs, c as commonjsGlobal } from './peernet-83538246.js';
2
2
  import './value-157ab062.js';
3
3
 
4
4
  function commonjsRequire(path) {
@@ -1,4 +1,4 @@
1
- import { M as MultiWallet, e as encrypt, b as base58$1 } from './peernet-b366d9d4.js';
1
+ import { M as MultiWallet, e as encrypt, b as base58$1 } from './peernet-83538246.js';
2
2
  import './value-157ab062.js';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { F as FormatInterface } from './peernet-b366d9d4.js';
1
+ import { F as FormatInterface } from './peernet-83538246.js';
2
2
  import './value-157ab062.js';
3
3
 
4
4
  var proto$b = {
@@ -20180,7 +20180,7 @@ class Identity {
20180
20180
  globalThis.peernet.selectedAccount = new TextDecoder().decode(selected);
20181
20181
  }
20182
20182
  else {
20183
- const importee = await import(/* webpackChunkName: "generate-account" */ './index-3efb868f.js');
20183
+ const importee = await import(/* webpackChunkName: "generate-account" */ './index-712688fc.js');
20184
20184
  const { identity, accounts } = await importee.default(password, this.network);
20185
20185
  await globalThis.accountStore.put('public', JSON.stringify({ walletId: identity.walletId }));
20186
20186
  await globalThis.walletStore.put('version', String(1));
@@ -20351,7 +20351,7 @@ class Peernet {
20351
20351
  this.root = options.root;
20352
20352
  const { RequestMessage, ResponseMessage, PeerMessage, PeerMessageResponse, PeernetMessage, DHTMessage, DHTMessageResponse, DataMessage, DataMessageResponse, PsMessage, ChatMessage, PeernetFile
20353
20353
  // FolderMessageResponse
20354
- } = await import(/* webpackChunkName: "messages" */ './messages-86fd79b4.js');
20354
+ } = await import(/* webpackChunkName: "messages" */ './messages-3f370680.js');
20355
20355
  /**
20356
20356
  * proto Object containing protos
20357
20357
  * @type {Object}
@@ -20423,7 +20423,7 @@ class Peernet {
20423
20423
  if (this.#starting || this.#started)
20424
20424
  return;
20425
20425
  this.#starting = true;
20426
- const importee = await import('./client-ede3dfc2.js');
20426
+ const importee = await import('./client-de444350.js');
20427
20427
  /**
20428
20428
  * @access public
20429
20429
  * @type {PeernetClient}
@@ -20444,13 +20444,12 @@ class Peernet {
20444
20444
  this.requestProtos[name] = method;
20445
20445
  }
20446
20446
  async sendMessage(peer, id, data) {
20447
- if (peer.readyState === 'open') {
20447
+ if (peer.connected) {
20448
20448
  await peer.send(data, id);
20449
20449
  this.bw.up += data.length;
20450
20450
  }
20451
- else if (peer.readyState === 'closed') {
20451
+ else
20452
20452
  this.removePeer(peer);
20453
- }
20454
20453
  }
20455
20454
  async handleDHT(peer, id, proto) {
20456
20455
  let { hash, store } = proto.decoded;
@@ -1,2 +1,2 @@
1
- export { P as default } from './peernet-b366d9d4.js';
1
+ export { P as default } from './peernet-83538246.js';
2
2
  import './value-157ab062.js';
@@ -604,13 +604,12 @@ class Peernet {
604
604
  this.requestProtos[name] = method;
605
605
  }
606
606
  async sendMessage(peer, id, data) {
607
- if (peer.readyState === 'open') {
607
+ if (peer.connected) {
608
608
  await peer.send(data, id);
609
609
  this.bw.up += data.length;
610
610
  }
611
- else if (peer.readyState === 'closed') {
611
+ else
612
612
  this.removePeer(peer);
613
- }
614
613
  }
615
614
  async handleDHT(peer, id, proto) {
616
615
  let { hash, store } = proto.decoded;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/peernet",
3
- "version": "1.1.20",
3
+ "version": "1.1.21",
4
4
  "description": "",
5
5
  "main": "src/peernet.js",
6
6
  "exports": {
package/src/peernet.ts CHANGED
@@ -292,14 +292,10 @@ export default class Peernet {
292
292
  }
293
293
 
294
294
  async sendMessage(peer, id, data) {
295
-
296
- if (peer.readyState === 'open') {
295
+ if (peer.connected) {
297
296
  await peer.send(data, id)
298
297
  this.bw.up += data.length
299
- } else if (peer.readyState === 'closed') {
300
- this.removePeer(peer)
301
- }
302
-
298
+ } else this.removePeer(peer)
303
299
  }
304
300
 
305
301
  async handleDHT(peer, id, proto) {