@leofcoin/chain 1.7.70 → 1.7.72
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-BCS5wcAv.js → browser-BogfGRzB-D3fc2MzB.js} +2 -1
- package/exports/browser/chain.js +6 -5
- package/exports/browser/{client-C0VVXIWm-DcqDljSm.js → client-DD7vhDK_-UAymLS2i.js} +31 -8
- package/exports/browser/{identity-CQ_ieRiz-CTM-_kGF.js → identity--VAIVSMm-DTWL357I.js} +217 -127
- package/exports/browser/{index-CEwkDK9g-CHsuUR8y.js → index-Vgr1JQcP-DNJYAZ_u.js} +63 -42
- package/exports/browser/{index-BeqbCwUk-BNpn0JK0.js → index-Vl0cNziw-Dw2QX2H3.js} +1 -1
- package/exports/browser/{messages-BdevLRCA-DCm-zGuC.js → messages-CW17jRdc-c9cSXiiQ.js} +2 -2
- package/exports/browser/{node-browser-DcYcGvEF.js → node-browser-BvxzAdLe.js} +279 -4323
- package/exports/browser/node-browser.js +2 -2
- package/exports/browser/workers/machine-worker.js +5 -3
- package/exports/chain.js +6 -5
- package/exports/workers/machine-worker.js +5 -3
- package/package.json +3 -3
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { N as default } from './node-browser-
|
|
2
|
-
import './identity-
|
|
1
|
+
export { N as default } from './node-browser-BvxzAdLe.js';
|
|
2
|
+
import './identity--VAIVSMm-DTWL357I.js';
|
|
3
3
|
import './index-DUfUgiQY.js';
|
|
@@ -55,6 +55,8 @@ let Zeros = "0000";
|
|
|
55
55
|
while (Zeros.length < 80) {
|
|
56
56
|
Zeros += Zeros;
|
|
57
57
|
}
|
|
58
|
+
|
|
59
|
+
const jsonStringifyBigInt = (key, value) => (typeof value === 'bigint' ? { $bigint: value.toString() } : value);
|
|
58
60
|
const jsonParseBigInt = (key, value) => typeof value === 'object' && value.$bigint ? BigInt(value.$bigint) : value;
|
|
59
61
|
|
|
60
62
|
const byteFormats = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
|
@@ -344,7 +346,7 @@ const _ = {
|
|
|
344
346
|
throw new Error(`error: ${e.message}
|
|
345
347
|
contract: ${contract}
|
|
346
348
|
method: ${method}
|
|
347
|
-
params: ${JSON.stringify(params,
|
|
349
|
+
params: ${JSON.stringify(params, jsonStringifyBigInt, '\t')}
|
|
348
350
|
`);
|
|
349
351
|
}
|
|
350
352
|
},
|
|
@@ -406,8 +408,8 @@ const _ = {
|
|
|
406
408
|
}
|
|
407
409
|
else {
|
|
408
410
|
await Promise.all([contractFactoryMessage, nativeTokenMessage, nameServiceMessage, validatorsMessage].map(async (contract) => {
|
|
409
|
-
|
|
410
|
-
return _.runContract({ decoded:
|
|
411
|
+
const message = await new ContractMessage(new Uint8Array(contract.split(',')));
|
|
412
|
+
return _.runContract({ decoded: message.decoded, encoded: message.encoded, hash: await message.hash() });
|
|
411
413
|
}));
|
|
412
414
|
console.log({ blocks: message.blocks });
|
|
413
415
|
if (message.blocks?.length > 0) {
|
package/exports/chain.js
CHANGED
|
@@ -1538,6 +1538,10 @@ class Chain extends VersionControl {
|
|
|
1538
1538
|
}
|
|
1539
1539
|
async #invalidTransaction(hash) {
|
|
1540
1540
|
hash = new TextDecoder().decode(hash);
|
|
1541
|
+
if (!(await globalThis.transactionPoolStore.has(hash))) {
|
|
1542
|
+
debug(`transaction ${hash} not in pool`);
|
|
1543
|
+
return;
|
|
1544
|
+
}
|
|
1541
1545
|
console.log(`removing invalid transaction: ${hash}`);
|
|
1542
1546
|
await globalThis.transactionPoolStore.delete(hash);
|
|
1543
1547
|
}
|
|
@@ -1674,9 +1678,9 @@ class Chain extends VersionControl {
|
|
|
1674
1678
|
promises = await Promise.allSettled(promises);
|
|
1675
1679
|
const noncesByAddress = {};
|
|
1676
1680
|
for (let transaction of transactions) {
|
|
1677
|
-
globalThis.pubsub.publish('transaction-processed', transaction);
|
|
1681
|
+
globalThis.pubsub.publish('transaction-processed', transaction.encoded);
|
|
1678
1682
|
if (transaction.decoded.to === globalThis.peernet.selectedAccount)
|
|
1679
|
-
globalThis.pubsub.publish('account-transaction-processed', transaction);
|
|
1683
|
+
globalThis.pubsub.publish('account-transaction-processed', transaction.encoded);
|
|
1680
1684
|
if (!noncesByAddress[transaction.decoded.from] ||
|
|
1681
1685
|
noncesByAddress?.[transaction.decoded.from] < transaction.decoded.nonce) {
|
|
1682
1686
|
noncesByAddress[transaction.decoded.from] = transaction.decoded.nonce;
|
|
@@ -1749,10 +1753,7 @@ class Chain extends VersionControl {
|
|
|
1749
1753
|
console.log({ e });
|
|
1750
1754
|
console.log(hash);
|
|
1751
1755
|
peernet.publish('invalid-transaction', hash);
|
|
1752
|
-
console.log(await globalThis.transactionPoolStore.keys());
|
|
1753
|
-
console.log(await globalThis.transactionPoolStore.has(e.hash));
|
|
1754
1756
|
await globalThis.transactionPoolStore.delete(e.hash);
|
|
1755
|
-
console.log(await globalThis.transactionPoolStore.has(e.hash));
|
|
1756
1757
|
}
|
|
1757
1758
|
}
|
|
1758
1759
|
// todo filter tx that need to wait on prev nonce
|
|
@@ -55,6 +55,8 @@ let Zeros = "0000";
|
|
|
55
55
|
while (Zeros.length < 80) {
|
|
56
56
|
Zeros += Zeros;
|
|
57
57
|
}
|
|
58
|
+
|
|
59
|
+
const jsonStringifyBigInt = (key, value) => (typeof value === 'bigint' ? { $bigint: value.toString() } : value);
|
|
58
60
|
const jsonParseBigInt = (key, value) => typeof value === 'object' && value.$bigint ? BigInt(value.$bigint) : value;
|
|
59
61
|
|
|
60
62
|
const byteFormats = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
|
@@ -344,7 +346,7 @@ const _ = {
|
|
|
344
346
|
throw new Error(`error: ${e.message}
|
|
345
347
|
contract: ${contract}
|
|
346
348
|
method: ${method}
|
|
347
|
-
params: ${JSON.stringify(params,
|
|
349
|
+
params: ${JSON.stringify(params, jsonStringifyBigInt, '\t')}
|
|
348
350
|
`);
|
|
349
351
|
}
|
|
350
352
|
},
|
|
@@ -406,8 +408,8 @@ const _ = {
|
|
|
406
408
|
}
|
|
407
409
|
else {
|
|
408
410
|
await Promise.all([contractFactoryMessage, nativeTokenMessage, nameServiceMessage, validatorsMessage].map(async (contract) => {
|
|
409
|
-
|
|
410
|
-
return _.runContract({ decoded:
|
|
411
|
+
const message = await new ContractMessage(new Uint8Array(contract.split(',')));
|
|
412
|
+
return _.runContract({ decoded: message.decoded, encoded: message.encoded, hash: await message.hash() });
|
|
411
413
|
}));
|
|
412
414
|
console.log({ blocks: message.blocks });
|
|
413
415
|
if (message.blocks?.length > 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leofcoin/chain",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.72",
|
|
4
4
|
"description": "Official javascript implementation",
|
|
5
5
|
"private": false,
|
|
6
6
|
"exports": {
|
|
@@ -69,10 +69,10 @@
|
|
|
69
69
|
"@leofcoin/messages": "^1.4.40",
|
|
70
70
|
"@leofcoin/multi-wallet": "^3.1.8",
|
|
71
71
|
"@leofcoin/networks": "^1.1.25",
|
|
72
|
-
"@leofcoin/peernet": "^1.1.
|
|
72
|
+
"@leofcoin/peernet": "^1.1.83",
|
|
73
73
|
"@leofcoin/storage": "^3.5.38",
|
|
74
74
|
"@leofcoin/utils": "^1.1.39",
|
|
75
|
-
"@leofcoin/workers": "^1.5.
|
|
75
|
+
"@leofcoin/workers": "^1.5.23",
|
|
76
76
|
"@vandeurenglenn/base58": "^1.1.9",
|
|
77
77
|
"@vandeurenglenn/easy-worker": "^1.0.2",
|
|
78
78
|
"semver": "^7.7.2"
|