@leofcoin/messages 1.4.12 → 1.4.14

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.
Files changed (2) hide show
  1. package/exports/block.js +1 -12
  2. package/package.json +5 -5
package/exports/block.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import { BigNumber } from '@leofcoin/utils';
2
2
  import { FormatInterface } from '@leofcoin/codec-format-interface';
3
- import TransactionMessage from './transaction.js';
4
3
  import ValidatorMessage from './validator.js';
5
4
  import smartConcat from '@vandeurenglenn/typed-array-smart-concat';
6
5
  import smartDeconcat from '@vandeurenglenn/typed-array-smart-deconcat';
@@ -28,31 +27,21 @@ class BlockMessage extends FormatInterface {
28
27
  encode(decoded) {
29
28
  decoded = decoded || this.decoded;
30
29
  const validators = [];
31
- const transactions = [];
32
30
  for (const validator of decoded.validators) {
33
31
  if (validator instanceof ValidatorMessage)
34
32
  validators.push(validator.encode());
35
33
  else
36
34
  validators.push(new ValidatorMessage(validator).encode());
37
35
  }
38
- for (const transaction of decoded.transactions) {
39
- if (transaction instanceof TransactionMessage)
40
- transactions.push(transaction.encode());
41
- else
42
- transactions.push(new TransactionMessage(transaction).encode());
43
- }
44
36
  return super.encode({
45
37
  ...decoded,
46
- validators: smartConcat(validators),
47
- transactions: smartConcat(transactions)
38
+ validators: smartConcat(validators)
48
39
  });
49
40
  }
50
41
  decode(encoded) {
51
42
  encoded = encoded || this.encoded;
52
43
  super.decode(encoded);
53
44
  // @ts-ignore
54
- this.decoded.transactions = smartDeconcat(this.decoded.transactions).map((transaction) => new TransactionMessage(transaction).decoded);
55
- // @ts-ignore
56
45
  this.decoded.validators = smartDeconcat(this.decoded.validators).map((validator) => new ValidatorMessage(validator).decoded);
57
46
  return this.decoded;
58
47
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leofcoin/messages",
3
- "version": "1.4.12",
3
+ "version": "1.4.14",
4
4
  "description": "",
5
5
  "private": false,
6
6
  "exports": {
@@ -56,15 +56,15 @@
56
56
  "author": "",
57
57
  "license": "MIT",
58
58
  "devDependencies": {
59
- "@leofcoin/types": "^1.0.5",
59
+ "@leofcoin/types": "^1.0.6",
60
60
  "@rollup/plugin-typescript": "^11.1.6",
61
- "rollup": "^4.12.1",
61
+ "rollup": "^4.16.4",
62
62
  "tslib": "^2.6.2",
63
- "typescript": "^5.3.3"
63
+ "typescript": "^5.4.5"
64
64
  },
65
65
  "dependencies": {
66
66
  "@leofcoin/codec-format-interface": "^1.7.11",
67
- "@leofcoin/utils": "^1.1.17",
67
+ "@leofcoin/utils": "^1.1.18",
68
68
  "@vandeurenglenn/typed-array-smart-concat": "^1.0.4",
69
69
  "@vandeurenglenn/typed-array-smart-deconcat": "^1.0.3"
70
70
  }