@leofcoin/chain 1.5.24 → 1.5.26

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.
@@ -5568,6 +5568,8 @@ class TransactionMessage extends FormatInterface {
5568
5568
  return 'TransactionMessage';
5569
5569
  }
5570
5570
  constructor(buffer) {
5571
+ if (buffer instanceof TransactionMessage)
5572
+ return buffer;
5571
5573
  const name = 'transaction-message';
5572
5574
  super(buffer, proto$6, { name });
5573
5575
  }
@@ -5583,6 +5585,8 @@ class ValidatorMessage extends FormatInterface {
5583
5585
  return 'ValidatorMessage';
5584
5586
  }
5585
5587
  constructor(buffer) {
5588
+ if (buffer instanceof ValidatorMessage)
5589
+ return buffer;
5586
5590
  const name = 'validator-message';
5587
5591
  super(buffer, proto$5, { name });
5588
5592
  }
@@ -5603,6 +5607,8 @@ class BlockMessage extends FormatInterface {
5603
5607
  return 'BlockMessage';
5604
5608
  }
5605
5609
  constructor(buffer) {
5610
+ if (buffer instanceof BlockMessage)
5611
+ return buffer;
5606
5612
  const name = 'block-message';
5607
5613
  super(buffer, proto$4, { name });
5608
5614
  }
@@ -5632,9 +5638,9 @@ class BlockMessage extends FormatInterface {
5632
5638
  encoded = encoded || this.encoded;
5633
5639
  super.decode(encoded);
5634
5640
  // @ts-ignore
5635
- this.decoded.transactions = index$4(this.decoded.transactions).map(transaction => new TransactionMessage(transaction).decoded);
5641
+ this.decoded.transactions = index$4(this.decoded.transactions).map((transaction) => new TransactionMessage(transaction).decoded);
5636
5642
  // @ts-ignore
5637
- this.decoded.validators = index$4(this.decoded.validators).map(validator => new ValidatorMessage(validator).decoded);
5643
+ this.decoded.validators = index$4(this.decoded.validators).map((validator) => new ValidatorMessage(validator).decoded);
5638
5644
  return this.decoded;
5639
5645
  }
5640
5646
  }
@@ -5649,6 +5655,8 @@ class BWMessage extends FormatInterface {
5649
5655
  return 'BWMessage';
5650
5656
  }
5651
5657
  constructor(buffer) {
5658
+ if (buffer instanceof BWMessage)
5659
+ return buffer;
5652
5660
  const name = 'bw-message';
5653
5661
  super(buffer, proto$3, { name });
5654
5662
  }
@@ -5661,6 +5669,8 @@ class BWRequestMessage extends FormatInterface {
5661
5669
  return 'BWRequestMessage';
5662
5670
  }
5663
5671
  constructor(buffer) {
5672
+ if (buffer instanceof BWRequestMessage)
5673
+ return buffer;
5664
5674
  const name = 'bw-request-message';
5665
5675
  super(buffer, proto$2, { name });
5666
5676
  }
@@ -5677,6 +5687,8 @@ class ContractMessage extends FormatInterface {
5677
5687
  return 'ContractMessage';
5678
5688
  }
5679
5689
  constructor(buffer) {
5690
+ if (buffer instanceof ContractMessage)
5691
+ return buffer;
5680
5692
  super(buffer, proto$1, { name: 'contract-message' });
5681
5693
  }
5682
5694
  }
@@ -5695,6 +5707,8 @@ class RawTransactionMessage extends FormatInterface {
5695
5707
  return 'RawTransactionMessage';
5696
5708
  }
5697
5709
  constructor(buffer) {
5710
+ if (buffer instanceof RawTransactionMessage)
5711
+ return buffer;
5698
5712
  const name = 'raw-transaction-message';
5699
5713
  super(buffer, proto, { name });
5700
5714
  }
@@ -1,5 +1,5 @@
1
- import { M as MultiWallet, e as encrypt, b as base58$1 } from './node-browser-f8484520.js';
2
- import './index-de7cd283.js';
1
+ import { M as MultiWallet, e as encrypt, b as base58$1 } from './node-browser-ccafb3fc.js';
2
+ import './index-055d5584.js';
3
3
 
4
4
  /**
5
5
  * @params {String} network
@@ -1,5 +1,5 @@
1
- import { F as FormatInterface } from './node-browser-f8484520.js';
2
- import './index-de7cd283.js';
1
+ import { F as FormatInterface } from './node-browser-ccafb3fc.js';
2
+ import './index-055d5584.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-b3d08518.js';
1
+ import { C as ContractMessage, T as TransactionMessage, c as BlockMessage, d as BWMessage, e as BWRequestMessage, V as ValidatorMessage } from './index-055d5584.js';
2
2
 
3
3
  var nodeConfig = async (config = {
4
4
  network: 'leofcoin:peach',
@@ -20216,7 +20216,7 @@ class Identity {
20216
20216
  this.selectedAccount = new TextDecoder().decode(selected);
20217
20217
  }
20218
20218
  else {
20219
- const importee = await import(/* webpackChunkName: "generate-account" */ './index-329e0324-dcac6dff.js');
20219
+ const importee = await import(/* webpackChunkName: "generate-account" */ './index-329e0324-f8858eb6.js');
20220
20220
  const { identity, accounts } = await importee.default(password, this.network);
