@leofcoin/workers 1.3.1 → 1.3.2
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-a91140f8.js} +24 -12
- package/dist/bundle/commonjs/machine-worker.js +6 -1
- package/dist/bundle/commonjs/workers.js +1 -1
- package/dist/bundle/module/{machine-worker-fa1190e7.js → machine-worker-b674296f.js} +24 -13
- 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-8ed82a54.js} +24 -12
- package/dist/commonjs/machine-worker.js +6 -1
- package/dist/commonjs/workers.js +1 -1
- package/dist/module/{machine-worker-cfafa406.js → machine-worker-30ef6a37.js} +24 -13
- 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,6 +49,9 @@ globalThis.BigNumber = utils.BigNumber;
|
|
|
49
49
|
globalThis.peernet = globalThis.peernet || {};
|
|
50
50
|
globalThis.contracts = {};
|
|
51
51
|
|
|
52
|
+
const unique = arr => arr.filter((el, pos, arr) => {
|
|
53
|
+
return arr.indexOf(el) == pos;
|
|
54
|
+
});
|
|
52
55
|
|
|
53
56
|
const get = (contract, method, params) => {
|
|
54
57
|
let result;
|
|
@@ -146,16 +149,23 @@ const _init = async ({ contracts, blocks, peerid })=> {
|
|
|
146
149
|
|
|
147
150
|
if (blocks?.length > 0) {
|
|
148
151
|
const _worker = await new worker$1.EasyWorker('./block-worker.js', {serialization: 'advanced', type: 'module' });
|
|
149
|
-
blocks = await _worker.once(blocks);
|
|
152
|
+
blocks = await _worker.once([blocks[blocks.length - 1]]);
|
|
150
153
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}
|
|
154
|
+
// blocks = unique(globalThis.blocks ? globalThis : [], blocks)
|
|
155
|
+
// for (let i = 0; i < blocks.length; i++) {
|
|
156
|
+
|
|
157
|
+
// }
|
|
158
|
+
// for (const block of blocks) {
|
|
159
|
+
// await Promise.all(block.decoded.transactions.map(async message => {
|
|
160
|
+
// if (!block.loaded) {
|
|
161
|
+
// const {from, to, method, params} = message;
|
|
162
|
+
// globalThis.msg = createMessage(from);
|
|
163
|
+
|
|
164
|
+
// await execute(to, method, params);
|
|
165
|
+
// block.loaded = true
|
|
166
|
+
// }
|
|
167
|
+
// }));
|
|
168
|
+
// }
|
|
159
169
|
|
|
160
170
|
if (blocks.length > 0) {
|
|
161
171
|
lastBlock = blocks[blocks.length - 1].decoded;
|
|
@@ -166,15 +176,15 @@ const _init = async ({ contracts, blocks, peerid })=> {
|
|
|
166
176
|
hash: await lastBlock.hash
|
|
167
177
|
};
|
|
168
178
|
}
|
|
179
|
+
globalThis.blocks = blocks;
|
|
169
180
|
}
|
|
170
181
|
|
|
171
182
|
|
|
172
183
|
|
|
173
184
|
|
|
174
185
|
worker.postMessage({type: 'machine-ready', lastBlock});
|
|
175
|
-
_worker.terminate();
|
|
176
186
|
|
|
177
|
-
worker.postMessage(blocks);
|
|
187
|
+
// worker.postMessage({blocks});
|
|
178
188
|
};
|
|
179
189
|
|
|
180
190
|
const tasks = async (e) => {
|
|
@@ -229,7 +239,9 @@ const tasks = async (e) => {
|
|
|
229
239
|
worker.onmessage(data => tasks(data));
|
|
230
240
|
|
|
231
241
|
var machineWorker = /*#__PURE__*/Object.freeze({
|
|
232
|
-
__proto__: null
|
|
242
|
+
__proto__: null,
|
|
243
|
+
unique: unique
|
|
233
244
|
});
|
|
234
245
|
|
|
235
246
|
exports.machineWorker = machineWorker;
|
|
247
|
+
exports.unique = unique;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var machineWorker = require('./machine-worker-a91140f8.js');
|
|
4
6
|
require('./worker-6ace445f.js');
|
|
5
7
|
require('./utils-6e881be4.js');
|
|
6
8
|
require('path');
|
|
@@ -12,3 +14,6 @@ require('string_decoder/');
|
|
|
12
14
|
require('fs');
|
|
13
15
|
require('os');
|
|
14
16
|
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
exports.unique = machineWorker.unique;
|
|
@@ -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-a91140f8.js');
|
|
9
9
|
require('./worker-6ace445f.js');
|
|
10
10
|
require('stream');
|
|
11
11
|
require('events');
|
|
@@ -47,6 +47,9 @@ globalThis.BigNumber = BigNumber;
|
|
|
47
47
|
globalThis.peernet = globalThis.peernet || {};
|
|
48
48
|
globalThis.contracts = {};
|
|
49
49
|
|
|
50
|
+
const unique = arr => arr.filter((el, pos, arr) => {
|
|
51
|
+
return arr.indexOf(el) == pos;
|
|
52
|
+
});
|
|
50
53
|
|
|
51
54
|
const get = (contract, method, params) => {
|
|
52
55
|
let result;
|
|
@@ -144,16 +147,23 @@ const _init = async ({ contracts, blocks, peerid })=> {
|
|
|
144
147
|
|
|
145
148
|
if (blocks?.length > 0) {
|
|
146
149
|
const _worker = await new EasyWorker('./block-worker.js', {serialization: 'advanced', type: 'module' });
|
|
147
|
-
blocks = await _worker.once(blocks);
|
|
150
|
+
blocks = await _worker.once([blocks[blocks.length - 1]]);
|
|
148
151
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
}
|
|
152
|
+
// blocks = unique(globalThis.blocks ? globalThis : [], blocks)
|
|
153
|
+
// for (let i = 0; i < blocks.length; i++) {
|
|
154
|
+
|
|
155
|
+
// }
|
|
156
|
+
// for (const block of blocks) {
|
|
157
|
+
// await Promise.all(block.decoded.transactions.map(async message => {
|
|
158
|
+
// if (!block.loaded) {
|
|
159
|
+
// const {from, to, method, params} = message;
|
|
160
|
+
// globalThis.msg = createMessage(from);
|
|
161
|
+
|
|
162
|
+
// await execute(to, method, params);
|
|
163
|
+
// block.loaded = true
|
|
164
|
+
// }
|
|
165
|
+
// }));
|
|
166
|
+
// }
|
|
157
167
|
|
|
158
168
|
if (blocks.length > 0) {
|
|
159
169
|
lastBlock = blocks[blocks.length - 1].decoded;
|
|
@@ -164,15 +174,15 @@ const _init = async ({ contracts, blocks, peerid })=> {
|
|
|
164
174
|
hash: await lastBlock.hash
|
|
165
175
|
};
|
|
166
176
|
}
|
|
177
|
+
globalThis.blocks = blocks;
|
|
167
178
|
}
|
|
168
179
|
|
|
169
180
|
|
|
170
181
|
|
|
171
182
|
|
|
172
183
|
worker.postMessage({type: 'machine-ready', lastBlock});
|
|
173
|
-
_worker.terminate();
|
|
174
184
|
|
|
175
|
-
worker.postMessage(blocks);
|
|
185
|
+
// worker.postMessage({blocks});
|
|
176
186
|
};
|
|
177
187
|
|
|
178
188
|
const tasks = async (e) => {
|
|
@@ -227,7 +237,8 @@ const tasks = async (e) => {
|
|
|
227
237
|
worker.onmessage(data => tasks(data));
|
|
228
238
|
|
|
229
239
|
var machineWorker = /*#__PURE__*/Object.freeze({
|
|
230
|
-
__proto__: null
|
|
240
|
+
__proto__: null,
|
|
241
|
+
unique: unique
|
|
231
242
|
});
|
|
232
243
|
|
|
233
|
-
export { machineWorker as m };
|
|
244
|
+
export { machineWorker as m, unique as u };
|
|
@@ -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-b674296f.js';
|
|
5
5
|
import './worker-def77c26.js';
|
|
6
6
|
import 'stream';
|
|
7
7
|
import 'events';
|
|
@@ -54,6 +54,9 @@ globalThis.BigNumber = utils.BigNumber;
|
|
|
54
54
|
globalThis.peernet = globalThis.peernet || {};
|
|
55
55
|
globalThis.contracts = {};
|
|
56
56
|
|
|
57
|
+
const unique = arr => arr.filter((el, pos, arr) => {
|
|
58
|
+
return arr.indexOf(el) == pos;
|
|
59
|
+
});
|
|
57
60
|
|
|
58
61
|
const get = (contract, method, params) => {
|
|
59
62
|
let result;
|
|
@@ -151,16 +154,23 @@ const _init = async ({ contracts, blocks, peerid })=> {
|
|
|
151
154
|
|
|
152
155
|
if (blocks?.length > 0) {
|
|
153
156
|
const _worker = await new EasyWorker__default["default"]('./block-worker.js', {serialization: 'advanced', type: 'module' });
|
|
154
|
-
blocks = await _worker.once(blocks);
|
|
157
|
+
blocks = await _worker.once([blocks[blocks.length - 1]]);
|
|
155
158
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
}
|
|
159
|
+
// blocks = unique(globalThis.blocks ? globalThis : [], blocks)
|
|
160
|
+
// for (let i = 0; i < blocks.length; i++) {
|
|
161
|
+
|
|
162
|
+
// }
|
|
163
|
+
// for (const block of blocks) {
|
|
164
|
+
// await Promise.all(block.decoded.transactions.map(async message => {
|
|
165
|
+
// if (!block.loaded) {
|
|
166
|
+
// const {from, to, method, params} = message;
|
|
167
|
+
// globalThis.msg = createMessage(from);
|
|
168
|
+
|
|
169
|
+
// await execute(to, method, params);
|
|
170
|
+
// block.loaded = true
|
|
171
|
+
// }
|
|
172
|
+
// }));
|
|
173
|
+
// }
|
|
164
174
|
|
|
165
175
|
if (blocks.length > 0) {
|
|
166
176
|
lastBlock = blocks[blocks.length - 1].decoded;
|
|
@@ -171,15 +181,15 @@ const _init = async ({ contracts, blocks, peerid })=> {
|
|
|
171
181
|
hash: await lastBlock.hash
|
|
172
182
|
};
|
|
173
183
|
}
|
|
184
|
+
globalThis.blocks = blocks;
|
|
174
185
|
}
|
|
175
186
|
|
|
176
187
|
|
|
177
188
|
|
|
178
189
|
|
|
179
190
|
worker.postMessage({type: 'machine-ready', lastBlock});
|
|
180
|
-
_worker.terminate();
|
|
181
191
|
|
|
182
|
-
worker.postMessage(blocks);
|
|
192
|
+
// worker.postMessage({blocks});
|
|
183
193
|
};
|
|
184
194
|
|
|
185
195
|
const tasks = async (e) => {
|
|
@@ -234,7 +244,9 @@ const tasks = async (e) => {
|
|
|
234
244
|
worker.onmessage(data => tasks(data));
|
|
235
245
|
|
|
236
246
|
var machineWorker = /*#__PURE__*/Object.freeze({
|
|
237
|
-
__proto__: null
|
|
247
|
+
__proto__: null,
|
|
248
|
+
unique: unique
|
|
238
249
|
});
|
|
239
250
|
|
|
240
251
|
exports.machineWorker = machineWorker;
|
|
252
|
+
exports.unique = unique;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var machineWorker = require('./machine-worker-8ed82a54.js');
|
|
4
6
|
require('@leofcoin/codec-format-interface');
|
|
5
7
|
require('./utils-1dc37f72.js');
|
|
6
8
|
require('path');
|
|
@@ -10,3 +12,6 @@ require('@ethersproject/bytes');
|
|
|
10
12
|
require('@ethersproject/logger');
|
|
11
13
|
require('@ethersproject/bignumber');
|
|
12
14
|
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
exports.unique = machineWorker.unique;
|
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-8ed82a54.js');
|
|
9
9
|
require('@leofcoin/codec-format-interface');
|
|
10
10
|
require('./transaction-220a3a15.js');
|
|
11
11
|
require('@vandeurenglenn/easy-worker');
|
|
@@ -48,6 +48,9 @@ globalThis.BigNumber = BigNumber;
|
|
|
48
48
|
globalThis.peernet = globalThis.peernet || {};
|
|
49
49
|
globalThis.contracts = {};
|
|
50
50
|
|
|
51
|
+
const unique = arr => arr.filter((el, pos, arr) => {
|
|
52
|
+
return arr.indexOf(el) == pos;
|
|
53
|
+
});
|
|
51
54
|
|
|
52
55
|
const get = (contract, method, params) => {
|
|
53
56
|
let result;
|
|
@@ -145,16 +148,23 @@ const _init = async ({ contracts, blocks, peerid })=> {
|
|
|
145
148
|
|
|
146
149
|
if (blocks?.length > 0) {
|
|
147
150
|
const _worker = await new EasyWorker('./block-worker.js', {serialization: 'advanced', type: 'module' });
|
|
148
|
-
blocks = await _worker.once(blocks);
|
|
151
|
+
blocks = await _worker.once([blocks[blocks.length - 1]]);
|
|
149
152
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}
|
|
153
|
+
// blocks = unique(globalThis.blocks ? globalThis : [], blocks)
|
|
154
|
+
// for (let i = 0; i < blocks.length; i++) {
|
|
155
|
+
|
|
156
|
+
// }
|
|
157
|
+
// for (const block of blocks) {
|
|
158
|
+
// await Promise.all(block.decoded.transactions.map(async message => {
|
|
159
|
+
// if (!block.loaded) {
|
|
160
|
+
// const {from, to, method, params} = message;
|
|
161
|
+
// globalThis.msg = createMessage(from);
|
|
162
|
+
|
|
163
|
+
// await execute(to, method, params);
|
|
164
|
+
// block.loaded = true
|
|
165
|
+
// }
|
|
166
|
+
// }));
|
|
167
|
+
// }
|
|
158
168
|
|
|
159
169
|
if (blocks.length > 0) {
|
|
160
170
|
lastBlock = blocks[blocks.length - 1].decoded;
|
|
@@ -165,15 +175,15 @@ const _init = async ({ contracts, blocks, peerid })=> {
|
|
|
165
175
|
hash: await lastBlock.hash
|
|
166
176
|
};
|
|
167
177
|
}
|
|
178
|
+
globalThis.blocks = blocks;
|
|
168
179
|
}
|
|
169
180
|
|
|
170
181
|
|
|
171
182
|
|
|
172
183
|
|
|
173
184
|
worker.postMessage({type: 'machine-ready', lastBlock});
|
|
174
|
-
_worker.terminate();
|
|
175
185
|
|
|
176
|
-
worker.postMessage(blocks);
|
|
186
|
+
// worker.postMessage({blocks});
|
|
177
187
|
};
|
|
178
188
|
|
|
179
189
|
const tasks = async (e) => {
|
|
@@ -228,7 +238,8 @@ const tasks = async (e) => {
|
|
|
228
238
|
worker.onmessage(data => tasks(data));
|
|
229
239
|
|
|
230
240
|
var machineWorker = /*#__PURE__*/Object.freeze({
|
|
231
|
-
__proto__: null
|
|
241
|
+
__proto__: null,
|
|
242
|
+
unique: unique
|
|
232
243
|
});
|
|
233
244
|
|
|
234
|
-
export { machineWorker as m };
|
|
245
|
+
export { machineWorker as m, unique as u };
|
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-30ef6a37.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
|
+
export 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) => {
|