ripple-binary-codec 1.4.2 → 1.4.3

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 (102) hide show
  1. package/dist/binary.js +25 -29
  2. package/dist/binary.js.map +1 -1
  3. package/dist/coretypes.js +31 -8
  4. package/dist/coretypes.js.map +1 -1
  5. package/dist/enums/bytes.d.ts +26 -0
  6. package/dist/enums/bytes.js +64 -0
  7. package/dist/enums/bytes.js.map +1 -0
  8. package/dist/enums/constants.d.ts +4 -0
  9. package/dist/enums/constants.js +8 -0
  10. package/dist/enums/constants.js.map +1 -0
  11. package/dist/enums/definitions.json +2330 -1971
  12. package/dist/enums/field.d.ts +29 -0
  13. package/dist/enums/field.js +59 -0
  14. package/dist/enums/field.js.map +1 -0
  15. package/dist/enums/index.js +69 -60
  16. package/dist/enums/index.js.map +1 -1
  17. package/dist/enums/src/enums/definitions.json +2337 -0
  18. package/dist/enums/utils-renumber.js +14 -14
  19. package/dist/enums/utils-renumber.js.map +1 -1
  20. package/dist/enums/xrpl-definitions-base.d.ts +44 -0
  21. package/dist/enums/xrpl-definitions-base.js +64 -0
  22. package/dist/enums/xrpl-definitions-base.js.map +1 -0
  23. package/dist/enums/xrpl-definitions.d.ts +21 -0
  24. package/dist/enums/xrpl-definitions.js +28 -0
  25. package/dist/enums/xrpl-definitions.js.map +1 -0
  26. package/dist/hash-prefixes.js +3 -3
  27. package/dist/hash-prefixes.js.map +1 -1
  28. package/dist/hashes.js +21 -43
  29. package/dist/hashes.js.map +1 -1
  30. package/dist/index.d.ts +2 -12
  31. package/dist/index.js +39 -16
  32. package/dist/index.js.map +1 -1
  33. package/dist/ledger-hashes.d.ts +1 -1
  34. package/dist/ledger-hashes.js +51 -28
  35. package/dist/ledger-hashes.js.map +1 -1
  36. package/dist/quality.js +18 -21
  37. package/dist/quality.js.map +1 -1
  38. package/dist/serdes/binary-parser.js +78 -56
  39. package/dist/serdes/binary-parser.js.map +1 -1
  40. package/dist/serdes/binary-serializer.js +59 -40
  41. package/dist/serdes/binary-serializer.js.map +1 -1
  42. package/dist/shamap.js +70 -98
  43. package/dist/shamap.js.map +1 -1
  44. package/dist/types/account-id.js +18 -35
  45. package/dist/types/account-id.js.map +1 -1
  46. package/dist/types/amount.js +71 -88
  47. package/dist/types/amount.js.map +1 -1
  48. package/dist/types/blob.js +10 -27
  49. package/dist/types/blob.js.map +1 -1
  50. package/dist/types/currency.js +26 -44
  51. package/dist/types/currency.js.map +1 -1
  52. package/dist/types/hash-128.d.ts +6 -0
  53. package/dist/types/hash-128.js +23 -25
  54. package/dist/types/hash-128.js.map +1 -1
  55. package/dist/types/hash-160.js +8 -25
  56. package/dist/types/hash-160.js.map +1 -1
  57. package/dist/types/hash-256.js +8 -25
  58. package/dist/types/hash-256.js.map +1 -1
  59. package/dist/types/hash.js +20 -38
  60. package/dist/types/hash.js.map +1 -1
  61. package/dist/types/index.js +18 -18
  62. package/dist/types/index.js.map +1 -1
  63. package/dist/types/path-set.js +57 -87
  64. package/dist/types/path-set.js.map +1 -1
  65. package/dist/types/serialized-type.d.ts +3 -3
  66. package/dist/types/serialized-type.js +35 -56
  67. package/dist/types/serialized-type.js.map +1 -1
  68. package/dist/types/st-array.js +26 -46
  69. package/dist/types/st-array.js.map +1 -1
  70. package/dist/types/st-object.js +49 -73
  71. package/dist/types/st-object.js.map +1 -1
  72. package/dist/types/uint-16.js +15 -32
  73. package/dist/types/uint-16.js.map +1 -1
  74. package/dist/types/uint-32.js +16 -33
  75. package/dist/types/uint-32.js.map +1 -1
  76. package/dist/types/uint-64.d.ts +1 -1
  77. package/dist/types/uint-64.js +30 -47
  78. package/dist/types/uint-64.js.map +1 -1
  79. package/dist/types/uint-8.js +15 -32
  80. package/dist/types/uint-8.js.map +1 -1
  81. package/dist/types/uint.d.ts +1 -1
  82. package/dist/types/uint.js +10 -27
  83. package/dist/types/uint.js.map +1 -1
  84. package/dist/types/vector-256.js +23 -40
  85. package/dist/types/vector-256.js.map +1 -1
  86. package/package.json +6 -8
  87. package/test/amount.test.js +1 -1
  88. package/test/binary-json.test.js +1 -1
  89. package/test/binary-parser.test.js +4 -4
  90. package/test/binary-serializer.test.js +3 -3
  91. package/test/fixtures/data-driven-tests.json +0 -14
  92. package/test/hash.test.js +28 -2
  93. package/test/ledger.test.js +1 -1
  94. package/test/lower-case-hex.test.js +1 -1
  95. package/test/pseudo-transaction.test.js +1 -1
  96. package/test/quality.test.js +1 -1
  97. package/test/shamap.test.js +3 -3
  98. package/test/signing-data-encoding.test.js +1 -1
  99. package/test/tx-encode-decode.test.js +1 -1
  100. package/test/types.test.js +2 -2
  101. package/test/uint.test.js +2 -2
  102. package/test/x-address.test.js +1 -1
