@leofcoin/chain 1.7.70 → 1.7.71
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
CHANGED
|
@@ -5528,9 +5528,9 @@ class Chain extends VersionControl {
|
|
|
5528
5528
|
promises = await Promise.allSettled(promises);
|
|
5529
5529
|
const noncesByAddress = {};
|
|
5530
5530
|
for (let transaction of transactions) {
|
|
5531
|
-
globalThis.pubsub.publish('transaction-processed', transaction);
|
|
5531
|
+
globalThis.pubsub.publish('transaction-processed', transaction.encoded);
|
|
5532
5532
|
if (transaction.decoded.to === globalThis.peernet.selectedAccount)
|
|
5533
|
-
globalThis.pubsub.publish('account-transaction-processed', transaction);
|
|
5533
|
+
globalThis.pubsub.publish('account-transaction-processed', transaction.encoded);
|
|
5534
5534
|
if (!noncesByAddress[transaction.decoded.from] ||
|
|
5535
5535
|
noncesByAddress?.[transaction.decoded.from] < transaction.decoded.nonce) {
|
|
5536
5536
|
noncesByAddress[transaction.decoded.from] = transaction.decoded.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/exports/chain.js
CHANGED
|
@@ -1674,9 +1674,9 @@ class Chain extends VersionControl {
|
|
|
1674
1674
|
promises = await Promise.allSettled(promises);
|
|
1675
1675
|
const noncesByAddress = {};
|
|
1676
1676
|
for (let transaction of transactions) {
|
|
1677
|
-
globalThis.pubsub.publish('transaction-processed', transaction);
|
|
1677
|
+
globalThis.pubsub.publish('transaction-processed', transaction.encoded);
|
|
1678
1678
|
if (transaction.decoded.to === globalThis.peernet.selectedAccount)
|
|
1679
|
-
globalThis.pubsub.publish('account-transaction-processed', transaction);
|
|
1679
|
+
globalThis.pubsub.publish('account-transaction-processed', transaction.encoded);
|
|
1680
1680
|
if (!noncesByAddress[transaction.decoded.from] ||
|
|
1681
1681
|
noncesByAddress?.[transaction.decoded.from] < transaction.decoded.nonce) {
|
|
1682
1682
|
noncesByAddress[transaction.decoded.from] = transaction.decoded.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) {
|