@leofcoin/chain 1.7.49 → 1.7.52

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,33 +0,0 @@
1
- import { E as EasyWorker, B as BigNumber, a as BlockMessage } from './worker-Botf--mj-BUK2CMT9.js';
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(
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
- const hash = await block.hash();
20
- const index = block.decoded.index;
21
- resolve({ ...block.decoded, hash, blockInfo: { hash, size, index } });
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));