@leofcoin/chain 1.5.37 → 1.5.39

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 { B as BigNumber, L as Logger, v as version$1, h as hexZeroPad, i as isBigNumberish, a as arrayify, b as isBytes, T as TransactionMessage, t as toBase58, C as ContractMessage, R as RawTransactionMessage, c as BlockMessage, d as BWMessage, e as BWRequestMessage } from './index-4420907d.js';
1
+ import { B as BigNumber, L as Logger, v as version$1, h as hexZeroPad, i as isBigNumberish, a as arrayify, b as isBytes, T as TransactionMessage, t as toBase58, C as ContractMessage, R as RawTransactionMessage, c as BlockMessage, d as BWMessage, e as BWRequestMessage } from './index-526fd466.js';
2
2
 
3
3
  const logger$1 = new Logger(version$1);
4
4
  const _constructorGuard = {};
@@ -1496,12 +1496,14 @@ class State extends Contract {
1496
1496
  request: 'lastBlock'
1497
1497
  });
1498
1498
  let node = await globalThis.peernet.prepareMessage(data);
1499
+ console.log(node.encoded);
1500
+ console.log(node.encode());
1499
1501
  for (const peer of globalThis.peernet?.connections) {
1500
1502
  // @ts-ignore
1501
1503
  if (peer.connected && peer.version === this.version) {
1502
1504
  const task = async () => {
1503
1505
  try {
1504
- const result = await peer.request(node.encoded);
1506
+ const result = await peer.request(node.encode());
1505
1507
  return { result: Uint8Array.from(Object.values(result)), peer };
1506
1508
  }
1507
1509
  catch (error) {
@@ -103,15 +103,18 @@ class LittlePubSub {
103
103
  if (this.subscribers[event].handlers.length === 0)
104
104
  delete this.subscribers[event];
105
105
  }
106
- publish(event, change) {
106
+ publish(event, value) {
107
+ // always set value even when having no subscribers
107
108
  if (!this.hasSubscribers(event))
108
- return;
109
- if (this.verbose || this.subscribers[event]?.value !== change) {
110
- this.subscribers[event].value = change;
111
- this.subscribers[event].handlers.forEach((handler) => {
112
- handler(change, this.subscribers[event].value);
113
- });
114
- }
109
+ this.subscribers[event] = {
110
+ handlers: []
111
+ };
112
+ const oldValue = this.subscribers[event]?.value;
113
+ this.subscribers[event].value = value;
114
+ if (this.verbose || oldValue !== value)
115
+ for (const handler of this.subscribers[event].handlers) {
116
+ handler(value, oldValue);
117
+ }
115
118
  }
116
119
  once(event) {
117
120
  return new Promise((resolve) => {
@@ -270,53 +273,61 @@ const base = (ALPHABET) => {
270
273
  const ALPHABET$3 = '0123456789ABCDEF';
271
274
  base(ALPHABET$3);
272
275
 
273
- const ALPHABET$2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567';
274
- const ALPHABET_HEX$1 = '0123456789ABCDEFGHIJKLMNOPQRSTUV';
275
- base(ALPHABET$2);
276
+ const ALPHABET$2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
277
+ const ALPHABET_HEX$1 = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
278
+ base(ALPHABET$2);
276
279
  base(ALPHABET_HEX$1);
277
280
 
278
- var ALPHABET$1 = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
279
- var ALPHABET_HEX = '0123456789ABCDEFGHJKLMNPQRSTUVabcdefghijklmnopqrstuv';
280
- var base58 = base(ALPHABET$1);
281
- var base58Hex = base(ALPHABET_HEX);
282
- var encode = base58.encode;
283
- var decode = base58.decode;
284
- var encodeHex = base58Hex.encode;
285
- var decodeHex = base58Hex.decode;
286
- var isBase58 = function (string) {
287
- try {
288
- decode(string);
289
- return true;
290
- }
291
- catch (e) {
292
- return false;
293
- }
294
- };
295
- var isBase58Hex = function (string) {
296
- try {
297
- decodeHex(string);
298
- return true;
299
- }
300
- catch (e) {
301
- return false;
302
- }
303
- };
304
- var whatType = function (string) {
305
- try {
306
- decode(string);
307
- return 'base58';
308
- }
309
- catch (e) {
310
- try {
311
- decodeHex(string);
312
- return 'base58Hex';
313
- }
314
- catch (_a) {
315
- return;
316
- }
317
- }
318
- };
319
- var base58$1 = { encode: encode, decode: decode, isBase58: isBase58, isBase58Hex: isBase58Hex, encodeHex: encodeHex, decodeHex: decodeHex, whatType: whatType };
281
+ const ALPHABET$1 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
282
+ const ALPHABET_HEX = "0123456789ABCDEFGHJKLMNPQRSTUVabcdefghijklmnopqrstuv";
283
+ const base58 = base(ALPHABET$1);
284
+ const base58Hex = base(ALPHABET_HEX);
285
+ const encode = base58.encode;
286
+ const decode = base58.decode;
287
+ const encodeHex = base58Hex.encode;
288
+ const decodeHex = base58Hex.decode;
289
+ const isBase58 = (string) => {
290
+ try {
291
+ decode(string);
292
+ return true;
293
+ }
294
+ catch (e) {
295
+ return false;
296
+ }
297
+ };
298
+ const isBase58Hex = (string) => {
299
+ try {
300
+ decodeHex(string);
301
+ return true;
302
+ }
303
+ catch (e) {
304
+ return false;
305
+ }
306
+ };
307
+ const whatType = (string) => {
308
+ try {
309
+ decode(string);
310
+ return "base58";
311
+ }
312
+ catch (e) {
313
+ try {
314
+ decodeHex(string);
315
+ return "base58Hex";
316
+ }
317
+ catch {
318
+ return;
319
+ }
320
+ }
321
+ };
322
+ var base58$1 = {
323
+ encode,
324
+ decode,
325
+ isBase58,
326
+ isBase58Hex,
327
+ encodeHex,
328
+ decodeHex,
329
+ whatType,
330
+ };
320
331
 
321
332
  const ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_';
322
333
  base(ALPHABET);
@@ -467,18 +478,20 @@ let P2PT$1 = class P2PT extends EventEmitter {
467
478
  infoHash;
468
479
  _infoHashBuffer;
469
480
  _infoHashBinary;
481
+ #maxPeerChannels;
470
482
  /**
471
483
  *
472
484
  * @param array announceURLs List of announce tracker URLs
473
485
  * @param string identifierString Identifier used to discover peers in the network
474
486
  */
475
- constructor(announceURLs = [], identifierString = '', peerId) {
487
+ constructor(announceURLs = [], identifierString = '', peerId, maxPeerChannels = 5) {
476
488
  super();
477
489
  this.announceURLs = announceURLs;
478
490
  this.trackers = {};
479
491
  this.peers = {};
480
492
  this.msgChunks = {};
481
493
  this.responseWaiting = {};
494
+ this.#maxPeerChannels = maxPeerChannels;
482
495
  if (identifierString) {
483
496
  this.setIdentifier(identifierString);
484
497
  }
@@ -497,83 +510,94 @@ let P2PT$1 = class P2PT extends EventEmitter {
497
510
  this._infoHashBuffer = hex2arr(this.infoHash);
498
511
  this._infoHashBinary = hex2bin(this.infoHash);
499
512
  }
500
- /**
501
- * Connect to network and start discovering peers
502
- */
503
- start() {
504
- this.on('peer', peer => {
505
- peer.on('connect', () => {
506
- let newpeer = false;
507
- /**
508
- * peer connected or reconnected
509
- * Sometimes peers reconnect so need to handle the newpeer here
510
- */
511
- if (!this.peers[peer.id]) {
512
- newpeer = true;
513
- this.peers[peer.id] = {};
514
- if (!this.responseWaiting[peer.id])
515
- this.responseWaiting[peer.id] = {};
516
- }
517
- /**
518
- * Multiple data channels to one peer is possible
519
- * The `peer` object actually refers to a peer with a data channel. Even though it may have same `id` (peerID) property, the data channel will be different. Different trackers giving the same "peer" will give the `peer` object with different channels.
520
- * We will store all channels as backups in case any one of them fails
521
- * A peer is removed if all data channels become unavailable
522
- */
523
- this.peers[peer.id][peer.channelName] = peer;
524
- if (newpeer) {
525
- this.emit('peerconnect', peer);
526
- }
527
- });
528
- peer.on('data', data => {
529
- this.emit('data', peer, data);
530
- data = data.toString();
531
- debug('got a message from ' + peer.id);
532
- if (data[0] === JSON_MESSAGE_IDENTIFIER) {
533
- try {
534
- data = JSON.parse(data.slice(1));
535
- // A respond function
536
- peer.respond = this._peerRespond(peer, data.id);
537
- let msg = this._chunkHandler(data);
538
- // msg fully retrieved
539
- if (msg !== false) {
540
- if (data.o) {
541
- msg = JSON.parse(msg);
542
- }
543
- /**
544
- * If there's someone waiting for a response, call them
545
- */
546
- if (this.responseWaiting[peer.id] && this.responseWaiting[peer.id][data.id]) {
547
- this.responseWaiting[peer.id][data.id]([peer, msg]);
548
- delete this.responseWaiting[peer.id][data.id];
549
- }
550
- else {
551
- this.emit('msg', peer, msg, data.id, data.from);
552
- }
553
- this._destroyChunks(data.id);
554
- }
513
+ #onPeerConnect = (peer) => {
514
+ let newpeer = false;
515
+ /**
516
+ * peer connected or reconnected
517
+ * Sometimes peers reconnect so need to handle the newpeer here
518
+ */
519
+ if (!this.peers[peer.id]) {
520
+ newpeer = true;
521
+ this.peers[peer.id] = {};
522
+ if (!this.responseWaiting[peer.id])
523
+ this.responseWaiting[peer.id] = {};
524
+ }
525
+ /**
526
+ * Multiple data channels to one peer is possible
527
+ * The `peer` object actually refers to a peer with a data channel. Even though it may have same `id` (peerID) property, the data channel will be different. Different trackers giving the same "peer" will give the `peer` object with different channels.
528
+ * We will store all channels as backups in case any one of them fails
529
+ * A peer is removed if all data channels become unavailable
530
+ */
531
+ for (const channelName in this.peers[peer.id]) {
532
+ if (!this.peers[peer.id][channelName].connected) {
533
+ this.peers[peer.id][channelName].destroy();
534
+ }
535
+ }
536
+ if (Object.keys(this.peers[peer.id]).length < this.#maxPeerChannels)
537
+ this.peers[peer.id][peer.channelName] = peer;
538
+ else
539
+ peer.destroy();
540
+ if (newpeer) {
541
+ this.emit('peerconnect', peer);
542
+ }
543
+ };
544
+ #onPeerData = (peer, data) => {
545
+ this.emit('data', peer, data);
546
+ data = data.toString();
547
+ debug('got a message from ' + peer.id);
548
+ if (data[0] === JSON_MESSAGE_IDENTIFIER) {
549
+ try {
550
+ data = JSON.parse(data.slice(1));
551
+ // A respond function
552
+ peer.respond = this._peerRespond(peer, data.id);
553
+ let msg = this._chunkHandler(data);
554
+ // msg fully retrieved
555
+ if (msg !== false) {
556
+ if (data.o) {
557
+ msg = JSON.parse(msg);
558
+ }
559
+ /**
560
+ * If there's someone waiting for a response, call them
561
+ */
562
+ if (this.responseWaiting[peer.id] && this.responseWaiting[peer.id][data.id]) {
563
+ this.responseWaiting[peer.id][data.id]([peer, msg]);
564
+ delete this.responseWaiting[peer.id][data.id];
555
565
  }
556
- catch (e) {
557
- console.log(e);
566
+ else {
567
+ this.emit('msg', peer, msg, data.id, data.from);
558
568
  }
569
+ this._destroyChunks(data.id);
559
570
  }
560
- });
561
- peer.on('error', err => {
562
- this._removePeer(peer);
563
- debug('Error in connection : ' + err);
564
- });
565
- peer.on('close', () => {
566
- this._removePeer(peer);
567
- debug('Connection closed with ' + peer.id);
568
- });
571
+ }
572
+ catch (e) {
573
+ console.log(e);
574
+ }
575
+ }
576
+ };
577
+ #onPeer = (peer) => {
578
+ peer.on('connect', () => this.#onPeerConnect(peer));
579
+ peer.on('data', (data) => this.#onPeerData(peer, data));
580
+ peer.on('error', (err) => {
581
+ this._removePeer(peer);
582
+ debug('Error in connection : ' + err);
569
583
  });
584
+ peer.on('close', () => {
585
+ this._removePeer(peer);
586
+ debug('Connection closed with ' + peer.id);
587
+ });
588
+ };
589
+ /**
590
+ * Connect to network and start discovering peers
591
+ */
592
+ start() {
593
+ this.on('peer', this.#onPeer);
570
594
  // Tracker responded to the announce request
571
- this.on('update', response => {
595
+ this.on('update', (response) => {
572
596
  const tracker = this.trackers[this.announceURLs.indexOf(response.announce)];
573
597
  this.emit('trackerconnect', tracker, this.getTrackerStats());
574
598
  });
575
599
  // Errors in tracker connection
576
- this.on('warning', err => {
600
+ this.on('warning', (err) => {
577
601
  this.emit('trackerwarning', err, this.getTrackerStats());
578
602
  });
579
603
  this._fetchPeers();
@@ -611,7 +635,10 @@ let P2PT$1 = class P2PT extends EventEmitter {
611
635
  if (!this.peers[peer.id]) {
612
636
  return false;
613
637
  }
614
- delete this.peers[peer.id][peer.channelName];
638
+ if (this.peers[peer.id][peer.channelName]) {
639
+ this.peers[peer.id][peer.channelName].destroy();
640
+ delete this.peers[peer.id][peer.channelName];
641
+ }
615
642
  // All data channels are gone. Peer lost
616
643
  if (Object.keys(this.peers[peer.id]).length === 0) {
617
644
  this.emit('peerclose', peer);
@@ -665,8 +692,13 @@ let P2PT$1 = class P2PT extends EventEmitter {
665
692
  * Array should atleast have one channel, otherwise peer connection is closed
666
693
  */
667
694
  if (!peer.connected) {
668
- for (const index in this.peers[peer.id]) {
695
+ for (const index in { ...this.peers[peer.id] }) {
669
696
  peer = this.peers[peer.id][index];
697
+ /**
698
+ * directly cleanup channels
699
+ */
700
+ if (!peer.connected)
701
+ this._removePeer(peer);
670
702
  if (peer.connected)
671
703
  break;
672
704
  }
@@ -687,7 +719,7 @@ let P2PT$1 = class P2PT extends EventEmitter {
687
719
  * Request more peers
688
720
  */
689
721
  requestMorePeers() {
690
- return new Promise(resolve => {
722
+ return new Promise((resolve) => {
691
723
  for (const key in this.trackers) {
692
724
  this.trackers[key].announce(this._defaultAnnounceOpts());
693
725
  }
@@ -729,7 +761,7 @@ let P2PT$1 = class P2PT extends EventEmitter {
729
761
  * @param integer msgID Message ID
730
762
  */
731
763
  _peerRespond(peer, msgID) {
732
- return msg => {
764
+ return (msg) => {
733
765
  return this.send(peer, msg, msgID);
734
766
  };
735
767
  }
@@ -763,7 +795,7 @@ let P2PT$1 = class P2PT extends EventEmitter {
763
795
  */
764
796
  _defaultAnnounceOpts(options = {}) {
765
797
  if (options.numwant === undefined)
766
- options.numwant = 50;
798
+ options.numwant = 5;
767
799
  if (options.uploaded === undefined)
768
800
  options.uploaded = 0;
769
801
  if (options.downloaded === undefined)
@@ -1231,7 +1263,7 @@ class WebSocketTracker extends Tracker {
1231
1263
  if (data.complete != null) {
1232
1264
  const response = Object.assign({}, data, {
1233
1265
  announce: this.announceUrl,
1234
- infoHash: data.info_hash
1266
+ infoHash: common.binaryToHex(data.info_hash)
1235
1267
  });
1236
1268
  this.client.emit('update', response);
1237
1269
  }
@@ -1,5 +1,5 @@
1
- import { M as MultiWallet, e as encrypt, b as base58$1 } from './node-browser-1bc3977e.js';
2
- import './index-4420907d.js';
1
+ import { M as MultiWallet, e as encrypt, b as base58$1 } from './node-browser-e7da3b14.js';
2
+ import './index-526fd466.js';
3
3
 
4
4
  /**
5
5
  * @params {String} network
@@ -12316,6 +12316,13 @@ class CodecHash extends BasicInterface {
12316
12316
  let FormatInterface$1 = class FormatInterface extends BasicInterface {
12317
12317
  hashFormat;
12318
12318
  #hash;
12319
+ #encoded;
12320
+ get encoded() {
12321
+ return this.#encoded || this.encode();
12322
+ }
12323
+ set encoded(value) {
12324
+ this.#encoded = value;
12325
+ }
12319
12326
  init(buffer) {
12320
12327
  if (buffer instanceof FormatInterface && buffer?.name === this.name)
12321
12328
  return buffer;
@@ -1,5 +1,5 @@
1
- import { F as FormatInterface } from './node-browser-1bc3977e.js';
2
- import './index-4420907d.js';
1
+ import { F as FormatInterface } from './node-browser-e7da3b14.js';
2
+ import './index-526fd466.js';
3
3
 
4
4
  var proto$b = {
5
5
  data: new Uint8Array(),
@@ -1,4 +1,4 @@
1
- import { C as ContractMessage, T as TransactionMessage, c as BlockMessage, d as BWMessage, e as BWRequestMessage, V as ValidatorMessage } from './index-4420907d.js';
1
+ import { C as ContractMessage, T as TransactionMessage, c as BlockMessage, d as BWMessage, e as BWRequestMessage, V as ValidatorMessage } from './index-526fd466.js';
2
2
 
3
3
  var nodeConfig = async (config = {
4
4
  network: 'leofcoin:peach',
@@ -11750,25 +11750,23 @@ var pako = {
11750
11750
  };
11751
11751
 
11752
11752
  const { fromString, toString } = index$3;
11753
- const isJson = (type) => type === "object" || "array";
11754
- const isString = (type) => type === "string";
11755
- const isNumber = (type) => type === "number";
11756
- const isBoolean = (type) => type === "boolean";
11757
- const isUint8Array$1 = (type) => type === "uint8Array";
11758
- const isBigNumber = (type) => type === "bigNumber";
11753
+ const isJson = (type) => type === 'object' || 'array';
11754
+ const isString = (type) => type === 'string';
11755
+ const isNumber = (type) => type === 'number';
11756
+ const isBoolean = (type) => type === 'boolean';
11757
+ const isUint8Array$1 = (type) => type === 'uint8Array';
11758
+ const isBigNumber = (type) => type === 'bigNumber';
11759
11759
  const tokenize = (key, value) => {
11760
- const optional = key.endsWith("?");
11760
+ const optional = key.endsWith('?');
11761
11761
  let type = value === undefined ? key : value;
11762
11762
  if (type instanceof Uint8Array)
11763
- type = "uint8Array";
11763
+ type = 'uint8Array';
11764
11764
  else if (type instanceof BigNumber)
11765
- type = "bigNumber";
11765
+ type = 'bigNumber';
11766
11766
  else
11767
- type = Array.isArray(type) ? "array" : typeof type;
11768
- const parts = key.split("?");
11769
- const minimumLength = parts[2]?.includes("min")
11770
- ? parts[2].split["min:"][1]
11771
- : 0;
11767
+ type = Array.isArray(type) ? 'array' : typeof type;
11768
+ const parts = key.split('?');
11769
+ const minimumLength = parts[2]?.includes('min') ? parts[2].split['min:'][1] : 0;
11772
11770
  return { type, optional, key: parts[0], minimumLength };
11773
11771
  };
11774
11772
  const toType = (data) => {
@@ -11782,13 +11780,13 @@ const toType = (data) => {
11782
11780
  if (data instanceof BigNumber)
11783
11781
  return new TextEncoder().encode(data._hex || data.toHexString());
11784
11782
  // returns the string as a UintArray
11785
- if (typeof data === "string")
11783
+ if (typeof data === 'string')
11786
11784
  return new TextEncoder().encode(data);
11787
11785
  // returns the object as a UintArray
11788
- if (typeof data === "object")
11786
+ if (typeof data === 'object')
11789
11787
  return new TextEncoder().encode(JSON.stringify(data));
11790
11788
  // returns the number as a UintArray
11791
- if (typeof data === "number" || typeof data === "boolean")
11789
+ if (typeof data === 'number' || typeof data === 'boolean')
11792
11790
  return new TextEncoder().encode(data.toString());
11793
11791
  throw new Error(`unsuported type ${typeof data || data}`);
11794
11792
  };
@@ -11801,17 +11799,14 @@ const encode$3 = (proto, input, compress) => {
11801
11799
  const data = input[token.key];
11802
11800
  if (!token.optional && data === undefined)
11803
11801
  throw new Error(`missing required property: ${token.key}`);
11804
- if ((token.type === "array" && token.minimumLength > data?.length) ||
11805
- (token.type === "object" &&
11806
- token.minimumLength > Object.keys(data).length))
11802
+ if ((token.type === 'array' && token.minimumLength > data?.length) ||
11803
+ (token.type === 'object' && token.minimumLength > Object.keys(data).length))
11807
11804
  throw new Error(`minimumLength for ${token.key} is set to ${token.minimumLength} but got ${data.length}`);
11808
11805
  // always push data to the set.
11809
11806
  // when data is undefined push the default value of the proto
11810
11807
  set.push(toType(data || values[i]));
11811
11808
  }
11812
- return compress
11813
- ? pako.deflate(index$7(set))
11814
- : index$7(set);
11809
+ return compress ? pako.deflate(index$7(set)) : index$7(set);
11815
11810
  };
11816
11811
  const decode$4 = (proto, uint8Array, compressed) => {
11817
11812
  if (compressed)
@@ -11829,7 +11824,7 @@ const decode$4 = (proto, uint8Array, compressed) => {
11829
11824
  else if (isString(token.type))
11830
11825
  output[token.key] = toString(deconcated[i]);
11831
11826
  else if (isBoolean(token.type))
11832
- output[token.key] = Boolean(new TextDecoder().decode(deconcated[i]));
11827
+ output[token.key] = new TextDecoder().decode(deconcated[i]) === 'true';
11833
11828
  else if (isNumber(token.type))
11834
11829
  output[token.key] = Number(new TextDecoder().decode(deconcated[i]));
11835
11830
  else if (isBigNumber(token.type))
@@ -11847,7 +11842,7 @@ const decode$4 = (proto, uint8Array, compressed) => {
11847
11842
  };
11848
11843
  var index$2 = {
11849
11844
  encode: encode$3,
11850
- decode: decode$4,
11845
+ decode: decode$4
11851
11846
  };
11852
11847
 
11853
11848
  class BasicInterface {
@@ -12398,6 +12393,13 @@ class CodecHash extends BasicInterface {
12398
12393
  let FormatInterface$1 = class FormatInterface extends BasicInterface {
12399
12394
  hashFormat;
12400
12395
  #hash;
12396
+ #encoded;
12397
+ get encoded() {
12398
+ return this.#encoded || this.encode();
12399
+ }
12400
+ set encoded(value) {
12401
+ this.#encoded = value;
12402
+ }
12401
12403
  init(buffer) {
12402
12404
  if (buffer instanceof FormatInterface && buffer?.name === this.name)
12403
12405
  return buffer;
@@ -12405,7 +12407,7 @@ let FormatInterface$1 = class FormatInterface extends BasicInterface {
12405
12407
  this.fromUint8Array(buffer);
12406
12408
  else if (buffer instanceof ArrayBuffer)
12407
12409
  this.fromArrayBuffer(buffer);
12408
- else if (typeof buffer === "string") {
12410
+ else if (typeof buffer === 'string') {
12409
12411
  if (this.isHex(buffer))
12410
12412
  this.fromHex(buffer);
12411
12413
  else if (this.isBase58(buffer))
@@ -12471,7 +12473,7 @@ let FormatInterface$1 = class FormatInterface extends BasicInterface {
12471
12473
  constructor(buffer, proto, options) {
12472
12474
  super();
12473
12475
  this.proto = proto;
12474
- this.hashFormat = options?.hashFormat ? options.hashFormat : "bs32";
12476
+ this.hashFormat = options?.hashFormat ? options.hashFormat : 'bs32';
12475
12477
  if (options?.name)
12476
12478
  this.name = options.name;
12477
12479
  this.init(buffer);
@@ -12480,13 +12482,16 @@ let FormatInterface$1 = class FormatInterface extends BasicInterface {
12480
12482
  const upper = this.hashFormat.charAt(0).toUpperCase();
12481
12483
  return `${upper}${this.hashFormat.substring(1, this.hashFormat.length)}`;
12482
12484
  }
12485
+ beforeHashing(decoded) {
12486
+ delete decoded.hash;
12487
+ return decoded;
12488
+ }
12483
12489
  /**
12484
12490
  * @return {PeernetHash}
12485
12491
  */
12486
12492
  get peernetHash() {
12487
- const decoded = this.decoded;
12493
+ const decoded = this.beforeHashing({ ...this.decoded });
12488
12494
  // @ts-ignore
12489
- delete decoded.hash;
12490
12495
  return new CodecHash(decoded, { name: this.name });
12491
12496
  }
12492
12497
  /**
@@ -27173,7 +27178,7 @@ class Identity {
27173
27178
  this.selectedAccount = new TextDecoder().decode(selected);
27174
27179
  }
27175
27180
  else {
27176
- const importee = await import(/* webpackChunkName: "generate-account" */ './index-20ad607b-d0eaabce.js');
27181
+ const importee = await import(/* webpackChunkName: "generate-account" */ './index-34c93510-db72e006.js');
27177
27182
  const { identity, accounts } = await importee.default(password, this.network);
27178
27183
  await globalThis.accountStore.put('public', JSON.stringify({ walletId: identity.walletId }));
27179
27184
  await globalThis.walletStore.put('version', String(1));
@@ -27365,7 +27370,7 @@ class Peernet {
27365
27370
  this.root = options.root;
27366
27371
  const { RequestMessage, ResponseMessage, PeerMessage, PeerMessageResponse, PeernetMessage, DHTMessage, DHTMessageResponse, DataMessage, DataMessageResponse, PsMessage, ChatMessage, PeernetFile
27367
27372
  // FolderMessageResponse
27368
- } = await import(/* webpackChunkName: "messages" */ './messages-29f5675b-a1c47a58.js');
27373
+ } = await import(/* webpackChunkName: "messages" */ './messages-b7f41cba-61105b71.js');
27369
27374
  /**
27370
27375
  * proto Object containing protos
27371
27376
  * @type {Object}
@@ -27456,7 +27461,7 @@ class Peernet {
27456
27461
  if (this.#starting || this.#started)
27457
27462
  return;
27458
27463
  this.#starting = true;
27459
- const importee = await import('./client-d602421d-d602421d.js');
27464
+ const importee = await import('./client-493cbd83-493cbd83.js');
27460
27465
  /**
27461
27466
  * @access public
27462
27467
  * @type {PeernetClient}
@@ -1,2 +1,2 @@
1
- export { N as default } from './node-browser-1bc3977e.js';
2
- import './index-4420907d.js';
1
+ export { N as default } from './node-browser-e7da3b14.js';
2
+ import './index-526fd466.js';
@@ -1,4 +1,4 @@
1
- import { E as EasyWorker, B as BigNumber, a as BlockMessage, f as formatBytes } from './worker-b84221fa.js';
1
+ import { E as EasyWorker, B as BigNumber, a as BlockMessage, f as formatBytes } from './worker-dab33545.js';
2
2
 
3
3
  const worker = new EasyWorker();
4
4
 
@@ -1,4 +1,4 @@
1
- import { E as EasyWorker, B as BigNumber, f as formatBytes, C as ContractMessage, a as BlockMessage } from './worker-b84221fa.js';
1
+ import { E as EasyWorker, B as BigNumber, f as formatBytes, C as ContractMessage, a as BlockMessage } from './worker-dab33545.js';
2
2
 
3
3
  var contractFactory = "237,198,141,3,53,89,84,113,122,116,99,109,98,57,68,110,99,114,50,116,116,57,77,100,50,104,77,84,106,107,102,72,56,50,68,57,116,118,119,76,106,76,55,78,98,117,67,118,72,111,100,51,114,98,115,70,71,117,173,5,99,108,97,115,115,32,70,97,99,116,111,114,121,123,35,110,97,109,101,61,34,65,114,116,79,110,108,105,110,101,67,111,110,116,114,97,99,116,70,97,99,116,111,114,121,34,59,35,116,111,116,97,108,67,111,110,116,114,97,99,116,115,61,48,59,35,99,111,110,116,114,97,99,116,115,61,91,93,59,99,111,110,115,116,114,117,99,116,111,114,40,115,116,97,116,101,41,123,115,116,97,116,101,38,38,40,116,104,105,115,46,35,99,111,110,116,114,97,99,116,115,61,115,116,97,116,101,46,99,111,110,116,114,97,99,116,115,44,116,104,105,115,46,35,116,111,116,97,108,67,111,110,116,114,97,99,116,115,61,115,116,97,116,101,46,116,111,116,97,108,67,111,110,116,114,97,99,116,115,41,125,103,101,116,32,115,116,97,116,101,40,41,123,114,101,116,117,114,110,123,116,111,116,97,108,67,111,110,116,114,97,99,116,115,58,116,104,105,115,46,35,116,111,116,97,108,67,111,110,116,114,97,99,116,115,44,99,111,110,116,114,97,99,116,115,58,116,104,105,115,46,35,99,111,110,116,114,97,99,116,115,125,125,103,101,116,32,110,97,109,101,40,41,123,114,101,116,117,114,110,32,116,104,105,115,46,35,110,97,109,101,125,103,101,116,32,99,111,110,116,114,97,99,116,115,40,41,123,114,101,116,117,114,110,91,46,46,46,116,104,105,115,46,35,99,111,110,116,114,97,99,116,115,93,125,103,101,116,32,116,111,116,97,108,67,111,110,116,114,97,99,116,115,40,41,123,114,101,116,117,114,110,32,116,104,105,115,46,35,116,111,116,97,108,67,111,110,116,114,97,99,116,115,125,105,115,82,101,103,105,115,116,101,114,101,100,40,97,100,100,114,101,115,115,41,123,114,101,116,117,114,110,32,116,104,105,115,46,35,99,111,110,116,114,97,99,116,115,46,105,110,99,108,117,100,101,115,40,97,100,100,114,101,115,115,41,125,97,115,121,110,99,32,114,101,103,105,115,116,101,114,67,111,110,116,114,97,99,116,40,97,100,100,114,101,115,115,41,123,105,102,40,97,119,97,105,116,32,109,115,103,46,115,116,97,116,105,99,67,97,108,108,40,97,100,100,114,101,115,115,44,34,104,97,115,82,111,108,101,34,44,91,109,115,103,46,115,101,110,100,101,114,44,34,79,87,78,69,82,34,93,41,44,116,104,105,115,46,35,99,111,110,116,114,97,99,116,115,46,105,110,99,108,117,100,101,115,40,97,100,100,114,101,115,115,41,41,116,104,114,111,119,32,110,101,119,32,69,114,114,111,114,40,34,97,108,114,101,97,100,121,32,114,101,103,105,115,116,101,114,101,100,34,41,59,116,104,105,115,46,35,116,111,116,97,108,67,111,110,116,114,97,99,116,115,43,61,49,44,116,104,105,115,46,35,99,111,110,116,114,97,99,116,115,46,112,117,115,104,40,97,100,100,114,101,115,115,41,125,125,114,101,116,117,114,110,32,70,97,99,116,111,114,121,59,2,91,93";
4
4
  var nativeToken = "237,198,141,3,53,89,84,113,122,116,99,109,98,57,68,110,99,114,50,116,116,57,77,100,50,104,77,84,106,107,102,72,56,50,68,57,116,118,119,76,106,76,55,78,98,117,67,118,72,111,100,51,114,98,115,70,71,117,163,26,99,108,97,115,115,32,82,111,108,101,115,123,35,114,111,108,101,115,61,123,79,87,78,69,82,58,91,93,44,77,73,78,84,58,91,93,44,66,85,82,78,58,91,93,125,59,99,111,110,115,116,114,117,99,116,111,114,40,114,111,108,101,115,41,123,105,102,40,114,111,108,101,115,41,123,105,102,40,33,40,114,111,108,101,115,32,105,110,115,116,97,110,99,101,111,102,32,79,98,106,101,99,116,41,41,116,104,114,111,119,32,110,101,119,32,84,121,112,101,69,114,114,111,114,40,34,101,120,112,101,99,116,101,100,32,114,111,108,101,115,32,116,111,32,98,101,32,97,110,32,111,98,106,101,99,116,34,41,59,116,104,105,115,46,35,114,111,108,101,115,61,123,46,46,46,114,111,108,101,115,44,46,46,46,116,104,105,115,46,35,114,111,108,101,115,125,125,101,108,115,101,32,116,104,105,115,46,35,103,114,97,110,116,82,111,108,101,40,109,115,103,46,115,101,110,100,101,114,44,34,79,87,78,69,82,34,41,125,103,101,116,32,115,116,97,116,101,40,41,123,114,101,116,117,114,110,123,114,111,108,101,115,58,116,104,105,115,46,114,111,108,101,115,125,125,103,101,116,32,114,111,108,101,115,40,41,123,114,101,116,117,114,110,123,46,46,46,116,104,105,115,46,35,114,111,108,101,115,125,125,104,97,115,82,111,108,101,40,97,100,100,114,101,115,115,44,114,111,108,101,41,123,114,101,116,117,114,110,33,33,116,104,105,115,46,35,114,111,108,101,115,91,114,111,108,101,93,38,38,116,104,105,115,46,35,114,111,108,101,115,91,114,111,108,101,93,46,105,110,99,108,117,100,101,115,40,97,100,100,114,101,115,115,41,125,35,103,114,97,110,116,82,111,108,101,40,97,100,100,114,101,115,115,44,114,111,108,101,41,123,105,102,40,116,104,105,115,46,104,97,115,82,111,108,101,40,97,100,100,114,101,115,115,44,114,111,108,101,41,41,116,104,114,111,119,32,110,101,119,32,69,114,114,111,114,40,96,36,123,114,111,108,101,125,32,114,111,108,101,32,97,108,114,101,97,100,121,32,103,114,97,110,116,101,100,32,102,111,114,32,36,123,97,100,100,114,101,115,115,125,96,41,59,116,104,105,115,46,35,114,111,108,101,115,91,114,111,108,101,93,46,112,117,115,104,40,97,100,100,114,101,115,115,41,125,35,114,101,118,111,107,101,82,111,108,101,40,97,100,100,114,101,115,115,44,114,111,108,101,41,123,105,102,40,33,116,104,105,115,46,104,97,115,82,111,108,101,40,97,100,100,114,101,115,115,44,114,111,108,101,41,41,116,104,114,111,119,32,110,101,119,32,69,114,114,111,114,40,96,36,123,114,111,108,101,125,32,114,111,108,101,32,97,108,114,101,97,100,121,32,114,101,118,111,107,101,100,32,102,111,114,32,36,123,97,100,100,114,101,115,115,125,96,41,59,105,102,40,34,79,87,78,69,82,34,61,61,61,114,111,108,101,38,38,49,61,61,61,116,104,105,115,46,35,114,111,108,101,115,91,114,111,108,101,93,46,108,101,110,103,116,104,41,116,104,114,111,119,32,110,101,119,32,69,114,114,111,114,40,34,97,116,108,101,97,115,116,32,111,110,101,32,111,119,110,101,114,32,105,115,32,110,101,101,100,101,100,33,34,41,59,116,104,105,115,46,35,114,111,108,101,115,91,114,111,108,101,93,46,115,112,108,105,99,101,40,116,104,105,115,46,35,114,111,108,101,115,91,114,111,108,101,93,46,105,110,100,101,120,79,102,40,97,100,100,114,101,115,115,41,41,125,103,114,97,110,116,82,111,108,101,40,97,100,100,114,101,115,115,44,114,111,108,101,41,123,105,102,40,33,116,104,105,115,46,104,97,115,82,111,108,101,40,97,100,100,114,101,115,115,44,34,79,87,78,69,82,34,41,41,116,104,114,111,119,32,110,101,119,32,69,114,114,111,114,40,34,78,111,116,32,97,108,108,111,119,101,100,34,41,59,116,104,105,115,46,35,103,114,97,110,116,82,111,108,101,40,97,100,100,114,101,115,115,44,114,111,108,101,41,125,114,101,118,111,107,101,82,111,108,101,40,97,100,100,114,101,115,115,44,114,111,108,101,41,123,105,102,40,33,116,104,105,115,46,104,97,115,82,111,108,101,40,97,100,100,114,101,115,115,44,34,79,87,78,69,82,34,41,41,116,104,114,111,119,32,110,101,119,32,69,114,114,111,114,40,34,78,111,116,32,97,108,108,111,119,101,100,34,41,59,116,104,105,115,46,35,114,101,118,111,107,101,82,111,108,101,40,97,100,100,114,101,115,115,44,114,111,108,101,41,125,125,99,108,97,115,115,32,84,111,107,101,110,32,101,120,116,101,110,100,115,32,82,111,108,101,115,123,35,110,97,109,101,59,35,115,121,109,98,111,108,59,35,104,111,108,100,101,114,115,61,48,59,35,98,97,108,97,110,99,101,115,61,123,125,59,35,97,112,112,114,111,118,97,108,115,61,123,125,59,35,100,101,99,105,109,97,108,115,61,49,56,59,35,116,111,116,97,108,83,117,112,112,108,121,61,66,105,103,78,117,109,98,101,114,46,102,114,111,109,40,48,41,59,99,111,110,115,116,114,117,99,116,111,114,40,110,97,109,101,44,115,121,109,98,111,108,44,100,101,99,105,109,97,108,115,61,49,56,44,115,116,97,116,101,41,123,105,102,40,33,110,97,109,101,41,116,104,114,111,119,32,110,101,119,32,69,114,114,111,114,40,34,110,97,109,101,32,117,110,100,101,102,105,110,101,100,34,41,59,105,102,40,33,115,121,109,98,111,108,41,116,104,114,111,119,32,110,101,119,32,69,114,114,111,114,40,34,115,121,109,98,111,108,32,117,110,100,101,102,105,110,101,100,34,41,59,115,117,112,101,114,40,115,116,97,116,101,63,46,114,111,108,101,115,41,44,116,104,105,115,46,35,110,97,109,101,61,110,97,109,101,44,116,104,105,115,46,35,115,121,109,98,111,108,61,115,121,109,98,111,108,44,116,104,105,115,46,35,100,101,99,105,109,97,108,115,61,100,101,99,105,109,97,108,115,125,103,101,116,32,115,116,97,116,101,40,41,123,114,101,116,117,114,110,123,46,46,46,115,117,112,101,114,46,115,116,97,116,101,44,104,111,108,100,101,114,115,58,116,104,105,115,46,104,111,108,100,101,114,115,44,98,97,108,97,110,99,101,115,58,116,104,105,115,46,98,97,108,97,110,99,101,115,44,97,112,112,114,111,118,97,108,115,58,123,46,46,46,116,104,105,115,46,35,97,112,112,114,111,118,97,108,115,125,44,116,111,116,97,108,83,117,112,112,108,121,58,116,104,105,115,46,116,111,116,97,108,83,117,112,112,108,121,125,125,103,101,116,32,116,111,116,97,108,83,117,112,112,108,121,40,41,123,114,101,116,117,114,110,32,116,104,105,115,46,35,116,111,116,97,108,83,117,112,112,108,121,125,103,101,116,32,110,97,109,101,40,41,123,114,101,116,117,114,110,32,116,104,105,115,46,35,110,97,109,101,125,103,101,116,32,115,121,109,98,111,108,40,41,123,114,101,116,117,114,110,32,116,104,105,115,46,35,115,121,109,98,111,108,125,103,101,116,32,104,111,108,100,101,114,115,40,41,123,114,101,116,117,114,110,32,116,104,105,115,46,35,104,111,108,100,101,114,115,125,103,101,116,32,98,97,108,97,110,99,101,115,40,41,123,114,101,116,117,114,110,123,46,46,46,116,104,105,115,46,35,98,97,108,97,110,99,101,115,125,125,109,105,110,116,40,116,111,44,97,109,111,117,110,116,41,123,105,102,40,33,116,104,105,115,46,104,97,115,82,111,108,101,40,109,115,103,46,115,101,110,100,101,114,44,34,77,73,78,84,34,41,41,116,104,114,111,119,32,110,101,119,32,69,114,114,111,114,40,34,110,111,116,32,97,108,108,111,119,101,100,34,41,59,116,104,105,115,46,35,116,111,116,97,108,83,117,112,112,108,121,61,116,104,105,115,46,35,116,111,116,97,108,83,117,112,112,108,121,46,97,100,100,40,97,109,111,117,110,116,41,44,116,104,105,115,46,35,105,110,99,114,101,97,115,101,66,97,108,97,110,99,101,40,116,111,44,97,109,111,117,110,116,41,125,98,117,114,110,40,102,114,111,109,44,97,109,111,117,110,116,41,123,105,102,40,33,116,104,105,115,46,104,97,115,82,111,108,101,40,109,115,103,46,115,101,110,100,101,114,44,34,66,85,82,78,34,41,41,116,104,114,111,119,32,110,101,119,32,69,114,114,111,114,40,34,110,111,116,32,97,108,108,111,119,101,100,34,41,59,116,104,105,115,46,35,116,111,116,97,108,83,117,112,112,108,121,61,116,104,105,115,46,35,116,111,116,97,108,83,117,112,112,108,121,46,115,117,98,40,97,109,111,117,110,116,41,44,116,104,105,115,46,35,100,101,99,114,101,97,115,101,66,97,108,97,110,99,101,40,102,114,111,109,44,97,109,111,117,110,116,41,125,35,98,101,102,111,114,101,84,114,97,110,115,102,101,114,40,102,114,111,109,44,116,111,44,97,109,111,117,110,116,41,123,105,102,40,33,116,104,105,115,46,35,98,97,108,97,110,99,101,115,91,102,114,111,109,93,124,124,116,104,105,115,46,35,98,97,108,97,110,99,101,115,91,102,114,111,109,93,60,97,109,111,117,110,116,41,116,104,114,111,119,32,110,101,119,32,69,114,114,111,114,40,34,97,109,111,117,110,116,32,101,120,99,101,101,100,115,32,98,97,108,97,110,99,101,34,41,125,35,117,112,100,97,116,101,72,111,108,100,101,114,115,40,97,100,100,114,101,115,115,44,112,114,101,118,105,111,117,115,66,97,108,97,110,99,101,41,123,34,48,120,48,48,34,61,61,61,116,104,105,115,46,35,98,97,108,97,110,99,101,115,91,97,100,100,114,101,115,115,93,46,116,111,72,101,120,83,116,114,105,110,103,40,41,63,116,104,105,115,46,35,104,111,108,100,101,114,115,45,61,49,58,34,48,120,48,48,34,33,61,61,116,104,105,115,46,35,98,97,108,97,110,99,101,115,91,97,100,100,114,101,115,115,93,46,116,111,72,101,120,83,116,114,105,110,103,40,41,38,38,34,48,120,48,48,34,61,61,61,112,114,101,118,105,111,117,115,66,97,108,97,110,99,101,46,116,111,72,101,120,83,116,114,105,110,103,40,41,38,38,40,116,104,105,115,46,35,104,111,108,100,101,114,115,43,61,49,41,125,35,105,110,99,114,101,97,115,101,66,97,108,97,110,99,101,40,97,100,100,114,101,115,115,44,97,109,111,117,110,116,41,123,116,104,105,115,46,35,98,97,108,97,110,99,101,115,91,97,100,100,114,101,115,115,93,124,124,40,116,104,105,115,46,35,98,97,108,97,110,99,101,115,91,97,100,100,114,101,115,115,93,61,66,105,103,78,117,109,98,101,114,46,102,114,111,109,40,48,41,41,59,99,111,110,115,116,32,112,114,101,118,105,111,117,115,66,97,108,97,110,99,101,61,116,104,105,115,46,35,98,97,108,97,110,99,101,115,91,97,100,100,114,101,115,115,93,59,116,104,105,115,46,35,98,97,108,97,110,99,101,115,91,97,100,100,114,101,115,115,93,61,116,104,105,115,46,35,98,97,108,97,110,99,101,115,91,97,100,100,114,101,115,115,93,46,97,100,100,40,97,109,111,117,110,116,41,44,116,104,105,115,46,35,117,112,100,97,116,101,72,111,108,100,101,114,115,40,97,100,100,114,101,115,115,44,112,114,101,118,105,111,117,115,66,97,108,97,110,99,101,41,125,35,100,101,99,114,101,97,115,101,66,97,108,97,110,99,101,40,97,100,100,114,101,115,115,44,97,109,111,117,110,116,41,123,99,111,110,115,116,32,112,114,101,118,105,111,117,115,66,97,108,97,110,99,101,61,116,104,105,115,46,35,98,97,108,97,110,99,101,115,91,97,100,100,114,101,115,115,93,59,116,104,105,115,46,35,98,97,108,97,110,99,101,115,91,97,100,100,114,101,115,115,93,61,116,104,105,115,46,35,98,97,108,97,110,99,101,115,91,97,100,100,114,101,115,115,93,46,115,117,98,40,97,109,111,117,110,116,41,44,116,104,105,115,46,35,117,112,100,97,116,101,72,111,108,100,101,114,115,40,97,100,100,114,101,115,115,44,112,114,101,118,105,111,117,115,66,97,108,97,110,99,101,41,125,98,97,108,97,110,99,101,79,102,40,97,100,100,114,101,115,115,41,123,114,101,116,117,114,110,32,116,104,105,115,46,35,98,97,108,97,110,99,101,115,91,97,100,100,114,101,115,115,93,125,115,101,116,65,112,112,114,111,118,97,108,40,111,112,101,114,97,116,111,114,44,97,109,111,117,110,116,41,123,99,111,110,115,116,32,111,119,110,101,114,61,109,115,103,46,115,101,110,100,101,114,59,116,104,105,115,46,35,97,112,112,114,111,118,97,108,115,91,111,119,110,101,114,93,124,124,40,116,104,105,115,46,35,97,112,112,114,111,118,97,108,115,91,111,119,110,101,114,93,61,123,125,41,44,116,104,105,115,46,35,97,112,112,114,111,118,97,108,115,91,111,119,110,101,114,93,91,111,112,101,114,97,116,111,114,93,61,97,109,111,117,110,116,125,97,112,112,114,111,118,101,100,40,111,119,110,101,114,44,111,112,101,114,97,116,111,114,44,97,109,111,117,110,116,41,123,114,101,116,117,114,110,32,116,104,105,115,46,35,97,112,112,114,111,118,97,108,115,91,111,119,110,101,114,93,91,111,112,101,114,97,116,111,114,93,61,61,61,97,109,111,117,110,116,125,116,114,97,110,115,102,101,114,40,102,114,111,109,44,116,111,44,97,109,111,117,110,116,41,123,97,109,111,117,110,116,61,66,105,103,78,117,109,98,101,114,46,102,114,111,109,40,97,109,111,117,110,116,41,44,116,104,105,115,46,35,98,101,102,111,114,101,84,114,97,110,115,102,101,114,40,102,114,111,109,44,116,111,44,97,109,111,117,110,116,41,44,116,104,105,115,46,35,100,101,99,114,101,97,115,101,66,97,108,97,110,99,101,40,102,114,111,109,44,97,109,111,117,110,116,41,44,116,104,105,115,46,35,105,110,99,114,101,97,115,101,66,97,108,97,110,99,101,40,116,111,44,97,109,111,117,110,116,41,125,125,99,108,97,115,115,32,65,114,116,79,110,108,105,110,101,32,101,120,116,101,110,100,115,32,84,111,107,101,110,123,99,111,110,115,116,114,117,99,116,111,114,40,115,116,97,116,101,41,123,115,117,112,101,114,40,34,65,114,116,79,110,108,105,110,101,34,44,34,65,82,84,34,44,49,56,44,115,116,97,116,101,41,125,125,114,101,116,117,114,110,32,65,114,116,79,110,108,105,110,101,59,2,91,93";
@@ -12248,6 +12248,13 @@ class CodecHash extends BasicInterface {
12248
12248
  let FormatInterface$1 = class FormatInterface extends BasicInterface {
12249
12249
  hashFormat;
12250
12250
  #hash;
12251
+ #encoded;
12252
+ get encoded() {
12253
+ return this.#encoded || this.encode();
12254
+ }
12255
+ set encoded(value) {
12256
+ this.#encoded = value;
12257
+ }
12251
12258
  init(buffer) {
12252
12259
  if (buffer instanceof FormatInterface && buffer?.name === this.name)
12253
12260
  return buffer;
package/exports/chain.js CHANGED
@@ -932,12 +932,14 @@ class State extends Contract {
932
932
  request: 'lastBlock'
933
933
  });
934
934
  let node = await globalThis.peernet.prepareMessage(data);
935
+ console.log(node.encoded);
936
+ console.log(node.encode());
935
937
  for (const peer of globalThis.peernet?.connections) {
936
938
  // @ts-ignore
937
939
  if (peer.connected && peer.version === this.version) {
938
940
  const task = async () => {
939
941
  try {
940
- const result = await peer.request(node.encoded);
942
+ const result = await peer.request(node.encode());
941
943
  return { result: Uint8Array.from(Object.values(result)), peer };
942
944
  }
943
945
  catch (error) {
@@ -1,4 +1,4 @@
1
- import { E as EasyWorker, B as BigNumber, a as BlockMessage, f as formatBytes } from './worker-b84221fa.js';
1
+ import { E as EasyWorker, B as BigNumber, a as BlockMessage, f as formatBytes } from './worker-dab33545.js';
2
2
 
3
3
  const worker = new EasyWorker();
4
4
 
@@ -1,4 +1,4 @@
1
- import { E as EasyWorker, B as BigNumber, f as formatBytes, C as ContractMessage, a as BlockMessage } from './worker-b84221fa.js';
1
+ import { E as EasyWorker, B as BigNumber, f as formatBytes, C as ContractMessage, a as BlockMessage } from './worker-dab33545.js';
2
2
 
3
3
  var contractFactory = "237,198,141,3,53,89,84,113,122,116,99,109,98,57,68,110,99,114,50,116,116,57,77,100,50,104,77,84,106,107,102,72,56,50,68,57,116,118,119,76,106,76,55,78,98,117,67,118,72,111,100,51,114,98,115,70,71,117,173,5,99,108,97,115,115,32,70,97,99,116,111,114,121,123,35,110,97,109,101,61,34,65,114,116,79,110,108,105,110,101,67,111,110,116,114,97,99,116,70,97,99,116,111,114,121,34,59,35,116,111,116,97,108,67,111,110,116,114,97,99,116,115,61,48,59,35,99,111,110,116,114,97,99,116,115,61,91,93,59,99,111,110,115,116,114,117,99,116,111,114,40,115,116,97,116,101,41,123,115,116,97,116,101,38,38,40,116,104,105,115,46,35,99,111,110,116,114,97,99,116,115,61,115,116,97,116,101,46,99,111,110,116,114,97,99,116,115,44,116,104,105,115,46,35,116,111,116,97,108,67,111,110,116,114,97,99,116,115,61,115,116,97,116,101,46,116,111,116,97,108,67,111,110,116,114,97,99,116,115,41,125,103,101,116,32,115,116,97,116,101,40,41,123,114,101,116,117,114,110,123,116,111,116,97,108,67,111,110,116,114,97,99,116,115,58,116,104,105,115,46,35,116,111,116,97,108,67,111,110,116,114,97,99,116,115,44,99,111,110,116,114,97,99,116,115,58,116,104,105,115,46,35,99,111,110,116,114,97,99,116,115,125,125,103,101,116,32,110,97,109,101,40,41,123,114,101,116,117,114,110,32,116,104,105,115,46,35,110,97,109,101,125,103,101,116,32,99,111,110,116,114,97,99,116,115,40,41,123,114,101,116,117,114,110,91,46,46,46,116,104,105,115,46,35,99,111,110,116,114,97,99,116,115,93,125,103,101,116,32,116,111,116,97,108,67,111,110,116,114,97,99,116,115,40,41,123,114,101,116,117,114,110,32,116,104,105,115,46,35,116,111,116,97,108,67,111,110,116,114,97,99,116,115,125,105,115,82,101,103,105,115,116,101,114,101,100,40,97,100,100,114,101,115,115,41,123,114,101,116,117,114,110,32,116,104,105,115,46,35,99,111,110,116,114,97,99,116,115,46,105,110,99,108,117,100,101,115,40,97,100,100,114,101,115,115,41,125,97,115,121,110,99,32,114,101,103,105,115,116,101,114,67,111,110,116,114,97,99,116,40,97,100,100,114,101,115,115,41,123,105,102,40,97,119,97,105,116,32,109,115,103,46,115,116,97,116,105,99,67,97,108,108,40,97,100,100,114,101,115,115,44,34,104,97,115,82,111,108,101,34,44,91,109,115,103,46,115,101,110,100,101,114,44,34,79,87,78,69,82,34,93,41,44,116,104,105,115,46,35,99,111,110,116,114,97,99,116,115,46,105,110,99,108,117,100,101,115,40,97,100,100,114,101,115,115,41,41,116,104,114,111,119,32,110,101,119,32,69,114,114,111,114,40,34,97,108,114,101,97,100,121,32,114,101,103,105,115,116,101,114,101,100,34,41,59,116,104,105,115,46,35,116,111,116,97,108,67,111,110,116,114,97,99,116,115,43,61,49,44,116,104,105,115,46,35,99,111,110,116,114,97,99,116,115,46,112,117,115,104,40,97,100,100,114,101,115,115,41,125,125,114,101,116,117,114,110,32,70,97,99,116,111,114,121,59,2,91,93";
4
4
  var nativeToken = "237,198,141,3,53,89,84,113,122,116,99,109,98,57,68,110,99,114,50,116,116,57,77,100,50,104,77,84,106,107,102,72,56,50,68,57,116,118,119,76,106,76,55,78,98,117,67,118,72,111,100,51,114,98,115,70,71,117,163,26,99,108,97,115,115,32,82,111,108,101,115,123,35,114,111,108,101,115,61,123,79,87,78,69,82,58,91,93,44,77,73,78,84,58,91,93,44,66,85,82,78,58,91,93,125,59,99,111,110,115,116,114,117,99,116,111,114,40,114,111,108,101,115,41,123,105,102,40,114,111,108,101,115,41,123,105,102,40,33,40,114,111,108,101,115,32,105,110,115,116,97,110,99,101,111,102,32,79,98,106,101,99,116,41,41,116,104,114,111,119,32,110,101,119,32,84,121,112,101,69,114,114,111,114,40,34,101,120,112,101,99,116,101,100,32,114,111,108,101,115,32,116,111,32,98,101,32,97,110,32,111,98,106,101,99,116,34,41,59,116,104,105,115,46,35,114,111,108,101,115,61,123,46,46,46,114,111,108,101,115,44,46,46,46,116,104,105,115,46,35,114,111,108,101,115,125,125,101,108,115,101,32,116,104,105,115,46,35,103,114,97,110,116,82,111,108,101,40,109,115,103,46,115,101,110,100,101,114,44,34,79,87,78,69,82,34,41,125,103,101,116,32,115,116,97,116,101,40,41,123,114,101,116,117,114,110,123,114,111,108,101,115,58,116,104,105,115,46,114,111,108,101,115,125,125,103,101,116,32,114,111,108,101,115,40,41,123,114,101,116,117,114,110,123,46,46,46,116,104,105,115,46,35,114,111,108,101,115,125,125,104,97,115,82,111,108,101,40,97,100,100,114,101,115,115,44,114,111,108,101,41,123,114,101,116,117,114,110,33,33,116,104,105,115,46,35,114,111,108,101,115,91,114,111,108,101,93,38,38,116,104,105,115,46,35,114,111,108,101,115,91,114,111,108,101,93,46,105,110,99,108,117,100,101,115,40,97,100,100,114,101,115,115,41,125,35,103,114,97,110,116,82,111,108,101,40,97,100,100,114,101,115,115,44,114,111,108,101,41,123,105,102,40,116,104,105,115,46,104,97,115,82,111,108,101,40,97,100,100,114,101,115,115,44,114,111,108,101,41,41,116,104,114,111,119,32,110,101,119,32,69,114,114,111,114,40,96,36,123,114,111,108,101,125,32,114,111,108,101,32,97,108,114,101,97,100,121,32,103,114,97,110,116,101,100,32,102,111,114,32,36,123,97,100,100,114,101,115,115,125,96,41,59,116,104,105,115,46,35,114,111,108,101,115,91,114,111,108,101,93,46,112,117,115,104,40,97,100,100,114,101,115,115,41,125,35,114,101,118,111,107,101,82,111,108,101,40,97,100,100,114,101,115,115,44,114,111,108,101,41,123,105,102,40,33,116,104,105,115,46,104,97,115,82,111,108,101,40,97,100,100,114,101,115,115,44,114,111,108,101,41,41,116,104,114,111,119,32,110,101,119,32,69,114,114,111,114,40,96,36,123,114,111,108,101,125,32,114,111,108,101,32,97,108,114,101,97,100,121,32,114,101,118,111,107,101,100,32,102,111,114,32,36,123,97,100,100,114,101,115,115,125,96,41,59,105,102,40,34,79,87,78,69,82,34,61,61,61,114,111,108,101,38,38,49,61,61,61,116,104,105,115,46,35,114,111,108,101,115,91,114,111,108,101,93,46,108,101,110,103,116,104,41,116,104,114,111,119,32,110,101,119,32,69,114,114,111,114,40,34,97,116,108,101,97,115,116,32,111,110,101,32,111,119,110,101,114,32,105,115,32,110,101,101,100,101,100,33,34,41,59,116,104,105,115,46,35,114,111,108,101,115,91,114,111,108,101,93,46,115,112,108,105,99,101,40,116,104,105,115,46,35,114,111,108,101,115,91,114,111,108,101,93,46,105,110,100,101,120,79,102,40,97,100,100,114,101,115,115,41,41,125,103,114,97,110,116,82,111,108,101,40,97,100,100,114,101,115,115,44,114,111,108,101,41,123,105,102,40,33,116,104,105,115,46,104,97,115,82,111,108,101,40,97,100,100,114,101,115,115,44,34,79,87,78,69,82,34,41,41,116,104,114,111,119,32,110,101,119,32,69,114,114,111,114,40,34,78,111,116,32,97,108,108,111,119,101,100,34,41,59,116,104,105,115,46,35,103,114,97,110,116,82,111,108,101,40,97,100,100,114,101,115,115,44,114,111,108,101,41,125,114,101,118,111,107,101,82,111,108,101,40,97,100,100,114,101,115,115,44,114,111,108,101,41,123,105,102,40,33,116,104,105,115,46,104,97,115,82,111,108,101,40,97,100,100,114,101,115,115,44,34,79,87,78,69,82,34,41,41,116,104,114,111,119,32,110,101,119,32,69,114,114,111,114,40,34,78,111,116,32,97,108,108,111,119,101,100,34,41,59,116,104,105,115,46,35,114,101,118,111,107,101,82,111,108,101,40,97,100,100,114,101,115,115,44,114,111,108,101,41,125,125,99,108,97,115,115,32,84,111,107,101,110,32,101,120,116,101,110,100,115,32,82,111,108,101,115,123,35,110,97,109,101,59,35,115,121,109,98,111,108,59,35,104,111,108,100,101,114,115,61,48,59,35,98,97,108,97,110,99,101,115,61,123,125,59,35,97,112,112,114,111,118,97,108,115,61,123,125,59,35,100,101,99,105,109,97,108,115,61,49,56,59,35,116,111,116,97,108,83,117,112,112,108,121,61,66,105,103,78,117,109,98,101,114,46,102,114,111,109,40,48,41,59,99,111,110,115,116,114,117,99,116,111,114,40,110,97,109,101,44,115,121,109,98,111,108,44,100,101,99,105,109,97,108,115,61,49,56,44,115,116,97,116,101,41,123,105,102,40,33,110,97,109,101,41,116,104,114,111,119,32,110,101,119,32,69,114,114,111,114,40,34,110,97,109,101,32,117,110,100,101,102,105,110,101,100,34,41,59,105,102,40,33,115,121,109,98,111,108,41,116,104,114,111,119,32,110,101,119,32,69,114,114,111,114,40,34,115,121,109,98,111,108,32,117,110,100,101,102,105,110,101,100,34,41,59,115,117,112,101,114,40,115,116,97,116,101,63,46,114,111,108,101,115,41,44,116,104,105,115,46,35,110,97,109,101,61,110,97,109,101,44,116,104,105,115,46,35,115,121,109,98,111,108,61,115,121,109,98,111,108,44,116,104,105,115,46,35,100,101,99,105,109,97,108,115,61,100,101,99,105,109,97,108,115,125,103,101,116,32,115,116,97,116,101,40,41,123,114,101,116,117,114,110,123,46,46,46,115,117,112,101,114,46,115,116,97,116,101,44,104,111,108,100,101,114,115,58,116,104,105,115,46,104,111,108,100,101,114,115,44,98,97,108,97,110,99,101,115,58,116,104,105,115,46,98,97,108,97,110,99,101,115,44,97,112,112,114,111,118,97,108,115,58,123,46,46,46,116,104,105,115,46,35,97,112,112,114,111,118,97,108,115,125,44,116,111,116,97,108,83,117,112,112,108,121,58,116,104,105,115,46,116,111,116,97,108,83,117,112,112,108,121,125,125,103,101,116,32,116,111,116,97,108,83,117,112,112,108,121,40,41,123,114,101,116,117,114,110,32,116,104,105,115,46,35,116,111,116,97,108,83,117,112,112,108,121,125,103,101,116,32,110,97,109,101,40,41,123,114,101,116,117,114,110,32,116,104,105,115,46,35,110,97,109,101,125,103,101,116,32,115,121,109,98,111,108,40,41,123,114,101,116,117,114,110,32,116,104,105,115,46,35,115,121,109,98,111,108,125,103,101,116,32,104,111,108,100,101,114,115,40,41,123,114,101,116,117,114,110,32,116,104,105,115,46,35,104,111,108,100,101,114,115,125,103,101,116,32,98,97,108,97,110,99,101,115,40,41,123,114,101,116,117,114,110,123,46,46,46,116,104,105,115,46,35,98,97,108,97,110,99,101,115,125,125,109,105,110,116,40,116,111,44,97,109,111,117,110,116,41,123,105,102,40,33,116,104,105,115,46,104,97,115,82,111,108,101,40,109,115,103,46,115,101,110,100,101,114,44,34,77,73,78,84,34,41,41,116,104,114,111,119,32,110,101,119,32,69,114,114,111,114,40,34,110,111,116,32,97,108,108,111,119,101,100,34,41,59,116,104,105,115,46,35,116,111,116,97,108,83,117,112,112,108,121,61,116,104,105,115,46,35,116,111,116,97,108,83,117,112,112,108,121,46,97,100,100,40,97,109,111,117,110,116,41,44,116,104,105,115,46,35,105,110,99,114,101,97,115,101,66,97,108,97,110,99,101,40,116,111,44,97,109,111,117,110,116,41,125,98,117,114,110,40,102,114,111,109,44,97,109,111,117,110,116,41,123,105,102,40,33,116,104,105,115,46,104,97,115,82,111,108,101,40,109,115,103,46,115,101,110,100,101,114,44,34,66,85,82,78,34,41,41,116,104,114,111,119,32,110,101,119,32,69,114,114,111,114,40,34,110,111,116,32,97,108,108,111,119,101,100,34,41,59,116,104,105,115,46,35,116,111,116,97,108,83,117,112,112,108,121,61,116,104,105,115,46,35,116,111,116,97,108,83,117,112,112,108,121,46,115,117,98,40,97,109,111,117,110,116,41,44,116,104,105,115,46,35,100,101,99,114,101,97,115,101,66,97,108,97,110,99,101,40,102,114,111,109,44,97,109,111,117,110,116,41,125,35,98,101,102,111,114,101,84,114,97,110,115,102,101,114,40,102,114,111,109,44,116,111,44,97,109,111,117,110,116,41,123,105,102,40,33,116,104,105,115,46,35,98,97,108,97,110,99,101,115,91,102,114,111,109,93,124,124,116,104,105,115,46,35,98,97,108,97,110,99,101,115,91,102,114,111,109,93,60,97,109,111,117,110,116,41,116,104,114,111,119,32,110,101,119,32,69,114,114,111,114,40,34,97,109,111,117,110,116,32,101,120,99,101,101,100,115,32,98,97,108,97,110,99,101,34,41,125,35,117,112,100,97,116,101,72,111,108,100,101,114,115,40,97,100,100,114,101,115,115,44,112,114,101,118,105,111,117,115,66,97,108,97,110,99,101,41,123,34,48,120,48,48,34,61,61,61,116,104,105,115,46,35,98,97,108,97,110,99,101,115,91,97,100,100,114,101,115,115,93,46,116,111,72,101,120,83,116,114,105,110,103,40,41,63,116,104,105,115,46,35,104,111,108,100,101,114,115,45,61,49,58,34,48,120,48,48,34,33,61,61,116,104,105,115,46,35,98,97,108,97,110,99,101,115,91,97,100,100,114,101,115,115,93,46,116,111,72,101,120,83,116,114,105,110,103,40,41,38,38,34,48,120,48,48,34,61,61,61,112,114,101,118,105,111,117,115,66,97,108,97,110,99,101,46,116,111,72,101,120,83,116,114,105,110,103,40,41,38,38,40,116,104,105,115,46,35,104,111,108,100,101,114,115,43,61,49,41,125,35,105,110,99,114,101,97,115,101,66,97,108,97,110,99,101,40,97,100,100,114,101,115,115,44,97,109,111,117,110,116,41,123,116,104,105,115,46,35,98,97,108,97,110,99,101,115,91,97,100,100,114,101,115,115,93,124,124,40,116,104,105,115,46,35,98,97,108,97,110,99,101,115,91,97,100,100,114,101,115,115,93,61,66,105,103,78,117,109,98,101,114,46,102,114,111,109,40,48,41,41,59,99,111,110,115,116,32,112,114,101,118,105,111,117,115,66,97,108,97,110,99,101,61,116,104,105,115,46,35,98,97,108,97,110,99,101,115,91,97,100,100,114,101,115,115,93,59,116,104,105,115,46,35,98,97,108,97,110,99,101,115,91,97,100,100,114,101,115,115,93,61,116,104,105,115,46,35,98,97,108,97,110,99,101,115,91,97,100,100,114,101,115,115,93,46,97,100,100,40,97,109,111,117,110,116,41,44,116,104,105,115,46,35,117,112,100,97,116,101,72,111,108,100,101,114,115,40,97,100,100,114,101,115,115,44,112,114,101,118,105,111,117,115,66,97,108,97,110,99,101,41,125,35,100,101,99,114,101,97,115,101,66,97,108,97,110,99,101,40,97,100,100,114,101,115,115,44,97,109,111,117,110,116,41,123,99,111,110,115,116,32,112,114,101,118,105,111,117,115,66,97,108,97,110,99,101,61,116,104,105,115,46,35,98,97,108,97,110,99,101,115,91,97,100,100,114,101,115,115,93,59,116,104,105,115,46,35,98,97,108,97,110,99,101,115,91,97,100,100,114,101,115,115,93,61,116,104,105,115,46,35,98,97,108,97,110,99,101,115,91,97,100,100,114,101,115,115,93,46,115,117,98,40,97,109,111,117,110,116,41,44,116,104,105,115,46,35,117,112,100,97,116,101,72,111,108,100,101,114,115,40,97,100,100,114,101,115,115,44,112,114,101,118,105,111,117,115,66,97,108,97,110,99,101,41,125,98,97,108,97,110,99,101,79,102,40,97,100,100,114,101,115,115,41,123,114,101,116,117,114,110,32,116,104,105,115,46,35,98,97,108,97,110,99,101,115,91,97,100,100,114,101,115,115,93,125,115,101,116,65,112,112,114,111,118,97,108,40,111,112,101,114,97,116,111,114,44,97,109,111,117,110,116,41,123,99,111,110,115,116,32,111,119,110,101,114,61,109,115,103,46,115,101,110,100,101,114,59,116,104,105,115,46,35,97,112,112,114,111,118,97,108,115,91,111,119,110,101,114,93,124,124,40,116,104,105,115,46,35,97,112,112,114,111,118,97,108,115,91,111,119,110,101,114,93,61,123,125,41,44,116,104,105,115,46,35,97,112,112,114,111,118,97,108,115,91,111,119,110,101,114,93,91,111,112,101,114,97,116,111,114,93,61,97,109,111,117,110,116,125,97,112,112,114,111,118,101,100,40,111,119,110,101,114,44,111,112,101,114,97,116,111,114,44,97,109,111,117,110,116,41,123,114,101,116,117,114,110,32,116,104,105,115,46,35,97,112,112,114,111,118,97,108,115,91,111,119,110,101,114,93,91,111,112,101,114,97,116,111,114,93,61,61,61,97,109,111,117,110,116,125,116,114,97,110,115,102,101,114,40,102,114,111,109,44,116,111,44,97,109,111,117,110,116,41,123,97,109,111,117,110,116,61,66,105,103,78,117,109,98,101,114,46,102,114,111,109,40,97,109,111,117,110,116,41,44,116,104,105,115,46,35,98,101,102,111,114,101,84,114,97,110,115,102,101,114,40,102,114,111,109,44,116,111,44,97,109,111,117,110,116,41,44,116,104,105,115,46,35,100,101,99,114,101,97,115,101,66,97,108,97,110,99,101,40,102,114,111,109,44,97,109,111,117,110,116,41,44,116,104,105,115,46,35,105,110,99,114,101,97,115,101,66,97,108,97,110,99,101,40,116,111,44,97,109,111,117,110,116,41,125,125,99,108,97,115,115,32,65,114,116,79,110,108,105,110,101,32,101,120,116,101,110,100,115,32,84,111,107,101,110,123,99,111,110,115,116,114,117,99,116,111,114,40,115,116,97,116,101,41,123,115,117,112,101,114,40,34,65,114,116,79,110,108,105,110,101,34,44,34,65,82,84,34,44,49,56,44,115,116,97,116,101,41,125,125,114,101,116,117,114,110,32,65,114,116,79,110,108,105,110,101,59,2,91,93";
@@ -12248,6 +12248,13 @@ class CodecHash extends BasicInterface {
12248
12248
  let FormatInterface$1 = class FormatInterface extends BasicInterface {
12249
12249
  hashFormat;
12250
12250
  #hash;
12251
+ #encoded;
12252
+ get encoded() {
12253
+ return this.#encoded || this.encode();
12254
+ }
12255
+ set encoded(value) {
12256
+ this.#encoded = value;
12257
+ }
12251
12258
  init(buffer) {
12252
12259
  if (buffer instanceof FormatInterface && buffer?.name === this.name)
12253
12260
  return buffer;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/chain",
3
- "version": "1.5.37",
3
+ "version": "1.5.39",
4
4
  "description": "Official javascript implementation",
5
5
  "exports": {
6
6
  "./node": {
@@ -35,7 +35,7 @@
35
35
  "docs": "sh ./node_modules/.bin/esdoc src/chain.js",
36
36
  "workers": "cp ./../workers/src/** ./workers",
37
37
  "demo": "jsproject --serve ./ --port 5478 --open demo",
38
- "test": "node test",
38
+ "test": "node --inspect test",
39
39
  "pack": "webpack",
40
40
  "build": "rollup -c"
41
41
  },