@leofcoin/chain 1.5.24 → 1.5.25
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/chain.js +74 -42
- package/exports/browser/{index-329e0324-a0469bb9.js → index-329e0324-835f93a9.js} +2 -2
- package/exports/browser/{index-de7cd283.js → index-73138caf.js} +14 -0
- package/exports/browser/{messages-000b7f84-8465e629.js → messages-000b7f84-b6b8b755.js} +2 -2
- package/exports/browser/{node-browser-c27ce598.js → node-browser-19707bf6.js} +3 -3
- package/exports/browser/node-browser.js +2 -2
- package/exports/browser/workers/block-worker.js +1 -1
- package/exports/browser/workers/machine-worker.js +1 -1
- package/exports/browser/workers/{worker-156dda16.js → worker-0f66935f.js} +8 -0
- package/exports/chain.d.ts +1 -0
- package/exports/chain.js +73 -41
- package/exports/jobs/jobber.d.ts +1 -1
- package/exports/state.d.ts +8 -2
- package/exports/workers/block-worker.js +1 -1
- package/exports/workers/machine-worker.js +1 -1
- package/exports/workers/{worker-156dda16.js → worker-0f66935f.js} +8 -0
- package/package.json +1 -1
- package/exports/browser/index-329e0324-dcac6dff.js +0 -37
- package/exports/browser/index-b3d08518.js +0 -5703
- package/exports/browser/messages-000b7f84-8b18c4c6.js +0 -225
- package/exports/browser/node-browser-f8484520.js +0 -20987
package/exports/browser/chain.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as BigNumber, L as Logger, v as version$1, h as hexZeroPad, i as isBigNumberish, a as arrayify, b as isBytes, T as TransactionMessage, t as toBase58, C as ContractMessage, R as RawTransactionMessage, c as BlockMessage, d as BWMessage, e as BWRequestMessage } from './index-
|
|
1
|
+
import { B as BigNumber, L as Logger, v as version$1, h as hexZeroPad, i as isBigNumberish, a as arrayify, b as isBytes, T as TransactionMessage, t as toBase58, C as ContractMessage, R as RawTransactionMessage, c as BlockMessage, d as BWMessage, e as BWRequestMessage } from './index-73138caf.js';
|
|
2
2
|
|
|
3
3
|
const logger$1 = new Logger(version$1);
|
|
4
4
|
const _constructorGuard = {};
|
|
@@ -474,7 +474,7 @@ const requestTimeout = 30000;
|
|
|
474
474
|
const syncTimeout = 30000;
|
|
475
475
|
class Protocol {
|
|
476
476
|
constructor() {
|
|
477
|
-
this.resolveTimeout =
|
|
477
|
+
this.resolveTimeout = 10000;
|
|
478
478
|
}
|
|
479
479
|
get limit() {
|
|
480
480
|
return limit;
|
|
@@ -1060,7 +1060,7 @@ class Jobber {
|
|
|
1060
1060
|
const timeout = setTimeout(() => {
|
|
1061
1061
|
reject('timeout');
|
|
1062
1062
|
}, this.timeout);
|
|
1063
|
-
this.
|
|
1063
|
+
this.destroy = () => {
|
|
1064
1064
|
clearTimeout(timeout);
|
|
1065
1065
|
this.busy = false;
|
|
1066
1066
|
resolve('stopped');
|
|
@@ -1072,6 +1072,7 @@ class Jobber {
|
|
|
1072
1072
|
resolve(result);
|
|
1073
1073
|
}
|
|
1074
1074
|
catch (error) {
|
|
1075
|
+
clearTimeout(timeout);
|
|
1075
1076
|
reject(error);
|
|
1076
1077
|
}
|
|
1077
1078
|
});
|
|
@@ -1085,6 +1086,7 @@ class State extends Contract {
|
|
|
1085
1086
|
#resolving;
|
|
1086
1087
|
#resolveErrorCount;
|
|
1087
1088
|
#syncState;
|
|
1089
|
+
#chainState;
|
|
1088
1090
|
#lastBlockInQue;
|
|
1089
1091
|
#syncErrorCount;
|
|
1090
1092
|
#blockHashMap;
|
|
@@ -1094,6 +1096,12 @@ class State extends Contract {
|
|
|
1094
1096
|
#totalSize;
|
|
1095
1097
|
#machine;
|
|
1096
1098
|
#loaded;
|
|
1099
|
+
get state() {
|
|
1100
|
+
return {
|
|
1101
|
+
sync: this.#syncState,
|
|
1102
|
+
chain: this.#chainState
|
|
1103
|
+
};
|
|
1104
|
+
}
|
|
1097
1105
|
get blockHashMap() {
|
|
1098
1106
|
return this.#blockHashMap.entries();
|
|
1099
1107
|
}
|
|
@@ -1155,8 +1163,10 @@ class State extends Contract {
|
|
|
1155
1163
|
}
|
|
1156
1164
|
constructor() {
|
|
1157
1165
|
super();
|
|
1166
|
+
this.#lastResolvedTime = 0;
|
|
1158
1167
|
this.#resolving = false;
|
|
1159
1168
|
this.#resolveErrorCount = 0;
|
|
1169
|
+
this.#chainState = 'loading';
|
|
1160
1170
|
this.#syncErrorCount = 0;
|
|
1161
1171
|
this.#blockHashMap = new Map();
|
|
1162
1172
|
this.#chainSyncing = false;
|
|
@@ -1188,6 +1198,15 @@ class State extends Contract {
|
|
|
1188
1198
|
* {Number}
|
|
1189
1199
|
*/
|
|
1190
1200
|
this.#totalTransactions = 0;
|
|
1201
|
+
this.#chainStateHandler = () => {
|
|
1202
|
+
return new globalThis.peernet.protos['peernet-response']({ response: this.#chainState });
|
|
1203
|
+
};
|
|
1204
|
+
this.#lastBlockHandler = async () => {
|
|
1205
|
+
return new globalThis.peernet.protos['peernet-response']({ response: { hash: this.#lastBlock?.hash, index: this.#lastBlock?.index } });
|
|
1206
|
+
};
|
|
1207
|
+
this.#knownBlocksHandler = async () => {
|
|
1208
|
+
return new globalThis.peernet.protos['peernet-response']({ response: { blocks: this.#blocks.map((block) => block.hash) } });
|
|
1209
|
+
};
|
|
1191
1210
|
this.#loadBlockTransactions = (transactions) => Promise.all(transactions.map((transaction) => new TransactionMessage(transaction)));
|
|
1192
1211
|
this.#getLastTransactions = async () => {
|
|
1193
1212
|
let lastTransactions = (await Promise.all(this.#blocks.filter(block => block.loaded).slice(-128)
|
|
@@ -1208,12 +1227,16 @@ class State extends Contract {
|
|
|
1208
1227
|
await globalThis.blockStore.clear();
|
|
1209
1228
|
await globalThis.transactionPoolStore.clear();
|
|
1210
1229
|
}
|
|
1230
|
+
#chainStateHandler;
|
|
1231
|
+
#lastBlockHandler;
|
|
1232
|
+
#knownBlocksHandler;
|
|
1211
1233
|
async init() {
|
|
1212
|
-
this.jobber = new Jobber(
|
|
1234
|
+
this.jobber = new Jobber(this.resolveTimeout);
|
|
1213
1235
|
if (super.init)
|
|
1214
1236
|
await super.init();
|
|
1215
|
-
await globalThis.peernet.addRequestHandler('lastBlock', this.#lastBlockHandler
|
|
1216
|
-
await globalThis.peernet.addRequestHandler('knownBlocks', this.#knownBlocksHandler
|
|
1237
|
+
await globalThis.peernet.addRequestHandler('lastBlock', this.#lastBlockHandler);
|
|
1238
|
+
await globalThis.peernet.addRequestHandler('knownBlocks', this.#knownBlocksHandler);
|
|
1239
|
+
await globalThis.peernet.addRequestHandler('chainState', this.#chainStateHandler);
|
|
1217
1240
|
try {
|
|
1218
1241
|
let localBlock;
|
|
1219
1242
|
try {
|
|
@@ -1268,12 +1291,6 @@ class State extends Contract {
|
|
|
1268
1291
|
await globalThis.chainStore.put('lastBlock', hash);
|
|
1269
1292
|
globalThis.pubsub.publish('lastBlock', this.#lastBlock);
|
|
1270
1293
|
}
|
|
1271
|
-
async #lastBlockHandler() {
|
|
1272
|
-
return new globalThis.peernet.protos['peernet-response']({ response: { hash: this.#lastBlock?.hash, index: this.#lastBlock?.index } });
|
|
1273
|
-
}
|
|
1274
|
-
async #knownBlocksHandler() {
|
|
1275
|
-
return new globalThis.peernet.protos['peernet-response']({ response: { blocks: this.#blocks.map((block) => block.hash) } });
|
|
1276
|
-
}
|
|
1277
1294
|
getLatestBlock() {
|
|
1278
1295
|
// @ts-ignore
|
|
1279
1296
|
return this.#getLatestBlock();
|
|
@@ -1314,8 +1331,6 @@ class State extends Contract {
|
|
|
1314
1331
|
this.#lastResolvedTime = Date.now();
|
|
1315
1332
|
}
|
|
1316
1333
|
catch (error) {
|
|
1317
|
-
this.#resolving = false;
|
|
1318
|
-
this.#chainSyncing = false;
|
|
1319
1334
|
throw new ResolveError(`block: ${hash}@${index}`);
|
|
1320
1335
|
}
|
|
1321
1336
|
return;
|
|
@@ -1328,6 +1343,8 @@ class State extends Contract {
|
|
|
1328
1343
|
if (this.#resolving)
|
|
1329
1344
|
return 'already resolving';
|
|
1330
1345
|
this.#resolving = true;
|
|
1346
|
+
if (this.jobber.busy && this.jobber.destroy)
|
|
1347
|
+
await this.jobber.destroy();
|
|
1331
1348
|
try {
|
|
1332
1349
|
await this.jobber.add(() => this.#resolveBlock(hash));
|
|
1333
1350
|
this.#resolving = false;
|
|
@@ -1337,6 +1354,7 @@ class State extends Contract {
|
|
|
1337
1354
|
catch (error) {
|
|
1338
1355
|
console.log({ error });
|
|
1339
1356
|
this.#resolveErrorCount += 1;
|
|
1357
|
+
this.#resolving = false;
|
|
1340
1358
|
if (this.#resolveErrorCount < 3)
|
|
1341
1359
|
return this.resolveBlock(hash);
|
|
1342
1360
|
this.#resolveErrorCount = 0;
|
|
@@ -1345,8 +1363,8 @@ class State extends Contract {
|
|
|
1345
1363
|
}
|
|
1346
1364
|
async resolveBlocks() {
|
|
1347
1365
|
try {
|
|
1348
|
-
if (this.jobber.busy && this.jobber.
|
|
1349
|
-
await this.jobber.
|
|
1366
|
+
if (this.jobber.busy && this.jobber.destroy) {
|
|
1367
|
+
await this.jobber.destroy();
|
|
1350
1368
|
}
|
|
1351
1369
|
}
|
|
1352
1370
|
catch (error) {
|
|
@@ -1362,10 +1380,10 @@ class State extends Contract {
|
|
|
1362
1380
|
}
|
|
1363
1381
|
catch (error) {
|
|
1364
1382
|
console.log(error);
|
|
1383
|
+
this.#chainSyncing = false;
|
|
1384
|
+
this.#syncState = 'errored';
|
|
1365
1385
|
this.#resolveErrored = true;
|
|
1366
|
-
this
|
|
1367
|
-
this.#resolving = false;
|
|
1368
|
-
this.restoreChain();
|
|
1386
|
+
return this.restoreChain();
|
|
1369
1387
|
// console.log(e);
|
|
1370
1388
|
}
|
|
1371
1389
|
}
|
|
@@ -1383,23 +1401,25 @@ class State extends Contract {
|
|
|
1383
1401
|
this.#resolveErrored = true;
|
|
1384
1402
|
this.#resolveErrorCount += 1;
|
|
1385
1403
|
this.#resolving = false;
|
|
1386
|
-
this.restoreChain();
|
|
1404
|
+
return this.restoreChain();
|
|
1387
1405
|
// console.log(e);
|
|
1388
1406
|
}
|
|
1389
1407
|
}
|
|
1408
|
+
destroyResolveJob() {
|
|
1409
|
+
}
|
|
1390
1410
|
async syncChain(lastBlock) {
|
|
1391
|
-
if (!this.shouldSync)
|
|
1411
|
+
if (!this.shouldSync)
|
|
1392
1412
|
return;
|
|
1393
|
-
|
|
1413
|
+
this.#syncState;
|
|
1414
|
+
this.#chainSyncing = true;
|
|
1394
1415
|
try {
|
|
1395
|
-
if (this.jobber.busy && this.jobber.
|
|
1396
|
-
await this.jobber.
|
|
1416
|
+
if (this.jobber.busy && this.jobber.destroy) {
|
|
1417
|
+
await this.jobber.destroy();
|
|
1397
1418
|
}
|
|
1398
1419
|
}
|
|
1399
1420
|
catch (error) {
|
|
1400
1421
|
console.error(error);
|
|
1401
1422
|
}
|
|
1402
|
-
this.#chainSyncing = true;
|
|
1403
1423
|
if (!lastBlock)
|
|
1404
1424
|
lastBlock = await this.#getLatestBlock();
|
|
1405
1425
|
console.log('starting sync');
|
|
@@ -1414,7 +1434,8 @@ class State extends Contract {
|
|
|
1414
1434
|
return this.syncChain(lastBlock);
|
|
1415
1435
|
this.#syncErrorCount = 0;
|
|
1416
1436
|
this.#chainSyncing = false;
|
|
1417
|
-
|
|
1437
|
+
this.#syncState = 'errored';
|
|
1438
|
+
return this.#syncState;
|
|
1418
1439
|
}
|
|
1419
1440
|
if (lastBlock.index === this.#lastBlockInQue?.index)
|
|
1420
1441
|
this.#lastBlockInQue = undefined;
|
|
@@ -1422,7 +1443,8 @@ class State extends Contract {
|
|
|
1422
1443
|
this.#chainSyncing = false;
|
|
1423
1444
|
if (this.#lastBlockInQue)
|
|
1424
1445
|
return this.syncChain(this.#lastBlockInQue);
|
|
1425
|
-
|
|
1446
|
+
this.#syncState = 'synced';
|
|
1447
|
+
return this.#syncState;
|
|
1426
1448
|
}
|
|
1427
1449
|
async #syncChain(lastBlock) {
|
|
1428
1450
|
try {
|
|
@@ -1504,6 +1526,7 @@ class State extends Contract {
|
|
|
1504
1526
|
* @param {Block[]} blocks
|
|
1505
1527
|
*/
|
|
1506
1528
|
async #loadBlocks(blocks) {
|
|
1529
|
+
this.#chainState = 'loading';
|
|
1507
1530
|
let poolTransactionKeys = await globalThis.transactionPoolStore.keys();
|
|
1508
1531
|
for (const block of blocks) {
|
|
1509
1532
|
if (block && !block.loaded) {
|
|
@@ -1556,6 +1579,7 @@ class State extends Contract {
|
|
|
1556
1579
|
globalThis.pubsub.publish('block-loaded', { ...block });
|
|
1557
1580
|
}
|
|
1558
1581
|
}
|
|
1582
|
+
this.#chainState = 'loaded';
|
|
1559
1583
|
return true;
|
|
1560
1584
|
}
|
|
1561
1585
|
promiseRequests(promises) {
|
|
@@ -1586,9 +1610,12 @@ class State extends Contract {
|
|
|
1586
1610
|
return true;
|
|
1587
1611
|
}
|
|
1588
1612
|
get shouldSync() {
|
|
1589
|
-
if (this
|
|
1590
|
-
|
|
1591
|
-
|
|
1613
|
+
if (this.#chainSyncing)
|
|
1614
|
+
return false;
|
|
1615
|
+
if (this.#resolveErrored ||
|
|
1616
|
+
this.#syncState === 'errored' ||
|
|
1617
|
+
this.#syncState === 'connectionless' ||
|
|
1618
|
+
!this.canSync && this.#lastResolvedTime + this.resolveTimeout > Date.now())
|
|
1592
1619
|
return true;
|
|
1593
1620
|
return false;
|
|
1594
1621
|
}
|
|
@@ -1771,31 +1798,36 @@ class Chain extends VersionControl {
|
|
|
1771
1798
|
response = await new globalThis.peernet.protos['peernet-response'](new Uint8Array(Object.values(response)));
|
|
1772
1799
|
return response.decoded.response;
|
|
1773
1800
|
}
|
|
1801
|
+
async getPeerTransactionPool(peer) {
|
|
1802
|
+
const transactionsInPool = await this.#makeRequest(peer, 'transactionPool');
|
|
1803
|
+
// todo iterate vs getting all keys?
|
|
1804
|
+
const transactions = await globalThis.transactionPoolStore.keys();
|
|
1805
|
+
const transactionsToGet = [];
|
|
1806
|
+
for (const key of transactionsInPool) {
|
|
1807
|
+
!transactions.includes(key) &&
|
|
1808
|
+
!ignorelist.includes(key) &&
|
|
1809
|
+
transactionsToGet.push(transactionPoolStore.put(key, await peernet.get(key, 'transaction')));
|
|
1810
|
+
}
|
|
1811
|
+
return Promise.all(transactionsToGet);
|
|
1812
|
+
}
|
|
1774
1813
|
async #peerConnected(peer) {
|
|
1775
1814
|
// todo handle version changes
|
|
1776
1815
|
// for now just do nothing if version doesn't match
|
|
1777
1816
|
if (!peer.version || peer.version !== this.version)
|
|
1778
1817
|
return;
|
|
1779
1818
|
const lastBlock = await this.#makeRequest(peer, 'lastBlock');
|
|
1780
|
-
|
|
1781
|
-
const
|
|
1782
|
-
const transactionsToGet = [];
|
|
1783
|
-
for (const key of transactionsInPool) {
|
|
1784
|
-
if (!transactions.includes(key) && !ignorelist.includes(key))
|
|
1785
|
-
transactionsToGet.push(transactionPoolStore.put(key, (await peernet.get(key, 'transaction'))));
|
|
1786
|
-
}
|
|
1787
|
-
await Promise.all(transactionsToGet);
|
|
1819
|
+
const higherThenCurrentLocal = lastBlock.index > this.lastBlock?.index;
|
|
1820
|
+
const peerTransactionPool = higherThenCurrentLocal && await this.getPeerTransactionPool(peer) || [];
|
|
1788
1821
|
if (Object.keys(lastBlock).length > 0) {
|
|
1789
|
-
if (!this.lastBlock ||
|
|
1822
|
+
if (!this.lastBlock || higherThenCurrentLocal) {
|
|
1790
1823
|
this.knownBlocks = await this.#makeRequest(peer, 'knownBlocks');
|
|
1791
1824
|
await this.syncChain(lastBlock);
|
|
1792
|
-
// if (await this.hasTransactionToHandle() && this.#participating) this.#runEpoch()
|
|
1793
1825
|
}
|
|
1794
1826
|
else if (!this.knownBlocks)
|
|
1795
1827
|
this.knownBlocks = await this.#makeRequest(peer, 'knownBlocks');
|
|
1796
1828
|
}
|
|
1797
|
-
if (this.#participating)
|
|
1798
|
-
this.#runEpoch();
|
|
1829
|
+
if (this.#participating && peerTransactionPool.length > 0)
|
|
1830
|
+
return this.#runEpoch();
|
|
1799
1831
|
}
|
|
1800
1832
|
#epochTimeout;
|
|
1801
1833
|
async #transactionPoolHandler() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { M as MultiWallet, e as encrypt, b as base58$1 } from './node-browser-
|
|
2
|
-
import './index-
|
|
1
|
+
import { M as MultiWallet, e as encrypt, b as base58$1 } from './node-browser-19707bf6.js';
|
|
2
|
+
import './index-73138caf.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @params {String} network
|
|
@@ -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
|
}
|
|
@@ -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,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-
|
|
1
|
+
import { C as ContractMessage, T as TransactionMessage, c as BlockMessage, d as BWMessage, e as BWRequestMessage, V as ValidatorMessage } from './index-73138caf.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-
|
|
20219
|
+
const importee = await import(/* webpackChunkName: "generate-account" */ './index-329e0324-835f93a9.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-
|
|
20410
|
+
} = await import(/* webpackChunkName: "messages" */ './messages-000b7f84-b6b8b755.js');
|
|
20411
20411
|
/**
|
|
20412
20412
|
* proto Object containing protos
|
|
20413
20413
|
* @type {Object}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { N as default } from './node-browser-
|
|
2
|
-
import './index-
|
|
1
|
+
export { N as default } from './node-browser-19707bf6.js';
|
|
2
|
+
import './index-73138caf.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E as EasyWorker, B as BigNumber, f as formatBytes, C as ContractMessage, a as BlockMessage } from './worker-
|
|
1
|
+
import { E as EasyWorker, B as BigNumber, f as formatBytes, C as ContractMessage, a as BlockMessage } from './worker-0f66935f.js';
|
|
2
2
|
|
|
3
3
|
var contractFactory = "237,198,141,3,53,89,84,113,119,88,110,55,76,101,103,89,119,65,109,100,117,75,88,119,116,83,52,118,52,100,97,114,113,66,84,81,82,76,90,106,50,57,117,106,112,114,98,104,52,119,121,76,106,112,56,50,87,106,173,5,99,108,97,115,115,32,70,97,99,116,111,114,121,123,35,110,97,109,101,61,34,65,114,116,79,110,108,105,110,101,67,111,110,116,114,97,99,116,70,97,99,116,111,114,121,34,59,35,116,111,116,97,108,67,111,110,116,114,97,99,116,115,61,48,59,35,99,111,110,116,114,97,99,116,115,61,91,93,59,99,111,110,115,116,114,117,99,116,111,114,40,115,116,97,116,101,41,123,115,116,97,116,101,38,38,40,116,104,105,115,46,35,99,111,110,116,114,97,99,116,115,61,115,116,97,116,101,46,99,111,110,116,114,97,99,116,115,44,116,104,105,115,46,35,116,111,116,97,108,67,111,110,116,114,97,99,116,115,61,115,116,97,116,101,46,116,111,116,97,108,67,111,110,116,114,97,99,116,115,41,125,103,101,116,32,115,116,97,116,101,40,41,123,114,101,116,117,114,110,123,116,111,116,97,108,67,111,110,116,114,97,99,116,115,58,116,104,105,115,46,35,116,111,116,97,108,67,111,110,116,114,97,99,116,115,44,99,111,110,116,114,97,99,116,115,58,116,104,105,115,46,35,99,111,110,116,114,97,99,116,115,125,125,103,101,116,32,110,97,109,101,40,41,123,114,101,116,117,114,110,32,116,104,105,115,46,35,110,97,109,101,125,103,101,116,32,99,111,110,116,114,97,99,116,115,40,41,123,114,101,116,117,114,110,91,46,46,46,116,104,105,115,46,35,99,111,110,116,114,97,99,116,115,93,125,103,101,116,32,116,111,116,97,108,67,111,110,116,114,97,99,116,115,40,41,123,114,101,116,117,114,110,32,116,104,105,115,46,35,116,111,116,97,108,67,111,110,116,114,97,99,116,115,125,105,115,82,101,103,105,115,116,101,114,101,100,40,97,100,100,114,101,115,115,41,123,114,101,116,117,114,110,32,116,104,105,115,46,35,99,111,110,116,114,97,99,116,115,46,105,110,99,108,117,100,101,115,40,97,100,100,114,101,115,115,41,125,97,115,121,110,99,32,114,101,103,105,115,116,101,114,67,111,110,116,114,97,99,116,40,97,100,100,114,101,115,115,41,123,105,102,40,97,119,97,105,116,32,109,115,103,46,115,116,97,116,105,99,67,97,108,108,40,97,100,100,114,101,115,115,44,34,104,97,115,82,111,108,101,34,44,91,109,115,103,46,115,101,110,100,101,114,44,34,79,87,78,69,82,34,93,41,44,116,104,105,115,46,35,99,111,110,116,114,97,99,116,115,46,105,110,99,108,117,100,101,115,40,97,100,100,114,101,115,115,41,41,116,104,114,111,119,32,110,101,119,32,69,114,114,111,114,40,34,97,108,114,101,97,100,121,32,114,101,103,105,115,116,101,114,101,100,34,41,59,116,104,105,115,46,35,116,111,116,97,108,67,111,110,116,114,97,99,116,115,43,61,49,44,116,104,105,115,46,35,99,111,110,116,114,97,99,116,115,46,112,117,115,104,40,97,100,100,114,101,115,115,41,125,125,114,101,116,117,114,110,32,70,97,99,116,111,114,121,59,2,91,93";
|
|
4
4
|
var nativeToken = "237,198,141,3,53,89,84,113,119,88,110,55,76,101,103,89,119,65,109,100,117,75,88,119,116,83,52,118,52,100,97,114,113,66,84,81,82,76,90,106,50,57,117,106,112,114,98,104,52,119,121,76,106,112,56,50,87,106,163,26,99,108,97,115,115,32,82,111,108,101,115,123,35,114,111,108,101,115,61,123,79,87,78,69,82,58,91,93,44,77,73,78,84,58,91,93,44,66,85,82,78,58,91,93,125,59,99,111,110,115,116,114,117,99,116,111,114,40,114,111,108,101,115,41,123,105,102,40,114,111,108,101,115,41,123,105,102,40,33,40,114,111,108,101,115,32,105,110,115,116,97,110,99,101,111,102,32,79,98,106,101,99,116,41,41,116,104,114,111,119,32,110,101,119,32,84,121,112,101,69,114,114,111,114,40,34,101,120,112,101,99,116,101,100,32,114,111,108,101,115,32,116,111,32,98,101,32,97,110,32,111,98,106,101,99,116,34,41,59,116,104,105,115,46,35,114,111,108,101,115,61,123,46,46,46,114,111,108,101,115,44,46,46,46,116,104,105,115,46,35,114,111,108,101,115,125,125,101,108,115,101,32,116,104,105,115,46,35,103,114,97,110,116,82,111,108,101,40,109,115,103,46,115,101,110,100,101,114,44,34,79,87,78,69,82,34,41,125,103,101,116,32,115,116,97,116,101,40,41,123,114,101,116,117,114,110,123,114,111,108,101,115,58,116,104,105,115,46,114,111,108,101,115,125,125,103,101,116,32,114,111,108,101,115,40,41,123,114,101,116,117,114,110,123,46,46,46,116,104,105,115,46,35,114,111,108,101,115,125,125,104,97,115,82,111,108,101,40,97,100,100,114,101,115,115,44,114,111,108,101,41,123,114,101,116,117,114,110,33,33,116,104,105,115,46,35,114,111,108,101,115,91,114,111,108,101,93,38,38,116,104,105,115,46,35,114,111,108,101,115,91,114,111,108,101,93,46,105,110,99,108,117,100,101,115,40,97,100,100,114,101,115,115,41,125,35,103,114,97,110,116,82,111,108,101,40,97,100,100,114,101,115,115,44,114,111,108,101,41,123,105,102,40,116,104,105,115,46,104,97,115,82,111,108,101,40,97,100,100,114,101,115,115,44,114,111,108,101,41,41,116,104,114,111,119,32,110,101,119,32,69,114,114,111,114,40,96,36,123,114,111,108,101,125,32,114,111,108,101,32,97,108,114,101,97,100,121,32,103,114,97,110,116,101,100,32,102,111,114,32,36,123,97,100,100,114,101,115,115,125,96,41,59,116,104,105,115,46,35,114,111,108,101,115,91,114,111,108,101,93,46,112,117,115,104,40,97,100,100,114,101,115,115,41,125,35,114,101,118,111,107,101,82,111,108,101,40,97,100,100,114,101,115,115,44,114,111,108,101,41,123,105,102,40,33,116,104,105,115,46,104,97,115,82,111,108,101,40,97,100,100,114,101,115,115,44,114,111,108,101,41,41,116,104,114,111,119,32,110,101,119,32,69,114,114,111,114,40,96,36,123,114,111,108,101,125,32,114,111,108,101,32,97,108,114,101,97,100,121,32,114,101,118,111,107,101,100,32,102,111,114,32,36,123,97,100,100,114,101,115,115,125,96,41,59,105,102,40,34,79,87,78,69,82,34,61,61,61,114,111,108,101,38,38,49,61,61,61,116,104,105,115,46,35,114,111,108,101,115,91,114,111,108,101,93,46,108,101,110,103,116,104,41,116,104,114,111,119,32,110,101,119,32,69,114,114,111,114,40,34,97,116,108,101,97,115,116,32,111,110,101,32,111,119,110,101,114,32,105,115,32,110,101,101,100,101,100,33,34,41,59,116,104,105,115,46,35,114,111,108,101,115,91,114,111,108,101,93,46,115,112,108,105,99,101,40,116,104,105,115,46,35,114,111,108,101,115,91,114,111,108,101,93,46,105,110,100,101,120,79,102,40,97,100,100,114,101,115,115,41,41,125,103,114,97,110,116,82,111,108,101,40,97,100,100,114,101,115,115,44,114,111,108,101,41,123,105,102,40,33,116,104,105,115,46,104,97,115,82,111,108,101,40,97,100,100,114,101,115,115,44,34,79,87,78,69,82,34,41,41,116,104,114,111,119,32,110,101,119,32,69,114,114,111,114,40,34,78,111,116,32,97,108,108,111,119,101,100,34,41,59,116,104,105,115,46,35,103,114,97,110,116,82,111,108,101,40,97,100,100,114,101,115,115,44,114,111,108,101,41,125,114,101,118,111,107,101,82,111,108,101,40,97,100,100,114,101,115,115,44,114,111,108,101,41,123,105,102,40,33,116,104,105,115,46,104,97,115,82,111,108,101,40,97,100,100,114,101,115,115,44,34,79,87,78,69,82,34,41,41,116,104,114,111,119,32,110,101,119,32,69,114,114,111,114,40,34,78,111,116,32,97,108,108,111,119,101,100,34,41,59,116,104,105,115,46,35,114,101,118,111,107,101,82,111,108,101,40,97,100,100,114,101,115,115,44,114,111,108,101,41,125,125,99,108,97,115,115,32,84,111,107,101,110,32,101,120,116,101,110,100,115,32,82,111,108,101,115,123,35,110,97,109,101,59,35,115,121,109,98,111,108,59,35,104,111,108,100,101,114,115,61,48,59,35,98,97,108,97,110,99,101,115,61,123,125,59,35,97,112,112,114,111,118,97,108,115,61,123,125,59,35,100,101,99,105,109,97,108,115,61,49,56,59,35,116,111,116,97,108,83,117,112,112,108,121,61,66,105,103,78,117,109,98,101,114,46,102,114,111,109,40,48,41,59,99,111,110,115,116,114,117,99,116,111,114,40,110,97,109,101,44,115,121,109,98,111,108,44,100,101,99,105,109,97,108,115,61,49,56,44,115,116,97,116,101,41,123,105,102,40,33,110,97,109,101,41,116,104,114,111,119,32,110,101,119,32,69,114,114,111,114,40,34,110,97,109,101,32,117,110,100,101,102,105,110,101,100,34,41,59,105,102,40,33,115,121,109,98,111,108,41,116,104,114,111,119,32,110,101,119,32,69,114,114,111,114,40,34,115,121,109,98,111,108,32,117,110,100,101,102,105,110,101,100,34,41,59,115,117,112,101,114,40,115,116,97,116,101,63,46,114,111,108,101,115,41,44,116,104,105,115,46,35,110,97,109,101,61,110,97,109,101,44,116,104,105,115,46,35,115,121,109,98,111,108,61,115,121,109,98,111,108,44,116,104,105,115,46,35,100,101,99,105,109,97,108,115,61,100,101,99,105,109,97,108,115,125,103,101,116,32,115,116,97,116,101,40,41,123,114,101,116,117,114,110,123,46,46,46,115,117,112,101,114,46,115,116,97,116,101,44,104,111,108,100,101,114,115,58,116,104,105,115,46,104,111,108,100,101,114,115,44,98,97,108,97,110,99,101,115,58,116,104,105,115,46,98,97,108,97,110,99,101,115,44,97,112,112,114,111,118,97,108,115,58,123,46,46,46,116,104,105,115,46,35,97,112,112,114,111,118,97,108,115,125,44,116,111,116,97,108,83,117,112,112,108,121,58,116,104,105,115,46,116,111,116,97,108,83,117,112,112,108,121,125,125,103,101,116,32,116,111,116,97,108,83,117,112,112,108,121,40,41,123,114,101,116,117,114,110,32,116,104,105,115,46,35,116,111,116,97,108,83,117,112,112,108,121,125,103,101,116,32,110,97,109,101,40,41,123,114,101,116,117,114,110,32,116,104,105,115,46,35,110,97,109,101,125,103,101,116,32,115,121,109,98,111,108,40,41,123,114,101,116,117,114,110,32,116,104,105,115,46,35,115,121,109,98,111,108,125,103,101,116,32,104,111,108,100,101,114,115,40,41,123,114,101,116,117,114,110,32,116,104,105,115,46,35,104,111,108,100,101,114,115,125,103,101,116,32,98,97,108,97,110,99,101,115,40,41,123,114,101,116,117,114,110,123,46,46,46,116,104,105,115,46,35,98,97,108,97,110,99,101,115,125,125,109,105,110,116,40,116,111,44,97,109,111,117,110,116,41,123,105,102,40,33,116,104,105,115,46,104,97,115,82,111,108,101,40,109,115,103,46,115,101,110,100,101,114,44,34,77,73,78,84,34,41,41,116,104,114,111,119,32,110,101,119,32,69,114,114,111,114,40,34,110,111,116,32,97,108,108,111,119,101,100,34,41,59,116,104,105,115,46,35,116,111,116,97,108,83,117,112,112,108,121,61,116,104,105,115,46,35,116,111,116,97,108,83,117,112,112,108,121,46,97,100,100,40,97,109,111,117,110,116,41,44,116,104,105,115,46,35,105,110,99,114,101,97,115,101,66,97,108,97,110,99,101,40,116,111,44,97,109,111,117,110,116,41,125,98,117,114,110,40,102,114,111,109,44,97,109,111,117,110,116,41,123,105,102,40,33,116,104,105,115,46,104,97,115,82,111,108,101,40,109,115,103,46,115,101,110,100,101,114,44,34,66,85,82,78,34,41,41,116,104,114,111,119,32,110,101,119,32,69,114,114,111,114,40,34,110,111,116,32,97,108,108,111,119,101,100,34,41,59,116,104,105,115,46,35,116,111,116,97,108,83,117,112,112,108,121,61,116,104,105,115,46,35,116,111,116,97,108,83,117,112,112,108,121,46,115,117,98,40,97,109,111,117,110,116,41,44,116,104,105,115,46,35,100,101,99,114,101,97,115,101,66,97,108,97,110,99,101,40,102,114,111,109,44,97,109,111,117,110,116,41,125,35,98,101,102,111,114,101,84,114,97,110,115,102,101,114,40,102,114,111,109,44,116,111,44,97,109,111,117,110,116,41,123,105,102,40,33,116,104,105,115,46,35,98,97,108,97,110,99,101,115,91,102,114,111,109,93,124,124,116,104,105,115,46,35,98,97,108,97,110,99,101,115,91,102,114,111,109,93,60,97,109,111,117,110,116,41,116,104,114,111,119,32,110,101,119,32,69,114,114,111,114,40,34,97,109,111,117,110,116,32,101,120,99,101,101,100,115,32,98,97,108,97,110,99,101,34,41,125,35,117,112,100,97,116,101,72,111,108,100,101,114,115,40,97,100,100,114,101,115,115,44,112,114,101,118,105,111,117,115,66,97,108,97,110,99,101,41,123,34,48,120,48,48,34,61,61,61,116,104,105,115,46,35,98,97,108,97,110,99,101,115,91,97,100,100,114,101,115,115,93,46,116,111,72,101,120,83,116,114,105,110,103,40,41,63,116,104,105,115,46,35,104,111,108,100,101,114,115,45,61,49,58,34,48,120,48,48,34,33,61,61,116,104,105,115,46,35,98,97,108,97,110,99,101,115,91,97,100,100,114,101,115,115,93,46,116,111,72,101,120,83,116,114,105,110,103,40,41,38,38,34,48,120,48,48,34,61,61,61,112,114,101,118,105,111,117,115,66,97,108,97,110,99,101,46,116,111,72,101,120,83,116,114,105,110,103,40,41,38,38,40,116,104,105,115,46,35,104,111,108,100,101,114,115,43,61,49,41,125,35,105,110,99,114,101,97,115,101,66,97,108,97,110,99,101,40,97,100,100,114,101,115,115,44,97,109,111,117,110,116,41,123,116,104,105,115,46,35,98,97,108,97,110,99,101,115,91,97,100,100,114,101,115,115,93,124,124,40,116,104,105,115,46,35,98,97,108,97,110,99,101,115,91,97,100,100,114,101,115,115,93,61,66,105,103,78,117,109,98,101,114,46,102,114,111,109,40,48,41,41,59,99,111,110,115,116,32,112,114,101,118,105,111,117,115,66,97,108,97,110,99,101,61,116,104,105,115,46,35,98,97,108,97,110,99,101,115,91,97,100,100,114,101,115,115,93,59,116,104,105,115,46,35,98,97,108,97,110,99,101,115,91,97,100,100,114,101,115,115,93,61,116,104,105,115,46,35,98,97,108,97,110,99,101,115,91,97,100,100,114,101,115,115,93,46,97,100,100,40,97,109,111,117,110,116,41,44,116,104,105,115,46,35,117,112,100,97,116,101,72,111,108,100,101,114,115,40,97,100,100,114,101,115,115,44,112,114,101,118,105,111,117,115,66,97,108,97,110,99,101,41,125,35,100,101,99,114,101,97,115,101,66,97,108,97,110,99,101,40,97,100,100,114,101,115,115,44,97,109,111,117,110,116,41,123,99,111,110,115,116,32,112,114,101,118,105,111,117,115,66,97,108,97,110,99,101,61,116,104,105,115,46,35,98,97,108,97,110,99,101,115,91,97,100,100,114,101,115,115,93,59,116,104,105,115,46,35,98,97,108,97,110,99,101,115,91,97,100,100,114,101,115,115,93,61,116,104,105,115,46,35,98,97,108,97,110,99,101,115,91,97,100,100,114,101,115,115,93,46,115,117,98,40,97,109,111,117,110,116,41,44,116,104,105,115,46,35,117,112,100,97,116,101,72,111,108,100,101,114,115,40,97,100,100,114,101,115,115,44,112,114,101,118,105,111,117,115,66,97,108,97,110,99,101,41,125,98,97,108,97,110,99,101,79,102,40,97,100,100,114,101,115,115,41,123,114,101,116,117,114,110,32,116,104,105,115,46,35,98,97,108,97,110,99,101,115,91,97,100,100,114,101,115,115,93,125,115,101,116,65,112,112,114,111,118,97,108,40,111,112,101,114,97,116,111,114,44,97,109,111,117,110,116,41,123,99,111,110,115,116,32,111,119,110,101,114,61,109,115,103,46,115,101,110,100,101,114,59,116,104,105,115,46,35,97,112,112,114,111,118,97,108,115,91,111,119,110,101,114,93,124,124,40,116,104,105,115,46,35,97,112,112,114,111,118,97,108,115,91,111,119,110,101,114,93,61,123,125,41,44,116,104,105,115,46,35,97,112,112,114,111,118,97,108,115,91,111,119,110,101,114,93,91,111,112,101,114,97,116,111,114,93,61,97,109,111,117,110,116,125,97,112,112,114,111,118,101,100,40,111,119,110,101,114,44,111,112,101,114,97,116,111,114,44,97,109,111,117,110,116,41,123,114,101,116,117,114,110,32,116,104,105,115,46,35,97,112,112,114,111,118,97,108,115,91,111,119,110,101,114,93,91,111,112,101,114,97,116,111,114,93,61,61,61,97,109,111,117,110,116,125,116,114,97,110,115,102,101,114,40,102,114,111,109,44,116,111,44,97,109,111,117,110,116,41,123,97,109,111,117,110,116,61,66,105,103,78,117,109,98,101,114,46,102,114,111,109,40,97,109,111,117,110,116,41,44,116,104,105,115,46,35,98,101,102,111,114,101,84,114,97,110,115,102,101,114,40,102,114,111,109,44,116,111,44,97,109,111,117,110,116,41,44,116,104,105,115,46,35,100,101,99,114,101,97,115,101,66,97,108,97,110,99,101,40,102,114,111,109,44,97,109,111,117,110,116,41,44,116,104,105,115,46,35,105,110,99,114,101,97,115,101,66,97,108,97,110,99,101,40,116,111,44,97,109,111,117,110,116,41,125,125,99,108,97,115,115,32,65,114,116,79,110,108,105,110,101,32,101,120,116,101,110,100,115,32,84,111,107,101,110,123,99,111,110,115,116,114,117,99,116,111,114,40,115,116,97,116,101,41,123,115,117,112,101,114,40,34,65,114,116,79,110,108,105,110,101,34,44,34,65,82,84,34,44,49,56,44,115,116,97,116,101,41,125,125,114,101,116,117,114,110,32,65,114,116,79,110,108,105,110,101,59,2,91,93";
|
|
@@ -5500,6 +5500,8 @@ class TransactionMessage extends FormatInterface {
|
|
|
5500
5500
|
return 'TransactionMessage';
|
|
5501
5501
|
}
|
|
5502
5502
|
constructor(buffer) {
|
|
5503
|
+
if (buffer instanceof TransactionMessage)
|
|
5504
|
+
return buffer;
|
|
5503
5505
|
const name = 'transaction-message';
|
|
5504
5506
|
super(buffer, proto$3, { name });
|
|
5505
5507
|
}
|
|
@@ -5515,6 +5517,8 @@ class ValidatorMessage extends FormatInterface {
|
|
|
5515
5517
|
return 'ValidatorMessage';
|
|
5516
5518
|
}
|
|
5517
5519
|
constructor(buffer) {
|
|
5520
|
+
if (buffer instanceof ValidatorMessage)
|
|
5521
|
+
return buffer;
|
|
5518
5522
|
const name = 'validator-message';
|
|
5519
5523
|
super(buffer, proto$2, { name });
|
|
5520
5524
|
}
|
|
@@ -5535,6 +5539,8 @@ class BlockMessage extends FormatInterface {
|
|
|
5535
5539
|
return 'BlockMessage';
|
|
5536
5540
|
}
|
|
5537
5541
|
constructor(buffer) {
|
|
5542
|
+
if (buffer instanceof BlockMessage)
|
|
5543
|
+
return buffer;
|
|
5538
5544
|
const name = 'block-message';
|
|
5539
5545
|
super(buffer, proto$1, { name });
|
|
5540
5546
|
}
|
|
@@ -5582,6 +5588,8 @@ class ContractMessage extends FormatInterface {
|
|
|
5582
5588
|
return 'ContractMessage';
|
|
5583
5589
|
}
|
|
5584
5590
|
constructor(buffer) {
|
|
5591
|
+
if (buffer instanceof ContractMessage)
|
|
5592
|
+
return buffer;
|
|
5585
5593
|
super(buffer, proto, { name: 'contract-message' });
|
|
5586
5594
|
}
|
|
5587
5595
|
}
|
package/exports/chain.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export default class Chain extends VersionControl {
|
|
|
10
10
|
get nativeToken(): string;
|
|
11
11
|
get validators(): any[];
|
|
12
12
|
hasTransactionToHandle(): Promise<boolean>;
|
|
13
|
+
getPeerTransactionPool(peer: any): Promise<any[]>;
|
|
13
14
|
participate(address: any): Promise<void>;
|
|
14
15
|
/**
|
|
15
16
|
* every tx done is trough contracts so no need for amount
|