20221
20221
  await globalThis.accountStore.put('public', JSON.stringify({ walletId: identity.walletId }));
20222
20222
  await globalThis.walletStore.put('version', String(1));
@@ -20407,7 +20407,7 @@ class Peernet {
20407
20407
  this.root = options.root;
20408
20408
  const { RequestMessage, ResponseMessage, PeerMessage, PeerMessageResponse, PeernetMessage, DHTMessage, DHTMessageResponse, DataMessage, DataMessageResponse, PsMessage, ChatMessage, PeernetFile
20409
20409
  // FolderMessageResponse
20410
- } = await import(/* webpackChunkName: "messages" */ './messages-000b7f84-8b18c4c6.js');
20410
+ } = await import(/* webpackChunkName: "messages" */ './messages-000b7f84-2f945543.js');
20411
20411
  /**
20412
20412
  * proto Object containing protos
20413
20413
  * @type {Object}
@@ -20971,7 +20971,9 @@ class Node {
20971
20971
  networkVersion: 'peach',
20972
20972
  stars: networks.leofcoin.peach.stars
20973
20973
  }, password) {
20974
- this.#node = globalThis.Peernet ? await new globalThis.Peernet(config, password) : await new Peernet(config, password);
20974
+ this.#node = globalThis.Peernet
20975
+ ? await new globalThis.Peernet(config, password)
20976
+ : await new Peernet(config, password);
20975
20977
  await nodeConfig(config);
20976
20978
  globalThis.pubsub.subscribe('chain:ready', async () => {
20977
20979
  if (!this.#node.autoStart) {
@@ -1,2 +1,2 @@
1
- export { N as default } from './node-browser-f8484520.js';
2
- import './index-de7cd283.js';
1
+ export { N as default } from './node-browser-ccafb3fc.js';
2
+ import './index-055d5584.js';
@@ -1,29 +1,33 @@
1
- import { E as EasyWorker, B as BigNumber, a as BlockMessage, f as formatBytes } from './worker-156dda16.js';
1
+ import { E as EasyWorker, B as BigNumber, a as BlockMessage, f as formatBytes } from './worker-5b02efbe.js';
2
2
 
3
- const worker = new EasyWorker();
4
-
5
- globalThis.BigNumber = BigNumber;
6
- globalThis.contracts = {};
7
-
8
- const run = async (blocks) => {
9
- blocks = await Promise.all(blocks.map(block => new BlockMessage(block)));
10
- blocks = blocks.sort((a, b) => a.decoded.timestamp - b.decoded.timestamp);
11
-
12
- blocks = await Promise.all(blocks.map(block => new Promise(async (resolve, reject) => {
13
- // todo: tx worker or nah?
14
- await block.encode();
15
- const size = block.encoded.length || block.encoded.byteLength;
16
- console.log(`loaded block: ${await block.hash()} @${block.decoded.index} ${formatBytes(size)}`);
17
- // todo we don't want this, need shared state
18
- resolve(block.decoded);
19
- })));
20
- return blocks
21
- };
22
-
23
- const tasks = async blocks => {
24
- blocks = await run(blocks);
25
- worker.postMessage(blocks);
26
- };
27
-
28
-
29
- worker.onmessage(data => tasks(data));
3
+ const worker = new EasyWorker();
4
+
5
+ globalThis.BigNumber = BigNumber;
6
+ globalThis.contracts = {};
7
+
8
+ const run = async (blocks) => {
9
+ blocks = await Promise.all(blocks.map((block) => new BlockMessage(block)));
10
+ blocks = blocks.sort((a, b) => a.decoded.timestamp - b.decoded.timestamp);
11
+
12
+ blocks = await Promise.all(
13
+ blocks.map(
14
+ (block) =>
15
+ new Promise(async (resolve, reject) => {
16
+ // todo: tx worker or nah?
17
+ await block.encode();
18
+ const size = block.encoded.length || block.encoded.byteLength;
19
+ console.log(`loaded block: ${await block.hash()} @${block.decoded.index} ${formatBytes(size)}`);
20
+ // todo we don't want this, need shared state
21
+ resolve(block.decoded);
22
+ })
23
+ )
24
+ );
25
+ return blocks
26
+ };
27
+
28
+ const tasks = async (blocks) => {
29
+ blocks = await run(blocks);
30
+ worker.postMessage(blocks);
31
+ };
32
+
33
+ worker.onmessage((data) => tasks(data));