@leofcoin/chain 1.7.69 → 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.
@@ -1,2 +1,3 @@
1
- export { N as default } from './node-browser-Bm1Y3-al.js';
1
+ export { N as default } from './node-browser-DcYcGvEF.js';
2
+ import './identity-CQ_ieRiz-CTM-_kGF.js';
2
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, null, '\t')}
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
- contract = await new ContractMessage(new Uint8Array(contract.split(',')));
410
- return _.runContract({ decoded: contract.decoded, encoded: contract.encoded, hash: await contract.hash() });
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
@@ -360,7 +360,7 @@ class Machine {
360
360
  }
361
361
  catch (error) {
362
362
  console.error(error);
363
- this.worker.postMessage({ id: data.id, input: data.input });
363
+ this.worker.postMessage({ id: data.id, error: `could not get ${data.question} @${data.input}` });
364
364
  this.wantList.push(data.input);
365
365
  }
366
366
  }
@@ -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, null, '\t')}
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
- contract = await new ContractMessage(new Uint8Array(contract.split(',')));
410
- return _.runContract({ decoded: contract.decoded, encoded: contract.encoded, hash: await contract.hash() });
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.69",
3
+ "version": "1.7.71",
4
4
  "description": "Official javascript implementation",
5
5
  "private": false,
6
6
  "exports": {
@@ -49,32 +49,32 @@
49
49
  "author": "",
50
50
  "license": "MIT",
51
51
  "devDependencies": {
52
- "@rollup/plugin-commonjs": "^28.0.0",
52
+ "@rollup/plugin-commonjs": "^28.0.6",
53
53
  "@rollup/plugin-json": "^6.1.0",
54
- "@rollup/plugin-node-resolve": "^15.3.0",
55
- "@rollup/plugin-typescript": "^12.1.0",
56
- "@types/semver": "^7.5.8",
57
- "@vandeurenglenn/debug": "^1.2.5",
58
- "rollup": "^4.23.0",
54
+ "@rollup/plugin-node-resolve": "^16.0.1",
55
+ "@rollup/plugin-typescript": "^12.1.4",
56
+ "@types/semver": "^7.7.0",
57
+ "@vandeurenglenn/debug": "^1.2.6",
58
+ "rollup": "^4.44.2",
59
59
  "rollup-plugin-modify": "^3.0.0",
60
60
  "tape": "^5.9.0",
61
- "tslib": "^2.7.0"
61
+ "tslib": "^2.8.1"
62
62
  },
63
63
  "dependencies": {
64
- "@leofcoin/addresses": "^1.0.44",
64
+ "@leofcoin/addresses": "^1.0.53",
65
65
  "@leofcoin/contracts": "^0.1.14",
66
- "@leofcoin/crypto": "^0.2.28",
67
- "@leofcoin/errors": "^1.0.23",
68
- "@leofcoin/lib": "^1.2.67",
69
- "@leofcoin/messages": "^1.4.37",
66
+ "@leofcoin/crypto": "^0.2.37",
67
+ "@leofcoin/errors": "^1.0.25",
68
+ "@leofcoin/lib": "^1.2.71",
69
+ "@leofcoin/messages": "^1.4.40",
70
70
  "@leofcoin/multi-wallet": "^3.1.8",
71
- "@leofcoin/networks": "^1.1.22",
72
- "@leofcoin/peernet": "^1.1.80",
73
- "@leofcoin/storage": "^3.5.32",
74
- "@leofcoin/utils": "^1.1.36",
75
- "@leofcoin/workers": "^1.5.19",
71
+ "@leofcoin/networks": "^1.1.25",
72
+ "@leofcoin/peernet": "^1.1.82",
73
+ "@leofcoin/storage": "^3.5.38",
74
+ "@leofcoin/utils": "^1.1.39",
75
+ "@leofcoin/workers": "^1.5.22",
76
76
  "@vandeurenglenn/base58": "^1.1.9",
77
77
  "@vandeurenglenn/easy-worker": "^1.0.2",
78
- "semver": "^7.6.3"
78
+ "semver": "^7.7.2"
79
79
  }
80
80
  }