@leofcoin/workers 1.3.1 → 1.3.3
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/dist/bundle/commonjs/{machine-worker-70694321.js → machine-worker-ffb53877.js} +18 -12
- package/dist/bundle/commonjs/machine-worker.js +1 -1
- package/dist/bundle/commonjs/workers.js +1 -1
- package/dist/bundle/module/{machine-worker-fa1190e7.js → machine-worker-cf4a1a57.js} +18 -12
- package/dist/bundle/module/machine-worker.js +1 -1
- package/dist/bundle/module/workers.js +1 -1
- package/dist/commonjs/{machine-worker-4856ed22.js → machine-worker-5c403db5.js} +18 -12
- package/dist/commonjs/machine-worker.js +1 -1
- package/dist/commonjs/workers.js +1 -1
- package/dist/module/{machine-worker-cfafa406.js → machine-worker-fb6e00a8.js} +18 -12
- package/dist/module/machine-worker.js +1 -1
- package/dist/module/workers.js +1 -1
- package/package.json +1 -1
- package/src/machine-worker.js +21 -11
|
@@ -49,7 +49,6 @@ globalThis.BigNumber = utils.BigNumber;
|
|
|
49
49
|
globalThis.peernet = globalThis.peernet || {};
|
|
50
50
|
globalThis.contracts = {};
|
|
51
51
|
|
|
52
|
-
|
|
53
52
|
const get = (contract, method, params) => {
|
|
54
53
|
let result;
|
|
55
54
|
if (params?.length > 0) {
|
|
@@ -146,16 +145,23 @@ const _init = async ({ contracts, blocks, peerid })=> {
|
|
|
146
145
|
|
|
147
146
|
if (blocks?.length > 0) {
|
|
148
147
|
const _worker = await new worker$1.EasyWorker('./block-worker.js', {serialization: 'advanced', type: 'module' });
|
|
149
|
-
blocks = await _worker.once(blocks);
|
|
148
|
+
blocks = await _worker.once([blocks[blocks.length - 1]]);
|
|
150
149
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}
|
|
150
|
+
// blocks = unique(globalThis.blocks ? globalThis : [], blocks)
|
|
151
|
+
// for (let i = 0; i < blocks.length; i++) {
|
|
152
|
+
|
|
153
|
+
// }
|
|
154
|
+
// for (const block of blocks) {
|
|
155
|
+
// await Promise.all(block.decoded.transactions.map(async message => {
|
|
156
|
+
// if (!block.loaded) {
|
|
157
|
+
// const {from, to, method, params} = message;
|
|
158
|
+
// globalThis.msg = createMessage(from);
|
|
159
|
+
|
|
160
|
+
// await execute(to, method, params);
|
|
161
|
+
// block.loaded = true
|
|
162
|
+
// }
|
|
163
|
+
// }));
|
|
164
|
+
// }
|
|
159
165
|
|
|
160
166
|
if (blocks.length > 0) {
|
|
161
167
|
lastBlock = blocks[blocks.length - 1].decoded;
|
|
@@ -166,15 +172,15 @@ const _init = async ({ contracts, blocks, peerid })=> {
|
|
|
166
172
|
hash: await lastBlock.hash
|
|
167
173
|
};
|
|
168
174
|
}
|
|
175
|
+
globalThis.blocks = blocks;
|
|
169
176
|
}
|
|
170
177
|
|
|
171
178
|
|
|
172
179
|
|
|
173
180
|
|
|
174
181
|
worker.postMessage({type: 'machine-ready', lastBlock});
|
|
175
|
-
_worker.terminate();
|
|
176
182
|
|
|
177
|
-
worker.postMessage(blocks);
|
|
183
|
+
// worker.postMessage({blocks});
|
|
178
184
|
};
|
|
179
185
|
|
|
180
186
|
const tasks = async (e) => {
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var transactionWorker = require('./transaction-worker-176a5aaa.js');
|
|
6
6
|
var blockWorker = require('./block-worker-21ad8152.js');
|
|
7
7
|
var poolWorker = require('./pool-worker-f450eeff.js');
|
|
8
|
-
var machineWorker = require('./machine-worker-
|
|
8
|
+
var machineWorker = require('./machine-worker-ffb53877.js');
|
|
9
9
|
require('./worker-6ace445f.js');
|
|
10
10
|
require('stream');
|
|
11
11
|
require('events');
|
|
@@ -47,7 +47,6 @@ globalThis.BigNumber = BigNumber;
|
|
|
47
47
|
globalThis.peernet = globalThis.peernet || {};
|
|
48
48
|
globalThis.contracts = {};
|
|
49
49
|
|
|
50
|
-
|
|
51
50
|
const get = (contract, method, params) => {
|
|
52
51
|
let result;
|
|
53
52
|
if (params?.length > 0) {
|
|
@@ -144,16 +143,23 @@ const _init = async ({ contracts, blocks, peerid })=> {
|
|
|
144
143
|
|
|
145
144
|
if (blocks?.length > 0) {
|
|
146
145
|
const _worker = await new EasyWorker('./block-worker.js', {serialization: 'advanced', type: 'module' });
|
|
147
|
-
blocks = await _worker.once(blocks);
|
|
146
|
+
blocks = await _worker.once([blocks[blocks.length - 1]]);
|
|
148
147
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
}
|
|
148
|
+
// blocks = unique(globalThis.blocks ? globalThis : [], blocks)
|
|
149
|
+
// for (let i = 0; i < blocks.length; i++) {
|
|
150
|
+
|
|
151
|
+
// }
|
|
152
|
+
// for (const block of blocks) {
|
|
153
|
+
// await Promise.all(block.decoded.transactions.map(async message => {
|
|
154
|
+
// if (!block.loaded) {
|
|
155
|
+
// const {from, to, method, params} = message;
|
|
156
|
+
// globalThis.msg = createMessage(from);
|
|
157
|
+
|
|
158
|
+
// await execute(to, method, params);
|
|
159
|
+
// block.loaded = true
|
|
160
|
+
// }
|
|
161
|
+
// }));
|
|
162
|
+
// }
|
|
157
163
|
|
|
158
164
|
if (blocks.length > 0) {
|
|
159
165
|
lastBlock = blocks[blocks.length - 1].decoded;
|
|
@@ -164,15 +170,15 @@ const _init = async ({ contracts, blocks, peerid })=> {
|
|
|
164
170
|
hash: await lastBlock.hash
|
|
165
171
|
};
|
|
166
172
|
}
|
|
173
|
+
globalThis.blocks = blocks;
|
|
167
174
|
}
|
|
168
175
|
|
|
169
176
|
|
|
170
177
|
|
|
171
178
|
|
|
172
179
|
worker.postMessage({type: 'machine-ready', lastBlock});
|
|
173
|
-
_worker.terminate();
|
|
174
180
|
|
|
175
|
-
worker.postMessage(blocks);
|
|
181
|
+
// worker.postMessage({blocks});
|
|
176
182
|
};
|
|
177
183
|
|
|
178
184
|
const tasks = async (e) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as transactionWorker } from './transaction-worker-548cd200.js';
|
|
2
2
|
import { b as blockWorker } from './block-worker-414860e0.js';
|
|
3
3
|
import { p as poolWorker } from './pool-worker-0d927e3c.js';
|
|
4
|
-
import { m as machineWorker } from './machine-worker-
|
|
4
|
+
import { m as machineWorker } from './machine-worker-cf4a1a57.js';
|
|
5
5
|
import './worker-def77c26.js';
|
|
6
6
|
import 'stream';
|
|
7
7
|
import 'events';
|
|
@@ -54,7 +54,6 @@ globalThis.BigNumber = utils.BigNumber;
|
|
|
54
54
|
globalThis.peernet = globalThis.peernet || {};
|
|
55
55
|
globalThis.contracts = {};
|
|
56
56
|
|
|
57
|
-
|
|
58
57
|
const get = (contract, method, params) => {
|
|
59
58
|
let result;
|
|
60
59
|
if (params?.length > 0) {
|
|
@@ -151,16 +150,23 @@ const _init = async ({ contracts, blocks, peerid })=> {
|
|
|
151
150
|
|
|
152
151
|
if (blocks?.length > 0) {
|
|
153
152
|
const _worker = await new EasyWorker__default["default"]('./block-worker.js', {serialization: 'advanced', type: 'module' });
|
|
154
|
-
blocks = await _worker.once(blocks);
|
|
153
|
+
blocks = await _worker.once([blocks[blocks.length - 1]]);
|
|
155
154
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
}
|
|
155
|
+
// blocks = unique(globalThis.blocks ? globalThis : [], blocks)
|
|
156
|
+
// for (let i = 0; i < blocks.length; i++) {
|
|
157
|
+
|
|
158
|
+
// }
|
|
159
|
+
// for (const block of blocks) {
|
|
160
|
+
// await Promise.all(block.decoded.transactions.map(async message => {
|
|
161
|
+
// if (!block.loaded) {
|
|
162
|
+
// const {from, to, method, params} = message;
|
|
163
|
+
// globalThis.msg = createMessage(from);
|
|
164
|
+
|
|
165
|
+
// await execute(to, method, params);
|
|
166
|
+
// block.loaded = true
|
|
167
|
+
// }
|
|
168
|
+
// }));
|
|
169
|
+
// }
|
|
164
170
|
|
|
165
171
|
if (blocks.length > 0) {
|
|
166
172
|
lastBlock = blocks[blocks.length - 1].decoded;
|
|
@@ -171,15 +177,15 @@ const _init = async ({ contracts, blocks, peerid })=> {
|
|
|
171
177
|
hash: await lastBlock.hash
|
|
172
178
|
};
|
|
173
179
|
}
|
|
180
|
+
globalThis.blocks = blocks;
|
|
174
181
|
}
|
|
175
182
|
|
|
176
183
|
|
|
177
184
|
|
|
178
185
|
|
|
179
186
|
worker.postMessage({type: 'machine-ready', lastBlock});
|
|
180
|
-
_worker.terminate();
|
|
181
187
|
|
|
182
|
-
worker.postMessage(blocks);
|
|
188
|
+
// worker.postMessage({blocks});
|
|
183
189
|
};
|
|
184
190
|
|
|
185
191
|
const tasks = async (e) => {
|
package/dist/commonjs/workers.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var transactionWorker = require('./transaction-worker-8eecc7a1.js');
|
|
6
6
|
var blockWorker = require('./block-worker-60e4cfa3.js');
|
|
7
7
|
var poolWorker = require('./pool-worker-81e8b4c0.js');
|
|
8
|
-
var machineWorker = require('./machine-worker-
|
|
8
|
+
var machineWorker = require('./machine-worker-5c403db5.js');
|
|
9
9
|
require('@leofcoin/codec-format-interface');
|
|
10
10
|
require('./transaction-220a3a15.js');
|
|
11
11
|
require('@vandeurenglenn/easy-worker');
|
|
@@ -48,7 +48,6 @@ globalThis.BigNumber = BigNumber;
|
|
|
48
48
|
globalThis.peernet = globalThis.peernet || {};
|
|
49
49
|
globalThis.contracts = {};
|
|
50
50
|
|
|
51
|
-
|
|
52
51
|
const get = (contract, method, params) => {
|
|
53
52
|
let result;
|
|
54
53
|
if (params?.length > 0) {
|
|
@@ -145,16 +144,23 @@ const _init = async ({ contracts, blocks, peerid })=> {
|
|
|
145
144
|
|
|
146
145
|
if (blocks?.length > 0) {
|
|
147
146
|
const _worker = await new EasyWorker('./block-worker.js', {serialization: 'advanced', type: 'module' });
|
|
148
|
-
blocks = await _worker.once(blocks);
|
|
147
|
+
blocks = await _worker.once([blocks[blocks.length - 1]]);
|
|
149
148
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}
|
|
149
|
+
// blocks = unique(globalThis.blocks ? globalThis : [], blocks)
|
|
150
|
+
// for (let i = 0; i < blocks.length; i++) {
|
|
151
|
+
|
|
152
|
+
// }
|
|
153
|
+
// for (const block of blocks) {
|
|
154
|
+
// await Promise.all(block.decoded.transactions.map(async message => {
|
|
155
|
+
// if (!block.loaded) {
|
|
156
|
+
// const {from, to, method, params} = message;
|
|
157
|
+
// globalThis.msg = createMessage(from);
|
|
158
|
+
|
|
159
|
+
// await execute(to, method, params);
|
|
160
|
+
// block.loaded = true
|
|
161
|
+
// }
|
|
162
|
+
// }));
|
|
163
|
+
// }
|
|
158
164
|
|
|
159
165
|
if (blocks.length > 0) {
|
|
160
166
|
lastBlock = blocks[blocks.length - 1].decoded;
|
|
@@ -165,15 +171,15 @@ const _init = async ({ contracts, blocks, peerid })=> {
|
|
|
165
171
|
hash: await lastBlock.hash
|
|
166
172
|
};
|
|
167
173
|
}
|
|
174
|
+
globalThis.blocks = blocks;
|
|
168
175
|
}
|
|
169
176
|
|
|
170
177
|
|
|
171
178
|
|
|
172
179
|
|
|
173
180
|
worker.postMessage({type: 'machine-ready', lastBlock});
|
|
174
|
-
_worker.terminate();
|
|
175
181
|
|
|
176
|
-
worker.postMessage(blocks);
|
|
182
|
+
// worker.postMessage({blocks});
|
|
177
183
|
};
|
|
178
184
|
|
|
179
185
|
const tasks = async (e) => {
|
package/dist/module/workers.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as transactionWorker } from './transaction-worker-105deaa8.js';
|
|
2
2
|
import { b as blockWorker } from './block-worker-f539b1b2.js';
|
|
3
3
|
import { p as poolWorker } from './pool-worker-f65671d7.js';
|
|
4
|
-
import { m as machineWorker } from './machine-worker-
|
|
4
|
+
import { m as machineWorker } from './machine-worker-fb6e00a8.js';
|
|
5
5
|
import '@leofcoin/codec-format-interface';
|
|
6
6
|
import './transaction-d06dc6c4.js';
|
|
7
7
|
import '@vandeurenglenn/easy-worker';
|
package/package.json
CHANGED
package/src/machine-worker.js
CHANGED
|
@@ -16,6 +16,9 @@ globalThis.BigNumber = BigNumber
|
|
|
16
16
|
globalThis.peernet = globalThis.peernet || {}
|
|
17
17
|
globalThis.contracts = {}
|
|
18
18
|
|
|
19
|
+
const unique = arr => arr.filter((el, pos, arr) => {
|
|
20
|
+
return arr.indexOf(el) == pos;
|
|
21
|
+
})
|
|
19
22
|
|
|
20
23
|
const get = (contract, method, params) => {
|
|
21
24
|
let result
|
|
@@ -113,16 +116,23 @@ const _init = async ({ contracts, blocks, peerid })=> {
|
|
|
113
116
|
|
|
114
117
|
if (blocks?.length > 0) {
|
|
115
118
|
const _worker = await new EasyWorker('./block-worker.js', {serialization: 'advanced', type: 'module' })
|
|
116
|
-
blocks = await _worker.once(blocks)
|
|
119
|
+
blocks = await _worker.once([blocks[blocks.length - 1]])
|
|
117
120
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}
|
|
121
|
+
// blocks = unique(globalThis.blocks ? globalThis : [], blocks)
|
|
122
|
+
// for (let i = 0; i < blocks.length; i++) {
|
|
123
|
+
|
|
124
|
+
// }
|
|
125
|
+
// for (const block of blocks) {
|
|
126
|
+
// await Promise.all(block.decoded.transactions.map(async message => {
|
|
127
|
+
// if (!block.loaded) {
|
|
128
|
+
// const {from, to, method, params} = message;
|
|
129
|
+
// globalThis.msg = createMessage(from);
|
|
130
|
+
|
|
131
|
+
// await execute(to, method, params);
|
|
132
|
+
// block.loaded = true
|
|
133
|
+
// }
|
|
134
|
+
// }));
|
|
135
|
+
// }
|
|
126
136
|
|
|
127
137
|
if (blocks.length > 0) {
|
|
128
138
|
lastBlock = blocks[blocks.length - 1].decoded;
|
|
@@ -133,15 +143,15 @@ const _init = async ({ contracts, blocks, peerid })=> {
|
|
|
133
143
|
hash: await lastBlock.hash
|
|
134
144
|
};
|
|
135
145
|
}
|
|
146
|
+
globalThis.blocks = blocks
|
|
136
147
|
}
|
|
137
148
|
|
|
138
149
|
|
|
139
150
|
|
|
140
151
|
|
|
141
152
|
worker.postMessage({type: 'machine-ready', lastBlock});
|
|
142
|
-
_worker.terminate();
|
|
143
153
|
|
|
144
|
-
worker.postMessage(blocks);
|
|
154
|
+
// worker.postMessage({blocks});
|
|
145
155
|
}
|
|
146
156
|
|
|
147
157
|
const tasks = async (e) => {
|