@leofcoin/chain 1.8.17 → 1.8.18

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.
@@ -963,7 +963,7 @@ function parseUnits(value, unit) {
963
963
  return FixedNumber.fromString(value, { decimals, width: 512 }).value;
964
964
  }
965
965
 
966
- const jsonStringifyBigInt$1 = (key, value) => (typeof value === 'bigint' ? { $bigint: value.toString() } : value);
966
+ const jsonStringifyBigInt = (key, value) => (typeof value === 'bigint' ? { $bigint: value.toString() } : value);
967
967
  const jsonParseBigInt = (key, value) => typeof value === 'object' && value.$bigint ? BigInt(value.$bigint) : value;
968
968
 
969
969
  const byteFormats = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
@@ -4631,9 +4631,9 @@ class Machine {
4631
4631
  await Promise.all(promises);
4632
4632
  }
4633
4633
  const tasks = [
4634
- stateStore.put('lastBlock', JSON.stringify(await this.lastBlock, jsonStringifyBigInt$1)),
4635
- stateStore.put('states', JSON.stringify(state, jsonStringifyBigInt$1)),
4636
- stateStore.put('accounts', JSON.stringify(accounts, jsonStringifyBigInt$1)),
4634
+ stateStore.put('lastBlock', JSON.stringify(await this.lastBlock, jsonStringifyBigInt)),
4635
+ stateStore.put('states', JSON.stringify(state, jsonStringifyBigInt)),
4636
+ stateStore.put('accounts', JSON.stringify(accounts, jsonStringifyBigInt)),
4637
4637
  stateStore.put('info', JSON.stringify({
4638
4638
  nativeCalls: await this.nativeCalls,
4639
4639
  nativeMints: await this.nativeMints,
@@ -4644,7 +4644,7 @@ class Machine {
4644
4644
  totalMintAmount: await this.totalMintAmount,
4645
4645
  totalTransferAmount: await this.totalTransferAmount,
4646
4646
  totalBlocks: await blockStore.length
4647
- }, jsonStringifyBigInt$1))
4647
+ }, jsonStringifyBigInt))
4648
4648
  // accountsStore.clear()
4649
4649
  ];
4650
4650
  await Promise.all(tasks);
@@ -4710,7 +4710,7 @@ class Machine {
4710
4710
  totalTransactions: BigInt(0),
4711
4711
  totalBlocks: BigInt(0)
4712
4712
  };
4713
- rawInfo = JSON.stringify(this.states.info, jsonStringifyBigInt$1);
4713
+ rawInfo = JSON.stringify(this.states.info, jsonStringifyBigInt);
4714
4714
  await stateStore.put('info', new TextEncoder().encode(rawInfo));
4715
4715
  }
4716
4716
  }
@@ -4945,7 +4945,7 @@ class Machine {
4945
4945
  debug$2(`adding loaded block: ${block.index}@${block.hash}`);
4946
4946
  if (block.decoded)
4947
4947
  block = { ...block.decoded, hash: await block.hash() };
4948
- return this.#askWorker('addLoadedBlock', JSON.stringify(block, jsonStringifyBigInt$1));
4948
+ return this.#askWorker('addLoadedBlock', JSON.stringify(block, jsonStringifyBigInt));
4949
4949
  }
4950
4950
  async latestTransactions() {
4951
4951
  return this.#askWorker('latestTransactions');
@@ -4999,11 +4999,6 @@ utils.addCodec({
4999
4999
  codec: 0x6c626d,
5000
5000
  hashAlg: 'keccak-256'
5001
5001
  });
5002
- const jsonStringifyBigInt = (key, value) => {
5003
- if (typeof value === 'bigint')
5004
- return value.toString();
5005
- return value;
5006
- };
5007
5002
  const debug$1 = createDebugger('leofcoin/state');
5008
5003
  class State extends Contract {
5009
5004
  #resolveErrored;
@@ -5117,7 +5112,7 @@ class State extends Contract {
5117
5112
  };
5118
5113
  this.#lastBlockHandler = async () => {
5119
5114
  return new globalThis.peernet.protos['peernet-response']({
5120
- response: JSON.stringify(new LastBlockMessage(await this.lastBlock).decoded, jsonStringifyBigInt)
5115
+ response: new LastBlockMessage(await this.lastBlock).decoded
5121
5116
  });
5122
5117
  };
5123
5118
  this.#knownBlocksHandler = async () => {
package/exports/chain.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createDebugger } from '@vandeurenglenn/debug';
2
- import { formatBytes, jsonStringifyBigInt as jsonStringifyBigInt$1, jsonParseBigInt, parseUnits, formatUnits } from '@leofcoin/utils';
2
+ import { formatBytes, jsonStringifyBigInt, jsonParseBigInt, parseUnits, formatUnits } from '@leofcoin/utils';
3
3
  import { TransactionMessage, BlockMessage, ContractMessage, LastBlockMessage, BWMessage, BWRequestMessage } from '@leofcoin/messages';
