@leofcoin/peernet 0.15.0 → 0.15.2

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.
@@ -8932,13 +8932,15 @@ class Peernet {
8932
8932
  this.network = options.network || 'leofcoin';
8933
8933
  this.stars = options.stars;
8934
8934
  const parts = this.network.split(':');
8935
-
8935
+ this.networkVersion = parts.length > 1 ? parts[1] : 'mainnet';
8936
+
8936
8937
  if (!options.storePrefix) options.storePrefix = 'lfc';
8937
8938
  if (!options.port) options.port = 2000;
8938
8939
  if (!options.root) {
8939
8940
  if (parts[1]) options.root = `.${parts[0]}/${parts[1]}`;
8940
8941
  else options.root = `.${this.network}`;
8941
8942
  }
8943
+
8942
8944
  globalThis.peernet = this;
8943
8945
  this.bw = {
8944
8946
  up: 0,
@@ -9147,7 +9149,7 @@ class Peernet {
9147
9149
  * @access public
9148
9150
  * @type {PeernetClient}
9149
9151
  */
9150
- this.client = new importee.default(this.id, this.network, this.stars);
9152
+ this.client = new importee.default(this.id, this.networkVersion, this.stars);
9151
9153
  if (globalThis.onbeforeunload) {
9152
9154
  globalThis.addEventListener('beforeunload', async () => this.client.close());
9153
9155
  } else {
@@ -8902,13 +8902,15 @@ class Peernet {
8902
8902
  this.network = options.network || 'leofcoin';
8903
8903
  this.stars = options.stars;
8904
8904
  const parts = this.network.split(':');
8905
-
8905
+ this.networkVersion = parts.length > 1 ? parts[1] : 'mainnet';
8906
+
8906
8907
  if (!options.storePrefix) options.storePrefix = 'lfc';
8907
8908
  if (!options.port) options.port = 2000;
8908
8909
  if (!options.root) {
8909
8910
  if (parts[1]) options.root = `.${parts[0]}/${parts[1]}`;
8910
8911
  else options.root = `.${this.network}`;
8911
8912
  }
8913
+
8912
8914
  globalThis.peernet = this;
8913
8915
  this.bw = {
8914
8916
  up: 0,
@@ -9117,7 +9119,7 @@ class Peernet {
9117
9119
  * @access public
9118
9120
  * @type {PeernetClient}
9119
9121
  */
9120
- this.client = new importee.default(this.id, this.network, this.stars);
9122
+ this.client = new importee.default(this.id, this.networkVersion, this.stars);
9121
9123
  if (globalThis.onbeforeunload) {
9122
9124
  globalThis.addEventListener('beforeunload', async () => this.client.close());
9123
9125
  } else {
@@ -464,13 +464,15 @@ class Peernet {
464
464
  this.network = options.network || 'leofcoin';
465
465
  this.stars = options.stars;
466
466
  const parts = this.network.split(':');
467
-
467
+ this.networkVersion = parts.length > 1 ? parts[1] : 'mainnet';
468
+
468
469
  if (!options.storePrefix) options.storePrefix = 'lfc';
469
470
  if (!options.port) options.port = 2000;
470
471
  if (!options.root) {
471
472
  if (parts[1]) options.root = `.${parts[0]}/${parts[1]}`;
472
473
  else options.root = `.${this.network}`;
473
474
  }
475
+
474
476
  globalThis.peernet = this;
475
477
  this.bw = {
476
478
  up: 0,
@@ -679,7 +681,7 @@ class Peernet {
679
681
  * @access public
680
682
  * @type {PeernetClient}
681
683
  */
682
- this.client = new importee.default(this.id, this.network, this.stars);
684
+ this.client = new importee.default(this.id, this.networkVersion, this.stars);
683
685
  if (globalThis.onbeforeunload) {
684
686
  globalThis.addEventListener('beforeunload', async () => this.client.close());
685
687
  } else {
@@ -438,13 +438,15 @@ class Peernet {
438
438
  this.network = options.network || 'leofcoin';
439
439
  this.stars = options.stars;
440
440
  const parts = this.network.split(':');
441
-
441
+ this.networkVersion = parts.length > 1 ? parts[1] : 'mainnet';
442
+
442
443
  if (!options.storePrefix) options.storePrefix = 'lfc';
443
444
  if (!options.port) options.port = 2000;
444
445
  if (!options.root) {
445
446
  if (parts[1]) options.root = `.${parts[0]}/${parts[1]}`;
446
447
  else options.root = `.${this.network}`;
447
448
  }
449
+
448
450
  globalThis.peernet = this;
449
451
  this.bw = {
450
452
  up: 0,
@@ -653,7 +655,7 @@ class Peernet {
653
655
  * @access public
654
656
  * @type {PeernetClient}
655
657
  */
656
- this.client = new importee.default(this.id, this.network, this.stars);
658
+ this.client = new importee.default(this.id, this.networkVersion, this.stars);
657
659
  if (globalThis.onbeforeunload) {
658
660
  globalThis.addEventListener('beforeunload', async () => this.client.close());
659
661
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/peernet",
3
- "version": "0.15.0",
3
+ "version": "0.15.2",
4
4
  "description": "",
5
5
  "source": "src/peernet.js",
6
6
  "main": "dist/commonjs/peernet.js",
package/src/peernet.js CHANGED
@@ -40,6 +40,7 @@ export default class Peernet {
40
40
  this.network = options.network || 'leofcoin'
41
41
  this.stars = options.stars
42
42
  const parts = this.network.split(':')
43
+ this.networkVersion = options.networkVersion ? options.networkVersion : parts.length > 1 ? parts[1] : 'mainnet'
43
44
 
44
45
  if (!options.storePrefix) options.storePrefix = 'lfc'
45
46
  if (!options.port) options.port = 2000
@@ -47,6 +48,7 @@ export default class Peernet {
47
48
  if (parts[1]) options.root = `.${parts[0]}/${parts[1]}`
48
49
  else options.root = `.${this.network}`
49
50
  }
51
+
50
52
  globalThis.peernet = this
51
53
  this.bw = {
52
54
  up: 0,
@@ -255,7 +257,7 @@ export default class Peernet {
255
257
  * @access public
256
258
  * @type {PeernetClient}
257
259
  */
258
- this.client = new importee.default(this.id, this.network, this.stars)
260
+ this.client = new importee.default(this.id, this.networkVersion, this.stars)
259
261
  if (globalThis.onbeforeunload) {
260
262
  globalThis.addEventListener('beforeunload', async () => this.client.close());
261
263
  } else {