@@ -1,46 +1,30 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
2
  Object.defineProperty(exports, "__esModule", { value: true });
18
3
  exports.UInt32 = void 0;
19
- var uint_1 = require("./uint");
20
- var buffer_1 = require("buffer/");
4
+ const uint_1 = require("./uint");
5
+ const buffer_1 = require("buffer/");
21
6
  /**
22
7
  * Derived UInt class for serializing/deserializing 32 bit UInt
23
8
  */
24
- var UInt32 = /** @class */ (function (_super) {
25
- __extends(UInt32, _super);
26
- function UInt32(bytes) {
27
- return _super.call(this, bytes !== null && bytes !== void 0 ? bytes : UInt32.defaultUInt32.bytes) || this;
9
+ class UInt32 extends uint_1.UInt {
10
+ constructor(bytes) {
11
+ super(bytes !== null && bytes !== void 0 ? bytes : UInt32.defaultUInt32.bytes);
28
12
  }
29
- UInt32.fromParser = function (parser) {
13
+ static fromParser(parser) {
30
14
  return new UInt32(parser.read(UInt32.width));
31
- };
15
+ }
32
16
  /**
33
17
  * Construct a UInt32 object from a number
34
18
  *
35
19
  * @param val UInt32 object or number
36
20
  */
37
- UInt32.from = function (val) {
21
+ static from(val) {
38
22
  if (val instanceof UInt32) {
39
23
  return val;
40
24
  }
41
- var buf = buffer_1.Buffer.alloc(UInt32.width);
25
+ const buf = buffer_1.Buffer.alloc(UInt32.width);
42
26
  if (typeof val === 'string') {
43
- var num = Number.parseInt(val);
27
+ const num = Number.parseInt(val);
44
28
  buf.writeUInt32BE(num, 0);
45
29
  return new UInt32(buf);
46
30
  }
@@ -49,18 +33,17 @@ var UInt32 = /** @class */ (function (_super) {
49
33
  return new UInt32(buf);
50
34
  }
51
35
  throw new Error('Cannot construct UInt32 from given value');
52
- };
36
+ }
53
37
  /**
54
38
  * get the value of a UInt32 object
55
39
  *
56
40
  * @returns the number represented by this.bytes
57
41
  */
58
- UInt32.prototype.valueOf = function () {
42
+ valueOf() {
59
43
  return this.bytes.readUInt32BE(0);
60
- };
61
- UInt32.width = 32 / 8; // 4
62
- UInt32.defaultUInt32 = new UInt32(buffer_1.Buffer.alloc(UInt32.width));
63
- return UInt32;
64
- }(uint_1.UInt));
44
+ }
45
+ }
65
46
  exports.UInt32 = UInt32;
47
+ UInt32.width = 32 / 8; // 4
48
+ UInt32.defaultUInt32 = new UInt32(buffer_1.Buffer.alloc(UInt32.width));
66
49
  //# sourceMappingURL=uint-32.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"uint-32.js","sourceRoot":"","sources":["../../src/types/uint-32.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,+BAA6B;AAE7B,kCAAgC;AAEhC;;GAEG;AACH;IAAqB,0BAAI;IAIvB,gBAAY,KAAa;eACvB,kBAAM,K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C,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import { UInt } from './uint';
2
2
  import { BinaryParser } from '../serdes/binary-parser';
3
- import * as bigInt from 'big-integer';
3
+ import bigInt = require('big-integer');
4
4
  import { Buffer } from 'buffer/';
5
5
  /**
6
6
  * Derived UInt class for serializing/deserializing 64 bit UInt
@@ -1,104 +1,87 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
2
  Object.defineProperty(exports, "__esModule", { value: true });
18
3
  exports.UInt64 = void 0;
19
- var uint_1 = require("./uint");
20
- var bigInt = require("big-integer");
21
- var big_integer_1 = require("big-integer");
22
- var buffer_1 = require("buffer/");
23
- var HEX_REGEX = /^[a-fA-F0-9]{1,16}$/;
24
- var mask = bigInt(0x00000000ffffffff);
4
+ const uint_1 = require("./uint");
5
+ const bigInt = require("big-integer");
6
+ const big_integer_1 = require("big-integer");
7
+ const buffer_1 = require("buffer/");
8
+ const HEX_REGEX = /^[a-fA-F0-9]{1,16}$/;
9
+ const mask = bigInt(0x00000000ffffffff);
25
10
  /**
26
11
  * Derived UInt class for serializing/deserializing 64 bit UInt
27
12
  */
28
- var UInt64 = /** @class */ (function (_super) {
29
- __extends(UInt64, _super);
30
- function UInt64(bytes) {
31
- return _super.call(this, bytes !== null && bytes !== void 0 ? bytes : UInt64.defaultUInt64.bytes) || this;
13
+ class UInt64 extends uint_1.UInt {
14
+ constructor(bytes) {
15
+ super(bytes !== null && bytes !== void 0 ? bytes : UInt64.defaultUInt64.bytes);
32
16
  }
33
- UInt64.fromParser = function (parser) {
17
+ static fromParser(parser) {
34
18
  return new UInt64(parser.read(UInt64.width));
35
- };
19
+ }
36
20
  /**
37
21
  * Construct a UInt64 object
38
22
  *
39
23
  * @param val A UInt64, hex-string, bigInt, or number
40
24
  * @returns A UInt64 object
41
25
  */
42
- UInt64.from = function (val) {
26
+ static from(val) {
43
27
  if (val instanceof UInt64) {
44
28
  return val;
45
29
  }
46
- var buf = buffer_1.Buffer.alloc(UInt64.width);
30
+ let buf = buffer_1.Buffer.alloc(UInt64.width);
47
31
  if (typeof val === 'number') {
48
32
  if (val < 0) {
49
33
  throw new Error('value must be an unsigned integer');
50
34
  }
51
- var number = bigInt(val);
52
- var intBuf = [buffer_1.Buffer.alloc(4), buffer_1.Buffer.alloc(4)];
35
+ const number = bigInt(val);
36
+ const intBuf = [buffer_1.Buffer.alloc(4), buffer_1.Buffer.alloc(4)];
53
37
  intBuf[0].writeUInt32BE(Number(number.shiftRight(32)), 0);
54
38
  intBuf[1].writeUInt32BE(Number(number.and(mask)), 0);
55
39
  return new UInt64(buffer_1.Buffer.concat(intBuf));
56
40
  }
57
41
  if (typeof val === 'string') {
58
42
  if (!HEX_REGEX.test(val)) {
59
- throw new Error("".concat(val, " is not a valid hex-string"));
43
+ throw new Error(`${val} is not a valid hex-string`);
60
44
  }
61
- var strBuf = val.padStart(16, '0');
45
+ const strBuf = val.padStart(16, '0');
62
46
  buf = buffer_1.Buffer.from(strBuf, 'hex');
63
47
  return new UInt64(buf);
64
48
  }
65
49
  if ((0, big_integer_1.isInstance)(val)) {
66
- var intBuf = [buffer_1.Buffer.alloc(4), buffer_1.Buffer.alloc(4)];
50
+ const intBuf = [buffer_1.Buffer.alloc(4), buffer_1.Buffer.alloc(4)];
67
51
  intBuf[0].writeUInt32BE(Number(val.shiftRight(bigInt(32))), 0);
68
52
  intBuf[1].writeUInt32BE(Number(val.and(mask)), 0);
69
53
  return new UInt64(buffer_1.Buffer.concat(intBuf));
70
54
  }
71
55
  throw new Error('Cannot construct UInt64 from given value');
72
- };
56
+ }
73
57
  /**
74
58
  * The JSON representation of a UInt64 object
75
59
  *
76
60
  * @returns a hex-string
77
61
  */
78
- UInt64.prototype.toJSON = function () {
62
+ toJSON() {
79
63
  return this.bytes.toString('hex').toUpperCase();
80
- };
64
+ }
81
65
  /**
82
66
  * Get the value of the UInt64
83
67
  *
84
68
  * @returns the number represented buy this.bytes
85
69
  */
86
- UInt64.prototype.valueOf = function () {
87
- var msb = bigInt(this.bytes.slice(0, 4).readUInt32BE(0));
88
- var lsb = bigInt(this.bytes.slice(4).readUInt32BE(0));
70
+ valueOf() {
71
+ const msb = bigInt(this.bytes.slice(0, 4).readUInt32BE(0));
72
+ const lsb = bigInt(this.bytes.slice(4).readUInt32BE(0));
89
73
  return msb.shiftLeft(bigInt(32)).or(lsb);
90
- };
74
+ }
91
75
  /**
92
76
  * Get the bytes representation of the UInt64 object
93
77
  *
94
78
  * @returns 8 bytes representing the UInt64
95
79
  */
96
- UInt64.prototype.toBytes = function () {
80
+ toBytes() {
97
81
  return this.bytes;
98
- };
99
- UInt64.width = 64 / 8; // 8
100
- UInt64.defaultUInt64 = new UInt64(buffer_1.Buffer.alloc(UInt64.width));
101
- return UInt64;
102
- }(uint_1.UInt));
82
+ }
83
+ }
103
84
  exports.UInt64 = UInt64;
85
+ UInt64.width = 64 / 8; // 8
86
+ UInt64.defaultUInt64 = new UInt64(buffer_1.Buffer.alloc(UInt64.width));
104
87
  //# sourceMappingURL=uint-64.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"uint-64.js","sourceRoot":"","sources":["../../src/types/uint-64.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,+BAA6B;AAE7B,oCAAqC;AACrC,2CAAwC;AACxC,kCAAgC;AAEhC,IAAM,SAAS,G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strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
2
  Object.defineProperty(exports, "__esModule", { value: true });
18
3
  exports.UInt8 = void 0;
19
- var uint_1 = require("./uint");
20
- var buffer_1 = require("buffer/");
4
+ const uint_1 = require("./uint");
5
+ const buffer_1 = require("buffer/");
21
6
  /**
22
7
  * Derived UInt class for serializing/deserializing 8 bit UInt
23
8
  */
24
- var UInt8 = /** @class */ (function (_super) {
25
- __extends(UInt8, _super);
26
- function UInt8(bytes) {
27
- return _super.call(this, bytes !== null && bytes !== void 0 ? bytes : UInt8.defaultUInt8.bytes) || this;
9
+ class UInt8 extends uint_1.UInt {
10
+ constructor(bytes) {
11
+ super(bytes !== null && bytes !== void 0 ? bytes : UInt8.defaultUInt8.bytes);
28
12
  }
29
- UInt8.fromParser = function (parser) {
13
+ static fromParser(parser) {
30
14
  return new UInt8(parser.read(UInt8.width));
31
- };
15
+ }
32
16
  /**
33
17
  * Construct a UInt8 object from a number
34
18
  *
35
19
  * @param val UInt8 object or number
36
20
  */
37
- UInt8.from = function (val) {
21
+ static from(val) {
38
22
  if (val instanceof UInt8) {
39
23
  return val;
40
24
  }
41
25
  if (typeof val === 'number') {
42
- var buf = buffer_1.Buffer.alloc(UInt8.width);
26
+ const buf = buffer_1.Buffer.alloc(UInt8.width);
43
27
  buf.writeUInt8(val, 0);
44
28
  return new UInt8(buf);
45
29
  }
46
30
  throw new Error('Cannot construct UInt8 from given value');
47
- };
31
+ }
48
32
  /**
49
33
  * get the value of a UInt8 object
50
34
  *
51
35
  * @returns the number represented by this.bytes
52
36
  */
53
- UInt8.prototype.valueOf = function () {
37
+ valueOf() {
54
38
  return this.bytes.readUInt8(0);
55
- };
56
- UInt8.width = 8 / 8; // 1
57
- UInt8.defaultUInt8 = new UInt8(buffer_1.Buffer.alloc(UInt8.width));
58
- return UInt8;
59
- }(uint_1.UInt));
39
+ }
40
+ }
60
41
  exports.UInt8 = UInt8;
42
+ UInt8.width = 8 / 8; // 1
43
+ UInt8.defaultUInt8 = new UInt8(buffer_1.Buffer.alloc(UInt8.width));
61
44
  //# sourceMappingURL=uint-8.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"uint-8.js","sourceRoot":"","sources":["../../src/types/uint-8.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,+BAA6B;AAE7B,kCAAgC;AAEhC;;GAEG;AACH;IAAoB,yBAAI;IAItB,eAAY,KAAa;eACvB,kBAAM,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC;IAC1C,CAAC;IAEM,gBAAU,GAAjB,UAAkB,MAAoB;QACpC,OAAO,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAA;IAC5C,CAAC;IAED;;;;OAIG;IACI,UAAI,GAAX,UAAsC,GAAM;QAC1C,IAAI,GAAG,YAAY,KAAK,EAAE;YACxB,OAAO,GAAG,CAAA;SACX;QAED,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;YAC3B,IAAM,GAAG,GAAG,eAAM,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;YACrC,GAAG,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,CAAC,CAAA;YACtB,OAAO,IAAI,KAAK,CAAC,GAAG,CAAC,CAAA;SACtB;QAED,MAAM,IAAI,KAAK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AAO,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA;IAChC,CAAC;;AAGM,sBAAK;AAxCc,WAAK,GAAW,CAAC,GAAG,CAAC,CAAA,CAAC,IAAI;AACpC,kBAAY,GAAU,IAAI,KAAK,CAAC,eAAM,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAA"}
@@ -1,4 +1,4 @@
1
- import * as bigInt from 'big-integer';
1
+ import bigInt = require('big-integer');
2
2
  import { Comparable } from './serialized-type';
3
3
  import { Buffer } from 'buffer/';
4
4
  /**
@@ -1,22 +1,7 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
2
  Object.defineProperty(exports, "__esModule", { value: true });
18
3
  exports.UInt = void 0;
19
- var serialized_type_1 = require("./serialized-type");
4
+ const serialized_type_1 = require("./serialized-type");
20
5
  /**
21
6
  * Compare numbers and bigInts n1 and n2
22
7
  *
@@ -30,10 +15,9 @@ function compare(n1, n2) {
30
15
  /**
31
16
  * Base class for serializing and deserializing unsigned integers.
32
17
  */
33
- var UInt = /** @class */ (function (_super) {
34
- __extends(UInt, _super);
35
- function UInt(bytes) {
36
- return _super.call(this, bytes) || this;
18
+ class UInt extends serialized_type_1.Comparable {
19
+ constructor(bytes) {
20
+ super(bytes);
37
21
  }
38
22
  /**
39
23
  * Overload of compareTo for Comparable
@@ -41,19 +25,18 @@ var UInt = /** @class */ (function (_super) {
41
25
  * @param other other UInt to compare this to
42
26
  * @returns -1, 0, or 1 depending on how the objects relate to each other
43
27
  */
44
- UInt.prototype.compareTo = function (other) {
28
+ compareTo(other) {
45
29
  return compare(this.valueOf(), other.valueOf());
46
- };
30
+ }
47
31
  /**
48
32
  * Convert a UInt object to JSON
49
33
  *
50
34
  * @returns number or string represented by this.bytes
51
35
  */
52
- UInt.prototype.toJSON = function () {
53
- var val = this.valueOf();
36
+ toJSON() {
37
+ const val = this.valueOf();
54
38
  return typeof val === 'number' ? val : val.toString();
55
- };
56
- return UInt;
57
- }(serialized_type_1.Comparable));
39
+ }
40
+ }
58
41
  exports.UInt = UInt;
59
42
  //# sourceMappingURL=uint.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"uint.js","sourceRoot":"","sources":["../../src/types/uint.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AACA,qDAA8C;AAG9C;;;;;;GAMG;AACH,SAAS,OAAO,CACd,EAA8B,EAC9B,EAA8B;IAE9B,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AACxC,CAAC;AAED;;GAEG;AACH;IAA4B,wBAAU;IAGpC,cAAY,KAAa;eACvB,kBAAM,KAAK,CAAC;IACd,CAAC;IAED;;;;;OAKG;IACH,wBAAS,GAAT,UAAU,KAAW;QACnB,OAAO,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;IACjD,CAAC;IAED;;;;OAIG;IACH,qBAAM,GAAN;QACE,IAAM,GAAG,GAAG,IAAI,CAAC,OAAO,EAAE,CAAA;QAC1B,OAAO,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAA;IACvD,CAAC;IAQH,WAAC;AAAD,CAAC,AAjCD,CAA4B,4BAAU,GAiCrC;AAEQ,oBAAI"}
1
+ {"version":3,"file":"uint.js","sourceRoot":"","sources":["../../src/types/uint.ts"],"names":[],"mappings":";;;AACA,uDAA8C;AAG9C;;;;;;GAMG;AACH,SAAS,OAAO,CACd,EAA8B,EAC9B,EAA8B;IAE9B,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AACxC,CAAC;AAED;;GAEG;AACH,MAAe,IAAK,SAAQ,4BAAU;IAGpC,YAAY,KAAa;QACvB,KAAK,CAAC,KAAK,CAAC,CAAA;IACd,CAAC;IAED;;;;;OAKG;IACH,SAAS,CAAC,KAAW;QACnB,OAAO,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;IACjD,CAAC;IAED;;;;OAIG;IACH,MAAM;QACJ,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,EAAE,CAAA;QAC1B,OAAO,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAA;IACvD,CAAC;CAQF;AAEQ,oBAAI"}
@@ -1,24 +1,9 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
2
  Object.defineProperty(exports, "__esModule", { value: true });
18
3
  exports.Vector256 = void 0;
19
- var serialized_type_1 = require("./serialized-type");
20
- var hash_256_1 = require("./hash-256");
21
- var binary_serializer_1 = require("../serdes/binary-serializer");
4
+ const serialized_type_1 = require("./serialized-type");
5
+ const hash_256_1 = require("./hash-256");
6
+ const binary_serializer_1 = require("../serdes/binary-serializer");
22
7
  /**
23
8
  * TypeGuard for Array<string>
24
9
  */
@@ -28,10 +13,9 @@ function isStrings(arg) {
28
13
  /**
29
14
  * Class for serializing and deserializing vectors of Hash256
30
15
  */
31
- var Vector256 = /** @class */ (function (_super) {
32
- __extends(Vector256, _super);
33
- function Vector256(bytes) {
34
- return _super.call(this, bytes) || this;
16
+ class Vector256 extends serialized_type_1.SerializedType {
17
+ constructor(bytes) {
18
+ super(bytes);
35
19
  }
36
20
  /**
37
21
  * Construct a Vector256 from a BinaryParser
@@ -40,53 +24,52 @@ var Vector256 = /** @class */ (function (_super) {
40
24
  * @param hint length of the vector, in bytes, optional
41
25
  * @returns a Vector256 object
42
26
  */
43
- Vector256.fromParser = function (parser, hint) {
44
- var bytesList = new binary_serializer_1.BytesList();
45
- var bytes = hint !== null && hint !== void 0 ? hint : parser.size();
46
- var hashes = bytes / 32;
47
- for (var i = 0; i < hashes; i++) {
27
+ static fromParser(parser, hint) {
28
+ const bytesList = new binary_serializer_1.BytesList();
29
+ const bytes = hint !== null && hint !== void 0 ? hint : parser.size();
30
+ const hashes = bytes / 32;
31
+ for (let i = 0; i < hashes; i++) {
48
32
  hash_256_1.Hash256.fromParser(parser).toBytesSink(bytesList);
49
33
  }
50
34
  return new Vector256(bytesList.toBytes());
51
- };
35
+ }
52
36
  /**
53
37
  * Construct a Vector256 object from an array of hashes
54
38
  *
55
39
  * @param value A Vector256 object or array of hex-strings representing Hash256's
56
40
  * @returns a Vector256 object
57
41
  */
58
- Vector256.from = function (value) {
42
+ static from(value) {
59
43
  if (value instanceof Vector256) {
60
44
  return value;
61
45
  }
62
46
  if (isStrings(value)) {
63
- var bytesList_1 = new binary_serializer_1.BytesList();
64
- value.forEach(function (hash) {
65
- hash_256_1.Hash256.from(hash).toBytesSink(bytesList_1);
47
+ const bytesList = new binary_serializer_1.BytesList();
48
+ value.forEach((hash) => {
49
+ hash_256_1.Hash256.from(hash).toBytesSink(bytesList);
66
50
  });
67
- return new Vector256(bytesList_1.toBytes());
51
+ return new Vector256(bytesList.toBytes());
68
52
  }
69
53
  throw new Error('Cannot construct Vector256 from given value');
70
- };
54
+ }
71
55
  /**
72
56
  * Return an Array of hex-strings represented by this.bytes
73
57
  *
74
58
  * @returns An Array of strings representing the Hash256 objects
75
59
  */
76
- Vector256.prototype.toJSON = function () {
60
+ toJSON() {
77
61
  if (this.bytes.byteLength % 32 !== 0) {
78
62
  throw new Error('Invalid bytes for Vector256');
79
63
  }
80
- var result = [];
81
- for (var i = 0; i < this.bytes.byteLength; i += 32) {
64
+ const result = [];
65
+ for (let i = 0; i < this.bytes.byteLength; i += 32) {
82
66
  result.push(this.bytes
83
67
  .slice(i, i + 32)
84
68
  .toString('hex')
85
69
  .toUpperCase());
86
70
  }
87
71
  return result;
88
- };
89
- return Vector256;
90
- }(serialized_type_1.SerializedType));
72
+ }
73
+ }
91
74
  exports.Vector256 = Vector256;
92
75
  //# sourceMappingURL=vector-256.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"vector-256.js","sourceRoot":"","sources":["../../src/types/vector-256.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,qDAAkD;AAElD,uCAAoC;AACpC,iEAAuD;AAGvD;;GAEG;AACH,SAAS,SAAS,CAAC,GAAG;IACpB,OAAO,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,GAAG,CAAC,CAAC,CAAC,KAAK,QAAQ,CAAC,CAA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ple-binary-codec",
3
- "version": "1.4.2",
3
+ "version": "1.4.3",
4
4
  "description": "XRP Ledger binary codec",
5
5
  "files": [
6
6
  "dist/*",
@@ -17,15 +17,13 @@
17
17
  "buffer": "5.6.0",
18
18
  "create-hash": "^1.2.0",
19
19
  "decimal.js": "^10.2.0",
20
- "ripple-address-codec": "^4.2.4"
20
+ "ripple-address-codec": "^4.2.5"
21
21
  },
22
22
  "scripts": {
23
- "build": "run-script-os",
24
- "build:default": "tsc -b && copy .\\src\\enums\\definitions.json .\\dist\\enums",
25
- "build:nix": "tsc -b && cp ./src/enums/definitions.json ./dist/enums",
23
+ "build": "tsc -b && copyfiles ./src/enums/definitions.json ./dist/enums/",
26
24
  "clean": "rm -rf ./dist && rm -rf tsconfig.tsbuildinfo",
27
25
  "prepare": "npm run build && npm test",
28
- "test": "jest",
26
+ "test": "jest --verbose false --silent=false ./test/*.test.js",
29
27
  "lint": "eslint . --ext .ts --ext .test.js"
30
28
  },
31
29
  "repository": {
@@ -40,7 +38,7 @@
40
38
  "readmeFilename": "README.md",
41
39
  "prettier": "@xrplf/prettier-config",
42
40
  "engines": {
43
- "node": ">=10.22.0"
41
+ "node": ">= 10"
44
42
  },
45
- "gitHead": "aff6988f098ecc033a0cfa7974101f91de5cf948"
43
+ "gitHead": "b3d3bc2f99c21336c32d234026ddff79f16e8194"
46
44
  }
@@ -1,5 +1,5 @@
1
1
  const { loadFixture } = require('./utils')
2
- const { coreTypes } = require('../dist/types')
2
+ const { coreTypes } = require('../src/types')
3
3
  const { Amount } = coreTypes
4
4
  const fixtures = loadFixture('data-driven-tests.json')
5
5
 
@@ -1,5 +1,5 @@
1
1
  const fixtures = require('./fixtures/codec-fixtures.json')
2
- const { decode, encode, decodeLedgerData } = require('../dist')
2
+ const { decode, encode, decodeLedgerData } = require('../src')
3
3
 
4
4
  function json(object) {
5
5
  return JSON.stringify(object)
@@ -1,14 +1,14 @@
1
- const { coreTypes } = require('../dist/types')
1
+ const { coreTypes } = require('../src/types')
2
2
  const Decimal = require('decimal.js')
3
3
 
4
4
  const { encodeAccountID } = require('ripple-address-codec')
5
- const { binary } = require('../dist/coretypes')
5
+ const { binary } = require('../src/coretypes')
6
6
  const { Amount, Hash160 } = coreTypes
7
7
  const { makeParser, readJSON } = binary
8
- const { Field, TransactionType } = require('./../dist/enums')
8
+ const { Field, TransactionType } = require('./../src/enums')
9
9
  const { parseHexOnly, hexOnly, loadFixture } = require('./utils')
10
10
  const fixtures = loadFixture('data-driven-tests.json')
11
- const { BytesList } = require('../dist/serdes/binary-serializer')
11
+ const { BytesList } = require('../src/serdes/binary-serializer')
12
12
  const { Buffer } = require('buffer/')
13
13
 
14
14
  const __ = hexOnly
@@ -1,7 +1,7 @@
1
- const { binary } = require('../dist/coretypes')
2
- const { encode, decode } = require('../dist')
1
+ const { binary } = require('../src/coretypes')
2
+ const { encode, decode } = require('../src')
3
3
  const { makeParser, BytesList, BinarySerializer } = binary
4
- const { coreTypes } = require('../dist/types')
4
+ const { coreTypes } = require('../src/types')
5
5
  const { UInt8, UInt16, UInt32, UInt64, STObject } = coreTypes
6
6
  const bigInt = require('big-integer')
7
7
  const { Buffer } = require('buffer/')