4
4
  import addresses, { contractFactory } from '@leofcoin/addresses';
5
5
  import { calculateFee, createContractMessage, signTransaction, contractFactoryMessage, nativeTokenMessage, validatorsMessage, nameServiceMessage } from '@leofcoin/lib';
@@ -772,9 +772,9 @@ class Machine {
772
772
  await Promise.all(promises);
773
773
  }
774
774
  const tasks = [
775
- stateStore.put('lastBlock', JSON.stringify(await this.lastBlock, jsonStringifyBigInt$1)),
776
- stateStore.put('states', JSON.stringify(state, jsonStringifyBigInt$1)),
777
- stateStore.put('accounts', JSON.stringify(accounts, jsonStringifyBigInt$1)),
775
+ stateStore.put('lastBlock', JSON.stringify(await this.lastBlock, jsonStringifyBigInt)),
776
+ stateStore.put('states', JSON.stringify(state, jsonStringifyBigInt)),
777
+ stateStore.put('accounts', JSON.stringify(accounts, jsonStringifyBigInt)),
778
778
  stateStore.put('info', JSON.stringify({
779
779
  nativeCalls: await this.nativeCalls,
780
780
  nativeMints: await this.nativeMints,
@@ -785,7 +785,7 @@ class Machine {
785
785
  totalMintAmount: await this.totalMintAmount,
786
786
  totalTransferAmount: await this.totalTransferAmount,
787
787
  totalBlocks: await blockStore.length
788
- }, jsonStringifyBigInt$1))
788
+ }, jsonStringifyBigInt))
789
789
  // accountsStore.clear()
790
790
  ];
791
791
  await Promise.all(tasks);
@@ -851,7 +851,7 @@ class Machine {
851
851
  totalTransactions: BigInt(0),
852
852
  totalBlocks: BigInt(0)
853
853
  };
854
- rawInfo = JSON.stringify(this.states.info, jsonStringifyBigInt$1);
854
+ rawInfo = JSON.stringify(this.states.info, jsonStringifyBigInt);
855
855
  await stateStore.put('info', new TextEncoder().encode(rawInfo));
856
856
  }
857
857
  }
@@ -1086,7 +1086,7 @@ class Machine {
1086
1086
  debug$2(`adding loaded block: ${block.index}@${block.hash}`);
1087
1087
  if (block.decoded)
1088
1088
  block = { ...block.decoded, hash: await block.hash() };
1089
- return this.#askWorker('addLoadedBlock', JSON.stringify(block, jsonStringifyBigInt$1));
1089
+ return this.#askWorker('addLoadedBlock', JSON.stringify(block, jsonStringifyBigInt));
1090
1090
  }
1091
1091
  async latestTransactions() {
1092
1092
  return this.#askWorker('latestTransactions');
@@ -1140,11 +1140,6 @@ codecs.addCodec({
1140
1140
  codec: 0x6c626d,
1141
1141
  hashAlg: 'keccak-256'
1142
1142
  });
1143
- const jsonStringifyBigInt = (key, value) => {
1144
- if (typeof value === 'bigint')
1145
- return value.toString();
1146
- return value;
1147
- };
1148
1143
  const debug$1 = createDebugger('leofcoin/state');
1149
1144
  class State extends Contract {
1150
1145
  #resolveErrored;
@@ -1258,7 +1253,7 @@ class State extends Contract {
1258
1253
  };
1259
1254
  this.#lastBlockHandler = async () => {
1260
1255
  return new globalThis.peernet.protos['peernet-response']({
1261
- response: JSON.stringify(new LastBlockMessage(await this.lastBlock).decoded, jsonStringifyBigInt)
1256
+ response: new LastBlockMessage(await this.lastBlock).decoded
1262
1257
  });
1263
1258
  };
1264
1259
  this.#knownBlocksHandler = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/chain",
3
- "version": "1.8.17",
3
+ "version": "1.8.18",
4
4
  "description": "Official javascript implementation",
5
5
  "private": false,
6
6
  "exports": {
@@ -69,7 +69,7 @@
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.2.13",
72
+ "@leofcoin/peernet": "^1.2.14",
73
73
  "@leofcoin/storage": "^3.5.38",
74
74
  "@leofcoin/utils": "^1.1.40",
75
75
  "@leofcoin/workers": "^1.5.27",