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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Quick script to re-number values
|
|
4
4
|
*/
|
|
5
|
-
|
|
5
|
+
const input = {
|
|
6
6
|
temBAD_SEND_XRP_PATHS: -283,
|
|
7
7
|
temBAD_SEQUENCE: -282,
|
|
8
8
|
temBAD_SIGNATURE: -281,
|
|
@@ -93,35 +93,35 @@ var input = {
|
|
|
93
93
|
tecHAS_OBLIGATIONS: 151,
|
|
94
94
|
tecTOO_SOON: 152,
|
|
95
95
|
};
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
Object.keys(input).forEach(
|
|
96
|
+
let startingFromTemBADSENDXRPPATHS = -284;
|
|
97
|
+
let startingFromTefFAILURE = -199;
|
|
98
|
+
let startingFromTerRETRY = -99;
|
|
99
|
+
const tesSUCCESS = 0;
|
|
100
|
+
let startingFromTecCLAIM = 100;
|
|
101
|
+
const startingFromTecDIRFULL = 121;
|
|
102
|
+
let previousKey = 'tem';
|
|
103
|
+
Object.keys(input).forEach((key) => {
|
|
104
104
|
if (key.substring(0, 3) !== previousKey.substring(0, 3)) {
|
|
105
105
|
console.log();
|
|
106
106
|
previousKey = key;
|
|
107
107
|
}
|
|
108
108
|
if (key.substring(0, 3) === 'tem') {
|
|
109
|
-
console.log(
|
|
109
|
+
console.log(` "${key}": ${startingFromTemBADSENDXRPPATHS++},`);
|
|
110
110
|
}
|
|
111
111
|
else if (key.substring(0, 3) === 'tef') {
|
|
112
|
-
console.log(
|
|
112
|
+
console.log(` "${key}": ${startingFromTefFAILURE++},`);
|
|
113
113
|
}
|
|
114
114
|
else if (key.substring(0, 3) === 'ter') {
|
|
115
|
-
console.log(
|
|
115
|
+
console.log(` "${key}": ${startingFromTerRETRY++},`);
|
|
116
116
|
}
|
|
117
117
|
else if (key.substring(0, 3) === 'tes') {
|
|
118
|
-
console.log(
|
|
118
|
+
console.log(` "${key}": ${tesSUCCESS},`);
|
|
119
119
|
}
|
|
120
120
|
else if (key.substring(0, 3) === 'tec') {
|
|
121
121
|
if (key === 'tecDIR_FULL') {
|
|
122
122
|
startingFromTecCLAIM = startingFromTecDIRFULL;
|
|
123
123
|
}
|
|
124
|
-
console.log(
|
|
124
|
+
console.log(` "${key}": ${startingFromTecCLAIM++},`);
|
|
125
125
|
}
|
|
126
126
|
});
|
|
127
127
|
//# sourceMappingURL=utils-renumber.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils-renumber.js","sourceRoot":"","sources":["../../src/enums/utils-renumber.ts"],"names":[],"mappings":";AAAA;;GAEG;AAEH,
|
|
1
|
+
{"version":3,"file":"utils-renumber.js","sourceRoot":"","sources":["../../src/enums/utils-renumber.ts"],"names":[],"mappings":";AAAA;;GAEG;AAEH,MAAM,KAAK,GAAG;IACZ,qBAAqB,EAAE,CAAC,GAAG;IAC3B,eAAe,EAAE,CAAC,GAAG;IACrB,gBAAgB,EAAE,CAAC,GAAG;IACtB,kBAAkB,EAAE,CAAC,GAAG;IACxB,oBAAoB,EAAE,CAAC,GAAG;IAC1B,aAAa,EAAE,CAAC,GAAG;IACnB,aAAa,EAAE,CAAC,GAAG;IACnB,UAAU,EAAE,CAAC,GAAG;IAChB,eAAe,EAAE,CAAC,GAAG;IACrB,YAAY,EAAE,CAAC,GAAG;IAClB,eAAe,EAAE,CAAC,GAAG;IACrB,WAAW,EAAE,CAAC,GAAG;IACjB,aAAa,EAAE,CAAC,GAAG;IACnB,aAAa,EAAE,CAAC,GAAG;IACnB,aAAa,EAAE,CAAC,GAAG;IACnB,gBAAgB,EAAE,CAAC,GAAG;IACtB,qBAAqB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CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE;QACvD,OAAO,CAAC,GAAG,EAAE,CAAA;QACb,WAAW,GAAG,GAAG,CAAA;KAClB;IACD,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,KAAK,EAAE;QACjC,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,MAAM,8BAA8B,EAAE,GAAG,CAAC,CAAA;KAClE;SAAM,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,KAAK,EAAE;QACxC,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,MAAM,sBAAsB,EAAE,GAAG,CAAC,CAAA;KAC1D;SAAM,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,KAAK,EAAE;QACxC,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,MAAM,oBAAoB,EAAE,GAAG,CAAC,CAAA;KACxD;SAAM,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,KAAK,EAAE;QACxC,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,MAAM,UAAU,GAAG,CAAC,CAAA;KAC5C;SAAM,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,KAAK,EAAE;QACxC,IAAI,GAAG,KAAK,aAAa,EAAE;YACzB,oBAAoB,GAAG,sBAAsB,CAAA;SAC9C;QACD,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,MAAM,oBAAoB,EAAE,GAAG,CAAC,CAAA;KACxD;AACH,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { SerializedType } from '../types/serialized-type';
|
|
2
|
+
import { Bytes, BytesLookup } from './bytes';
|
|
3
|
+
import { FieldInfo, FieldLookup, FieldInstance } from './field';
|
|
4
|
+
interface DefinitionsData {
|
|
5
|
+
TYPES: Record<string, number>;
|
|
6
|
+
LEDGER_ENTRY_TYPES: Record<string, number>;
|
|
7
|
+
FIELDS: (string | FieldInfo)[][];
|
|
8
|
+
TRANSACTION_RESULTS: Record<string, number>;
|
|
9
|
+
TRANSACTION_TYPES: Record<string, number>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Stores the various types and fields for rippled to be used to encode/decode information later on.
|
|
13
|
+
* XrplDefinitions should be instantiated instead of this class.
|
|
14
|
+
*/
|
|
15
|
+
declare class XrplDefinitionsBase {
|
|
16
|
+
field: FieldLookup;
|
|
17
|
+
ledgerEntryType: BytesLookup;
|
|
18
|
+
type: BytesLookup;
|
|
19
|
+
transactionResult: BytesLookup;
|
|
20
|
+
transactionType: BytesLookup;
|
|
21
|
+
transactionNames: string[];
|
|
22
|
+
dataTypes: Record<string, typeof SerializedType>;
|
|
23
|
+
/**
|
|
24
|
+
* Present rippled types in a typed and updatable format.
|
|
25
|
+
* For an example of the input format see `definitions.json`
|
|
26
|
+
* To generate a new definitions file from rippled source code, use this tool: https://github.com/RichardAH/xrpl-codec-gen
|
|
27
|
+
*
|
|
28
|
+
* See the definitions.test.js file for examples of how to create your own updated definitions.json.
|
|
29
|
+
*
|
|
30
|
+
* @param enums - A json encoding of the core types, transaction types, transaction results, transaction names, and fields.
|
|
31
|
+
* @param types - A list of type objects with the same name as the fields defined.
|
|
32
|
+
* You can use the coreTypes object if you are not adding new types.
|
|
33
|
+
*/
|
|
34
|
+
constructor(enums: DefinitionsData, types: Record<string, typeof SerializedType>);
|
|
35
|
+
/**
|
|
36
|
+
* Associates each Field to a corresponding class that TypeScript can recognize.
|
|
37
|
+
*
|
|
38
|
+
* @param types a list of type objects with the same name as the fields defined.
|
|
39
|
+
* Defaults to xrpl.js's core type definitions.
|
|
40
|
+
*/
|
|
41
|
+
associateTypes(types: Record<string, typeof SerializedType>): void;
|
|
42
|
+
getAssociatedTypes(): Record<string, typeof SerializedType>;
|
|
43
|
+
}
|
|
44
|
+
export { DefinitionsData, XrplDefinitionsBase, FieldLookup, FieldInfo, FieldInstance, Bytes, BytesLookup, };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BytesLookup = exports.Bytes = exports.FieldLookup = exports.XrplDefinitionsBase = void 0;
|
|
4
|
+
const bytes_1 = require("./bytes");
|
|
5
|
+
Object.defineProperty(exports, "Bytes", { enumerable: true, get: function () { return bytes_1.Bytes; } });
|
|
6
|
+
Object.defineProperty(exports, "BytesLookup", { enumerable: true, get: function () { return bytes_1.BytesLookup; } });
|
|
7
|
+
const field_1 = require("./field");
|
|
8
|
+
Object.defineProperty(exports, "FieldLookup", { enumerable: true, get: function () { return field_1.FieldLookup; } });
|
|
9
|
+
const constants_1 = require("./constants");
|
|
10
|
+
/**
|
|
11
|
+
* Stores the various types and fields for rippled to be used to encode/decode information later on.
|
|
12
|
+
* XrplDefinitions should be instantiated instead of this class.
|
|
13
|
+
*/
|
|
14
|
+
class XrplDefinitionsBase {
|
|
15
|
+
/**
|
|
16
|
+
* Present rippled types in a typed and updatable format.
|
|
17
|
+
* For an example of the input format see `definitions.json`
|
|
18
|
+
* To generate a new definitions file from rippled source code, use this tool: https://github.com/RichardAH/xrpl-codec-gen
|
|
19
|
+
*
|
|
20
|
+
* See the definitions.test.js file for examples of how to create your own updated definitions.json.
|
|
21
|
+
*
|
|
22
|
+
* @param enums - A json encoding of the core types, transaction types, transaction results, transaction names, and fields.
|
|
23
|
+
* @param types - A list of type objects with the same name as the fields defined.
|
|
24
|
+
* You can use the coreTypes object if you are not adding new types.
|
|
25
|
+
*/
|
|
26
|
+
constructor(enums, types) {
|
|
27
|
+
// Helps catch errors early in JavaScript code.
|
|
28
|
+
if (types == undefined) {
|
|
29
|
+
throw new TypeError('You passed in an undefined `types` parameter, but `types` must be defined since it contains logic for encoding/decoding transaction data. ' +
|
|
30
|
+
'If you have NOT added/modified any data types, you can import and use `coreTypes` from the types folder.');
|
|
31
|
+
}
|
|
32
|
+
this.type = new bytes_1.BytesLookup(enums.TYPES, constants_1.TYPE_WIDTH);
|
|
33
|
+
this.ledgerEntryType = new bytes_1.BytesLookup(enums.LEDGER_ENTRY_TYPES, constants_1.LEDGER_ENTRY_WIDTH);
|
|
34
|
+
this.transactionType = new bytes_1.BytesLookup(enums.TRANSACTION_TYPES, constants_1.TRANSACTION_TYPE_WIDTH);
|
|
35
|
+
this.transactionResult = new bytes_1.BytesLookup(enums.TRANSACTION_RESULTS, constants_1.TRANSACTION_RESULT_WIDTH);
|
|
36
|
+
this.field = new field_1.FieldLookup(enums.FIELDS, enums.TYPES);
|
|
37
|
+
this.transactionNames = Object.entries(enums.TRANSACTION_TYPES)
|
|
38
|
+
.filter(([_key, value]) => value >= 0)
|
|
39
|
+
.map(([key, _value]) => key);
|
|
40
|
+
this.dataTypes = {}; // Filled in via associateTypes
|
|
41
|
+
this.associateTypes(types);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Associates each Field to a corresponding class that TypeScript can recognize.
|
|
45
|
+
*
|
|
46
|
+
* @param types a list of type objects with the same name as the fields defined.
|
|
47
|
+
* Defaults to xrpl.js's core type definitions.
|
|
48
|
+
*/
|
|
49
|
+
associateTypes(types) {
|
|
50
|
+
// Overwrite any existing type definitions with the given types
|
|
51
|
+
this.dataTypes = Object.assign({}, this.dataTypes, types);
|
|
52
|
+
Object.values(this.field).forEach((field) => {
|
|
53
|
+
field.associatedType = this.dataTypes[field.type.name];
|
|
54
|
+
});
|
|
55
|
+
this.field['TransactionType'].associatedType = this.transactionType;
|
|
56
|
+
this.field['TransactionResult'].associatedType = this.transactionResult;
|
|
57
|
+
this.field['LedgerEntryType'].associatedType = this.ledgerEntryType;
|
|
58
|
+
}
|
|
59
|
+
getAssociatedTypes() {
|
|
60
|
+
return this.dataTypes;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.XrplDefinitionsBase = XrplDefinitionsBase;
|
|
64
|
+
//# sourceMappingURL=xrpl-definitions-base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xrpl-definitions-base.js","sourceRoot":"","sources":["../../src/enums/xrpl-definitions-base.ts"],"names":[],"mappings":";;;AACA,mCAA4C;AAmH1C,sFAnHO,aAAK,OAmHP;AACL,4FApHc,mBAAW,OAoHd;AAnHb,mCAA+D;AA+G7D,4FA/GkB,mBAAW,OA+GlB;AA9Gb,2CAKoB;AAUpB;;;GAGG;AACH,MAAM,mBAAmB;IAgBvB;;;;;;;;;;OAUG;IACH,YACE,KAAsB,EACtB,KAA4C;QAE5C,+CAA+C;QAC/C,IAAI,KAAK,IAAI,SAAS,EAAE;YACtB,MAAM,IAAI,SAAS,CACjB,4IAA4I;gBAC1I,0GAA0G,CAC7G,CAAA;SACF;QAED,IAAI,CAAC,IAAI,GAAG,IAAI,mBAAW,CAAC,KAAK,CAAC,KAAK,EAAE,sBAAU,CAAC,CAAA;QACpD,IAAI,CAAC,eAAe,GAAG,IAAI,mBAAW,CACpC,KAAK,CAAC,kBAAkB,EACxB,8BAAkB,CACnB,CAAA;QACD,IAAI,CAAC,eAAe,GAAG,IAAI,mBAAW,CACpC,KAAK,CAAC,iBAAiB,EACvB,kCAAsB,CACvB,CAAA;QACD,IAAI,CAAC,iBAAiB,GAAG,IAAI,mBAAW,CACtC,KAAK,CAAC,mBAAmB,EACzB,oCAAwB,CACzB,CAAA;QACD,IAAI,CAAC,KAAK,GAAG,IAAI,mBAAW,CAC1B,KAAK,CAAC,MAAoC,EAC1C,KAAK,CAAC,KAAK,CACZ,CAAA;QACD,IAAI,CAAC,gBAAgB,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,iBAAiB,CAAC;aAC5D,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,IAAI,CAAC,CAAC;aACrC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAA;QAE9B,IAAI,CAAC,SAAS,GAAG,EAAE,CAAA,CAAC,+BAA+B;QACnD,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAA;IAC5B,CAAC;IAED;;;;;OAKG;IACI,cAAc,CAAC,KAA4C;QAChE,+DAA+D;QAC/D,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,CAAA;QAEzD,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;YAC1C,KAAK,CAAC,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACxD,CAAC,CAAC,CAAA;QAEF,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,cAAc,GAAG,IAAI,CAAC,eAAe,CAAA;QACnE,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC,cAAc,GAAG,IAAI,CAAC,iBAAiB,CAAA;QACvE,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,cAAc,GAAG,IAAI,CAAC,eAAe,CAAA;IACrE,CAAC;IAEM,kBAAkB;QACvB,OAAO,IAAI,CAAC,SAAS,CAAA;IACvB,CAAC;CACF;AAIC,kDAAmB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type DefinitionsData, XrplDefinitionsBase } from './xrpl-definitions-base';
|
|
2
|
+
import { SerializedType } from '../types/serialized-type';
|
|
3
|
+
/**
|
|
4
|
+
* Stores the various types and fields for rippled to be used to encode/decode information later on.
|
|
5
|
+
* Should be used instead of XrplDefinitionsBase since this defines default `types` for serializing/deserializing
|
|
6
|
+
* ledger data.
|
|
7
|
+
*/
|
|
8
|
+
export declare class XrplDefinitions extends XrplDefinitionsBase {
|
|
9
|
+
/**
|
|
10
|
+
* Present rippled types in a typed and updatable format.
|
|
11
|
+
* For an example of the input format see `definitions.json`
|
|
12
|
+
* To generate a new definitions file from rippled source code, use this tool: https://github.com/RichardAH/xrpl-codec-gen
|
|
13
|
+
*
|
|
14
|
+
* See the definitions.test.js file for examples of how to create your own updated definitions.json.
|
|
15
|
+
*
|
|
16
|
+
* @param enums - A json encoding of the core types, transaction types, transaction results, transaction names, and fields.
|
|
17
|
+
* @param types - A list of type objects with the same name as the fields defined.
|
|
18
|
+
* You can use the coreTypes object if you are not adding new types.
|
|
19
|
+
*/
|
|
20
|
+
constructor(enums: DefinitionsData, types?: Record<string, typeof SerializedType>);
|
|
21
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.XrplDefinitions = void 0;
|
|
4
|
+
const xrpl_definitions_base_1 = require("./xrpl-definitions-base");
|
|
5
|
+
const types_1 = require("../types");
|
|
6
|
+
/**
|
|
7
|
+
* Stores the various types and fields for rippled to be used to encode/decode information later on.
|
|
8
|
+
* Should be used instead of XrplDefinitionsBase since this defines default `types` for serializing/deserializing
|
|
9
|
+
* ledger data.
|
|
10
|
+
*/
|
|
11
|
+
class XrplDefinitions extends xrpl_definitions_base_1.XrplDefinitionsBase {
|
|
12
|
+
/**
|
|
13
|
+
* Present rippled types in a typed and updatable format.
|
|
14
|
+
* For an example of the input format see `definitions.json`
|
|
15
|
+
* To generate a new definitions file from rippled source code, use this tool: https://github.com/RichardAH/xrpl-codec-gen
|
|
16
|
+
*
|
|
17
|
+
* See the definitions.test.js file for examples of how to create your own updated definitions.json.
|
|
18
|
+
*
|
|
19
|
+
* @param enums - A json encoding of the core types, transaction types, transaction results, transaction names, and fields.
|
|
20
|
+
* @param types - A list of type objects with the same name as the fields defined.
|
|
21
|
+
* You can use the coreTypes object if you are not adding new types.
|
|
22
|
+
*/
|
|
23
|
+
constructor(enums, types = types_1.coreTypes) {
|
|
24
|
+
super(enums, types);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.XrplDefinitions = XrplDefinitions;
|
|
28
|
+
//# sourceMappingURL=xrpl-definitions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xrpl-definitions.js","sourceRoot":"","sources":["../../src/enums/xrpl-definitions.ts"],"names":[],"mappings":";;;AAAA,mEAGgC;AAChC,oCAAoC;AAGpC;;;;GAIG;AACH,MAAa,eAAgB,SAAQ,2CAAmB;IACtD;;;;;;;;;;OAUG;IACH,YACE,KAAsB,EACtB,QAA+C,iBAAS;QAExD,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;IACrB,CAAC;CACF;AAlBD,0CAkBC"}
|
package/dist/hash-prefixes.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.HashPrefix = void 0;
|
|
4
|
-
|
|
4
|
+
const buffer_1 = require("buffer/");
|
|
5
5
|
/**
|
|
6
6
|
* Write a 32 bit integer to a Buffer
|
|
7
7
|
*
|
|
@@ -9,14 +9,14 @@ var buffer_1 = require("buffer/");
|
|
|
9
9
|
* @returns a buffer with the bytes representation of uint32
|
|
10
10
|
*/
|
|
11
11
|
function bytes(uint32) {
|
|
12
|
-
|
|
12
|
+
const result = buffer_1.Buffer.alloc(4);
|
|
13
13
|
result.writeUInt32BE(uint32, 0);
|
|
14
14
|
return result;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* Maps HashPrefix names to their byte representation
|
|
18
18
|
*/
|
|
19
|
-
|
|
19
|
+
const HashPrefix = {
|
|
20
20
|
transactionID: bytes(0x54584e00),
|
|
21
21
|
// transaction plus metadata
|
|
22
22
|
transaction: bytes(0x534e4400),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hash-prefixes.js","sourceRoot":"","sources":["../src/hash-prefixes.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"hash-prefixes.js","sourceRoot":"","sources":["../src/hash-prefixes.ts"],"names":[],"mappings":";;;AAAA,oCAAgC;AAEhC;;;;;GAKG;AACH,SAAS,KAAK,CAAC,MAAc;IAC3B,MAAM,MAAM,GAAG,eAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IAC9B,MAAM,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;IAC/B,OAAO,MAAM,CAAA;AACf,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,GAA2B;IACzC,aAAa,EAAE,KAAK,CAAC,UAAU,CAAC;IAChC,4BAA4B;IAC5B,WAAW,EAAE,KAAK,CAAC,UAAU,CAAC;IAC9B,gBAAgB;IAChB,iBAAiB,EAAE,KAAK,CAAC,UAAU,CAAC;IACpC,qBAAqB;IACrB,SAAS,EAAE,KAAK,CAAC,UAAU,CAAC;IAC5B,iCAAiC;IACjC,YAAY,EAAE,KAAK,CAAC,UAAU,CAAC;IAC/B,4BAA4B;IAC5B,cAAc,EAAE,KAAK,CAAC,UAAU,CAAC;IACjC,4BAA4B;IAC5B,mBAAmB,EAAE,KAAK,CAAC,UAAU,CAAC;IACtC,yBAAyB;IACzB,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC;IAC7B,uBAAuB;IACvB,QAAQ,EAAE,KAAK,CAAC,UAAU,CAAC;IAC3B,wBAAwB;IACxB,mBAAmB,EAAE,KAAK,CAAC,UAAU,CAAC;CACvC,CAAA;AAEQ,gCAAU"}
|
package/dist/hashes.js
CHANGED
|
@@ -1,36 +1,19 @@
|
|
|
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.transactionID = exports.sha512Half = exports.Sha512Half = void 0;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
4
|
+
const hash_prefixes_1 = require("./hash-prefixes");
|
|
5
|
+
const createHash = require("create-hash");
|
|
6
|
+
const hash_256_1 = require("./types/hash-256");
|
|
7
|
+
const binary_serializer_1 = require("./serdes/binary-serializer");
|
|
8
|
+
const buffer_1 = require("buffer/");
|
|
24
9
|
/**
|
|
25
10
|
* Class for hashing with SHA512
|
|
26
11
|
* @extends BytesList So SerializedTypes can write bytes to a Sha512Half
|
|
27
12
|
*/
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
_this.hash = createHash('sha512');
|
|
33
|
-
return _this;
|
|
13
|
+
class Sha512Half extends binary_serializer_1.BytesList {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.hash = createHash('sha512');
|
|
34
17
|
}
|
|
35
18
|
/**
|
|
36
19
|
* Construct a new Sha512Hash and write bytes this.hash
|
|
@@ -38,37 +21,36 @@ var Sha512Half = /** @class */ (function (_super) {
|
|
|
38
21
|
* @param bytes bytes to write to this.hash
|
|
39
22
|
* @returns the new Sha512Hash object
|
|
40
23
|
*/
|
|
41
|
-
|
|
24
|
+
static put(bytes) {
|
|
42
25
|
return new Sha512Half().put(bytes);
|
|
43
|
-
}
|
|
26
|
+
}
|
|
44
27
|
/**
|
|
45
28
|
* Write bytes to an existing Sha512Hash
|
|
46
29
|
*
|
|
47
30
|
* @param bytes bytes to write to object
|
|
48
31
|
* @returns the Sha512 object
|
|
49
32
|
*/
|
|
50
|
-
|
|
33
|
+
put(bytes) {
|
|
51
34
|
this.hash.update(bytes);
|
|
52
35
|
return this;
|
|
53
|
-
}
|
|
36
|
+
}
|
|
54
37
|
/**
|
|
55
38
|
* Compute SHA512 hash and slice in half
|
|
56
39
|
*
|
|
57
40
|
* @returns half of a SHA512 hash
|
|
58
41
|
*/
|
|
59
|
-
|
|
42
|
+
finish256() {
|
|
60
43
|
return buffer_1.Buffer.from(this.hash.digest().slice(0, 32));
|
|
61
|
-
}
|
|
44
|
+
}
|
|
62
45
|
/**
|
|
63
46
|
* Constructs a Hash256 from the Sha512Half object
|
|
64
47
|
*
|
|
65
48
|
* @returns a Hash256 object
|
|
66
49
|
*/
|
|
67
|
-
|
|
50
|
+
finish() {
|
|
68
51
|
return new hash_256_1.Hash256(this.finish256());
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
}(binary_serializer_1.BytesList));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
72
54
|
exports.Sha512Half = Sha512Half;
|
|
73
55
|
/**
|
|
74
56
|
* compute SHA512 hash of a list of bytes
|
|
@@ -76,13 +58,9 @@ exports.Sha512Half = Sha512Half;
|
|
|
76
58
|
* @param args zero or more arguments to hash
|
|
77
59
|
* @returns the sha512half hash of the arguments.
|
|
78
60
|
*/
|
|
79
|
-
function sha512Half() {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
args[_i] = arguments[_i];
|
|
83
|
-
}
|
|
84
|
-
var hash = new Sha512Half();
|
|
85
|
-
args.forEach(function (a) { return hash.put(a); });
|
|
61
|
+
function sha512Half(...args) {
|
|
62
|
+
const hash = new Sha512Half();
|
|
63
|
+
args.forEach((a) => hash.put(a));
|
|
86
64
|
return hash.finish256();
|
|
87
65
|
}
|
|
88
66
|
exports.sha512Half = sha512Half;
|
package/dist/hashes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hashes.js","sourceRoot":"","sources":["../src/hashes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hashes.js","sourceRoot":"","sources":["../src/hashes.ts"],"names":[],"mappings":";;;AAAA,mDAA4C;AAC5C,0CAA0C;AAC1C,+CAA0C;AAC1C,kEAAsD;AACtD,oCAAgC;AAEhC;;;GAGG;AACH,MAAM,UAAW,SAAQ,6BAAS;IAAlC;;QACU,SAAI,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAA;IAwCrC,CAAC;IAtCC;;;;;OAKG;IACH,MAAM,CAAC,GAAG,CAAC,KAAa;QACtB,OAAO,IAAI,UAAU,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;IACpC,CAAC;IAED;;;;;OAKG;IACH,GAAG,CAAC,KAAa;QACf,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QACvB,OAAO,IAAI,CAAA;IACb,CAAC;IAED;;;;OAIG;IACH,SAAS;QACP,OAAO,eAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;IACrD,CAAC;IAED;;;;OAIG;IACH,MAAM;QACJ,OAAO,IAAI,kBAAO,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAA;IACtC,CAAC;CACF;AAwBQ,gCAAU;AAtBnB;;;;;GAKG;AACH,SAAS,UAAU,CAAC,GAAG,IAAc;IACnC,MAAM,IAAI,GAAG,IAAI,UAAU,EAAE,CAAA;IAC7B,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IAChC,OAAO,IAAI,CAAC,SAAS,EAAE,CAAA;AACzB,CAAC;AAYoB,gCAAU;AAV/B;;;;;GAKG;AACH,SAAS,aAAa,CAAC,UAAkB;IACvC,OAAO,IAAI,kBAAO,CAAC,UAAU,CAAC,0BAAU,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC,CAAA;AACtE,CAAC;AAEgC,sCAAa"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { decodeLedgerData } from './ledger-hashes';
|
|
2
2
|
import { JsonObject } from './types/serialized-type';
|
|
3
|
+
import { TRANSACTION_TYPES } from './enums';
|
|
3
4
|
/**
|
|
4
5
|
* Decode a transaction
|
|
5
6
|
*
|
|
@@ -52,15 +53,4 @@ declare function encodeQuality(value: string): string;
|
|
|
52
53
|
* @returns a string representing the quality
|
|
53
54
|
*/
|
|
54
55
|
declare function decodeQuality(value: string): string;
|
|
55
|
-
|
|
56
|
-
decode: typeof decode;
|
|
57
|
-
encode: typeof encode;
|
|
58
|
-
encodeForSigning: typeof encodeForSigning;
|
|
59
|
-
encodeForSigningClaim: typeof encodeForSigningClaim;
|
|
60
|
-
encodeForMultisigning: typeof encodeForMultisigning;
|
|
61
|
-
encodeQuality: typeof encodeQuality;
|
|
62
|
-
decodeQuality: typeof decodeQuality;
|
|
63
|
-
decodeLedgerData: typeof decodeLedgerData;
|
|
64
|
-
TRANSACTION_TYPES: string[];
|
|
65
|
-
};
|
|
66
|
-
export = _default;
|
|
56
|
+
export { decode, encode, encodeForSigning, encodeForSigningClaim, encodeForMultisigning, encodeQuality, decodeQuality, decodeLedgerData, TRANSACTION_TYPES, };
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.TRANSACTION_TYPES = exports.decodeLedgerData = exports.decodeQuality = exports.encodeQuality = exports.encodeForMultisigning = exports.encodeForSigningClaim = exports.encodeForSigning = exports.encode = exports.decode = void 0;
|
|
27
|
+
const assert = __importStar(require("assert"));
|
|
28
|
+
const coretypes_1 = require("./coretypes");
|
|
29
|
+
const ledger_hashes_1 = require("./ledger-hashes");
|
|
30
|
+
Object.defineProperty(exports, "decodeLedgerData", { enumerable: true, get: function () { return ledger_hashes_1.decodeLedgerData; } });
|
|
31
|
+
const enums_1 = require("./enums");
|
|
32
|
+
Object.defineProperty(exports, "TRANSACTION_TYPES", { enumerable: true, get: function () { return enums_1.TRANSACTION_TYPES; } });
|
|
33
|
+
const { signingData, signingClaimData, multiSigningData, binaryToJSON, serializeObject, } = coretypes_1.binary;
|
|
7
34
|
/**
|
|
8
35
|
* Decode a transaction
|
|
9
36
|
*
|
|
@@ -14,6 +41,7 @@ function decode(binary) {
|
|
|
14
41
|
assert.ok(typeof binary === 'string', 'binary must be a hex string');
|
|
15
42
|
return binaryToJSON(binary);
|
|
16
43
|
}
|
|
44
|
+
exports.decode = decode;
|
|
17
45
|
/**
|
|
18
46
|
* Encode a transaction
|
|
19
47
|
*
|
|
@@ -26,6 +54,7 @@ function encode(json) {
|
|
|
26
54
|
.toString('hex')
|
|
27
55
|
.toUpperCase();
|
|
28
56
|
}
|
|
57
|
+
exports.encode = encode;
|
|
29
58
|
/**
|
|
30
59
|
* Encode a transaction and prepare for signing
|
|
31
60
|
*
|
|
@@ -39,6 +68,7 @@ function encodeForSigning(json) {
|
|
|
39
68
|
.toString('hex')
|
|
40
69
|
.toUpperCase();
|
|
41
70
|
}
|
|
71
|
+
exports.encodeForSigning = encodeForSigning;
|
|
42
72
|
/**
|
|
43
73
|
* Encode a transaction and prepare for signing with a claim
|
|
44
74
|
*
|
|
@@ -52,6 +82,7 @@ function encodeForSigningClaim(json) {
|
|
|
52
82
|
.toString('hex')
|
|
53
83
|
.toUpperCase();
|
|
54
84
|
}
|
|
85
|
+
exports.encodeForSigningClaim = encodeForSigningClaim;
|
|
55
86
|
/**
|
|
56
87
|
* Encode a transaction and prepare for multi-signing
|
|
57
88
|
*
|
|
@@ -66,6 +97,7 @@ function encodeForMultisigning(json, signer) {
|
|
|
66
97
|
.toString('hex')
|
|
67
98
|
.toUpperCase();
|
|
68
99
|
}
|
|
100
|
+
exports.encodeForMultisigning = encodeForMultisigning;
|
|
69
101
|
/**
|
|
70
102
|
* Encode a quality value
|
|
71
103
|
*
|
|
@@ -76,6 +108,7 @@ function encodeQuality(value) {
|
|
|
76
108
|
assert.ok(typeof value === 'string');
|
|
77
109
|
return coretypes_1.quality.encode(value).toString('hex').toUpperCase();
|
|
78
110
|
}
|
|
111
|
+
exports.encodeQuality = encodeQuality;
|
|
79
112
|
/**
|
|
80
113
|
* Decode a quality value
|
|
81
114
|
*
|
|
@@ -86,15 +119,5 @@ function decodeQuality(value) {
|
|
|
86
119
|
assert.ok(typeof value === 'string');
|
|
87
120
|
return coretypes_1.quality.decode(value).toString();
|
|
88
121
|
}
|
|
89
|
-
|
|
90
|
-
decode: decode,
|
|
91
|
-
encode: encode,
|
|
92
|
-
encodeForSigning: encodeForSigning,
|
|
93
|
-
encodeForSigningClaim: encodeForSigningClaim,
|
|
94
|
-
encodeForMultisigning: encodeForMultisigning,
|
|
95
|
-
encodeQuality: encodeQuality,
|
|
96
|
-
decodeQuality: decodeQuality,
|
|
97
|
-
decodeLedgerData: ledger_hashes_1.decodeLedgerData,
|
|
98
|
-
TRANSACTION_TYPES: enums_1.TRANSACTION_TYPES,
|
|
99
|
-
};
|
|
122
|
+
exports.decodeQuality = decodeQuality;
|
|
100
123
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAgC;AAChC,2CAA6C;AAC7C,mDAAkD;AA8GhD,iGA9GO,gCAAgB,OA8GP;AA3GlB,mCAA2C;AA4GzC,kGA5GO,yBAAiB,OA4GP;AA1GnB,MAAM,EACJ,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,EACZ,eAAe,GAChB,GAAG,kBAAM,CAAA;AAEV;;;;;GAKG;AACH,SAAS,MAAM,CAAC,MAAc;IAC5B,MAAM,CAAC,EAAE,CAAC,OAAO,MAAM,KAAK,QAAQ,EAAE,6BAA6B,CAAC,CAAA;IACpE,OAAO,YAAY,CAAC,MAAM,CAAC,CAAA;AAC7B,CAAC;AAiFC,wBAAM;AA/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