@leofcoin/chain 1.7.65 → 1.7.67
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.
- package/exports/browser/browser-DQJ6xf_F-D0onvbt2.js +188 -0
- package/exports/browser/browser-pguCHlVu-pguCHlVu.js +25 -0
- package/exports/browser/browser-store.js +306 -0
- package/exports/browser/chain.js +5760 -0
- package/exports/browser/client-Depp28gl-DItJEEYa.js +638 -0
- package/exports/browser/index-BeqbCwUk-DfNb2uRP.js +37 -0
- package/exports/browser/index-CM4QYC3g.js +8434 -0
- package/exports/browser/index-DqPlTtAJ-Bczd-x6k.js +7888 -0
- package/exports/browser/messages-RYLqPGkg-Da9CI_ow.js +215 -0
- package/exports/browser/node-browser-DewO13hB.js +30072 -0
- package/exports/browser/node-browser.js +2 -0
- package/exports/browser/password-oDixGC8h.js +3 -0
- package/exports/browser/qr-scanner-worker.min-Dy0qkKA4-Dy0qkKA4.js +100 -0
- package/exports/browser/workers/block-worker.js +33 -0
- package/exports/browser/workers/machine-worker.js +574 -0
- package/exports/browser/workers/worker-4K8uC3xq-4K8uC3xq.js +8469 -0
- package/exports/chain.js +2 -3
- package/exports/workers/block-worker.js +33 -0
- package/exports/workers/machine-worker.js +574 -0
- package/exports/workers/worker-4K8uC3xq-4K8uC3xq.js +8469 -0
- package/package.json +1 -1
package/exports/chain.js
CHANGED
|
@@ -7,7 +7,6 @@ import semver from 'semver';
|
|
|
7
7
|
import { randombytes } from '@leofcoin/crypto';
|
|
8
8
|
import EasyWorker from '@vandeurenglenn/easy-worker';
|
|
9
9
|
import { ContractDeploymentError, ExecutionError, isResolveError, ResolveError, isExecutionError } from '@leofcoin/errors';
|
|
10
|
-
import { warn } from 'console';
|
|
11
10
|
|
|
12
11
|
const limit = 1800;
|
|
13
12
|
const transactionLimit = 1000;
|
|
@@ -1394,9 +1393,9 @@ class VersionControl extends State {
|
|
|
1394
1393
|
// check if we are above v1.0.0 and if we still not reached v1.0.0
|
|
1395
1394
|
// if so, clear all data
|
|
1396
1395
|
// once v1.0.0 is reached this will not run and we can remove this check once every node is above v1.0.0
|
|
1397
|
-
warn('the reachedZeroZero flag is set to false, this will clear all data on every start if above v1.0.0');
|
|
1396
|
+
console.warn('the reachedZeroZero flag is set to false, this will clear all data on every start if above v1.0.0');
|
|
1398
1397
|
if (semver.compare(this.version, '1.0.0') === 1 && !this.#reachedOneZeroZero) {
|
|
1399
|
-
warn('clearing all data because we are below v1.0.0');
|
|
1398
|
+
console.warn('clearing all data because we are below v1.0.0');
|
|
1400
1399
|
await this.clearAll();
|
|
1401
1400
|
}
|
|
1402
1401
|
if (semver.compare(this.#currentVersion, this.version) === 1) {
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { E as EasyWorker, B as BlockMessage } from './worker-4K8uC3xq-4K8uC3xq.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));
|