@leofcoin/chain 1.5.67 → 1.5.68
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/{_polyfill-node.child_process-BsjYmFff.js → _polyfill-node.child_process-CblghArn.js} +48 -47
- package/exports/browser/{_polyfill-node.url-Bp9XkJZf.js → _polyfill-node.url-BLK_MhDf.js} +1 -1
- package/exports/browser/{browser-Ei0BXMlu-C1_XUL9Y.js → browser-Ei0BXMlu-C0woTcHa.js} +2 -2
- package/exports/browser/chain.js +83 -21
- package/exports/browser/{client-A009z8av-DQfd3vOY.js → client-A009z8av-Ssch8Yea.js} +4 -4
- package/exports/browser/{index-G74WLzL7-Dt2dwaXq.js → index-G74WLzL7-BnLRqHoy.js} +2 -2
- package/exports/browser/{index-YQrIDBUQ-c7011Ab4.js → index-YQrIDBUQ-APwDgUUG.js} +2 -2
- package/exports/browser/{messages-lWRTai7t-ClhClfC1.js → messages-lWRTai7t-DJnHZSdM.js} +2 -2
- package/exports/browser/{node-browser-DqIklEKv.js → node-browser-CeM_F-HL.js} +23 -4
- package/exports/browser/node-browser.js +2 -2
- package/exports/browser/workers/block-worker.js +1 -1
- package/exports/browser/workers/machine-worker.js +218 -91
- package/exports/browser/workers/{worker-CltAyHf1.js → worker-CbAak_hM.js} +47 -46
- package/exports/chain.js +75 -13
- package/exports/machine.d.ts +8 -0
- package/exports/simplifiers/state.d.ts +3 -0
- package/exports/workers/block-worker.js +1 -1
- package/exports/workers/machine-worker.js +218 -91
- package/exports/workers/{worker-CltAyHf1.js → worker-CbAak_hM.js} +47 -46
- package/package.json +110 -109
|
@@ -12430,55 +12430,56 @@ class ValidatorMessage extends FormatInterface {
|
|
|
12430
12430
|
}
|
|
12431
12431
|
|
|
12432
12432
|
var proto$1 = {
|
|
12433
|
-
|
|
12434
|
-
|
|
12435
|
-
|
|
12436
|
-
|
|
12437
|
-
|
|
12438
|
-
|
|
12439
|
-
|
|
12433
|
+
index: Number(),
|
|
12434
|
+
previousHash: String(),
|
|
12435
|
+
timestamp: Number(),
|
|
12436
|
+
reward: BigNumber.from(0),
|
|
12437
|
+
fees: BigNumber.from(0),
|
|
12438
|
+
transactions: new Uint8Array(),
|
|
12439
|
+
validators: new Uint8Array()
|
|
12440
12440
|
};
|
|
12441
12441
|
|
|
12442
12442
|
class BlockMessage extends FormatInterface {
|
|
12443
|
-
|
|
12444
|
-
|
|
12445
|
-
|
|
12446
|
-
|
|
12447
|
-
|
|
12448
|
-
|
|
12449
|
-
|
|
12450
|
-
|
|
12451
|
-
|
|
12452
|
-
decoded
|
|
12453
|
-
|
|
12454
|
-
|
|
12455
|
-
|
|
12456
|
-
|
|
12457
|
-
|
|
12458
|
-
|
|
12459
|
-
|
|
12460
|
-
|
|
12461
|
-
|
|
12462
|
-
|
|
12463
|
-
|
|
12464
|
-
|
|
12465
|
-
|
|
12466
|
-
|
|
12467
|
-
|
|
12468
|
-
|
|
12469
|
-
|
|
12470
|
-
|
|
12471
|
-
|
|
12472
|
-
|
|
12473
|
-
|
|
12474
|
-
|
|
12475
|
-
|
|
12476
|
-
|
|
12477
|
-
|
|
12478
|
-
|
|
12479
|
-
|
|
12480
|
-
|
|
12481
|
-
|
|
12443
|
+
get messageName() {
|
|
12444
|
+
return 'BlockMessage';
|
|
12445
|
+
}
|
|
12446
|
+
constructor(buffer) {
|
|
12447
|
+
if (buffer instanceof BlockMessage)
|
|
12448
|
+
return buffer;
|
|
12449
|
+
const name = 'block-message';
|
|
12450
|
+
super(buffer, proto$1, { name });
|
|
12451
|
+
}
|
|
12452
|
+
encode(decoded) {
|
|
12453
|
+
decoded = decoded || this.decoded;
|
|
12454
|
+
const validators = [];
|
|
12455
|
+
const transactions = [];
|
|
12456
|
+
for (const validator of decoded.validators) {
|
|
12457
|
+
if (validator instanceof ValidatorMessage)
|
|
12458
|
+
validators.push(validator.encode());
|
|
12459
|
+
else
|
|
12460
|
+
validators.push(new ValidatorMessage(validator).encode());
|
|
12461
|
+
}
|
|
12462
|
+
for (const transaction of decoded.transactions) {
|
|
12463
|
+
if (transaction instanceof TransactionMessage)
|
|
12464
|
+
transactions.push(transaction.encode());
|
|
12465
|
+
else
|
|
12466
|
+
transactions.push(new TransactionMessage(transaction).encode());
|
|
12467
|
+
}
|
|
12468
|
+
return super.encode({
|
|
12469
|
+
...decoded,
|
|
12470
|
+
validators: index$5(validators),
|
|
12471
|
+
transactions: index$5(transactions)
|
|
12472
|
+
});
|
|
12473
|
+
}
|
|
12474
|
+
decode(encoded) {
|
|
12475
|
+
encoded = encoded || this.encoded;
|
|
12476
|
+
super.decode(encoded);
|
|
12477
|
+
// @ts-ignore
|
|
12478
|
+
this.decoded.transactions = index$4(this.decoded.transactions).map((transaction) => new TransactionMessage(transaction).decoded);
|
|
12479
|
+
// @ts-ignore
|
|
12480
|
+
this.decoded.validators = index$4(this.decoded.validators).map((validator) => new ValidatorMessage(validator).decoded);
|
|
12481
|
+
return this.decoded;
|
|
12482
|
+
}
|
|
12482
12483
|
}
|
|
12483
12484
|
|
|
12484
12485
|
var proto = {
|
package/package.json
CHANGED
|
@@ -1,109 +1,110 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@leofcoin/chain",
|
|
3
|
-
"version": "1.5.
|
|
4
|
-
"description": "Official javascript implementation",
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
|
|
52
|
-
"@rollup/plugin-
|
|
53
|
-
"@rollup/plugin-
|
|
54
|
-
"@rollup/plugin-
|
|
55
|
-
"@
|
|
56
|
-
"@types/
|
|
57
|
-
"@types/
|
|
58
|
-
"@types/
|
|
59
|
-
"@types/
|
|
60
|
-
"@
|
|
61
|
-
"
|
|
62
|
-
"eslint
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"rollup
|
|
67
|
-
"rollup-plugin-
|
|
68
|
-
"rollup-plugin-node-
|
|
69
|
-
"rollup-plugin-
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
"@leofcoin/
|
|
78
|
-
"@leofcoin/
|
|
79
|
-
"@leofcoin/
|
|
80
|
-
"@leofcoin/
|
|
81
|
-
"@leofcoin/
|
|
82
|
-
"@leofcoin/
|
|
83
|
-
"@leofcoin/peernet
|
|
84
|
-
"@leofcoin/
|
|
85
|
-
"@leofcoin/
|
|
86
|
-
"@leofcoin/
|
|
87
|
-
"@
|
|
88
|
-
"@netpeer/swarm": "^
|
|
89
|
-
"@
|
|
90
|
-
"@vandeurenglenn/
|
|
91
|
-
"@vandeurenglenn/
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
"
|
|
97
|
-
"
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
"
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@leofcoin/chain",
|
|
3
|
+
"version": "1.5.68",
|
|
4
|
+
"description": "Official javascript implementation",
|
|
5
|
+
"private": false,
|
|
6
|
+
"exports": {
|
|
7
|
+
"./node": {
|
|
8
|
+
"import": "./exports/node.js",
|
|
9
|
+
"types": "./exports/node.d.ts"
|
|
10
|
+
},
|
|
11
|
+
"./chain": {
|
|
12
|
+
"import": "./exports/chain.js",
|
|
13
|
+
"types": "./exports/chain.d.ts"
|
|
14
|
+
},
|
|
15
|
+
"./browser/node": {
|
|
16
|
+
"import": "./exports/browser/node.js",
|
|
17
|
+
"types": "./exports/node.d.ts"
|
|
18
|
+
},
|
|
19
|
+
"./browser/chain": {
|
|
20
|
+
"import": "./exports/browser/chain.js",
|
|
21
|
+
"types": "./exports/chain.d.ts"
|
|
22
|
+
},
|
|
23
|
+
"./workers/machine-worker": "./exports/workers/machine-worker.js"
|
|
24
|
+
},
|
|
25
|
+
"type": "module",
|
|
26
|
+
"files": [
|
|
27
|
+
"./exports",
|
|
28
|
+
"LICENSE.txt"
|
|
29
|
+
],
|
|
30
|
+
"scripts": {
|
|
31
|
+
"np": "np",
|
|
32
|
+
"watch": "rollup -c -w --silent error --cache true",
|
|
33
|
+
"lint": "eslint src --fix",
|
|
34
|
+
"prettier": "prettier src --config ./../../.prettierrc --write",
|
|
35
|
+
"w": "rollup -c -w",
|
|
36
|
+
"docs": "sh ./node_modules/.bin/esdoc src/chain.js",
|
|
37
|
+
"workers": "cp ./../workers/src/** ./workers",
|
|
38
|
+
"demo": "jsproject --serve ./ --port 5478 --open demo",
|
|
39
|
+
"test": "node --inspect test",
|
|
40
|
+
"pack": "webpack",
|
|
41
|
+
"build": "rollup -c"
|
|
42
|
+
},
|
|
43
|
+
"np": {
|
|
44
|
+
"yarn": false,
|
|
45
|
+
"contents": "."
|
|
46
|
+
},
|
|
47
|
+
"browserslist": "> 0.5%, last 2 versions, not dead",
|
|
48
|
+
"keywords": [],
|
|
49
|
+
"author": "",
|
|
50
|
+
"license": "MIT",
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@rollup/plugin-commonjs": "^24.0.1",
|
|
53
|
+
"@rollup/plugin-json": "^6.0.0",
|
|
54
|
+
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
55
|
+
"@rollup/plugin-typescript": "^11.1.1",
|
|
56
|
+
"@types/bs58check": "^2.1.0",
|
|
57
|
+
"@types/pako": "^2.0.0",
|
|
58
|
+
"@types/randombytes": "^2.0.0",
|
|
59
|
+
"@types/semver": "^7.5.6",
|
|
60
|
+
"@types/varint": "^6.0.1",
|
|
61
|
+
"@vandeurenglenn/debug": "^1.1.1",
|
|
62
|
+
"eslint": "^8.28.0",
|
|
63
|
+
"eslint-plugin-unicorn": "^45.0.0",
|
|
64
|
+
"open": "^8.4.0",
|
|
65
|
+
"rimraf": "^4.4.0",
|
|
66
|
+
"rollup": "^4.9.2",
|
|
67
|
+
"rollup-plugin-modify": "^3.0.0",
|
|
68
|
+
"rollup-plugin-node-builtins": "^2.1.2",
|
|
69
|
+
"rollup-plugin-node-globals": "^1.4.0",
|
|
70
|
+
"rollup-plugin-polyfill-node": "^0.13.0",
|
|
71
|
+
"tape": "^5.5.2",
|
|
72
|
+
"tslib": "^2.5.3",
|
|
73
|
+
"typescript": "^5.2.2",
|
|
74
|
+
"wireit": "^0.9.5"
|
|
75
|
+
},
|
|
76
|
+
"dependencies": {
|
|
77
|
+
"@leofcoin/addresses": "^1.0.18",
|
|
78
|
+
"@leofcoin/errors": "^1.0.0",
|
|
79
|
+
"@leofcoin/lib": "^1.2.38",
|
|
80
|
+
"@leofcoin/messages": "^1.3.17",
|
|
81
|
+
"@leofcoin/multi-wallet": "^2.1.1",
|
|
82
|
+
"@leofcoin/networks": "^1.0.0",
|
|
83
|
+
"@leofcoin/peernet": "^1.1.73",
|
|
84
|
+
"@leofcoin/peernet-swarm": "^1.0.0",
|
|
85
|
+
"@leofcoin/storage": "^3.0.6",
|
|
86
|
+
"@leofcoin/utils": "^1.1.4",
|
|
87
|
+
"@leofcoin/workers": "^1.4.13",
|
|
88
|
+
"@netpeer/p2pt-swarm": "^1.3.5",
|
|
89
|
+
"@netpeer/swarm": "^0.8.9",
|
|
90
|
+
"@vandeurenglenn/base32": "^1.1.0",
|
|
91
|
+
"@vandeurenglenn/easy-worker": "^1.0.2",
|
|
92
|
+
"@vandeurenglenn/queue": "^1.0.0",
|
|
93
|
+
"chalk": "^4.0.0",
|
|
94
|
+
"p-queue": "^7.3.4",
|
|
95
|
+
"p2pt": "^1.5.1",
|
|
96
|
+
"pako": "^2.0.4",
|
|
97
|
+
"semver": "^7.5.4",
|
|
98
|
+
"simple-peer": "^9.11.1"
|
|
99
|
+
},
|
|
100
|
+
"eslintConfig": {
|
|
101
|
+
"env": {
|
|
102
|
+
"es2022": true
|
|
103
|
+
},
|
|
104
|
+
"parserOptions": {
|
|
105
|
+
"ecmaVersion": "latest",
|
|
106
|
+
"sourceType": "module"
|
|
107
|
+
},
|
|
108
|
+
"extends": "plugin:unicorn/recommended"
|
|
109
|
+
}
|
|
110
|
+
}
|