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.
- package/dist/binary.js +25 -29
- package/dist/binary.js.map +1 -1
- package/dist/coretypes.js +31 -8
- package/dist/coretypes.js.map +1 -1
- package/dist/enums/bytes.d.ts +26 -0
- package/dist/enums/bytes.js +64 -0
- package/dist/enums/bytes.js.map +1 -0
- package/dist/enums/constants.d.ts +4 -0
- package/dist/enums/constants.js +8 -0
- package/dist/enums/constants.js.map +1 -0
- package/dist/enums/definitions.json +2330 -1971
- package/dist/enums/field.d.ts +29 -0
- package/dist/enums/field.js +59 -0
- package/dist/enums/field.js.map +1 -0
- package/dist/enums/index.js +69 -60
- package/dist/enums/index.js.map +1 -1
- package/dist/enums/src/enums/definitions.json +2337 -0
- package/dist/enums/utils-renumber.js +14 -14
- package/dist/enums/utils-renumber.js.map +1 -1
- package/dist/enums/xrpl-definitions-base.d.ts +44 -0
- package/dist/enums/xrpl-definitions-base.js +64 -0
- package/dist/enums/xrpl-definitions-base.js.map +1 -0
- package/dist/enums/xrpl-definitions.d.ts +21 -0
- package/dist/enums/xrpl-definitions.js +28 -0
- package/dist/enums/xrpl-definitions.js.map +1 -0
- package/dist/hash-prefixes.js +3 -3
- package/dist/hash-prefixes.js.map +1 -1
- package/dist/hashes.js +21 -43
- package/dist/hashes.js.map +1 -1
- package/dist/index.d.ts +2 -12
- package/dist/index.js +39 -16
- package/dist/index.js.map +1 -1
- package/dist/ledger-hashes.d.ts +1 -1
- package/dist/ledger-hashes.js +51 -28
- package/dist/ledger-hashes.js.map +1 -1
- package/dist/quality.js +18 -21
- package/dist/quality.js.map +1 -1
- package/dist/serdes/binary-parser.js +78 -56
- package/dist/serdes/binary-parser.js.map +1 -1
- package/dist/serdes/binary-serializer.js +59 -40
- package/dist/serdes/binary-serializer.js.map +1 -1
- package/dist/shamap.js +70 -98
- package/dist/shamap.js.map +1 -1
- package/dist/types/account-id.js +18 -35
- package/dist/types/account-id.js.map +1 -1
- package/dist/types/amount.js +71 -88
- package/dist/types/amount.js.map +1 -1
- package/dist/types/blob.js +10 -27
- package/dist/types/blob.js.map +1 -1
- package/dist/types/currency.js +26 -44
- package/dist/types/currency.js.map +1 -1
- package/dist/types/hash-128.d.ts +6 -0
- package/dist/types/hash-128.js +23 -25
- package/dist/types/hash-128.js.map +1 -1
- package/dist/types/hash-160.js +8 -25
- package/dist/types/hash-160.js.map +1 -1
- package/dist/types/hash-256.js +8 -25
- package/dist/types/hash-256.js.map +1 -1
- package/dist/types/hash.js +20 -38
- package/dist/types/hash.js.map +1 -1
- package/dist/types/index.js +18 -18
- package/dist/types/index.js.map +1 -1
- package/dist/types/path-set.js +57 -87
- package/dist/types/path-set.js.map +1 -1
- package/dist/types/serialized-type.d.ts +3 -3
- package/dist/types/serialized-type.js +35 -56
- package/dist/types/serialized-type.js.map +1 -1
- package/dist/types/st-array.js +26 -46
- package/dist/types/st-array.js.map +1 -1
- package/dist/types/st-object.js +49 -73
- package/dist/types/st-object.js.map +1 -1
- package/dist/types/uint-16.js +15 -32
- package/dist/types/uint-16.js.map +1 -1
- package/dist/types/uint-32.js +16 -33
- package/dist/types/uint-32.js.map +1 -1
- package/dist/types/uint-64.d.ts +1 -1
- package/dist/types/uint-64.js +30 -47
- package/dist/types/uint-64.js.map +1 -1
- package/dist/types/uint-8.js +15 -32
- package/dist/types/uint-8.js.map +1 -1
- package/dist/types/uint.d.ts +1 -1
- package/dist/types/uint.js +10 -27
- package/dist/types/uint.js.map +1 -1
- package/dist/types/vector-256.js +23 -40
- package/dist/types/vector-256.js.map +1 -1
- package/package.json +6 -8
- package/test/amount.test.js +1 -1
- package/test/binary-json.test.js +1 -1
- package/test/binary-parser.test.js +4 -4
- package/test/binary-serializer.test.js +3 -3
- package/test/fixtures/data-driven-tests.json +0 -14
- package/test/hash.test.js +28 -2
- package/test/ledger.test.js +1 -1
- package/test/lower-case-hex.test.js +1 -1
- package/test/pseudo-transaction.test.js +1 -1
- package/test/quality.test.js +1 -1
- package/test/shamap.test.js +3 -3
- package/test/signing-data-encoding.test.js +1 -1
- package/test/tx-encode-decode.test.js +1 -1
- package/test/types.test.js +2 -2
- package/test/uint.test.js +2 -2
- package/test/x-address.test.js +1 -1
package/dist/types/hash-160.js
CHANGED
|
@@ -1,37 +1,20 @@
|
|
|
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.Hash160 = void 0;
|
|
19
|
-
|
|
20
|
-
|
|
4
|
+
const hash_1 = require("./hash");
|
|
5
|
+
const buffer_1 = require("buffer/");
|
|
21
6
|
/**
|
|
22
7
|
* Hash with a width of 160 bits
|
|
23
8
|
*/
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
function Hash160(bytes) {
|
|
9
|
+
class Hash160 extends hash_1.Hash {
|
|
10
|
+
constructor(bytes) {
|
|
27
11
|
if (bytes && bytes.byteLength === 0) {
|
|
28
12
|
bytes = Hash160.ZERO_160.bytes;
|
|
29
13
|
}
|
|
30
|
-
|
|
14
|
+
super(bytes !== null && bytes !== void 0 ? bytes : Hash160.ZERO_160.bytes);
|
|
31
15
|
}
|
|
32
|
-
|
|
33
|
-
Hash160.ZERO_160 = new Hash160(buffer_1.Buffer.alloc(Hash160.width));
|
|
34
|
-
return Hash160;
|
|
35
|
-
}(hash_1.Hash));
|
|
16
|
+
}
|
|
36
17
|
exports.Hash160 = Hash160;
|
|
18
|
+
Hash160.width = 20;
|
|
19
|
+
Hash160.ZERO_160 = new Hash160(buffer_1.Buffer.alloc(Hash160.width));
|
|
37
20
|
//# sourceMappingURL=hash-160.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hash-160.js","sourceRoot":"","sources":["../../src/types/hash-160.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hash-160.js","sourceRoot":"","sources":["../../src/types/hash-160.ts"],"names":[],"mappings":";;;AAAA,iCAA6B;AAC7B,oCAAgC;AAEhC;;GAEG;AACH,MAAM,OAAQ,SAAQ,WAAI;IAIxB,YAAY,KAAc;QACxB,IAAI,KAAK,IAAI,KAAK,CAAC,UAAU,KAAK,CAAC,EAAE;YACnC,KAAK,GAAG,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAA;SAC/B;QAED,KAAK,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;IACxC,CAAC;;AAGM,0BAAO;AAZE,aAAK,GAAG,EAAE,CAAA;AACV,gBAAQ,GAAY,IAAI,OAAO,CAAC,eAAM,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAA"}
|
package/dist/types/hash-256.js
CHANGED
|
@@ -1,34 +1,17 @@
|
|
|
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.Hash256 = void 0;
|
|
19
|
-
|
|
20
|
-
|
|
4
|
+
const hash_1 = require("./hash");
|
|
5
|
+
const buffer_1 = require("buffer/");
|
|
21
6
|
/**
|
|
22
7
|
* Hash with a width of 256 bits
|
|
23
8
|
*/
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return _super.call(this, bytes !== null && bytes !== void 0 ? bytes : Hash256.ZERO_256.bytes) || this;
|
|
9
|
+
class Hash256 extends hash_1.Hash {
|
|
10
|
+
constructor(bytes) {
|
|
11
|
+
super(bytes !== null && bytes !== void 0 ? bytes : Hash256.ZERO_256.bytes);
|
|
28
12
|
}
|
|
29
|
-
|
|
30
|
-
Hash256.ZERO_256 = new Hash256(buffer_1.Buffer.alloc(Hash256.width));
|
|
31
|
-
return Hash256;
|
|
32
|
-
}(hash_1.Hash));
|
|
13
|
+
}
|
|
33
14
|
exports.Hash256 = Hash256;
|
|
15
|
+
Hash256.width = 32;
|
|
16
|
+
Hash256.ZERO_256 = new Hash256(buffer_1.Buffer.alloc(Hash256.width));
|
|
34
17
|
//# sourceMappingURL=hash-256.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hash-256.js","sourceRoot":"","sources":["../../src/types/hash-256.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hash-256.js","sourceRoot":"","sources":["../../src/types/hash-256.ts"],"names":[],"mappings":";;;AAAA,iCAA6B;AAC7B,oCAAgC;AAEhC;;GAEG;AACH,MAAM,OAAQ,SAAQ,WAAI;IAIxB,YAAY,KAAa;QACvB,KAAK,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;IACxC,CAAC;;AAGM,0BAAO;AARE,aAAK,GAAG,EAAE,CAAA;AACV,gBAAQ,GAAG,IAAI,OAAO,CAAC,eAAM,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAA"}
|
package/dist/types/hash.js
CHANGED
|
@@ -1,41 +1,24 @@
|
|
|
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.Hash = void 0;
|
|
19
|
-
|
|
20
|
-
|
|
4
|
+
const serialized_type_1 = require("./serialized-type");
|
|
5
|
+
const buffer_1 = require("buffer/");
|
|
21
6
|
/**
|
|
22
7
|
* Base class defining how to encode and decode hashes
|
|
23
8
|
*/
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
throw new Error("Invalid Hash length ".concat(_this.bytes.byteLength));
|
|
9
|
+
class Hash extends serialized_type_1.Comparable {
|
|
10
|
+
constructor(bytes) {
|
|
11
|
+
super(bytes);
|
|
12
|
+
if (this.bytes.byteLength !== this.constructor.width) {
|
|
13
|
+
throw new Error(`Invalid Hash length ${this.bytes.byteLength}`);
|
|
30
14
|
}
|
|
31
|
-
return _this;
|
|
32
15
|
}
|
|
33
16
|
/**
|
|
34
17
|
* Construct a Hash object from an existing Hash object or a hex-string
|
|
35
18
|
*
|
|
36
19
|
* @param value A hash object or hex-string of a hash
|
|
37
20
|
*/
|
|
38
|
-
|
|
21
|
+
static from(value) {
|
|
39
22
|
if (value instanceof this) {
|
|
40
23
|
return value;
|
|
41
24
|
}
|
|
@@ -43,39 +26,39 @@ var Hash = /** @class */ (function (_super) {
|
|
|
43
26
|
return new this(buffer_1.Buffer.from(value, 'hex'));
|
|
44
27
|
}
|
|
45
28
|
throw new Error('Cannot construct Hash from given value');
|
|
46
|
-
}
|
|
29
|
+
}
|
|
47
30
|
/**
|
|
48
31
|
* Read a Hash object from a BinaryParser
|
|
49
32
|
*
|
|
50
33
|
* @param parser BinaryParser to read the hash from
|
|
51
34
|
* @param hint length of the bytes to read, optional
|
|
52
35
|
*/
|
|
53
|
-
|
|
36
|
+
static fromParser(parser, hint) {
|
|
54
37
|
return new this(parser.read(hint !== null && hint !== void 0 ? hint : this.width));
|
|
55
|
-
}
|
|
38
|
+
}
|
|
56
39
|
/**
|
|
57
40
|
* Overloaded operator for comparing two hash objects
|
|
58
41
|
*
|
|
59
42
|
* @param other The Hash to compare this to
|
|
60
43
|
*/
|
|
61
|
-
|
|
44
|
+
compareTo(other) {
|
|
62
45
|
return this.bytes.compare(this.constructor.from(other).bytes);
|
|
63
|
-
}
|
|
46
|
+
}
|
|
64
47
|
/**
|
|
65
48
|
* @returns the hex-string representation of this Hash
|
|
66
49
|
*/
|
|
67
|
-
|
|
50
|
+
toString() {
|
|
68
51
|
return this.toHex();
|
|
69
|
-
}
|
|
52
|
+
}
|
|
70
53
|
/**
|
|
71
54
|
* Returns four bits at the specified depth within a hash
|
|
72
55
|
*
|
|
73
56
|
* @param depth The depth of the four bits
|
|
74
57
|
* @returns The number represented by the four bits
|
|
75
58
|
*/
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
59
|
+
nibblet(depth) {
|
|
60
|
+
const byteIx = depth > 0 ? (depth / 2) | 0 : 0;
|
|
61
|
+
let b = this.bytes[byteIx];
|
|
79
62
|
if (depth % 2 === 0) {
|
|
80
63
|
b = (b & 0xf0) >>> 4;
|
|
81
64
|
}
|
|
@@ -83,8 +66,7 @@ var Hash = /** @class */ (function (_super) {
|
|
|
83
66
|
b = b & 0x0f;
|
|
84
67
|
}
|
|
85
68
|
return b;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
}(serialized_type_1.Comparable));
|
|
69
|
+
}
|
|
70
|
+
}
|
|
89
71
|
exports.Hash = Hash;
|
|
90
72
|
//# sourceMappingURL=hash.js.map
|
package/dist/types/hash.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hash.js","sourceRoot":"","sources":["../../src/types/hash.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hash.js","sourceRoot":"","sources":["../../src/types/hash.ts"],"names":[],"mappings":";;;AAAA,uDAA8C;AAE9C,oCAAgC;AAEhC;;GAEG;AACH,MAAM,IAAK,SAAQ,4BAAU;IAG3B,YAAY,KAAa;QACvB,KAAK,CAAC,KAAK,CAAC,CAAA;QACZ,IAAI,IAAI,CAAC,KAAK,CAAC,UAAU,KAAM,IAAI,CAAC,WAA2B,CAAC,KAAK,EAAE;YACrE,MAAM,IAAI,KAAK,CAAC,uBAAuB,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC,CAAA;SAChE;IACH,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,IAAI,CAA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 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.coreTypes = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
4
|
+
const enums_1 = require("../enums");
|
|
5
|
+
const account_id_1 = require("./account-id");
|
|
6
|
+
const amount_1 = require("./amount");
|
|
7
|
+
const blob_1 = require("./blob");
|
|
8
|
+
const currency_1 = require("./currency");
|
|
9
|
+
const hash_128_1 = require("./hash-128");
|
|
10
|
+
const hash_160_1 = require("./hash-160");
|
|
11
|
+
const hash_256_1 = require("./hash-256");
|
|
12
|
+
const path_set_1 = require("./path-set");
|
|
13
|
+
const st_array_1 = require("./st-array");
|
|
14
|
+
const st_object_1 = require("./st-object");
|
|
15
|
+
const uint_16_1 = require("./uint-16");
|
|
16
|
+
const uint_32_1 = require("./uint-32");
|
|
17
|
+
const uint_64_1 = require("./uint-64");
|
|
18
|
+
const uint_8_1 = require("./uint-8");
|
|
19
|
+
const vector_256_1 = require("./vector-256");
|
|
20
|
+
const coreTypes = {
|
|
21
21
|
AccountID: account_id_1.AccountID,
|
|
22
22
|
Amount: amount_1.Amount,
|
|
23
23
|
Blob: blob_1.Blob,
|
|
@@ -35,7 +35,7 @@ var coreTypes = {
|
|
|
35
35
|
Vector256: vector_256_1.Vector256,
|
|
36
36
|
};
|
|
37
37
|
exports.coreTypes = coreTypes;
|
|
38
|
-
Object.values(enums_1.Field).forEach(
|
|
38
|
+
Object.values(enums_1.Field).forEach((field) => {
|
|
39
39
|
field.associatedType = coreTypes[field.type.name];
|
|
40
40
|
});
|
|
41
41
|
enums_1.Field['TransactionType'].associatedType = enums_1.TransactionType;
|
package/dist/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;AAAA,oCAKiB;AACjB,6CAAwC;AACxC,qCAAiC;AACjC,iCAA6B;AAC7B,yCAAqC;AACrC,yCAAoC;AACpC,yCAAoC;AACpC,yCAAoC;AACpC,yCAAoC;AACpC,yCAAoC;AACpC,2CAAsC;AACtC,uCAAkC;AAClC,uCAAkC;AAClC,uCAAkC;AAClC,qCAAgC;AAChC,6CAAwC;AAExC,MAAM,SAAS,GAAG;IAChB,SAAS,EAAT,sBAAS;IACT,MAAM,EAAN,eAAM;IACN,IAAI,EAAJ,WAAI;IACJ,QAAQ,EAAR,mBAAQ;IACR,OAAO,EAAP,kBAAO;IACP,OAAO,EAAP,kBAAO;IACP,OAAO,EAAP,kBAAO;IACP,OAAO,EAAP,kBAAO;IACP,OAAO,EAAP,kBAAO;IACP,QAAQ,EAAR,oBAAQ;IACR,KAAK,EAAL,cAAK;IACL,MAAM,EAAN,gBAAM;IACN,MAAM,EAAN,gBAAM;IACN,MAAM,EAAN,gBAAM;IACN,SAAS,EAAT,sBAAS;CACV,CAAA;AAUQ,8BAAS;AARlB,MAAM,CAAC,MAAM,CAAC,aAAK,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;IACrC,KAAK,CAAC,cAAc,GAAG,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACnD,CAAC,CAAC,CAAA;AAEF,aAAK,CAAC,iBAAiB,CAAC,CAAC,cAAc,GAAG,uBAAe,CAAA;AACzD,aAAK,CAAC,mBAAmB,CAAC,CAAC,cAAc,GAAG,yBAAiB,CAAA;AAC7D,aAAK,CAAC,iBAAiB,CAAC,CAAC,cAAc,GAAG,uBAAe,CAAA"}
|
package/dist/types/path-set.js
CHANGED
|
@@ -1,37 +1,22 @@
|
|
|
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.PathSet = void 0;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
4
|
+
const account_id_1 = require("./account-id");
|
|
5
|
+
const currency_1 = require("./currency");
|
|
6
|
+
const binary_parser_1 = require("../serdes/binary-parser");
|
|
7
|
+
const serialized_type_1 = require("./serialized-type");
|
|
8
|
+
const buffer_1 = require("buffer/");
|
|
24
9
|
/**
|
|
25
10
|
* Constants for separating Paths in a PathSet
|
|
26
11
|
*/
|
|
27
|
-
|
|
28
|
-
|
|
12
|
+
const PATHSET_END_BYTE = 0x00;
|
|
13
|
+
const PATH_SEPARATOR_BYTE = 0xff;
|
|
29
14
|
/**
|
|
30
15
|
* Constant for masking types of a Hop
|
|
31
16
|
*/
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
17
|
+
const TYPE_ACCOUNT = 0x01;
|
|
18
|
+
const TYPE_CURRENCY = 0x10;
|
|
19
|
+
const TYPE_ISSUER = 0x20;
|
|
35
20
|
/**
|
|
36
21
|
* TypeGuard for HopObject
|
|
37
22
|
*/
|
|
@@ -51,22 +36,18 @@ function isPathSet(arg) {
|
|
|
51
36
|
/**
|
|
52
37
|
* Serialize and Deserialize a Hop
|
|
53
38
|
*/
|
|
54
|
-
|
|
55
|
-
__extends(Hop, _super);
|
|
56
|
-
function Hop() {
|
|
57
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
58
|
-
}
|
|
39
|
+
class Hop extends serialized_type_1.SerializedType {
|
|
59
40
|
/**
|
|
60
41
|
* Create a Hop from a HopObject
|
|
61
42
|
*
|
|
62
43
|
* @param value Either a hop or HopObject to create a hop with
|
|
63
44
|
* @returns a Hop
|
|
64
45
|
*/
|
|
65
|
-
|
|
46
|
+
static from(value) {
|
|
66
47
|
if (value instanceof Hop) {
|
|
67
48
|
return value;
|
|
68
49
|
}
|
|
69
|
-
|
|
50
|
+
const bytes = [buffer_1.Buffer.from([0])];
|
|
70
51
|
if (value.account) {
|
|
71
52
|
bytes.push(account_id_1.AccountID.from(value.account).toBytes());
|
|
72
53
|
bytes[0][0] |= TYPE_ACCOUNT;
|
|
@@ -80,16 +61,16 @@ var Hop = /** @class */ (function (_super) {
|
|
|
80
61
|
bytes[0][0] |= TYPE_ISSUER;
|
|
81
62
|
}
|
|
82
63
|
return new Hop(buffer_1.Buffer.concat(bytes));
|
|
83
|
-
}
|
|
64
|
+
}
|
|
84
65
|
/**
|
|
85
66
|
* Construct a Hop from a BinaryParser
|
|
86
67
|
*
|
|
87
68
|
* @param parser BinaryParser to read the Hop from
|
|
88
69
|
* @returns a Hop
|
|
89
70
|
*/
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
71
|
+
static fromParser(parser) {
|
|
72
|
+
const type = parser.readUInt8();
|
|
73
|
+
const bytes = [buffer_1.Buffer.from([type])];
|
|
93
74
|
if (type & TYPE_ACCOUNT) {
|
|
94
75
|
bytes.push(parser.read(account_id_1.AccountID.width));
|
|
95
76
|
}
|
|
@@ -100,16 +81,16 @@ var Hop = /** @class */ (function (_super) {
|
|
|
100
81
|
bytes.push(parser.read(account_id_1.AccountID.width));
|
|
101
82
|
}
|
|
102
83
|
return new Hop(buffer_1.Buffer.concat(bytes));
|
|
103
|
-
}
|
|
84
|
+
}
|
|
104
85
|
/**
|
|
105
86
|
* Get the JSON interpretation of this hop
|
|
106
87
|
*
|
|
107
88
|
* @returns a HopObject, an JS object with optional account, issuer, and currency
|
|
108
89
|
*/
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
90
|
+
toJSON() {
|
|
91
|
+
const hopParser = new binary_parser_1.BinaryParser(this.bytes.toString('hex'));
|
|
92
|
+
const type = hopParser.readUInt8();
|
|
93
|
+
let account, currency, issuer;
|
|
113
94
|
if (type & TYPE_ACCOUNT) {
|
|
114
95
|
account = account_id_1.AccountID.fromParser(hopParser).toJSON();
|
|
115
96
|
}
|
|
@@ -119,7 +100,7 @@ var Hop = /** @class */ (function (_super) {
|
|
|
119
100
|
if (type & TYPE_ISSUER) {
|
|
120
101
|
issuer = account_id_1.AccountID.fromParser(hopParser).toJSON();
|
|
121
102
|
}
|
|
122
|
-
|
|
103
|
+
const result = {};
|
|
123
104
|
if (account) {
|
|
124
105
|
result.account = account;
|
|
125
106
|
}
|
|
@@ -130,49 +111,44 @@ var Hop = /** @class */ (function (_super) {
|
|
|
130
111
|
result.currency = currency;
|
|
131
112
|
}
|
|
132
113
|
return result;
|
|
133
|
-
}
|
|
114
|
+
}
|
|
134
115
|
/**
|
|
135
116
|
* get a number representing the type of this hop
|
|
136
117
|
*
|
|
137
118
|
* @returns a number to be bitwise and-ed with TYPE_ constants to describe the types in the hop
|
|
138
119
|
*/
|
|
139
|
-
|
|
120
|
+
type() {
|
|
140
121
|
return this.bytes[0];
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
}(serialized_type_1.SerializedType));
|
|
122
|
+
}
|
|
123
|
+
}
|
|
144
124
|
/**
|
|
145
125
|
* Class for serializing/deserializing Paths
|
|
146
126
|
*/
|
|
147
|
-
|
|
148
|
-
__extends(Path, _super);
|
|
149
|
-
function Path() {
|
|
150
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
151
|
-
}
|
|
127
|
+
class Path extends serialized_type_1.SerializedType {
|
|
152
128
|
/**
|
|
153
129
|
* construct a Path from an array of Hops
|
|
154
130
|
*
|
|
155
131
|
* @param value Path or array of HopObjects to construct a Path
|
|
156
132
|
* @returns the Path
|
|
157
133
|
*/
|
|
158
|
-
|
|
134
|
+
static from(value) {
|
|
159
135
|
if (value instanceof Path) {
|
|
160
136
|
return value;
|
|
161
137
|
}
|
|
162
|
-
|
|
163
|
-
value.forEach(
|
|
138
|
+
const bytes = [];
|
|
139
|
+
value.forEach((hop) => {
|
|
164
140
|
bytes.push(Hop.from(hop).toBytes());
|
|
165
141
|
});
|
|
166
142
|
return new Path(buffer_1.Buffer.concat(bytes));
|
|
167
|
-
}
|
|
143
|
+
}
|
|
168
144
|
/**
|
|
169
145
|
* Read a Path from a BinaryParser
|
|
170
146
|
*
|
|
171
147
|
* @param parser BinaryParser to read Path from
|
|
172
148
|
* @returns the Path represented by the bytes read from the BinaryParser
|
|
173
149
|
*/
|
|
174
|
-
|
|
175
|
-
|
|
150
|
+
static fromParser(parser) {
|
|
151
|
+
const bytes = [];
|
|
176
152
|
while (!parser.end()) {
|
|
177
153
|
bytes.push(Hop.fromParser(parser).toBytes());
|
|
178
154
|
if (parser.peek() === PATHSET_END_BYTE ||
|
|
@@ -181,59 +157,54 @@ var Path = /** @class */ (function (_super) {
|
|
|
181
157
|
}
|
|
182
158
|
}
|
|
183
159
|
return new Path(buffer_1.Buffer.concat(bytes));
|
|
184
|
-
}
|
|
160
|
+
}
|
|
185
161
|
/**
|
|
186
162
|
* Get the JSON representation of this Path
|
|
187
163
|
*
|
|
188
164
|
* @returns an Array of HopObject constructed from this.bytes
|
|
189
165
|
*/
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
166
|
+
toJSON() {
|
|
167
|
+
const json = [];
|
|
168
|
+
const pathParser = new binary_parser_1.BinaryParser(this.toString());
|
|
193
169
|
while (!pathParser.end()) {
|
|
194
170
|
json.push(Hop.fromParser(pathParser).toJSON());
|
|
195
171
|
}
|
|
196
172
|
return json;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
}(serialized_type_1.SerializedType));
|
|
173
|
+
}
|
|
174
|
+
}
|
|
200
175
|
/**
|
|
201
176
|
* Deserialize and Serialize the PathSet type
|
|
202
177
|
*/
|
|
203
|
-
|
|
204
|
-
__extends(PathSet, _super);
|
|
205
|
-
function PathSet() {
|
|
206
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
207
|
-
}
|
|
178
|
+
class PathSet extends serialized_type_1.SerializedType {
|
|
208
179
|
/**
|
|
209
180
|
* Construct a PathSet from an Array of Arrays representing paths
|
|
210
181
|
*
|
|
211
182
|
* @param value A PathSet or Array of Array of HopObjects
|
|
212
183
|
* @returns the PathSet constructed from value
|
|
213
184
|
*/
|
|
214
|
-
|
|
185
|
+
static from(value) {
|
|
215
186
|
if (value instanceof PathSet) {
|
|
216
187
|
return value;
|
|
217
188
|
}
|
|
218
189
|
if (isPathSet(value)) {
|
|
219
|
-
|
|
220
|
-
value.forEach(
|
|
221
|
-
|
|
222
|
-
|
|
190
|
+
const bytes = [];
|
|
191
|
+
value.forEach((path) => {
|
|
192
|
+
bytes.push(Path.from(path).toBytes());
|
|
193
|
+
bytes.push(buffer_1.Buffer.from([PATH_SEPARATOR_BYTE]));
|
|
223
194
|
});
|
|
224
|
-
|
|
225
|
-
return new PathSet(buffer_1.Buffer.concat(
|
|
195
|
+
bytes[bytes.length - 1] = buffer_1.Buffer.from([PATHSET_END_BYTE]);
|
|
196
|
+
return new PathSet(buffer_1.Buffer.concat(bytes));
|
|
226
197
|
}
|
|
227
198
|
throw new Error('Cannot construct PathSet from given value');
|
|
228
|
-
}
|
|
199
|
+
}
|
|
229
200
|
/**
|
|
230
201
|
* Construct a PathSet from a BinaryParser
|
|
231
202
|
*
|
|
232
203
|
* @param parser A BinaryParser to read PathSet from
|
|
233
204
|
* @returns the PathSet read from parser
|
|
234
205
|
*/
|
|
235
|
-
|
|
236
|
-
|
|
206
|
+
static fromParser(parser) {
|
|
207
|
+
const bytes = [];
|
|
237
208
|
while (!parser.end()) {
|
|
238
209
|
bytes.push(Path.fromParser(parser).toBytes());
|
|
239
210
|
bytes.push(parser.read(1));
|
|
@@ -242,22 +213,21 @@ var PathSet = /** @class */ (function (_super) {
|
|
|
242
213
|
}
|
|
243
214
|
}
|
|
244
215
|
return new PathSet(buffer_1.Buffer.concat(bytes));
|
|
245
|
-
}
|
|
216
|
+
}
|
|
246
217
|
/**
|
|
247
218
|
* Get the JSON representation of this PathSet
|
|
248
219
|
*
|
|
249
220
|
* @returns an Array of Array of HopObjects, representing this PathSet
|
|
250
221
|
*/
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
222
|
+
toJSON() {
|
|
223
|
+
const json = [];
|
|
224
|
+
const pathParser = new binary_parser_1.BinaryParser(this.toString());
|
|
254
225
|
while (!pathParser.end()) {
|
|
255
226
|
json.push(Path.fromParser(pathParser).toJSON());
|
|
256
227
|
pathParser.skip(1);
|
|
257
228
|
}
|
|
258
229
|
return json;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
}(serialized_type_1.SerializedType));
|
|
230
|
+
}
|
|
231
|
+
}
|
|
262
232
|
exports.PathSet = PathSet;
|
|
263
233
|
//# sourceMappingURL=path-set.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path-set.js","sourceRoot":"","sources":["../../src/types/path-set.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"path-set.js","sourceRoot":"","sources":["../../src/types/path-set.ts"],"names":[],"mappings":";;;AAAA,6CAAwC;AACxC,yCAAqC;AACrC,2DAAsD;AACtD,uDAA8D;AAC9D,oCAAgC;AAEhC;;G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,MAAM,IAAI,GAA4B,EAAE,CAAA;QACxC,MAAM,UAAU,GAAG,IAAI,4BAAY,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAA;QAEpD,OAAO,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE;YACxB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,MAAM,EAAE,CAAC,CAAA;YAC/C,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;SACnB;QAED,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAEQ,0BAAO"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BytesList } from '../serdes/binary-serializer';
|
|
2
2
|
import { BinaryParser } from '../serdes/binary-parser';
|
|
3
|
-
import
|
|
3
|
+
import bigInt = require('big-integer');
|
|
4
4
|
import { Buffer } from 'buffer/';
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
type JSON = string | number | boolean | null | undefined | JSON[] | JsonObject;
|
|
6
|
+
type JsonObject = {
|
|
7
7
|
[key: string]: JSON;
|
|
8
8
|
};
|
|
9
9
|
/**
|