ripple-binary-codec 1.1.3 → 1.2.0-beta.1
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/README.md +3 -3
- package/dist/ShaMap/ShaMap.d.ts +3 -0
- package/dist/ShaMap/ShaMap.js +25 -0
- package/dist/ShaMap/ShaMap.js.map +1 -0
- package/dist/ShaMap/ShaMapInner.d.ts +66 -0
- package/dist/ShaMap/ShaMapInner.js +145 -0
- package/dist/ShaMap/ShaMapInner.js.map +1 -0
- package/dist/ShaMap/ShaMapLeaf.d.ts +42 -0
- package/dist/ShaMap/ShaMapLeaf.js +84 -0
- package/dist/ShaMap/ShaMapLeaf.js.map +1 -0
- package/dist/ShaMap/ShaMapNode.d.ts +13 -0
- package/dist/ShaMap/ShaMapNode.js +12 -0
- package/dist/ShaMap/ShaMapNode.js.map +1 -0
- package/dist/ShaMap/index.d.ts +3 -0
- package/dist/ShaMap/index.js +9 -0
- package/dist/ShaMap/index.js.map +1 -0
- package/dist/enums/Bytes.d.ts +10 -0
- package/dist/enums/Bytes.js +30 -0
- package/dist/enums/Bytes.js.map +1 -0
- package/dist/enums/BytesLookup.d.ts +8 -0
- package/dist/enums/BytesLookup.js +29 -0
- package/dist/enums/BytesLookup.js.map +1 -0
- package/dist/enums/Field.d.ts +3 -0
- package/dist/enums/Field.js +9 -0
- package/dist/enums/Field.js.map +1 -0
- package/dist/enums/FieldInfo.d.ts +7 -0
- package/dist/enums/FieldInfo.js +3 -0
- package/dist/enums/FieldInfo.js.map +1 -0
- package/dist/enums/FieldInstance.d.ts +14 -0
- package/dist/enums/FieldInstance.js +3 -0
- package/dist/enums/FieldInstance.js.map +1 -0
- package/dist/enums/FieldLookup.d.ts +11 -0
- package/dist/enums/FieldLookup.js +102 -0
- package/dist/enums/FieldLookup.js.map +1 -0
- package/dist/enums/definitions.json +190 -4
- package/dist/hashes.js +2 -1
- package/dist/hashes.js.map +1 -1
- package/dist/serdes/BinaryParser.d.ts +100 -0
- package/dist/serdes/BinaryParser.js +200 -0
- package/dist/serdes/BinaryParser.js.map +1 -0
- package/dist/serdes/BinarySerializer.d.ts +50 -0
- package/dist/serdes/BinarySerializer.js +105 -0
- package/dist/serdes/BinarySerializer.js.map +1 -0
- package/dist/serdes/BytesList.d.ts +28 -0
- package/dist/serdes/BytesList.js +48 -0
- package/dist/serdes/BytesList.js.map +1 -0
- package/dist/types/Comparable.d.ts +18 -0
- package/dist/types/Comparable.js +43 -0
- package/dist/types/Comparable.js.map +1 -0
- package/dist/types/PathSet/Hop.d.ts +41 -0
- package/dist/types/PathSet/Hop.js +116 -0
- package/dist/types/PathSet/Hop.js.map +1 -0
- package/dist/types/PathSet/Path.d.ts +33 -0
- package/dist/types/PathSet/Path.js +83 -0
- package/dist/types/PathSet/Path.js.map +1 -0
- package/dist/types/PathSet/index.d.ts +29 -0
- package/dist/types/PathSet/index.js +98 -0
- package/dist/types/PathSet/index.js.map +1 -0
- package/dist/types/SerializedType.d.ts +47 -0
- package/dist/types/SerializedType.js +69 -0
- package/dist/types/SerializedType.js.map +1 -0
- package/dist/types/currency.d.ts +3 -10
- package/dist/types/currency.js +22 -23
- package/dist/types/currency.js.map +1 -1
- package/package.json +4 -3
- package/test/binary-parser.test.js +2 -2
- package/test/fixtures/data-driven-tests.json +2 -790
- package/test/hash.test.js +8 -4
- package/test/lower-case-hex.test.js +2 -1
- package/HISTORY.md +0 -90
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Hop.js","sourceRoot":"","sources":["../../../src/types/PathSet/Hop.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4EAA4E;AAC5E,kCAAgC;AAEhC,0DAAoD;AACpD,4CAAqC;AACrC,wCAAkC;AAClC,oDAA8D;AAE9D;;GAEG;AACH,IAAM,YAAY,GAAG,IAAI,CAAA;AACzB,IAAM,aAAa,GAAG,IAAI,CAAA;AAC1B,IAAM,WAAW,GAAG,IAAI,CAAA;AAWxB;;GAEG;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CAAC;IACH,UAAC;AAAD,CAAC,AA9FD,CAAiC,wBAAc,GA8F9C"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import BinaryParser from '../../serdes/BinaryParser';
|
|
2
|
+
import SerializedType from '../SerializedType';
|
|
3
|
+
import { HopObject } from './Hop';
|
|
4
|
+
/**
|
|
5
|
+
* Constants for separating Paths in a PathSet.
|
|
6
|
+
*/
|
|
7
|
+
export declare const PATHSET_END_BYTE = 0;
|
|
8
|
+
export declare const PATH_SEPARATOR_BYTE = 255;
|
|
9
|
+
/**
|
|
10
|
+
* Class for serializing/deserializing Paths.
|
|
11
|
+
*/
|
|
12
|
+
export default class Path extends SerializedType {
|
|
13
|
+
/**
|
|
14
|
+
* Construct a Path from an array of Hops.
|
|
15
|
+
*
|
|
16
|
+
* @param value - Path or array of HopObjects to construct a Path.
|
|
17
|
+
* @returns The Path.
|
|
18
|
+
*/
|
|
19
|
+
static from(value: Path | HopObject[]): Path;
|
|
20
|
+
/**
|
|
21
|
+
* Read a Path from a BinaryParser.
|
|
22
|
+
*
|
|
23
|
+
* @param parser - BinaryParser to read Path from.
|
|
24
|
+
* @returns The Path represented by the bytes read from the BinaryParser.
|
|
25
|
+
*/
|
|
26
|
+
static fromParser(parser: BinaryParser): Path;
|
|
27
|
+
/**
|
|
28
|
+
* Get the JSON representation of this Path.
|
|
29
|
+
*
|
|
30
|
+
* @returns An Array of HopObject constructed from this.bytes.
|
|
31
|
+
*/
|
|
32
|
+
toJSON(): HopObject[];
|
|
33
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
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 (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
extendStatics(d, b);
|
|
11
|
+
function __() { this.constructor = d; }
|
|
12
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.PATH_SEPARATOR_BYTE = exports.PATHSET_END_BYTE = void 0;
|
|
17
|
+
var buffer_1 = require("buffer/");
|
|
18
|
+
var BinaryParser_1 = require("../../serdes/BinaryParser");
|
|
19
|
+
var SerializedType_1 = require("../SerializedType");
|
|
20
|
+
var Hop_1 = require("./Hop");
|
|
21
|
+
/**
|
|
22
|
+
* Constants for separating Paths in a PathSet.
|
|
23
|
+
*/
|
|
24
|
+
exports.PATHSET_END_BYTE = 0x00;
|
|
25
|
+
exports.PATH_SEPARATOR_BYTE = 0xff;
|
|
26
|
+
/**
|
|
27
|
+
* Class for serializing/deserializing Paths.
|
|
28
|
+
*/
|
|
29
|
+
var Path = /** @class */ (function (_super) {
|
|
30
|
+
__extends(Path, _super);
|
|
31
|
+
function Path() {
|
|
32
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Construct a Path from an array of Hops.
|
|
36
|
+
*
|
|
37
|
+
* @param value - Path or array of HopObjects to construct a Path.
|
|
38
|
+
* @returns The Path.
|
|
39
|
+
*/
|
|
40
|
+
Path.from = function (value) {
|
|
41
|
+
if (value instanceof Path) {
|
|
42
|
+
return value;
|
|
43
|
+
}
|
|
44
|
+
var bytes = [];
|
|
45
|
+
value.forEach(function (hop) {
|
|
46
|
+
bytes.push(Hop_1.default.from(hop).toBytes());
|
|
47
|
+
});
|
|
48
|
+
return new Path(buffer_1.Buffer.concat(bytes));
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Read a Path from a BinaryParser.
|
|
52
|
+
*
|
|
53
|
+
* @param parser - BinaryParser to read Path from.
|
|
54
|
+
* @returns The Path represented by the bytes read from the BinaryParser.
|
|
55
|
+
*/
|
|
56
|
+
Path.fromParser = function (parser) {
|
|
57
|
+
var bytes = [];
|
|
58
|
+
while (!parser.end()) {
|
|
59
|
+
bytes.push(Hop_1.default.fromParser(parser).toBytes());
|
|
60
|
+
if (parser.peek() === exports.PATHSET_END_BYTE ||
|
|
61
|
+
parser.peek() === exports.PATH_SEPARATOR_BYTE) {
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return new Path(buffer_1.Buffer.concat(bytes));
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Get the JSON representation of this Path.
|
|
69
|
+
*
|
|
70
|
+
* @returns An Array of HopObject constructed from this.bytes.
|
|
71
|
+
*/
|
|
72
|
+
Path.prototype.toJSON = function () {
|
|
73
|
+
var json = [];
|
|
74
|
+
var pathParser = new BinaryParser_1.default(this.toString());
|
|
75
|
+
while (!pathParser.end()) {
|
|
76
|
+
json.push(Hop_1.default.fromParser(pathParser).toJSON());
|
|
77
|
+
}
|
|
78
|
+
return json;
|
|
79
|
+
};
|
|
80
|
+
return Path;
|
|
81
|
+
}(SerializedType_1.default));
|
|
82
|
+
exports.default = Path;
|
|
83
|
+
//# sourceMappingURL=Path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Path.js","sourceRoot":"","sources":["../../../src/types/PathSet/Path.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kCAAgC;AAEhC,0DAAoD;AACpD,oDAA8C;AAE9C,6BAAsC;AAEtC;;GAEG;AACU,QAAA,gBAAgB,GAAG,IAAI,CAAA;AACvB,QAAA,mBAAmB,GAAG,IAAI,CAAA;AAEvC;;GAEG;AACH;IAAkC,wBAAc;IAAhD;;IAwDA,CAAC;IAvDC;;;;;OAKG;IACW,SAAI,GAAlB,UAAmB,KAAyB;QAC1C,IAAI,KAAK,YAAY,IA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
|
2
|
+
import SerializedType from '../SerializedType';
|
|
3
|
+
import { HopObject } from './Hop';
|
|
4
|
+
/**
|
|
5
|
+
* Deserialize and Serialize the PathSet type.
|
|
6
|
+
*/
|
|
7
|
+
export default class PathSet extends SerializedType {
|
|
8
|
+
/**
|
|
9
|
+
* Construct a PathSet from an Array of Arrays representing paths.
|
|
10
|
+
*
|
|
11
|
+
* @param value - A PathSet or Array of Array of HopObjects.
|
|
12
|
+
* @returns The PathSet constructed from value.
|
|
13
|
+
* @throws Error.
|
|
14
|
+
*/
|
|
15
|
+
static from<T extends PathSet | HopObject[][]>(value: T): PathSet;
|
|
16
|
+
/**
|
|
17
|
+
* Construct a PathSet from a BinaryParser.
|
|
18
|
+
*
|
|
19
|
+
* @param parser - A BinaryParser to read PathSet from.
|
|
20
|
+
* @returns The PathSet read from parser.
|
|
21
|
+
*/
|
|
22
|
+
static fromParser(parser: BinaryParser): PathSet;
|
|
23
|
+
/**
|
|
24
|
+
* Get the JSON representation of this PathSet.
|
|
25
|
+
*
|
|
26
|
+
* @returns An Array of Array of HopObjects, representing this PathSet.
|
|
27
|
+
*/
|
|
28
|
+
toJSON(): HopObject[][];
|
|
29
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
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 (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
extendStatics(d, b);
|
|
11
|
+
function __() { this.constructor = d; }
|
|
12
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
var buffer_1 = require("buffer/");
|
|
17
|
+
var BinaryParser_1 = require("../../serdes/BinaryParser");
|
|
18
|
+
var SerializedType_1 = require("../SerializedType");
|
|
19
|
+
var Path_1 = require("./Path");
|
|
20
|
+
function isHopObject(arg) {
|
|
21
|
+
var _a, _b, _c;
|
|
22
|
+
/* eslint-disable @typescript-eslint/consistent-type-assertions --
|
|
23
|
+
* TODO is there any way to write this without a type assertion? */
|
|
24
|
+
return (((_a = arg) === null || _a === void 0 ? void 0 : _a.issuer) !== undefined ||
|
|
25
|
+
((_b = arg) === null || _b === void 0 ? void 0 : _b.account) !== undefined ||
|
|
26
|
+
((_c = arg) === null || _c === void 0 ? void 0 : _c.currency) !== undefined);
|
|
27
|
+
/* eslint-enable @typescript-eslint/consistent-type-assertions */
|
|
28
|
+
}
|
|
29
|
+
function isPathSet(arg) {
|
|
30
|
+
return ((Array.isArray(arg) && arg.length === 0) ||
|
|
31
|
+
(Array.isArray(arg) && Array.isArray(arg[0]) && arg[0].length === 0) ||
|
|
32
|
+
(Array.isArray(arg) && Array.isArray(arg[0]) && isHopObject(arg[0][0])));
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Deserialize and Serialize the PathSet type.
|
|
36
|
+
*/
|
|
37
|
+
var PathSet = /** @class */ (function (_super) {
|
|
38
|
+
__extends(PathSet, _super);
|
|
39
|
+
function PathSet() {
|
|
40
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Construct a PathSet from an Array of Arrays representing paths.
|
|
44
|
+
*
|
|
45
|
+
* @param value - A PathSet or Array of Array of HopObjects.
|
|
46
|
+
* @returns The PathSet constructed from value.
|
|
47
|
+
* @throws Error.
|
|
48
|
+
*/
|
|
49
|
+
PathSet.from = function (value) {
|
|
50
|
+
if (value instanceof PathSet) {
|
|
51
|
+
return value;
|
|
52
|
+
}
|
|
53
|
+
if (isPathSet(value)) {
|
|
54
|
+
var bytes_1 = [];
|
|
55
|
+
value.forEach(function (path) {
|
|
56
|
+
bytes_1.push(Path_1.default.from(path).toBytes());
|
|
57
|
+
bytes_1.push(buffer_1.Buffer.from([Path_1.PATH_SEPARATOR_BYTE]));
|
|
58
|
+
});
|
|
59
|
+
bytes_1[bytes_1.length - 1] = buffer_1.Buffer.from([Path_1.PATHSET_END_BYTE]);
|
|
60
|
+
return new PathSet(buffer_1.Buffer.concat(bytes_1));
|
|
61
|
+
}
|
|
62
|
+
throw new Error('Cannot construct PathSet from given value');
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Construct a PathSet from a BinaryParser.
|
|
66
|
+
*
|
|
67
|
+
* @param parser - A BinaryParser to read PathSet from.
|
|
68
|
+
* @returns The PathSet read from parser.
|
|
69
|
+
*/
|
|
70
|
+
PathSet.fromParser = function (parser) {
|
|
71
|
+
var bytes = [];
|
|
72
|
+
while (!parser.end()) {
|
|
73
|
+
bytes.push(Path_1.default.fromParser(parser).toBytes());
|
|
74
|
+
bytes.push(parser.read(1));
|
|
75
|
+
if (bytes[bytes.length - 1][0] === Path_1.PATHSET_END_BYTE) {
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return new PathSet(buffer_1.Buffer.concat(bytes));
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Get the JSON representation of this PathSet.
|
|
83
|
+
*
|
|
84
|
+
* @returns An Array of Array of HopObjects, representing this PathSet.
|
|
85
|
+
*/
|
|
86
|
+
PathSet.prototype.toJSON = function () {
|
|
87
|
+
var json = [];
|
|
88
|
+
var pathParser = new BinaryParser_1.default(this.toString());
|
|
89
|
+
while (!pathParser.end()) {
|
|
90
|
+
json.push(Path_1.default.fromParser(pathParser).toJSON());
|
|
91
|
+
pathParser.skip(1);
|
|
92
|
+
}
|
|
93
|
+
return json;
|
|
94
|
+
};
|
|
95
|
+
return PathSet;
|
|
96
|
+
}(SerializedType_1.default));
|
|
97
|
+
exports.default = PathSet;
|
|
98
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/PathSet/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kCAAgC;AAEhC,0DAAoD;AACpD,oDAA8C;AAG9C,+BAAoE;AAEpE,SAAS,WAAW,CAAC,GAAG;;IACtB;uEACmE;IACnE,OAAO,CACL,OAAC,GAAiB,0CAAE,MAAM,MAAK,SAAS;QACxC,OAAC,GAAiB,0CAAE,OAAO,MAAK,SAAS;QACzC,OAAC,GAAiB,0CAAE,QAAQ,MAAK,SAAS,CAC3C,CAAA;IACD,iEAAiE;AACnE,CAAC;AAED,SAAS,SAAS,CAAC,GAAG;IACpB,OAAO,CACL,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,CAAC;QACxC,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;QACpE,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CACxE,CAAA;AACH,CAAC;AAED;;GAEG;AACH;IAAqC,2BAAc;IAAnD;;IAkEA,CAAC;IAjEC;;;;;;OAMG;IACW,YAAI,GAAlB,UAAsD,KAAQ;QAC5D,IAAI,KAAK,YAAY,OAAO,EAAE;YAC5B,OAAO,KAAK,CAAA;SACb;QAED,IAAI,SAAS,CAAC,KAAK,CAAC,EAAE;YACpB,IAAM,OAAK,GAAa,EAAE,CAAA;YAE1B,KAAK,CA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E;YACxB,IAAI,CAAC,IAAI,CAAC,cAAI,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;IACH,cAAC;AAAD,CAAC,AAlED,CAAqC,wBAAc,GAkElD"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as bigInt from 'big-integer';
|
|
2
|
+
import { Buffer } from 'buffer/';
|
|
3
|
+
import type BinaryParser from '../serdes/BinaryParser';
|
|
4
|
+
import BytesList from '../serdes/BytesList';
|
|
5
|
+
export declare type JSON = string | number | boolean | null | undefined | JSON[] | JsonObject;
|
|
6
|
+
export interface JsonObject {
|
|
7
|
+
[key: string]: JSON;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The base class for all binary-codec types.
|
|
11
|
+
*/
|
|
12
|
+
export default class SerializedType {
|
|
13
|
+
protected readonly bytes: Buffer;
|
|
14
|
+
constructor(bytes: Buffer);
|
|
15
|
+
static fromParser(parser: BinaryParser, hint?: number): SerializedType;
|
|
16
|
+
static from(value: SerializedType | JSON | bigInt.BigInteger): SerializedType;
|
|
17
|
+
/**
|
|
18
|
+
* Write the bytes representation of a SerializedType to a BytesList.
|
|
19
|
+
*
|
|
20
|
+
* @param list - The BytesList to write SerializedType bytes to.
|
|
21
|
+
*/
|
|
22
|
+
toBytesSink(list: BytesList): void;
|
|
23
|
+
/**
|
|
24
|
+
* Get the hex representation of a SerializedType's bytes.
|
|
25
|
+
*
|
|
26
|
+
* @returns Hex String of this.bytes.
|
|
27
|
+
*/
|
|
28
|
+
toHex(): string;
|
|
29
|
+
/**
|
|
30
|
+
* Get the bytes representation of a SerializedType.
|
|
31
|
+
*
|
|
32
|
+
* @returns A buffer of the bytes.
|
|
33
|
+
*/
|
|
34
|
+
toBytes(): Buffer;
|
|
35
|
+
/**
|
|
36
|
+
* Return the JSON representation of a SerializedType.
|
|
37
|
+
*
|
|
38
|
+
* @returns Any type, if not overloaded returns hexString representation of bytes.
|
|
39
|
+
*/
|
|
40
|
+
toJSON(): JSON;
|
|
41
|
+
/**
|
|
42
|
+
* Return the HexString representation of this type.
|
|
43
|
+
*
|
|
44
|
+
* @returns HexString representation of this.bytes.
|
|
45
|
+
*/
|
|
46
|
+
toString(): string;
|
|
47
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var buffer_1 = require("buffer/");
|
|
4
|
+
var BytesList_1 = require("../serdes/BytesList");
|
|
5
|
+
/**
|
|
6
|
+
* The base class for all binary-codec types.
|
|
7
|
+
*/
|
|
8
|
+
var SerializedType = /** @class */ (function () {
|
|
9
|
+
function SerializedType(bytes) {
|
|
10
|
+
this.bytes = buffer_1.Buffer.alloc(0);
|
|
11
|
+
this.bytes = bytes !== null && bytes !== void 0 ? bytes : buffer_1.Buffer.alloc(0);
|
|
12
|
+
}
|
|
13
|
+
SerializedType.fromParser = function (parser, hint) {
|
|
14
|
+
throw new Error('fromParser not implemented');
|
|
15
|
+
return this.fromParser(parser, hint);
|
|
16
|
+
};
|
|
17
|
+
SerializedType.from = function (value) {
|
|
18
|
+
throw new Error('from not implemented');
|
|
19
|
+
return this.from(value);
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Write the bytes representation of a SerializedType to a BytesList.
|
|
23
|
+
*
|
|
24
|
+
* @param list - The BytesList to write SerializedType bytes to.
|
|
25
|
+
*/
|
|
26
|
+
SerializedType.prototype.toBytesSink = function (list) {
|
|
27
|
+
list.put(this.bytes);
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Get the hex representation of a SerializedType's bytes.
|
|
31
|
+
*
|
|
32
|
+
* @returns Hex String of this.bytes.
|
|
33
|
+
*/
|
|
34
|
+
SerializedType.prototype.toHex = function () {
|
|
35
|
+
return this.toBytes().toString('hex').toUpperCase();
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Get the bytes representation of a SerializedType.
|
|
39
|
+
*
|
|
40
|
+
* @returns A buffer of the bytes.
|
|
41
|
+
*/
|
|
42
|
+
SerializedType.prototype.toBytes = function () {
|
|
43
|
+
if (this.bytes) {
|
|
44
|
+
return this.bytes;
|
|
45
|
+
}
|
|
46
|
+
var bytes = new BytesList_1.default();
|
|
47
|
+
this.toBytesSink(bytes);
|
|
48
|
+
return bytes.toBytes();
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Return the JSON representation of a SerializedType.
|
|
52
|
+
*
|
|
53
|
+
* @returns Any type, if not overloaded returns hexString representation of bytes.
|
|
54
|
+
*/
|
|
55
|
+
SerializedType.prototype.toJSON = function () {
|
|
56
|
+
return this.toHex();
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Return the HexString representation of this type.
|
|
60
|
+
*
|
|
61
|
+
* @returns HexString representation of this.bytes.
|
|
62
|
+
*/
|
|
63
|
+
SerializedType.prototype.toString = function () {
|
|
64
|
+
return this.toHex();
|
|
65
|
+
};
|
|
66
|
+
return SerializedType;
|
|
67
|
+
}());
|
|
68
|
+
exports.default = SerializedType;
|
|
69
|
+
//# sourceMappingURL=SerializedType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SerializedType.js","sourceRoot":"","sources":["../../src/types/SerializedType.ts"],"names":[],"mappings":";;AACA,kCAAgC;AAGhC,iDAA2C;AAe3C;;GAEG;AACH;IAGE,wBAAmB,KAAa;QAFb,UAAK,GAAW,eAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;QAGhD,IAAI,CAAC,KAAK,GAAG,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,eAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IACvC,CAAC;IAEa,yBAAU,GAAxB,UACE,MAAoB,EACpB,IAAa;QAEb,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAA;QAC7C,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IACtC,CAAC;IAEa,mBAAI,GAAlB,UACE,KAAgD;QAEhD,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAA;QACvC,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IACzB,CAAC;IAED;;;;OAIG;IACI,oCAAW,GAAlB,UAAmB,IAAe;QAChC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IACtB,CAAC;IAED;;;;OAIG;IACI,8BAAK,GAAZ;QACE,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAA;IACrD,CAAC;IAED;;;;OAIG;IACI,gCAAO,GAAd;QACE,IAAI,IAAI,CAAC,KAAK,EAAE;YACd,OAAO,IAAI,CAAC,KAAK,CAAA;SAClB;QACD,IAAM,KAAK,GAAG,IAAI,mBAAS,EAAE,CAAA;QAC7B,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAA;QACvB,OAAO,KAAK,CAAC,OAAO,EAAE,CAAA;IACxB,CAAC;IAED;;;;OAIG;IACI,+BAAM,GAAb;QACE,OAAO,IAAI,CAAC,KAAK,EAAE,CAAA;IACrB,CAAC;IAED;;;;OAIG;IACI,iCAAQ,GAAf;QACE,OAAO,IAAI,CAAC,KAAK,EAAE,CAAA;IACrB,CAAC;IACH,qBAAC;AAAD,CAAC,AAvED,IAuEC"}
|
package/dist/types/currency.d.ts
CHANGED
|
@@ -5,21 +5,14 @@ import { Buffer } from "buffer/";
|
|
|
5
5
|
*/
|
|
6
6
|
declare class Currency extends Hash160 {
|
|
7
7
|
static readonly XRP: Currency;
|
|
8
|
-
private readonly _iso
|
|
9
|
-
private readonly _isNative;
|
|
8
|
+
private readonly _iso;
|
|
10
9
|
constructor(byteBuf: Buffer);
|
|
11
|
-
/**
|
|
12
|
-
* Tells if this currency is native
|
|
13
|
-
*
|
|
14
|
-
* @returns true if native, false if not
|
|
15
|
-
*/
|
|
16
|
-
isNative(): boolean;
|
|
17
10
|
/**
|
|
18
11
|
* Return the ISO code of this currency
|
|
19
12
|
*
|
|
20
|
-
* @returns ISO code if it exists, else
|
|
13
|
+
* @returns ISO code if it exists, else null
|
|
21
14
|
*/
|
|
22
|
-
iso(): string |
|
|
15
|
+
iso(): string | null;
|
|
23
16
|
/**
|
|
24
17
|
* Constructs a Currency object
|
|
25
18
|
*
|
package/dist/types/currency.js
CHANGED
|
@@ -33,7 +33,17 @@ function isoToBytes(iso) {
|
|
|
33
33
|
* Tests if ISO is a valid iso code
|
|
34
34
|
*/
|
|
35
35
|
function isIsoCode(iso) {
|
|
36
|
-
return iso
|
|
36
|
+
return ISO_REGEX.test(iso);
|
|
37
|
+
}
|
|
38
|
+
function isoCodeFromHex(code) {
|
|
39
|
+
var iso = code.toString();
|
|
40
|
+
if (iso === "XRP") {
|
|
41
|
+
throw new Error("Disallowed currency code: to indicate the currency XRP you must use 20 bytes of 0s");
|
|
42
|
+
}
|
|
43
|
+
if (isIsoCode(iso)) {
|
|
44
|
+
return iso;
|
|
45
|
+
}
|
|
46
|
+
return null;
|
|
37
47
|
}
|
|
38
48
|
/**
|
|
39
49
|
* Tests if hex is a valid hex-string
|
|
@@ -45,7 +55,7 @@ function isHex(hex) {
|
|
|
45
55
|
* Tests if a string is a valid representation of a currency
|
|
46
56
|
*/
|
|
47
57
|
function isStringRepresentation(input) {
|
|
48
|
-
return
|
|
58
|
+
return input.length === 3 || isHex(input);
|
|
49
59
|
}
|
|
50
60
|
/**
|
|
51
61
|
* Tests if a Buffer is a valid representation of a currency
|
|
@@ -77,33 +87,22 @@ var Currency = /** @class */ (function (_super) {
|
|
|
77
87
|
__extends(Currency, _super);
|
|
78
88
|
function Currency(byteBuf) {
|
|
79
89
|
var _this = _super.call(this, byteBuf !== null && byteBuf !== void 0 ? byteBuf : Currency.XRP.bytes) || this;
|
|
80
|
-
var onlyISO = true;
|
|
81
|
-
var bytes = _this.bytes;
|
|
82
90
|
var code = _this.bytes.slice(12, 15);
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
91
|
+
if (_this.bytes[0] !== 0) {
|
|
92
|
+
_this._iso = null;
|
|
93
|
+
}
|
|
94
|
+
else if (code.toString("hex") === "000000") {
|
|
95
|
+
_this._iso = "XRP";
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
_this._iso = isoCodeFromHex(code);
|
|
89
99
|
}
|
|
90
|
-
var lossLessISO = onlyISO && iso !== "XRP" && ISO_REGEX.test(iso);
|
|
91
|
-
_this._isNative = onlyISO && code.toString("hex") === "000000";
|
|
92
|
-
_this._iso = _this._isNative ? "XRP" : lossLessISO ? iso : undefined;
|
|
93
100
|
return _this;
|
|
94
101
|
}
|
|
95
|
-
/**
|
|
96
|
-
* Tells if this currency is native
|
|
97
|
-
*
|
|
98
|
-
* @returns true if native, false if not
|
|
99
|
-
*/
|
|
100
|
-
Currency.prototype.isNative = function () {
|
|
101
|
-
return this._isNative;
|
|
102
|
-
};
|
|
103
102
|
/**
|
|
104
103
|
* Return the ISO code of this currency
|
|
105
104
|
*
|
|
106
|
-
* @returns ISO code if it exists, else
|
|
105
|
+
* @returns ISO code if it exists, else null
|
|
107
106
|
*/
|
|
108
107
|
Currency.prototype.iso = function () {
|
|
109
108
|
return this._iso;
|
|
@@ -129,7 +128,7 @@ var Currency = /** @class */ (function (_super) {
|
|
|
129
128
|
*/
|
|
130
129
|
Currency.prototype.toJSON = function () {
|
|
131
130
|
var iso = this.iso();
|
|
132
|
-
if (iso !==
|
|
131
|
+
if (iso !== null) {
|
|
133
132
|
return iso;
|
|
134
133
|
}
|
|
135
134
|
return this.bytes.toString("hex").toUpperCase();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"currency.js","sourceRoot":"","sources":["../../src/types/currency.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uCAAqC;AACrC,kCAAiC;AAEjC,IAAM,SAAS,GAAG,eAAe,CAAC;AAClC,IAAM,SAAS,GAAG,gBAAgB,CAAC;AAEnC;;GAEG;AACH,SAAS,UAAU,CAAC,GAAW;IAC7B,IAAM,KAAK,GAAG,eAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC/B,IAAI,GAAG,KAAK,KAAK,EAAE;QACjB,IAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAf,CAAe,CAAC,CAAC;QAC3D,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;KACzB;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;GAEG;AACH,SAAS,SAAS,CAAC,GAAW;IAC5B,OAAO,GAAG,CAAC,MAAM,KAAK,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"currency.js","sourceRoot":"","sources":["../../src/types/currency.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uCAAqC;AACrC,kCAAiC;AAEjC,IAAM,SAAS,GAAG,eAAe,CAAC;AAClC,IAAM,SAAS,GAAG,gBAAgB,CAAC;AAEnC;;GAEG;AACH,SAAS,UAAU,CAAC,GAAW;IAC7B,IAAM,KAAK,GAAG,eAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC/B,IAAI,GAAG,KAAK,KAAK,EAAE;QACjB,IAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAf,CAAe,CAAC,CAAC;QAC3D,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC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AC;IArDe,YAAG,GAAG,IAAI,QAAQ,CAAC,eAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;IAsDvD,eAAC;CAAA,AAvDD,CAAuB,kBAAO,GAuD7B;AAEQ,4BAAQ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ripple-binary-codec",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.0-beta.1",
|
|
4
4
|
"description": "XRP Ledger binary codec",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/*",
|
|
@@ -13,13 +13,14 @@
|
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"assert": "^2.0.0",
|
|
16
|
-
"buffer": "5.6.0",
|
|
17
16
|
"big-integer": "^1.6.48",
|
|
17
|
+
"buffer": "5.6.0",
|
|
18
18
|
"create-hash": "^1.2.0",
|
|
19
19
|
"decimal.js": "^10.2.0",
|
|
20
20
|
"ripple-address-codec": "^4.1.1"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
+
"@types/create-hash": "^1.2.2",
|
|
23
24
|
"@types/jest": "^26.0.7",
|
|
24
25
|
"@types/node": "^14.0.10",
|
|
25
26
|
"@typescript-eslint/eslint-plugin": "^3.2.0",
|
|
@@ -55,6 +56,6 @@
|
|
|
55
56
|
},
|
|
56
57
|
"engines": {
|
|
57
58
|
"node": ">=10.22.0",
|
|
58
|
-
"
|
|
59
|
+
"npm": ">=7.0.0"
|
|
59
60
|
}
|
|
60
61
|
}
|
|
@@ -313,7 +313,7 @@ function pathSetBinaryTests() {
|
|
|
313
313
|
0000585E1F3BD02A15D6185F8BB9B57CC60DEDDB37C13157180C769B66D942EE
|
|
314
314
|
69E6DCC940CA48D82337AD000000000000000000000000425443000000000057
|
|
315
315
|
180C769B66D942EE69E6DCC940CA48D82337AD10000000000000000000000000
|
|
316
|
-
|
|
316
|
+
00000000000000003000000000000000000000000055534400000000000A20B3
|
|
317
317
|
C85F482532A9578DBB3950B85CA06594D100`
|
|
318
318
|
);
|
|
319
319
|
|
|
@@ -371,7 +371,7 @@ function pathSetBinaryTests() {
|
|
|
371
371
|
currency: "BTC",
|
|
372
372
|
issuer: "r3AWbdp2jQLXLywJypdoNwVSvr81xs3uhn",
|
|
373
373
|
},
|
|
374
|
-
{ currency: "
|
|
374
|
+
{ currency: "XRP" },
|
|
375
375
|
{
|
|
376
376
|
currency: "USD",
|
|
377
377
|
issuer: "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|