@leofcoin/chain 1.7.67 → 1.7.69

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,11 +1,11 @@
1
- import { F as FormatInterface$3, C as ContractMessage, T as TransactionMessage, B as BlockMessage, a as BWMessage, b as BWRequestMessage, V as ValidatorMessage } from './index-CM4QYC3g.js';
1
+ import { F as FormatInterface$2, C as ContractMessage, T as TransactionMessage, B as BlockMessage, a as BWMessage, b as BWRequestMessage, V as ValidatorMessage } from './index-DUfUgiQY.js';
2
2
 
3
3
  var proto = {
4
4
  lastblock: Object(),
5
5
  values: Object()
6
6
  };
7
7
 
8
- class StateMessage extends FormatInterface$3 {
8
+ class StateMessage extends FormatInterface$2 {
9
9
  get messageName() {
10
10
  return 'StateMessage';
11
11
  }
@@ -267,12 +267,11 @@ var base58$1 = {
267
267
  };
268
268
 
269
269
  const MSB$3 = 0x80;
270
- const REST$3 = 0x7F;
271
- const MSBALL$1 = ~REST$3;
270
+ const MSBALL$1 = -128;
272
271
  const INT$1 = Math.pow(2, 31);
273
- const encode$3$1 = (num, out, offset) => {
272
+ const encode$3 = (num, out, offset) => {
274
273
  if (Number.MAX_SAFE_INTEGER && num > Number.MAX_SAFE_INTEGER) {
275
- encode$3$1.bytes = 0;
274
+ encode$3.bytes = 0;
276
275
  throw new RangeError('Could not encode varint');
277
276
  }
278
277
  out = out || [];
@@ -287,7 +286,7 @@ const encode$3$1 = (num, out, offset) => {
287
286
  num >>>= 7;
288
287
  }
289
288
  out[offset] = num | 0;
290
- encode$3$1.bytes = offset - oldOffset + 1;
289
+ encode$3.bytes = offset - oldOffset + 1;
291
290
  return out;
292
291
  };
293
292
 
@@ -336,12 +335,12 @@ var encodingLength$1 = (value) => (value < N1$1 ? 1
336
335
  : 10);
337
336
 
338
337
  var index$4 = {
339
- encode: encode$3$1,
338
+ encode: encode$3,
340
339
  decode: decode$4,
341
340
  encodingLength: encodingLength$1
342
341
  };
343
342
 
344
- var index$3$1 = (input, prefix) => {
343
+ var index$3 = (input, prefix) => {
345
344
  const encodedArray = [];
346
345
  const length = input.reduce((total, current) => {
347
346
  const encoded = index$4.encode(current.length);
@@ -362,7 +361,7 @@ var index$3$1 = (input, prefix) => {
362
361
  return typedArray;
363
362
  };
364
363
 
365
- var index$2$1 = (typedArray, prefix) => {
364
+ var index$2 = (typedArray, prefix) => {
366
365
  const set = [];
367
366
  const varintAndSub = (typedArray) => {
368
367
  const length = index$4.decode(typedArray);
@@ -498,7 +497,7 @@ const concatAndDoubleHash = async (input) => {
498
497
  return new Uint8Array(await createDoubleHash(typedArrayConcat(input), 'SHA-256'));
499
498
  };
500
499
 
501
- const encode$2$1 = async (source, prefix = new TextEncoder().encode('00'), hex) => {
500
+ const encode$2 = async (source, prefix = new TextEncoder().encode('00'), hex) => {
502
501
  if (!(source instanceof Uint8Array) || !(prefix instanceof Uint8Array)) {
503
502
  throw new TypeError('Expected Uint8Array');
504
503
  }
@@ -515,7 +514,7 @@ const encode$2$1 = async (source, prefix = new TextEncoder().encode('00'), hex)
515
514
  return base58$1.encodeHex(uint8Array);
516
515
  return base58$1.encode(uint8Array);
517
516
  };
518
- const decode$3$1 = async (string, hex) => {
517
+ const decode$3 = async (string, hex) => {
519
518
  let uint8Array = hex ? base58$1.decodeHex(string) : base58$1.decode(string);
520
519
  const prefix = uint8Array.subarray(0, 2);
521
520
  const source = uint8Array.subarray(2, -4);
@@ -535,21 +534,21 @@ const decode$3$1 = async (string, hex) => {
535
534
  };
536
535
  const isBase58check = (string, hex) => {
537
536
  try {
538
- hex ? decode$3$1(string, true) : decode$3$1(string);
537
+ hex ? decode$3(string, true) : decode$3(string);
539
538
  return true;
540
539
  }
541
540
  catch (e) {
542
541
  return false;
543
542
  }
544
543
  };
545
- const encodeHex = (uint8Array, prefix = new TextEncoder().encode('00')) => encode$2$1(uint8Array, prefix, true);
546
- const decodeHex = (string) => decode$3$1(string, true);
544
+ const encodeHex = (uint8Array, prefix = new TextEncoder().encode('00')) => encode$2(uint8Array, prefix, true);
545
+ const decodeHex = (string) => decode$3(string, true);
547
546
  const isBase58checkHex = (string) => isBase58check(string, true);
548
- var base58check = { encode: encode$2$1, decode: decode$3$1, encodeHex, decodeHex, isBase58check, isBase58checkHex };
547
+ var base58check = { encode: encode$2, decode: decode$3, encodeHex, decodeHex, isBase58check, isBase58checkHex };
549
548
 
550
- const decode$2$1 = (multiWif, expectedVersion, expectedCodec) => {
549
+ const decode$2 = (multiWif, expectedVersion, expectedCodec) => {
551
550
  const decoded = base58$1.decode(multiWif);
552
- let [version, codec, privateKey] = index$2$1(decoded);
551
+ let [version, codec, privateKey] = index$2(decoded);
553
552
  version = Number(new TextDecoder().decode(version));
554
553
  codec = Number(new TextDecoder().decode(codec));
555
554
  if (expectedVersion && version !== expectedVersion)
@@ -560,16 +559,16 @@ const decode$2$1 = (multiWif, expectedVersion, expectedCodec) => {
560
559
  };
561
560
  var index$1$1 = {
562
561
  encode: (version, codec, privateKey) => {
563
- return base58$1.encode(index$3$1([
562
+ return base58$1.encode(index$3([
564
563
  new TextEncoder().encode(version.toString()),
565
564
  new TextEncoder().encode(codec.toString()),
566
565
  privateKey
567
566
  ]));
568
567
  },
569
- decode: decode$2$1,
568
+ decode: decode$2,
570
569
  isMultiWif: (multiWif) => {
571
570
  try {
572
- const { version, codec, privateKey } = decode$2$1(multiWif);
571
+ const { version, codec, privateKey } = decode$2(multiWif);
573
572
  if (version === undefined)
574
573
  return false;
575
574
  if (codec === undefined)
@@ -924,77 +923,9 @@ var lib = (secp256k1) => {
924
923
  };
925
924
 
926
925
  var elliptic$2 = {};
927
-
928
- var name = "elliptic";
929
926
  var version$1$1 = "6.5.4";
930
- var description = "EC cryptography";
931
- var main = "lib/elliptic.js";
932
- var files = [
933
- "lib"
934
- ];
935
- var scripts = {
936
- lint: "eslint lib test",
937
- "lint:fix": "npm run lint -- --fix",
938
- unit: "istanbul test _mocha --reporter=spec test/index.js",
939
- test: "npm run lint && npm run unit",
940
- version: "grunt dist && git add dist/"
941
- };
942
- var repository = {
943
- type: "git",
944
- url: "git@github.com:indutny/elliptic"
945
- };
946
- var keywords = [
947
- "EC",
948
- "Elliptic",
949
- "curve",
950
- "Cryptography"
951
- ];
952
- var author = "Fedor Indutny <fedor@indutny.com>";
953
- var license = "MIT";
954
- var bugs = {
955
- url: "https://github.com/indutny/elliptic/issues"
956
- };
957
- var homepage = "https://github.com/indutny/elliptic";
958
- var devDependencies = {
959
- brfs: "^2.0.2",
960
- coveralls: "^3.1.0",
961
- eslint: "^7.6.0",
962
- grunt: "^1.2.1",
963
- "grunt-browserify": "^5.3.0",
964
- "grunt-cli": "^1.3.2",
965
- "grunt-contrib-connect": "^3.0.0",
966
- "grunt-contrib-copy": "^1.0.0",
967
- "grunt-contrib-uglify": "^5.0.0",
968
- "grunt-mocha-istanbul": "^5.0.2",
969
- "grunt-saucelabs": "^9.0.1",
970
- istanbul: "^0.4.5",
971
- mocha: "^8.0.1"
972
- };
973
- var dependencies = {
974
- "bn.js": "^4.11.9",
975
- brorand: "^1.1.0",
976
- "hash.js": "^1.0.0",
977
- "hmac-drbg": "^1.0.1",
978
- inherits: "^2.0.4",
979
- "minimalistic-assert": "^1.0.1",
980
- "minimalistic-crypto-utils": "^1.0.1"
981
- };
982
927
  var require$$0 = {
983
- name: name,
984
- version: version$1$1,
985
- description: description,
986
- main: main,
987
- files: files,
988
- scripts: scripts,
989
- repository: repository,
990
- keywords: keywords,
991
- author: author,
992
- license: license,
993
- bugs: bugs,
994
- homepage: homepage,
995
- devDependencies: devDependencies,
996
- dependencies: dependencies
997
- };
928
+ version: version$1$1};
998
929
 
999
930
  var utils$o = {};
1000
931
 
@@ -2832,7 +2763,7 @@ var bn$1 = {exports: {}};
2832
2763
  }
2833
2764
 
2834
2765
  assert(carry === 0);
2835
- assert((carry & ~0x1fff) === 0);
2766
+ assert((carry & -8192) === 0);
2836
2767
  };
2837
2768
 
2838
2769
  FFTM.prototype.stub = function stub (N) {
@@ -9788,7 +9719,7 @@ EDDSA.prototype.decodePoint = function decodePoint(bytes) {
9788
9719
  bytes = utils$2.parseBytes(bytes);
9789
9720
 
9790
9721
  var lastIx = bytes.length - 1;
9791
- var normed = bytes.slice(0, lastIx).concat(bytes[lastIx] & ~0x80);
9722
+ var normed = bytes.slice(0, lastIx).concat(bytes[lastIx] & -129);
9792
9723
  var xIsOdd = (bytes[lastIx] & 0x80) !== 0;
9793
9724
 
9794
9725
  var y = utils$2.intFromLE(normed);
@@ -11013,7 +10944,7 @@ class HdNode {
11013
10944
  else {
11014
10945
  set.push(new Uint8Array(this.publicKey));
11015
10946
  }
11016
- return base58check.encode(index$3$1(set));
10947
+ return base58check.encode(index$3(set));
11017
10948
  }
11018
10949
  toWIF() {
11019
10950
  if (!this.#privateKey)
@@ -11029,14 +10960,14 @@ class HdNode {
11029
10960
  if (this.isNeutered)
11030
10961
  throw new TypeError('Missing private key for hardened child key');
11031
10962
  // data = 0x00 || ser256(kpar) || ser32(index)
11032
- data = index$3$1([
10963
+ data = index$3([
11033
10964
  new TextEncoder().encode('0'),
11034
10965
  this.privateKey,
11035
10966
  new TextEncoder().encode(index.toString()),
11036
10967
  ]);
11037
10968
  }
11038
10969
  else {
11039
- data = index$3$1([
10970
+ data = index$3([
11040
10971
  this.publicKey,
11041
10972
  new TextEncoder().encode(index.toString()),
11042
10973
  ]);
@@ -11102,7 +11033,7 @@ class HdNode {
11102
11033
  let buffer = (await base58check.decode(string)).data;
11103
11034
  // @ts-ignore
11104
11035
  network = network || networks$1.leofcoin;
11105
- const result = index$2$1(buffer);
11036
+ const result = index$2(buffer);
11106
11037
  const version = Number(new TextDecoder().decode(result[0]));
11107
11038
  const depth = Number(new TextDecoder().decode(result[1]));
11108
11039
  const parentFingerprint = Number(new TextDecoder().decode(result[2]));
@@ -13514,11 +13445,11 @@ var encrypt = async (password, data, version = new TextEncoder().encode('1')) =>
13514
13445
  name: 'AES-GCM',
13515
13446
  iv
13516
13447
  }, key, new TextEncoder().encode(data));
13517
- return index$3$1([version, salt, iv, new Uint8Array(encrypted)]);
13448
+ return index$3([version, salt, iv, new Uint8Array(encrypted)]);
13518
13449
  };
13519
13450
 
13520
13451
  var decrypt = async (password, concatecated) => {
13521
- const [version, salt, iv, cipher] = index$2$1(concatecated);
13452
+ const [version, salt, iv, cipher] = index$2(concatecated);
13522
13453
  let iterations;
13523
13454
  if (new TextDecoder().decode(version) === '1') {
13524
13455
  iterations = 250000;
@@ -13533,8 +13464,7 @@ var decrypt = async (password, concatecated) => {
13533
13464
  };
13534
13465
 
13535
13466
  const MSB$1 = 0x80;
13536
- const REST$1 = 0x7F;
13537
- const MSBALL = ~REST$1;
13467
+ const MSBALL = -128;
13538
13468
  const INT = Math.pow(2, 31);
13539
13469
  const encode$6 = (num, out, offset) => {
13540
13470
  if (Number.MAX_SAFE_INTEGER && num > Number.MAX_SAFE_INTEGER) {
@@ -13613,7 +13543,7 @@ class MultiHDNode extends HDWallet {
13613
13543
  super(network, hdnode);
13614
13544
  }
13615
13545
  get id() {
13616
- return base58check.encode(index$3$1([
13546
+ return base58check.encode(index$3([
13617
13547
  new TextEncoder().encode(this.version.toString()),
13618
13548
  this.account(0).hdnode.neutered.publicKey
13619
13549
  ]));
@@ -13706,7 +13636,7 @@ class MultiWallet extends MultiHDNode {
13706
13636
  super(network, hdnode);
13707
13637
  }
13708
13638
  get id() {
13709
- return base58check.encode(index$3$1([
13639
+ return base58check.encode(index$3([
13710
13640
  new TextEncoder().encode(this.version.toString()),
13711
13641
  this.account(0).hdnode.neutered.publicKey,
13712
13642
  ]));
@@ -13741,36 +13671,36 @@ class MultiWallet extends MultiHDNode {
13741
13671
  }
13742
13672
  }
13743
13673
 
13744
- class e{constructor(a,b,c,d,f){this._legacyCanvasSize=e.DEFAULT_CANVAS_SIZE;this._preferredCamera="environment";this._maxScansPerSecond=25;this._lastScanTimestamp=-1;this._destroyed=this._flashOn=this._paused=this._active=!1;this.$video=a;this.$canvas=document.createElement("canvas");c&&"object"===typeof c?this._onDecode=b:(c||d||f?console.warn("You're using a deprecated version of the QrScanner constructor which will be removed in the future"):console.warn("Note that the type of the scan result passed to onDecode will change in the future. To already switch to the new api today, you can pass returnDetailedScanResult: true."),
13674
+ class e{constructor(a,b,c,d,f){this._legacyCanvasSize=e.DEFAULT_CANVAS_SIZE;this._preferredCamera="environment";this._maxScansPerSecond=25;this._lastScanTimestamp=-1;this._destroyed=this._flashOn=this._paused=this._active=false;this.$video=a;this.$canvas=document.createElement("canvas");c&&"object"===typeof c?this._onDecode=b:(c||d||f?console.warn("You're using a deprecated version of the QrScanner constructor which will be removed in the future"):console.warn("Note that the type of the scan result passed to onDecode will change in the future. To already switch to the new api today, you can pass returnDetailedScanResult: true."),
13745
13675
  this._legacyOnDecode=b);b="object"===typeof c?c:{};this._onDecodeError=b.onDecodeError||("function"===typeof c?c:this._onDecodeError);this._calculateScanRegion=b.calculateScanRegion||("function"===typeof d?d:this._calculateScanRegion);this._preferredCamera=b.preferredCamera||f||this._preferredCamera;this._legacyCanvasSize="number"===typeof c?c:"number"===typeof d?d:this._legacyCanvasSize;this._maxScansPerSecond=b.maxScansPerSecond||this._maxScansPerSecond;this._onPlay=this._onPlay.bind(this);this._onLoadedMetaData=
13746
- this._onLoadedMetaData.bind(this);this._onVisibilityChange=this._onVisibilityChange.bind(this);this._updateOverlay=this._updateOverlay.bind(this);a.disablePictureInPicture=!0;a.playsInline=!0;a.muted=!0;let h=!1;a.hidden&&(a.hidden=!1,h=!0);document.body.contains(a)||(document.body.appendChild(a),h=!0);c=a.parentElement;if(b.highlightScanRegion||b.highlightCodeOutline){d=!!b.overlay;this.$overlay=b.overlay||document.createElement("div");f=this.$overlay.style;f.position="absolute";f.display="none";
13676
+ this._onLoadedMetaData.bind(this);this._onVisibilityChange=this._onVisibilityChange.bind(this);this._updateOverlay=this._updateOverlay.bind(this);a.disablePictureInPicture=true;a.playsInline=true;a.muted=true;let h=false;a.hidden&&(a.hidden=false,h=true);document.body.contains(a)||(document.body.appendChild(a),h=true);c=a.parentElement;if(b.highlightScanRegion||b.highlightCodeOutline){d=!!b.overlay;this.$overlay=b.overlay||document.createElement("div");f=this.$overlay.style;f.position="absolute";f.display="none";
13747
13677
  f.pointerEvents="none";this.$overlay.classList.add("scan-region-highlight");if(!d&&b.highlightScanRegion){this.$overlay.innerHTML='<svg class="scan-region-highlight-svg" viewBox="0 0 238 238" preserveAspectRatio="none" style="position:absolute;width:100%;height:100%;left:0;top:0;fill:none;stroke:#e9b213;stroke-width:4;stroke-linecap:round;stroke-linejoin:round"><path d="M31 2H10a8 8 0 0 0-8 8v21M207 2h21a8 8 0 0 1 8 8v21m0 176v21a8 8 0 0 1-8 8h-21m-176 0H10a8 8 0 0 1-8-8v-21"/></svg>';try{this.$overlay.firstElementChild.animate({transform:["scale(.98)",
13748
13678
  "scale(1.01)"]},{duration:400,iterations:Infinity,direction:"alternate",easing:"ease-in-out"});}catch(m){}c.insertBefore(this.$overlay,this.$video.nextSibling);}b.highlightCodeOutline&&(this.$overlay.insertAdjacentHTML("beforeend",'<svg class="code-outline-highlight" preserveAspectRatio="none" style="display:none;width:100%;height:100%;fill:none;stroke:#e9b213;stroke-width:5;stroke-dasharray:25;stroke-linecap:round;stroke-linejoin:round"><polygon/></svg>'),this.$codeOutlineHighlight=this.$overlay.lastElementChild);}this._scanRegion=
13749
- this._calculateScanRegion(a);requestAnimationFrame(()=>{let m=window.getComputedStyle(a);"none"===m.display&&(a.style.setProperty("display","block","important"),h=!0);"visible"!==m.visibility&&(a.style.setProperty("visibility","visible","important"),h=!0);h&&(console.warn("QrScanner has overwritten the video hiding style to avoid Safari stopping the playback."),a.style.opacity="0",a.style.width="0",a.style.height="0",this.$overlay&&this.$overlay.parentElement&&this.$overlay.parentElement.removeChild(this.$overlay),
13750
- delete this.$overlay,delete this.$codeOutlineHighlight);this.$overlay&&this._updateOverlay();});a.addEventListener("play",this._onPlay);a.addEventListener("loadedmetadata",this._onLoadedMetaData);document.addEventListener("visibilitychange",this._onVisibilityChange);window.addEventListener("resize",this._updateOverlay);this._qrEnginePromise=e.createQrEngine();}static set WORKER_PATH(a){console.warn("Setting QrScanner.WORKER_PATH is not required and not supported anymore. Have a look at the README for new setup instructions.");}static async hasCamera(){try{return !!(await e.listCameras(!1)).length}catch(a){return !1}}static async listCameras(a=
13751
- !1){if(!navigator.mediaDevices)return [];let b=async()=>(await navigator.mediaDevices.enumerateDevices()).filter(d=>"videoinput"===d.kind),c;try{a&&(await b()).every(d=>!d.label)&&(c=await navigator.mediaDevices.getUserMedia({audio:!1,video:!0}));}catch(d){}try{return (await b()).map((d,f)=>({id:d.deviceId,label:d.label||(0===f?"Default Camera":`Camera ${f+1}`)}))}finally{c&&(console.warn("Call listCameras after successfully starting a QR scanner to avoid creating a temporary video stream"),e._stopVideoStream(c));}}async hasFlash(){let a;
13752
- try{if(this.$video.srcObject){if(!(this.$video.srcObject instanceof MediaStream))return !1;a=this.$video.srcObject;}else a=(await this._getCameraStream()).stream;return "torch"in a.getVideoTracks()[0].getSettings()}catch(b){return !1}finally{a&&a!==this.$video.srcObject&&(console.warn("Call hasFlash after successfully starting the scanner to avoid creating a temporary video stream"),e._stopVideoStream(a));}}isFlashOn(){return this._flashOn}async toggleFlash(){this._flashOn?await this.turnFlashOff():await this.turnFlashOn();}async turnFlashOn(){if(!this._flashOn&&
13753
- !this._destroyed&&(this._flashOn=!0,this._active&&!this._paused))try{if(!await this.hasFlash())throw "No flash available";await this.$video.srcObject.getVideoTracks()[0].applyConstraints({advanced:[{torch:!0}]});}catch(a){throw this._flashOn=!1,a;}}async turnFlashOff(){this._flashOn&&(this._flashOn=!1,await this._restartVideoStream());}destroy(){this.$video.removeEventListener("loadedmetadata",this._onLoadedMetaData);this.$video.removeEventListener("play",this._onPlay);document.removeEventListener("visibilitychange",
13754
- this._onVisibilityChange);window.removeEventListener("resize",this._updateOverlay);this._destroyed=!0;this._flashOn=!1;this.stop();e._postWorkerMessage(this._qrEnginePromise,"close");}async start(){if(this._destroyed)throw Error("The QR scanner can not be started as it had been destroyed.");if(!this._active||this._paused)if("https:"!==window.location.protocol&&console.warn("The camera stream is only accessible if the page is transferred via https."),this._active=!0,!document.hidden)if(this._paused=
13755
- !1,this.$video.srcObject)await this.$video.play();else try{let {stream:a,facingMode:b}=await this._getCameraStream();!this._active||this._paused?e._stopVideoStream(a):(this._setVideoMirror(b),this.$video.srcObject=a,await this.$video.play(),this._flashOn&&(this._flashOn=!1,this.turnFlashOn().catch(()=>{})));}catch(a){if(!this._paused)throw this._active=!1,a;}}stop(){this.pause();this._active=!1;}async pause(a=!1){this._paused=!0;if(!this._active)return !0;this.$video.pause();this.$overlay&&(this.$overlay.style.display=
13756
- "none");let b=()=>{this.$video.srcObject instanceof MediaStream&&(e._stopVideoStream(this.$video.srcObject),this.$video.srcObject=null);};if(a)return b(),!0;await new Promise(c=>setTimeout(c,300));if(!this._paused)return !1;b();return !0}async setCamera(a){a!==this._preferredCamera&&(this._preferredCamera=a,await this._restartVideoStream());}static async scanImage(a,b,c,d,f=!1,h=!1){let m,n=!1;b&&("scanRegion"in b||"qrEngine"in b||"canvas"in b||"disallowCanvasResizing"in b||"alsoTryWithoutScanRegion"in
13757
- b||"returnDetailedScanResult"in b)?(m=b.scanRegion,c=b.qrEngine,d=b.canvas,f=b.disallowCanvasResizing||!1,h=b.alsoTryWithoutScanRegion||!1,n=!0):b||c||d||f||h?console.warn("You're using a deprecated api for scanImage which will be removed in the future."):console.warn("Note that the return type of scanImage will change in the future. To already switch to the new api today, you can pass returnDetailedScanResult: true.");b=!!c;try{let p,k;[c,p]=await Promise.all([c||e.createQrEngine(),e._loadImage(a)]);
13679
+ this._calculateScanRegion(a);requestAnimationFrame(()=>{let m=window.getComputedStyle(a);"none"===m.display&&(a.style.setProperty("display","block","important"),h=true);"visible"!==m.visibility&&(a.style.setProperty("visibility","visible","important"),h=true);h&&(console.warn("QrScanner has overwritten the video hiding style to avoid Safari stopping the playback."),a.style.opacity="0",a.style.width="0",a.style.height="0",this.$overlay&&this.$overlay.parentElement&&this.$overlay.parentElement.removeChild(this.$overlay),
13680
+ delete this.$overlay,delete this.$codeOutlineHighlight);this.$overlay&&this._updateOverlay();});a.addEventListener("play",this._onPlay);a.addEventListener("loadedmetadata",this._onLoadedMetaData);document.addEventListener("visibilitychange",this._onVisibilityChange);window.addEventListener("resize",this._updateOverlay);this._qrEnginePromise=e.createQrEngine();}static set WORKER_PATH(a){console.warn("Setting QrScanner.WORKER_PATH is not required and not supported anymore. Have a look at the README for new setup instructions.");}static async hasCamera(){try{return !!(await e.listCameras(!1)).length}catch(a){return false}}static async listCameras(a=
13681
+ false){if(!navigator.mediaDevices)return [];let b=async()=>(await navigator.mediaDevices.enumerateDevices()).filter(d=>"videoinput"===d.kind),c;try{a&&(await b()).every(d=>!d.label)&&(c=await navigator.mediaDevices.getUserMedia({audio:!1,video:!0}));}catch(d){}try{return (await b()).map((d,f)=>({id:d.deviceId,label:d.label||(0===f?"Default Camera":`Camera ${f+1}`)}))}finally{c&&(console.warn("Call listCameras after successfully starting a QR scanner to avoid creating a temporary video stream"),e._stopVideoStream(c));}}async hasFlash(){let a;
13682
+ try{if(this.$video.srcObject){if(!(this.$video.srcObject instanceof MediaStream))return !1;a=this.$video.srcObject;}else a=(await this._getCameraStream()).stream;return "torch"in a.getVideoTracks()[0].getSettings()}catch(b){return false}finally{a&&a!==this.$video.srcObject&&(console.warn("Call hasFlash after successfully starting the scanner to avoid creating a temporary video stream"),e._stopVideoStream(a));}}isFlashOn(){return this._flashOn}async toggleFlash(){this._flashOn?await this.turnFlashOff():await this.turnFlashOn();}async turnFlashOn(){if(!this._flashOn&&
13683
+ !this._destroyed&&(this._flashOn=true,this._active&&!this._paused))try{if(!await this.hasFlash())throw "No flash available";await this.$video.srcObject.getVideoTracks()[0].applyConstraints({advanced:[{torch:!0}]});}catch(a){throw this._flashOn=false,a;}}async turnFlashOff(){this._flashOn&&(this._flashOn=false,await this._restartVideoStream());}destroy(){this.$video.removeEventListener("loadedmetadata",this._onLoadedMetaData);this.$video.removeEventListener("play",this._onPlay);document.removeEventListener("visibilitychange",
13684
+ this._onVisibilityChange);window.removeEventListener("resize",this._updateOverlay);this._destroyed=true;this._flashOn=false;this.stop();e._postWorkerMessage(this._qrEnginePromise,"close");}async start(){if(this._destroyed)throw Error("The QR scanner can not be started as it had been destroyed.");if(!this._active||this._paused)if("https:"!==window.location.protocol&&console.warn("The camera stream is only accessible if the page is transferred via https."),this._active=true,!document.hidden)if(this._paused=
13685
+ false,this.$video.srcObject)await this.$video.play();else try{let {stream:a,facingMode:b}=await this._getCameraStream();!this._active||this._paused?e._stopVideoStream(a):(this._setVideoMirror(b),this.$video.srcObject=a,await this.$video.play(),this._flashOn&&(this._flashOn=!1,this.turnFlashOn().catch(()=>{})));}catch(a){if(!this._paused)throw this._active=false,a;}}stop(){this.pause();this._active=false;}async pause(a=false){this._paused=true;if(!this._active)return true;this.$video.pause();this.$overlay&&(this.$overlay.style.display=
13686
+ "none");let b=()=>{this.$video.srcObject instanceof MediaStream&&(e._stopVideoStream(this.$video.srcObject),this.$video.srcObject=null);};if(a)return b(),true;await new Promise(c=>setTimeout(c,300));if(!this._paused)return false;b();return true}async setCamera(a){a!==this._preferredCamera&&(this._preferredCamera=a,await this._restartVideoStream());}static async scanImage(a,b,c,d,f=false,h=false){let m,n=false;b&&("scanRegion"in b||"qrEngine"in b||"canvas"in b||"disallowCanvasResizing"in b||"alsoTryWithoutScanRegion"in
13687
+ b||"returnDetailedScanResult"in b)?(m=b.scanRegion,c=b.qrEngine,d=b.canvas,f=b.disallowCanvasResizing||false,h=b.alsoTryWithoutScanRegion||false,n=true):b||c||d||f||h?console.warn("You're using a deprecated api for scanImage which will be removed in the future."):console.warn("Note that the return type of scanImage will change in the future. To already switch to the new api today, you can pass returnDetailedScanResult: true.");b=!!c;try{let p,k;[c,p]=await Promise.all([c||e.createQrEngine(),e._loadImage(a)]);
13758
13688
  [d,k]=e._drawToCanvas(p,m,d,f);let q;if(c instanceof Worker){let g=c;b||e._postWorkerMessageSync(g,"inversionMode","both");q=await new Promise((l,v)=>{let w,u,r,y=-1;u=t=>{t.data.id===y&&(g.removeEventListener("message",u),g.removeEventListener("error",r),clearTimeout(w),null!==t.data.data?l({data:t.data.data,cornerPoints:e._convertPoints(t.data.cornerPoints,m)}):v(e.NO_QR_CODE_FOUND));};r=t=>{g.removeEventListener("message",u);g.removeEventListener("error",r);clearTimeout(w);v("Scanner error: "+(t?
13759
13689
  t.message||t:"Unknown Error"));};g.addEventListener("message",u);g.addEventListener("error",r);w=setTimeout(()=>r("timeout"),1E4);let x=k.getImageData(0,0,d.width,d.height);y=e._postWorkerMessageSync(g,"decode",x,[x.data.buffer]);});}else q=await Promise.race([new Promise((g,l)=>window.setTimeout(()=>l("Scanner error: timeout"),1E4)),(async()=>{try{var [g]=await c.detect(d);if(!g)throw e.NO_QR_CODE_FOUND;return {data:g.rawValue,cornerPoints:e._convertPoints(g.cornerPoints,m)}}catch(l){g=l.message||l;
13760
- if(/not implemented|service unavailable/.test(g))return e._disableBarcodeDetector=!0,e.scanImage(a,{scanRegion:m,canvas:d,disallowCanvasResizing:f,alsoTryWithoutScanRegion:h});throw `Scanner error: ${g}`;}})()]);return n?q:q.data}catch(p){if(!m||!h)throw p;let k=await e.scanImage(a,{qrEngine:c,canvas:d,disallowCanvasResizing:f});return n?k:k.data}finally{b||e._postWorkerMessage(c,"close");}}setGrayscaleWeights(a,b,c,d=!0){e._postWorkerMessage(this._qrEnginePromise,"grayscaleWeights",{red:a,green:b,
13690
+ if(/not implemented|service unavailable/.test(g))return e._disableBarcodeDetector=!0,e.scanImage(a,{scanRegion:m,canvas:d,disallowCanvasResizing:f,alsoTryWithoutScanRegion:h});throw `Scanner error: ${g}`;}})()]);return n?q:q.data}catch(p){if(!m||!h)throw p;let k=await e.scanImage(a,{qrEngine:c,canvas:d,disallowCanvasResizing:f});return n?k:k.data}finally{b||e._postWorkerMessage(c,"close");}}setGrayscaleWeights(a,b,c,d=true){e._postWorkerMessage(this._qrEnginePromise,"grayscaleWeights",{red:a,green:b,
13761
13691
  blue:c,useIntegerApproximation:d});}setInversionMode(a){e._postWorkerMessage(this._qrEnginePromise,"inversionMode",a);}static async createQrEngine(a){a&&console.warn("Specifying a worker path is not required and not supported anymore.");a=()=>import('./qr-scanner-worker.min-Dy0qkKA4-Dy0qkKA4.js').then(c=>c.createWorker());if(!(!e._disableBarcodeDetector&&"BarcodeDetector"in window&&BarcodeDetector.getSupportedFormats&&(await BarcodeDetector.getSupportedFormats()).includes("qr_code")))return a();let b=navigator.userAgentData;
13762
- return b&&b.brands.some(({brand:c})=>/Chromium/i.test(c))&&/mac ?OS/i.test(b.platform)&&await b.getHighEntropyValues(["architecture","platformVersion"]).then(({architecture:c,platformVersion:d})=>/arm/i.test(c||"arm")&&13<=parseInt(d||"13")).catch(()=>!0)?a():new BarcodeDetector({formats:["qr_code"]})}_onPlay(){this._scanRegion=this._calculateScanRegion(this.$video);this._updateOverlay();this.$overlay&&(this.$overlay.style.display="");this._scanFrame();}_onLoadedMetaData(){this._scanRegion=this._calculateScanRegion(this.$video);
13692
+ return b&&b.brands.some(({brand:c})=>/Chromium/i.test(c))&&/mac ?OS/i.test(b.platform)&&await b.getHighEntropyValues(["architecture","platformVersion"]).then(({architecture:c,platformVersion:d})=>/arm/i.test(c||"arm")&&13<=parseInt(d||"13")).catch(()=>true)?a():new BarcodeDetector({formats:["qr_code"]})}_onPlay(){this._scanRegion=this._calculateScanRegion(this.$video);this._updateOverlay();this.$overlay&&(this.$overlay.style.display="");this._scanFrame();}_onLoadedMetaData(){this._scanRegion=this._calculateScanRegion(this.$video);
13763
13693
  this._updateOverlay();}_onVisibilityChange(){document.hidden?this.pause():this._active&&this.start();}_calculateScanRegion(a){let b=Math.round(2/3*Math.min(a.videoWidth,a.videoHeight));return {x:Math.round((a.videoWidth-b)/2),y:Math.round((a.videoHeight-b)/2),width:b,height:b,downScaledWidth:this._legacyCanvasSize,downScaledHeight:this._legacyCanvasSize}}_updateOverlay(){requestAnimationFrame(()=>{if(this.$overlay){var a=this.$video,b=a.videoWidth,c=a.videoHeight,d=a.offsetWidth,f=a.offsetHeight,h=a.offsetLeft,
13764
13694
  m=a.offsetTop,n=window.getComputedStyle(a),p=n.objectFit,k=b/c,q=d/f;switch(p){case "none":var g=b;var l=c;break;case "fill":g=d;l=f;break;default:("cover"===p?k>q:k<q)?(l=f,g=l*k):(g=d,l=g/k),"scale-down"===p&&(g=Math.min(g,b),l=Math.min(l,c));}var [v,w]=n.objectPosition.split(" ").map((r,y)=>{const x=parseFloat(r);return r.endsWith("%")?(y?f-l:d-g)*x/100:x});n=this._scanRegion.width||b;q=this._scanRegion.height||c;p=this._scanRegion.x||0;var u=this._scanRegion.y||0;k=this.$overlay.style;k.width=
13765
13695
  `${n/b*g}px`;k.height=`${q/c*l}px`;k.top=`${m+w+u/c*l}px`;c=/scaleX\(-1\)/.test(a.style.transform);k.left=`${h+(c?d-v-g:v)+(c?b-p-n:p)/b*g}px`;k.transform=a.style.transform;}});}static _convertPoints(a,b){if(!b)return a;let c=b.x||0,d=b.y||0,f=b.width&&b.downScaledWidth?b.width/b.downScaledWidth:1;b=b.height&&b.downScaledHeight?b.height/b.downScaledHeight:1;for(let h of a)h.x=h.x*f+c,h.y=h.y*b+d;return a}_scanFrame(){!this._active||this.$video.paused||this.$video.ended||("requestVideoFrameCallback"in
13766
13696
  this.$video?this.$video.requestVideoFrameCallback.bind(this.$video):requestAnimationFrame)(async()=>{if(!(1>=this.$video.readyState)){var a=Date.now()-this._lastScanTimestamp,b=1E3/this._maxScansPerSecond;a<b&&await new Promise(d=>setTimeout(d,b-a));this._lastScanTimestamp=Date.now();try{var c=await e.scanImage(this.$video,{scanRegion:this._scanRegion,qrEngine:this._qrEnginePromise,canvas:this.$canvas});}catch(d){if(!this._active)return;this._onDecodeError(d);}!e._disableBarcodeDetector||await this._qrEnginePromise instanceof
13767
13697
  Worker||(this._qrEnginePromise=e.createQrEngine());c?(this._onDecode?this._onDecode(c):this._legacyOnDecode&&this._legacyOnDecode(c.data),this.$codeOutlineHighlight&&(clearTimeout(this._codeOutlineHighlightRemovalTimeout),this._codeOutlineHighlightRemovalTimeout=void 0,this.$codeOutlineHighlight.setAttribute("viewBox",`${this._scanRegion.x||0} `+`${this._scanRegion.y||0} `+`${this._scanRegion.width||this.$video.videoWidth} `+`${this._scanRegion.height||this.$video.videoHeight}`),this.$codeOutlineHighlight.firstElementChild.setAttribute("points",
13768
13698
  c.cornerPoints.map(({x:d,y:f})=>`${d},${f}`).join(" ")),this.$codeOutlineHighlight.style.display="")):this.$codeOutlineHighlight&&!this._codeOutlineHighlightRemovalTimeout&&(this._codeOutlineHighlightRemovalTimeout=setTimeout(()=>this.$codeOutlineHighlight.style.display="none",100));}this._scanFrame();});}_onDecodeError(a){a!==e.NO_QR_CODE_FOUND&&console.log(a);}async _getCameraStream(){if(!navigator.mediaDevices)throw "Camera not found.";let a=/^(environment|user)$/.test(this._preferredCamera)?"facingMode":
13769
- "deviceId",b=[{width:{min:1024}},{width:{min:768}},{}],c=b.map(d=>Object.assign({},d,{[a]:{exact:this._preferredCamera}}));for(let d of [...c,...b])try{let f=await navigator.mediaDevices.getUserMedia({video:d,audio:!1}),h=this._getFacingMode(f)||(d.facingMode?this._preferredCamera:"environment"===this._preferredCamera?"user":"environment");return {stream:f,facingMode:h}}catch(f){}throw "Camera not found.";}async _restartVideoStream(){let a=this._paused;await this.pause(!0)&&!a&&this._active&&await this.start();}static _stopVideoStream(a){for(let b of a.getTracks())b.stop(),
13770
- a.removeTrack(b);}_setVideoMirror(a){this.$video.style.transform="scaleX("+("user"===a?-1:1)+")";}_getFacingMode(a){return (a=a.getVideoTracks()[0])?/rear|back|environment/i.test(a.label)?"environment":/front|user|face/i.test(a.label)?"user":null:null}static _drawToCanvas(a,b,c,d=!1){c=c||document.createElement("canvas");let f=b&&b.x?b.x:0,h=b&&b.y?b.y:0,m=b&&b.width?b.width:a.videoWidth||a.width,n=b&&b.height?b.height:a.videoHeight||a.height;d||(d=b&&b.downScaledWidth?b.downScaledWidth:m,b=b&&b.downScaledHeight?
13771
- b.downScaledHeight:n,c.width!==d&&(c.width=d),c.height!==b&&(c.height=b));b=c.getContext("2d",{alpha:!1});b.imageSmoothingEnabled=!1;b.drawImage(a,f,h,m,n,0,0,c.width,c.height);return [c,b]}static async _loadImage(a){if(a instanceof Image)return await e._awaitImageLoad(a),a;if(a instanceof HTMLVideoElement||a instanceof HTMLCanvasElement||a instanceof SVGImageElement||"OffscreenCanvas"in window&&a instanceof OffscreenCanvas||"ImageBitmap"in window&&a instanceof ImageBitmap)return a;if(a instanceof
13699
+ "deviceId",b=[{width:{min:1024}},{width:{min:768}},{}],c=b.map(d=>Object.assign({},d,{[a]:{exact:this._preferredCamera}}));for(let d of [...c,...b])try{let f=await navigator.mediaDevices.getUserMedia({video:d,audio:!1}),h=this._getFacingMode(f)||(d.facingMode?this._preferredCamera:"environment"===this._preferredCamera?"user":"environment");return {stream:f,facingMode:h}}catch(f){}throw "Camera not found.";}async _restartVideoStream(){let a=this._paused;await this.pause(true)&&!a&&this._active&&await this.start();}static _stopVideoStream(a){for(let b of a.getTracks())b.stop(),
13700
+ a.removeTrack(b);}_setVideoMirror(a){this.$video.style.transform="scaleX("+("user"===a?-1:1)+")";}_getFacingMode(a){return (a=a.getVideoTracks()[0])?/rear|back|environment/i.test(a.label)?"environment":/front|user|face/i.test(a.label)?"user":null:null}static _drawToCanvas(a,b,c,d=false){c=c||document.createElement("canvas");let f=b&&b.x?b.x:0,h=b&&b.y?b.y:0,m=b&&b.width?b.width:a.videoWidth||a.width,n=b&&b.height?b.height:a.videoHeight||a.height;d||(d=b&&b.downScaledWidth?b.downScaledWidth:m,b=b&&b.downScaledHeight?
13701
+ b.downScaledHeight:n,c.width!==d&&(c.width=d),c.height!==b&&(c.height=b));b=c.getContext("2d",{alpha:false});b.imageSmoothingEnabled=false;b.drawImage(a,f,h,m,n,0,0,c.width,c.height);return [c,b]}static async _loadImage(a){if(a instanceof Image)return await e._awaitImageLoad(a),a;if(a instanceof HTMLVideoElement||a instanceof HTMLCanvasElement||a instanceof SVGImageElement||"OffscreenCanvas"in window&&a instanceof OffscreenCanvas||"ImageBitmap"in window&&a instanceof ImageBitmap)return a;if(a instanceof
13772
13702
  File||a instanceof Blob||a instanceof URL||"string"===typeof a){let b=new Image;b.src=a instanceof File||a instanceof Blob?URL.createObjectURL(a):a.toString();try{return await e._awaitImageLoad(b),b}finally{(a instanceof File||a instanceof Blob)&&URL.revokeObjectURL(b.src);}}else throw "Unsupported image type.";}static async _awaitImageLoad(a){a.complete&&0!==a.naturalWidth||await new Promise((b,c)=>{let d=f=>{a.removeEventListener("load",d);a.removeEventListener("error",d);f instanceof ErrorEvent?
13773
- c("Image load error"):b();};a.addEventListener("load",d);a.addEventListener("error",d);});}static async _postWorkerMessage(a,b,c,d){return e._postWorkerMessageSync(await a,b,c,d)}static _postWorkerMessageSync(a,b,c,d){if(!(a instanceof Worker))return -1;let f=e._workerMessageId++;a.postMessage({id:f,type:b,data:c},d);return f}}e.DEFAULT_CANVAS_SIZE=400;e.NO_QR_CODE_FOUND="No QR code found";e._disableBarcodeDetector=!1;e._workerMessageId=0;
13703
+ c("Image load error"):b();};a.addEventListener("load",d);a.addEventListener("error",d);});}static async _postWorkerMessage(a,b,c,d){return e._postWorkerMessageSync(await a,b,c,d)}static _postWorkerMessageSync(a,b,c,d){if(!(a instanceof Worker))return -1;let f=e._workerMessageId++;a.postMessage({id:f,type:b,data:c},d);return f}}e.DEFAULT_CANVAS_SIZE=400;e.NO_QR_CODE_FOUND="No QR code found";e._disableBarcodeDetector=false;e._workerMessageId=0;
13774
13704
 
13775
13705
  var browser = {};
13776
13706
 
@@ -16678,7 +16608,7 @@ class Identity {
16678
16608
  this.selectedAccount = new TextDecoder().decode(selected);
16679
16609
  }
16680
16610
  else {
16681
- const importee = await import(/* webpackChunkName: "generate-account" */ './index-BeqbCwUk-DfNb2uRP.js');
16611
+ const importee = await import(/* webpackChunkName: "generate-account" */ './index-BeqbCwUk-BbkInvhZ.js');
16682
16612
  const { identity, accounts } = await importee.default(password, this.network);
16683
16613
  await globalThis.accountStore.put('public', JSON.stringify({ walletId: identity.walletId }));
16684
16614
  await globalThis.walletStore.put('version', String(1));
@@ -16724,12 +16654,12 @@ class Identity {
16724
16654
  }
16725
16655
  }
16726
16656
 
16727
- const encode$3 = (string) => {
16657
+ const encode$1 = (string) => {
16728
16658
  if (typeof string === 'string')
16729
16659
  return new TextEncoder().encode(string);
16730
16660
  throw Error(`expected typeof String instead got ${string}`);
16731
16661
  };
16732
- const decode$3 = (uint8Array) => {
16662
+ const decode$1 = (uint8Array) => {
16733
16663
  if (uint8Array instanceof Uint8Array)
16734
16664
  return new TextDecoder().decode(uint8Array);
16735
16665
  throw Error(`expected typeof uint8Array instead got ${uint8Array}`);
@@ -16740,7 +16670,7 @@ class KeyPath {
16740
16670
  uint8Array;
16741
16671
  constructor(input) {
16742
16672
  if (typeof input === 'string') {
16743
- this.uint8Array = encode$3(input);
16673
+ this.uint8Array = encode$1(input);
16744
16674
  }
16745
16675
  else if (input instanceof Uint8Array) {
16746
16676
  this.uint8Array = input;
@@ -16756,7 +16686,7 @@ class KeyPath {
16756
16686
  return true;
16757
16687
  }
16758
16688
  toString() {
16759
- return decode$3(this.uint8Array);
16689
+ return decode$1(this.uint8Array);
16760
16690
  }
16761
16691
  /**
16762
16692
  * Returns the `list` representation of this path.
@@ -16776,7 +16706,7 @@ class KeyValue {
16776
16706
  uint8Array;
16777
16707
  constructor(input) {
16778
16708
  if (typeof input === 'string') {
16779
- this.uint8Array = encode$3(input);
16709
+ this.uint8Array = encode$1(input);
16780
16710
  }
16781
16711
  else if (input instanceof Uint8Array) {
16782
16712
  this.uint8Array = input;
@@ -16792,7 +16722,7 @@ class KeyValue {
16792
16722
  return true;
16793
16723
  }
16794
16724
  toString() {
16795
- return decode$3(this.uint8Array);
16725
+ return decode$1(this.uint8Array);
16796
16726
  }
16797
16727
  }
16798
16728
 
@@ -16907,87 +16837,16 @@ var isHex = string => /^[A-F0-9]+$/i.test(
16907
16837
  );
16908
16838
 
16909
16839
  const ALPHABET$1 = '0123456789ABCDEF';
16910
- const base16 = base$1(ALPHABET$1);
16911
- const decode$2 = base16.decode;
16912
- const encode$2 = base16.encode;
16913
- const isBase16 = (string) => {
16914
- try {
16915
- decode$2(string);
16916
- return true;
16917
- }
16918
- catch (e) {
16919
- return false;
16920
- }
16921
- };
16922
- var index$3 = {
16923
- encode: encode$2,
16924
- decode: decode$2,
16925
- isBase16
16926
- };
16840
+ base$1(ALPHABET$1);
16927
16841
 
16928
16842
  const ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_';
16929
- const base64 = base$1(ALPHABET);
16930
- const decode$1 = base64.decode;
16931
- const encode$1 = base64.encode;
16932
- const isBase64 = (string) => {
16933
- try {
16934
- decode$1(string);
16935
- return true;
16936
- }
16937
- catch (e) {
16938
- return false;
16939
- }
16940
- };
16941
- var index$2 = {
16942
- encode: encode$1,
16943
- decode: decode$1,
16944
- isBase64
16945
- };
16946
-
16947
- /**
16948
- * Returns a hex string as Binary string
16949
- * @param string string to encode to binary
16950
- * @returns binaryString
16951
- */
16952
- const hexToBinary = (hex) => (parseInt(hex, 16).toString(2)).padStart(8, '0');
16953
- const isTypedArrayCompatible = (possibleUint8Array) => {
16954
- if (typeof possibleUint8Array === 'string') {
16955
- possibleUint8Array = possibleUint8Array.split(',').map(number => Number(number));
16956
- for (const number of possibleUint8Array) {
16957
- if (isNaN(number))
16958
- return false;
16959
- }
16960
- }
16961
- for (const number of possibleUint8Array) {
16962
- if (isNaN(number))
16963
- return false;
16964
- }
16965
- return true;
16966
- };
16967
- /**
16968
- * Returns a String as Uint8Array
16969
- * @param string string to encode to Uint8Array
16970
- * @returns Uint8Array
16971
- */
16972
- const fromString$1 = (string) => new TextEncoder().encode(string);
16843
+ base$1(ALPHABET);
16973
16844
  /**
16974
16845
  * Returns a Uint8Array as String
16975
16846
  * @param uint8Array Uint8Array to encode to String
16976
16847
  * @returns String
16977
16848
  */
16978
16849
  const toString$3 = (uint8Array) => new TextDecoder().decode(uint8Array);
16979
- /**
16980
- * Returns a String as Uint8Array
16981
- * @param string string to encode to Uint8Array
16982
- * @returns Uint8Array
16983
- */
16984
- const fromUintArrayString = (string) => Uint8Array.from(string.split(',').map(string => Number(string)));
16985
- /**
16986
- * Returns a Uint8Array as String
16987
- * @param uint8Array Uint8Array to encode to String
16988
- * @returns String
16989
- */
16990
- const toUintArrayString = (uint8Array) => uint8Array.toString();
16991
16850
  /**
16992
16851
  * hexString -> uint8Array
16993
16852
  * @param string hex encoded string
@@ -17000,151 +16859,11 @@ const fromHex = (string) => Uint8Array.from(string.match(/.{1,2}/g).map((byte) =
17000
16859
  * @returns hexString
17001
16860
  */
17002
16861
  const toHex$1 = (bytes) => bytes.reduce((string, byte) => string + byte.toString(16).padStart(2, '0'), '');
17003
- /**
17004
- * number[] -> Uint8Array
17005
- * @param array number[]
17006
- * @returns Uint8Array
17007
- */
17008
- const fromArrayLike = (array) => Uint8Array.from(array);
17009
- /**
17010
- * Uint8Array -> number[]
17011
- * @param uint8Array Uint8Array
17012
- * @returns Uint8Array
17013
- */
17014
- const toArrayLike = (uint8Array) => [...uint8Array.values()];
17015
- /**
17016
- * object -> Uint8Array
17017
- * @param object any
17018
- * @returns Uint8Array
17019
- */
17020
- const fromObject = (object) => new TextEncoder().encode(JSON.stringify(object));
17021
- /**
17022
- * Uint8Array -> Object
17023
- * @param uint8Array Uint8Array
17024
- * @returns Object
17025
- */
17026
- const toObject = (uint8Array) => JSON.parse(new TextDecoder().decode(uint8Array));
17027
- const fromBinary = (string) => fromHex(parseInt(string, 2).toString(16).toUpperCase());
17028
- const toBinary = (uint8Array) => hexToBinary(toHex$1(uint8Array));
17029
- const toBase64 = (uint8Array) => index$2.encode(uint8Array);
17030
- const fromBase64 = (string) => index$2.decode(string);
17031
16862
  const toBase58 = (uint8Array) => base58$1.encode(uint8Array);
17032
16863
  const fromBase58 = (string) => base58$1.decode(string);
17033
16864
  const toBase32 = (uint8Array) => index$5.encode(uint8Array);
17034
- const fromBase32 = (string) => index$5.decode(string);
17035
- const toBase16 = (uint8Array) => index$3.encode(uint8Array);
17036
- const fromBase16 = (string) => index$3.decode(string);
17037
- let FormatInterface$2 = class FormatInterface {
17038
- encoded;
17039
- decoded;
17040
- constructor(input) {
17041
- if (input) {
17042
- if (index$3.isBase16(input))
17043
- this.encoded = this.fromBase16(input);
17044
- else if (index$5.isBase32(input))
17045
- this.encoded = this.fromBase32(input);
17046
- else if (base58$1.isBase58(input))
17047
- this.encoded = this.fromBase58(input);
17048
- else if (index$2.isBase64(input))
17049
- this.encoded = this.fromBase64(input);
17050
- else if (typeof input === 'string') {
17051
- let isCompatible = isTypedArrayCompatible(input);
17052
- if (isCompatible)
17053
- this.encoded = fromUintArrayString(input);
17054
- else
17055
- this.encoded = this.fromString(input); // normal string
17056
- }
17057
- else if (typeof input === 'object')
17058
- this.encoded = this.fromObject(input);
17059
- else if (input instanceof Uint8Array)
17060
- this.encoded = input;
17061
- else if (Array.isArray(input) && isTypedArrayCompatible(input))
17062
- this.encoded = this.fromArrayLike(input);
17063
- }
17064
- }
17065
- /**
17066
- * Returns a String as Uint8Array
17067
- * @param string string to encode to Uint8Array
17068
- * @returns Uint8Array
17069
- */
17070
- fromString = (string) => this.encoded = fromString$1(string);
17071
- /**
17072
- * Returns a Uint8Array as String
17073
- * @param uint8Array Uint8Array to encode to String
17074
- * @returns String
17075
- */
17076
- toString = (uint8Array) => this.decoded = toString$3(uint8Array);
17077
- /**
17078
- * Returns a String as Uint8Array
17079
- * @param string string to encode to Uint8Array
17080
- * @returns Uint8Array
17081
- */
17082
- fromUintArrayString = (string) => this.encoded = fromUintArrayString(string);
17083
- /**
17084
- * Returns a Uint8Array as String
17085
- * @param uint8Array Uint8Array to encode to String
17086
- * @returns String
17087
- */
17088
- toUintArrayString = (uint8Array) => this.decoded = uint8Array.toString();
17089
- /**
17090
- * hexString -> uint8Array
17091
- * @param string hex encoded string
17092
- * @returns UintArray
17093
- */
17094
- fromHex = (string) => this.encoded = fromHex(string);
17095
- /**
17096
- * uint8Array -> hexString
17097
- * @param bytes ArrayLike
17098
- * @returns hexString
17099
- */
17100
- toHex = (arrayLike) => this.decoded = toHex$1(arrayLike);
17101
- /**
17102
- * number[] -> Uint8Array
17103
- * @param array number[]
17104
- * @returns Uint8Array
17105
- */
17106
- fromArrayLike = (array) => this.encoded = Uint8Array.from(array);
17107
- /**
17108
- * Uint8Array -> number[]
17109
- * @param uint8Array Uint8Array
17110
- * @returns Uint8Array
17111
- */
17112
- toArrayLike = (uint8Array) => this.decoded = [...uint8Array.values()];
17113
- fromObject = (object) => this.encoded = fromObject(object);
17114
- toBinary = (uint8Array) => this.decoded = hexToBinary(toHex$1(uint8Array));
17115
- fromBinary = (binary) => this.encoded = fromBinary(binary);
17116
- toObject = (uint8Array) => this.decoded = toObject(uint8Array);
17117
- toBase64 = (uint8Array) => this.decoded = index$2.encode(uint8Array);
17118
- fromBase64 = (string) => this.encoded = index$2.decode(string);
17119
- toBase58 = (uint8Array) => this.decoded = base58$1.encode(uint8Array);
17120
- fromBase58 = (string) => this.encoded = base58$1.decode(string);
17121
- toBase32 = (uint8Array) => this.decoded = index$5.encode(uint8Array);
17122
- fromBase32 = (string) => this.encoded = index$5.decode(string);
17123
- toBase16 = (uint8Array) => this.decoded = index$3.encode(uint8Array);
17124
- fromBase16 = (string) => this.decoded = index$3.decode(string);
17125
- };
17126
16865
  var index$1 = {
17127
- fromString: fromString$1,
17128
- toString: toString$3,
17129
- fromHex,
17130
- toHex: toHex$1,
17131
- fromArrayLike,
17132
- toArrayLike,
17133
- fromUintArrayString,
17134
- toUintArrayString,
17135
- toObject,
17136
- toBinary,
17137
- fromBinary,
17138
- toBase64,
17139
- fromBase64,
17140
- toBase58,
17141
- fromBase58,
17142
- toBase32,
17143
- fromBase32,
17144
- toBase16,
17145
- fromBase16,
17146
- FormatInterface: FormatInterface$2
17147
- };
16866
+ toString: toString$3};
17148
16867
 
17149
16868
  var bn = {exports: {}};
17150
16869
 
@@ -21128,7 +20847,7 @@ class BigNumber {
21128
20847
  if (value % 1) {
21129
20848
  throwFault("underflow", "BigNumber.from", value);
21130
20849
  }
21131
- if (value >= MAX_SAFE || value <= -MAX_SAFE) {
20850
+ if (value >= MAX_SAFE || value <= -9007199254740991) {
21132
20851
  throwFault("overflow", "BigNumber.from", value);
21133
20852
  }
21134
20853
  return BigNumber.from(String(value));
@@ -25326,15 +25045,12 @@ var Deflate_1$1 = Deflate$1;
25326
25045
  var deflate_2 = deflate$1;
25327
25046
  var deflateRaw_1$1 = deflateRaw$1;
25328
25047
  var gzip_1$1 = gzip$1;
25329
- var constants$1 = constants$2;
25330
25048
 
25331
25049
  var deflate_1$1 = {
25332
25050
  Deflate: Deflate_1$1,
25333
25051
  deflate: deflate_2,
25334
25052
  deflateRaw: deflateRaw_1$1,
25335
- gzip: gzip_1$1,
25336
- constants: constants$1
25337
- };
25053
+ gzip: gzip_1$1};
25338
25054
 
25339
25055
  // (C) 1995-2013 Jean-loup Gailly and Mark Adler
25340
25056
  // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
@@ -28064,15 +27780,12 @@ var Inflate_1$1 = Inflate$1;
28064
27780
  var inflate_2 = inflate$1;
28065
27781
  var inflateRaw_1$1 = inflateRaw$1;
28066
27782
  var ungzip$1 = inflate$1;
28067
- var constants = constants$2;
28068
27783
 
28069
27784
  var inflate_1$1 = {
28070
27785
  Inflate: Inflate_1$1,
28071
27786
  inflate: inflate_2,
28072
27787
  inflateRaw: inflateRaw_1$1,
28073
- ungzip: ungzip$1,
28074
- constants: constants
28075
- };
27788
+ ungzip: ungzip$1};
28076
27789
 
28077
27790
  const { Deflate, deflate, deflateRaw, gzip } = deflate_1$1;
28078
27791
 
@@ -28102,8 +27815,7 @@ var pako = {
28102
27815
  constants: constants_1
28103
27816
  };
28104
27817
 
28105
- const { fromString, toString } = index$1;
28106
- const isJson = (type) => type === 'object' || 'array';
27818
+ const { toString } = index$1;
28107
27819
  const isString = (type) => type === 'string';
28108
27820
  const isNumber = (type) => type === 'number';
28109
27821
  const isBoolean = (type) => type === 'boolean';
@@ -28159,12 +27871,12 @@ const encode = (proto, input, compress) => {
28159
27871
  // when data is undefined push the default value of the proto
28160
27872
  set.push(toType(data || values[i]));
28161
27873
  }
28162
- return compress ? pako.deflate(index$3$1(set)) : index$3$1(set);
27874
+ return compress ? pako.deflate(index$3(set)) : index$3(set);
28163
27875
  };
28164
27876
  const decode = (proto, uint8Array, compressed) => {
28165
27877
  if (compressed)
28166
27878
  uint8Array = pako.inflate(uint8Array);
28167
- let deconcated = index$2$1(uint8Array);
27879
+ let deconcated = index$2(uint8Array);
28168
27880
  const output = {};
28169
27881
  const keys = Object.keys(proto);
28170
27882
  const values = Object.values(proto);
@@ -28182,8 +27894,7 @@ const decode = (proto, uint8Array, compressed) => {
28182
27894
  output[token.key] = Number(new TextDecoder().decode(deconcated[i]));
28183
27895
  else if (isBigNumber(token.type))
28184
27896
  output[token.key] = BigNumber.from(new TextDecoder().decode(deconcated[i]));
28185
- else if (isJson(token.type))
28186
- output[token.key] = JSON.parse(new TextDecoder().decode(deconcated[i]));
27897
+ else output[token.key] = JSON.parse(new TextDecoder().decode(deconcated[i]));
28187
27898
  if (token.optional) {
28188
27899
  if (!output[token.key] || output[token.key].length === 0)
28189
27900
  delete output[token.key];
@@ -28891,140 +28602,140 @@ let FormatInterface$1 = class FormatInterface extends BasicInterface {
28891
28602
  const FormatInterface = FormatInterface$1;
28892
28603
  const Codec = Codec$1;
28893
28604
 
28894
- const BufferToUint8Array = (data) => {
28895
- if (data.type === 'Buffer') {
28896
- data = new Uint8Array(data.data);
28897
- }
28898
- return data
28899
- };
28900
-
28901
- const protoFor = (message) => {
28902
- const codec = new Codec(message);
28903
- if (!codec.name) throw new Error(`proto not found ${message}`)
28904
- const Proto = globalThis.peernet.protos[codec.name];
28905
- if (!Proto) throw new Error(`No proto defined for ${codec.name}`)
28906
- return new Proto(message)
28907
- };
28908
-
28909
- /**
28910
- * wether or not a peernet daemon is active
28911
- * @return {Boolean}
28912
- */
28913
- const hasDaemon = async () => {
28914
- try {
28915
- let response = await fetch('http://127.0.0.1:1000/api/version');
28916
- response = await response.json();
28917
- return Boolean(response.client === '@peernet/api/http')
28918
- } catch (e) {
28919
- return false
28920
- }
28921
- };
28922
-
28923
- const https = () => {
28924
- if (!globalThis.location) return false
28925
- return Boolean(globalThis.location.protocol === 'https:')
28926
- };
28927
-
28928
- /**
28929
- * Get current environment
28930
- * @return {String} current environment [node, electron, browser]
28931
- */
28932
- const environment = () => {
28933
- const _navigator = globalThis.navigator;
28934
- if (!_navigator) {
28935
- return 'node'
28936
- } else if (_navigator && /electron/i.test(_navigator.userAgent)) {
28937
- return 'electron'
28938
- } else {
28939
- return 'browser'
28940
- }
28941
- };
28942
-
28943
- /**
28944
- * * Get current environment
28945
- * @return {Object} result
28946
- * @property {Boolean} reult.daemon whether or not daemon is running
28947
- * @property {Boolean} reult.environment Current environment
28948
- */
28949
- const target = async () => {
28950
- let daemon = false;
28951
- if (!https()) daemon = await hasDaemon();
28952
-
28953
- return { daemon, environment: environment() }
28605
+ const BufferToUint8Array = (data) => {
28606
+ if (data.type === 'Buffer') {
28607
+ data = new Uint8Array(data.data);
28608
+ }
28609
+ return data
28954
28610
  };
28955
28611
 
28956
- class PeerDiscovery {
28957
- constructor(id) {
28958
- this.id = id;
28959
- }
28960
-
28961
- _getPeerId(id) {
28962
- if (!peernet.peerMap || (peernet.peerMap && peernet.peerMap.size === 0)) return false
28963
-
28964
- for (const entry of [...peernet.peerMap.entries()]) {
28965
- for (const _id of entry[1]) {
28966
- if (_id === id) return entry[0]
28967
- }
28968
- }
28969
- }
28970
-
28971
- async discover(peer) {
28972
- let id = this._getPeerId(peer.id);
28973
- if (id) return id
28974
- const data = await new peernet.protos['peernet-peer']({ id: this.id });
28975
- const node = await peernet.prepareMessage(peer.id, data.encoded);
28976
-
28977
- let response = await peer.request(node.encoded);
28978
- response = await protoFor(response);
28979
- response = await new peernet.protos['peernet-peer-response'](response.decoded.data);
28980
-
28981
- id = response.decoded.id;
28982
- if (id === this.id) return
28983
-
28984
- if (!peernet.peerMap.has(id)) peernet.peerMap.set(id, [peer.id]);
28985
- else {
28986
- const connections = peernet.peerMap.get(id);
28987
- if (connections.indexOf(peer.id) === -1) {
28988
- connections.push(peer.id);
28989
- peernet.peerMap.set(peer.id, connections);
28990
- }
28991
- }
28992
- return id
28993
- }
28994
-
28995
- async discoverHandler(message, peer) {
28996
- const { id, proto } = message;
28997
- // if (typeof message.data === 'string') message.data = Buffer.from(message.data)
28998
- if (proto.name === 'peernet-peer') {
28999
- const from = proto.decoded.id;
29000
- if (from === this.id) return
29001
-
29002
- if (!peernet.peerMap.has(from)) peernet.peerMap.set(from, [peer.id]);
29003
- else {
29004
- const connections = peernet.peerMap.get(from);
29005
- if (connections.indexOf(peer.id) === -1) {
29006
- connections.push(peer.id);
29007
- peernet.peerMap.set(from, connections);
29008
- }
29009
- }
29010
- const data = await new peernet.protos['peernet-peer-response']({ id: this.id });
29011
- const node = await peernet.prepareMessage(from, data.encoded);
29012
-
29013
- peer.write(Buffer.from(JSON.stringify({ id, data: node.encoded })));
29014
- } else if (proto.name === 'peernet-peer-response') {
29015
- const from = proto.decoded.id;
29016
- if (from === this.id) return
29017
-
29018
- if (!peernet.peerMap.has(from)) peernet.peerMap.set(from, [peer.id]);
29019
- else {
29020
- const connections = peernet.peerMap.get(from);
29021
- if (connections.indexOf(peer.id) === -1) {
29022
- connections.push(peer.id);
29023
- peernet.peerMap.set(from, connections);
29024
- }
29025
- }
29026
- }
29027
- }
28612
+ const protoFor = (message) => {
28613
+ const codec = new Codec(message);
28614
+ if (!codec.name) throw new Error(`proto not found ${message}`)
28615
+ const Proto = globalThis.peernet.protos[codec.name];
28616
+ if (!Proto) throw new Error(`No proto defined for ${codec.name}`)
28617
+ return new Proto(message)
28618
+ };
28619
+
28620
+ /**
28621
+ * wether or not a peernet daemon is active
28622
+ * @return {Boolean}
28623
+ */
28624
+ const hasDaemon = async () => {
28625
+ try {
28626
+ let response = await fetch('http://127.0.0.1:1000/api/version');
28627
+ response = await response.json();
28628
+ return Boolean(response.client === '@peernet/api/http')
28629
+ } catch (e) {
28630
+ return false
28631
+ }
28632
+ };
28633
+
28634
+ const https = () => {
28635
+ if (!globalThis.location) return false
28636
+ return Boolean(globalThis.location.protocol === 'https:')
28637
+ };
28638
+
28639
+ /**
28640
+ * Get current environment
28641
+ * @return {String} current environment [node, electron, browser]
28642
+ */
28643
+ const environment = () => {
28644
+ const _navigator = globalThis.navigator;
28645
+ if (!_navigator) {
28646
+ return 'node'
28647
+ } else if (_navigator && /electron/i.test(_navigator.userAgent)) {
28648
+ return 'electron'
28649
+ } else {
28650
+ return 'browser'
28651
+ }
28652
+ };
28653
+
28654
+ /**
28655
+ * * Get current environment
28656
+ * @return {Object} result
28657
+ * @property {Boolean} reult.daemon whether or not daemon is running
28658
+ * @property {Boolean} reult.environment Current environment
28659
+ */
28660
+ const target = async () => {
28661
+ let daemon = false;
28662
+ if (!https()) daemon = await hasDaemon();
28663
+
28664
+ return { daemon, environment: environment() }
28665
+ };
28666
+
28667
+ class PeerDiscovery {
28668
+ constructor(id) {
28669
+ this.id = id;
28670
+ }
28671
+
28672
+ _getPeerId(id) {
28673
+ if (!peernet.peerMap || (peernet.peerMap && peernet.peerMap.size === 0)) return false
28674
+
28675
+ for (const entry of [...peernet.peerMap.entries()]) {
28676
+ for (const _id of entry[1]) {
28677
+ if (_id === id) return entry[0]
28678
+ }
28679
+ }
28680
+ }
28681
+
28682
+ async discover(peer) {
28683
+ let id = this._getPeerId(peer.id);
28684
+ if (id) return id
28685
+ const data = await new peernet.protos['peernet-peer']({ id: this.id });
28686
+ const node = await peernet.prepareMessage(peer.id, data.encoded);
28687
+
28688
+ let response = await peer.request(node.encoded);
28689
+ response = await protoFor(response);
28690
+ response = await new peernet.protos['peernet-peer-response'](response.decoded.data);
28691
+
28692
+ id = response.decoded.id;
28693
+ if (id === this.id) return
28694
+
28695
+ if (!peernet.peerMap.has(id)) peernet.peerMap.set(id, [peer.id]);
28696
+ else {
28697
+ const connections = peernet.peerMap.get(id);
28698
+ if (connections.indexOf(peer.id) === -1) {
28699
+ connections.push(peer.id);
28700
+ peernet.peerMap.set(peer.id, connections);
28701
+ }
28702
+ }
28703
+ return id
28704
+ }
28705
+
28706
+ async discoverHandler(message, peer) {
28707
+ const { id, proto } = message;
28708
+ // if (typeof message.data === 'string') message.data = Buffer.from(message.data)
28709
+ if (proto.name === 'peernet-peer') {
28710
+ const from = proto.decoded.id;
28711
+ if (from === this.id) return
28712
+
28713
+ if (!peernet.peerMap.has(from)) peernet.peerMap.set(from, [peer.id]);
28714
+ else {
28715
+ const connections = peernet.peerMap.get(from);
28716
+ if (connections.indexOf(peer.id) === -1) {
28717
+ connections.push(peer.id);
28718
+ peernet.peerMap.set(from, connections);
28719
+ }
28720
+ }
28721
+ const data = await new peernet.protos['peernet-peer-response']({ id: this.id });
28722
+ const node = await peernet.prepareMessage(from, data.encoded);
28723
+
28724
+ peer.write(Buffer.from(JSON.stringify({ id, data: node.encoded })));
28725
+ } else if (proto.name === 'peernet-peer-response') {
28726
+ const from = proto.decoded.id;
28727
+ if (from === this.id) return
28728
+
28729
+ if (!peernet.peerMap.has(from)) peernet.peerMap.set(from, [peer.id]);
28730
+ else {
28731
+ const connections = peernet.peerMap.get(from);
28732
+ if (connections.indexOf(peer.id) === -1) {
28733
+ connections.push(peer.id);
28734
+ peernet.peerMap.set(from, connections);
28735
+ }
28736
+ }
28737
+ }
28738
+ }
29028
28739
  }
29029
28740
 
29030
28741
  /**
@@ -29036,12 +28747,7 @@ const lastFetched = {
29036
28747
  address: {
29037
28748
  value: undefined,
29038
28749
  timestamp: 0
29039
- },
29040
- ptr: {
29041
- value: undefined,
29042
- timestamp: 0
29043
- }
29044
- };
28750
+ }};
29045
28751
  const fetchedCoordinates = {};
29046
28752
  const getAddress = async () => {
29047
28753
  const { address } = lastFetched;
@@ -29136,60 +28842,60 @@ class DhtEarth {
29136
28842
  }
29137
28843
  }
29138
28844
 
29139
- class MessageHandler {
29140
- constructor(network) {
29141
- this.network = network;
29142
- }
29143
- /**
29144
- * hash and sign message
29145
- *
29146
- * @param {object} message
29147
- * @param {Buffer} message.from peer id
29148
- * @param {Buffer} message.to peer id
29149
- * @param {string} message.data Peernet message
29150
- * (PeernetMessage excluded) encoded as a string
29151
- * @return message
29152
- */
29153
- async hashAndSignMessage(message) {
29154
- const hash = await message.peernetHash;
29155
- message.decoded.signature = globalThis.identity.sign(hash.buffer);
29156
- return message
29157
- }
29158
-
29159
- /**
29160
- * @param {String} from - peer id
29161
- * @param {String} to - peer id
29162
- * @param {String|PeernetMessage} data - data encoded message string
29163
- * or the messageNode itself
29164
- */
29165
- async prepareMessage(message) {
29166
- if (message.keys.includes('signature')) {
29167
- message = await this.hashAndSignMessage(message);
29168
- }
29169
-
29170
- return message
29171
- }
28845
+ class MessageHandler {
28846
+ constructor(network) {
28847
+ this.network = network;
28848
+ }
28849
+ /**
28850
+ * hash and sign message
28851
+ *
28852
+ * @param {object} message
28853
+ * @param {Buffer} message.from peer id
28854
+ * @param {Buffer} message.to peer id
28855
+ * @param {string} message.data Peernet message
28856
+ * (PeernetMessage excluded) encoded as a string
28857
+ * @return message
28858
+ */
28859
+ async hashAndSignMessage(message) {
28860
+ const hash = await message.peernetHash;
28861
+ message.decoded.signature = globalThis.identity.sign(hash.buffer);
28862
+ return message
28863
+ }
28864
+
28865
+ /**
28866
+ * @param {String} from - peer id
28867
+ * @param {String} to - peer id
28868
+ * @param {String|PeernetMessage} data - data encoded message string
28869
+ * or the messageNode itself
28870
+ */
28871
+ async prepareMessage(message) {
28872
+ if (message.keys.includes('signature')) {
28873
+ message = await this.hashAndSignMessage(message);
28874
+ }
28875
+
28876
+ return message
28877
+ }
29172
28878
  }
29173
28879
 
29174
- const dataHandler = async (message) => {
29175
- if (!message) return
29176
-
29177
- try {
29178
- const { data, id, from, peer } = message;
29179
- const proto = await protoFor(data);
29180
- peernet._protoHandler({ id, proto }, peernet.connections[from] || peer, from);
29181
- } catch (error) {
29182
- console.error(error);
29183
- }
28880
+ const dataHandler = async (message) => {
28881
+ if (!message) return
28882
+
28883
+ try {
28884
+ const { data, id, from, peer } = message;
28885
+ const proto = await protoFor(data);
28886
+ peernet._protoHandler({ id, proto }, peernet.connections[from] || peer, from);
28887
+ } catch (error) {
28888
+ console.error(error);
28889
+ }
29184
28890
  };
29185
28891
 
29186
- const dhtError = (proto) => {
29187
- const text = `Received proto ${proto.name} expected peernet-dht-response`;
29188
- return new Error(`Routing error: ${text}`)
29189
- };
29190
-
29191
- const nothingFoundError = (hash) => {
29192
- return new Error(`nothing found for ${hash}`)
28892
+ const dhtError = (proto) => {
28893
+ const text = `Received proto ${proto.name} expected peernet-dht-response`;
28894
+ return new Error(`Routing error: ${text}`)
28895
+ };
28896
+
28897
+ const nothingFoundError = (hash) => {
28898
+ return new Error(`nothing found for ${hash}`)
29193
28899
  };
29194
28900
 
29195
28901
  const isBrowser = globalThis.process?.versions?.node ? false : true;
@@ -29410,7 +29116,7 @@ class Peernet {
29410
29116
  * @return {Array} peerId
29411
29117
  */
29412
29118
  get peers() {
29413
- return Object.entries(this.client?.connections);
29119
+ return Object.entries(this.client?.connections || {});
29414
29120
  }
29415
29121
  get connections() {
29416
29122
  return this.client?.connections || {};
@@ -29434,7 +29140,7 @@ class Peernet {
29434
29140
  this.root = options.root;
29435
29141
  const { RequestMessage, ResponseMessage, PeerMessage, PeerMessageResponse, PeernetMessage, DHTMessage, DHTMessageResponse, DataMessage, DataMessageResponse, PsMessage, ChatMessage, PeernetFile
29436
29142
  // FolderMessageResponse
29437
- } = await import(/* webpackChunkName: "messages" */ './messages-RYLqPGkg-Da9CI_ow.js');
29143
+ } = await import(/* webpackChunkName: "messages" */ './messages-BdevLRCA-C7ieSv6K.js');
29438
29144
  /**
29439
29145
  * proto Object containing protos
29440
29146
  * @type {Object}
@@ -29528,7 +29234,7 @@ class Peernet {
29528
29234
  if (this.#starting || this.#started)
29529
29235
  return;
29530
29236
  this.#starting = true;
29531
- const importee = await import('./client-Depp28gl-DItJEEYa.js');
29237
+ const importee = await import('./client-C0VVXIWm-03WylCa-.js');
29532
29238
  /**
29533
29239
  * @access public
29534
29240
  * @type {PeernetClient}
@@ -30016,19 +29722,7 @@ globalThis.Peernet = Peernet;
30016
29722
  // maybe a good way to handle could be in p2pt-swarm
30017
29723
  var networks = {
30018
29724
  leofcoin: {
30019
- mainnet: {
30020
- // ports don't really matter since it is favorable to have it begind a ngninx proxy but if we change something to the proto it's easier maybe?
30021
- port: 44444,
30022
- // todo a versionhash would be nice to have as a double check?
30023
- versionHash: '0',
30024
- // a short description identifying the version
30025
- description: 'Main net current version',
30026
- stars: ['wss://star.leofcoin.org'] // todo webrtc and bittorent stars
30027
- },
30028
29725
  peach: {
30029
- port: 44444,
30030
- description: 'Main testnet: latest step before merging into main',
30031
- versionHash: '1',
30032
29726
  stars: ['wss://star.leofcoin.org'] // todo webrtc and bittorent stars
30033
29727
  }
30034
29728
  }
@@ -30037,7 +29731,7 @@ var networks = {
30037
29731
  const DEFAULT_NODE_OPTIONS = {
30038
29732
  network: 'leofcoin:peach',
30039
29733
  networkVersion: 'peach',
30040
- version: '1.2.1',
29734
+ version: '0.1.0',
30041
29735
  stars: networks.leofcoin.peach.stars
30042
29736
  };
30043
29737
 
@@ -30047,12 +29741,7 @@ class Node {
30047
29741
  constructor(config, password) {
30048
29742
  return this._init(config, password);
30049
29743
  }
30050
- async _init(config = {
30051
- network: 'leofcoin:peach',
30052
- networkVersion: 'peach',
30053
- version: '0.1.0',
30054
- stars: networks.leofcoin.peach.stars
30055
- }, password) {
29744
+ async _init(config = {}, password) {
30056
29745
  config = { ...DEFAULT_NODE_OPTIONS, ...config };
30057
29746
  this.#node = globalThis.Peernet
30058
29747
  ? await new globalThis.Peernet(config, password)