ripple-binary-codec 1.0.2 → 1.0.3-mpt-beta
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/binary.d.ts +34 -20
- package/dist/binary.js +51 -34
- package/dist/binary.js.map +1 -1
- package/dist/coretypes.d.ts +9 -9
- package/dist/coretypes.js +33 -9
- package/dist/coretypes.js.map +1 -1
- package/dist/enums/bytes.d.ts +25 -0
- package/dist/enums/bytes.js +63 -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 +3066 -1760
- package/dist/enums/field.d.ts +28 -0
- package/dist/enums/field.js +58 -0
- package/dist/enums/field.js.map +1 -0
- package/dist/enums/index.d.ts +12 -46
- package/dist/enums/index.js +22 -110
- package/dist/enums/index.js.map +1 -1
- package/dist/enums/src/enums/definitions.json +3073 -0
- package/dist/enums/utils-renumber.js +20 -20
- 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 +59 -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 +29 -0
- package/dist/enums/xrpl-definitions.js.map +1 -0
- package/dist/hash-prefixes.d.ts +1 -2
- package/dist/hash-prefixes.js +7 -6
- package/dist/hash-prefixes.js.map +1 -1
- package/dist/hashes.d.ts +7 -8
- package/dist/hashes.js +23 -44
- package/dist/hashes.js.map +1 -1
- package/dist/index.d.ts +16 -17
- package/dist/index.js +65 -40
- package/dist/index.js.map +1 -1
- package/dist/ledger-hashes.d.ts +6 -3
- package/dist/ledger-hashes.js +40 -33
- package/dist/ledger-hashes.js.map +1 -1
- package/dist/quality.d.ts +3 -4
- package/dist/quality.js +20 -19
- package/dist/quality.js.map +1 -1
- package/dist/serdes/binary-parser.d.ts +8 -6
- package/dist/serdes/binary-parser.js +74 -64
- package/dist/serdes/binary-parser.js.map +1 -1
- package/dist/serdes/binary-serializer.d.ts +10 -11
- package/dist/serdes/binary-serializer.js +50 -48
- package/dist/serdes/binary-serializer.js.map +1 -1
- package/dist/shamap.d.ts +6 -7
- package/dist/shamap.js +74 -97
- package/dist/shamap.js.map +1 -1
- package/dist/src/binary.d.ts +90 -0
- package/dist/src/binary.js +128 -0
- package/dist/src/binary.js.map +1 -0
- package/dist/src/coretypes.d.ts +9 -0
- package/dist/src/coretypes.js +48 -0
- package/dist/src/coretypes.js.map +1 -0
- package/dist/src/enums/bytes.d.ts +25 -0
- package/dist/src/enums/bytes.js +63 -0
- package/dist/src/enums/bytes.js.map +1 -0
- package/dist/src/enums/constants.d.ts +4 -0
- package/dist/src/enums/constants.js +8 -0
- package/dist/src/enums/constants.js.map +1 -0
- package/dist/src/enums/definitions.json +3068 -0
- package/dist/src/enums/field.d.ts +28 -0
- package/dist/src/enums/field.js +58 -0
- package/dist/src/enums/field.js.map +1 -0
- package/dist/src/enums/index.d.ts +12 -0
- package/dist/src/enums/index.js +31 -0
- package/dist/src/enums/index.js.map +1 -0
- package/dist/src/enums/utils-renumber.d.ts +101 -0
- package/dist/src/enums/utils-renumber.js +127 -0
- package/dist/src/enums/utils-renumber.js.map +1 -0
- package/dist/src/enums/xrpl-definitions-base.d.ts +44 -0
- package/dist/src/enums/xrpl-definitions-base.js +59 -0
- package/dist/src/enums/xrpl-definitions-base.js.map +1 -0
- package/dist/src/enums/xrpl-definitions.d.ts +21 -0
- package/dist/src/enums/xrpl-definitions.js +29 -0
- package/dist/src/enums/xrpl-definitions.js.map +1 -0
- package/dist/src/hash-prefixes.d.ts +5 -0
- package/dist/src/hash-prefixes.js +41 -0
- package/dist/src/hash-prefixes.js.map +1 -0
- package/dist/src/hashes.d.ts +50 -0
- package/dist/src/hashes.js +76 -0
- package/dist/src/hashes.js.map +1 -0
- package/dist/src/index.d.ts +64 -0
- package/dist/src/index.js +123 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/ledger-hashes.d.ts +48 -0
- package/dist/src/ledger-hashes.js +141 -0
- package/dist/src/ledger-hashes.js.map +1 -0
- package/dist/src/quality.d.ts +21 -0
- package/dist/src/quality.js +42 -0
- package/dist/src/quality.js.map +1 -0
- package/dist/src/serdes/binary-parser.d.ts +100 -0
- package/dist/src/serdes/binary-parser.js +194 -0
- package/dist/src/serdes/binary-parser.js.map +1 -0
- package/dist/src/serdes/binary-serializer.d.ts +81 -0
- package/dist/src/serdes/binary-serializer.js +149 -0
- package/dist/src/serdes/binary-serializer.js.map +1 -0
- package/dist/src/shamap.d.ts +102 -0
- package/dist/src/shamap.js +172 -0
- package/dist/src/shamap.js.map +1 -0
- package/dist/src/types/account-id.d.ts +35 -0
- package/dist/src/types/account-id.js +69 -0
- package/dist/src/types/account-id.js.map +1 -0
- package/dist/src/types/amount.d.ts +91 -0
- package/dist/src/types/amount.js +289 -0
- package/dist/src/types/amount.js.map +1 -0
- package/dist/src/types/blob.d.ts +24 -0
- package/dist/src/types/blob.js +43 -0
- package/dist/src/types/blob.js.map +1 -0
- package/dist/src/types/currency.d.ts +28 -0
- package/dist/src/types/currency.js +127 -0
- package/dist/src/types/currency.js.map +1 -0
- package/dist/src/types/hash-128.d.ts +16 -0
- package/dist/src/types/hash-128.js +32 -0
- package/dist/src/types/hash-128.js.map +1 -0
- package/dist/src/types/hash-160.d.ts +10 -0
- package/dist/src/types/hash-160.js +19 -0
- package/dist/src/types/hash-160.js.map +1 -0
- package/dist/src/types/hash-192.d.ts +10 -0
- package/dist/src/types/hash-192.js +19 -0
- package/dist/src/types/hash-192.js.map +1 -0
- package/dist/src/types/hash-256.d.ts +10 -0
- package/dist/src/types/hash-256.js +16 -0
- package/dist/src/types/hash-256.js.map +1 -0
- package/dist/src/types/hash.d.ts +40 -0
- package/dist/src/types/hash.js +73 -0
- package/dist/src/types/hash.js.map +1 -0
- package/dist/src/types/index.d.ts +19 -0
- package/dist/src/types/index.js +64 -0
- package/dist/src/types/index.js.map +1 -0
- package/dist/src/types/issue.d.ts +38 -0
- package/dist/src/types/issue.js +81 -0
- package/dist/src/types/issue.js.map +1 -0
- package/dist/src/types/path-set.d.ts +36 -0
- package/dist/src/types/path-set.js +233 -0
- package/dist/src/types/path-set.js.map +1 -0
- package/dist/src/types/serialized-type.d.ts +70 -0
- package/dist/src/types/serialized-type.js +105 -0
- package/dist/src/types/serialized-type.js.map +1 -0
- package/dist/src/types/st-array.d.ts +31 -0
- package/dist/src/types/st-array.js +86 -0
- package/dist/src/types/st-array.js.map +1 -0
- package/dist/src/types/st-object.d.ts +32 -0
- package/dist/src/types/st-object.js +155 -0
- package/dist/src/types/st-object.js.map +1 -0
- package/dist/src/types/uint-16.d.ts +24 -0
- package/dist/src/types/uint-16.js +45 -0
- package/dist/src/types/uint-16.js.map +1 -0
- package/dist/src/types/uint-32.d.ts +24 -0
- package/dist/src/types/uint-32.js +50 -0
- package/dist/src/types/uint-32.js.map +1 -0
- package/dist/src/types/uint-64.d.ts +37 -0
- package/dist/src/types/uint-64.js +86 -0
- package/dist/src/types/uint-64.js.map +1 -0
- package/dist/src/types/uint-8.d.ts +24 -0
- package/dist/src/types/uint-8.js +46 -0
- package/dist/src/types/uint-8.js.map +1 -0
- package/dist/src/types/uint.d.ts +29 -0
- package/dist/src/types/uint.js +47 -0
- package/dist/src/types/uint.js.map +1 -0
- package/dist/src/types/vector-256.d.ts +30 -0
- package/dist/src/types/vector-256.js +73 -0
- package/dist/src/types/vector-256.js.map +1 -0
- package/dist/src/types/xchain-bridge.d.ts +44 -0
- package/dist/src/types/xchain-bridge.js +102 -0
- package/dist/src/types/xchain-bridge.js.map +1 -0
- package/dist/src/utils.d.ts +47 -0
- package/dist/src/utils.js +137 -0
- package/dist/src/utils.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/account-id.d.ts +2 -3
- package/dist/types/account-id.js +29 -37
- package/dist/types/account-id.js.map +1 -1
- package/dist/types/amount.d.ts +33 -10
- package/dist/types/amount.js +181 -101
- package/dist/types/amount.js.map +1 -1
- package/dist/types/blob.d.ts +3 -4
- package/dist/types/blob.js +16 -27
- package/dist/types/blob.js.map +1 -1
- package/dist/types/currency.d.ts +5 -13
- package/dist/types/currency.js +53 -66
- package/dist/types/currency.js.map +1 -1
- package/dist/types/hash-128.d.ts +8 -3
- package/dist/types/hash-128.js +23 -22
- package/dist/types/hash-128.js.map +1 -1
- package/dist/types/hash-160.d.ts +2 -3
- package/dist/types/hash-160.js +7 -24
- package/dist/types/hash-160.js.map +1 -1
- package/dist/types/hash-192.d.ts +10 -0
- package/dist/types/hash-192.js +19 -0
- package/dist/types/hash-192.js.map +1 -0
- package/dist/types/hash-256.d.ts +2 -3
- package/dist/types/hash-256.js +7 -22
- package/dist/types/hash-256.js.map +1 -1
- package/dist/types/hash.d.ts +4 -5
- package/dist/types/hash.js +25 -39
- package/dist/types/hash.js.map +1 -1
- package/dist/types/index.d.ts +19 -33
- package/dist/types/index.js +44 -24
- package/dist/types/index.js.map +1 -1
- package/dist/types/issue.d.ts +38 -0
- package/dist/types/issue.js +81 -0
- package/dist/types/issue.js.map +1 -0
- package/dist/types/path-set.d.ts +2 -2
- package/dist/types/path-set.js +73 -94
- package/dist/types/path-set.js.map +1 -1
- package/dist/types/serialized-type.d.ts +26 -18
- package/dist/types/serialized-type.js +50 -60
- package/dist/types/serialized-type.js.map +1 -1
- package/dist/types/st-array.d.ts +7 -4
- package/dist/types/st-array.js +36 -47
- package/dist/types/st-array.js.map +1 -1
- package/dist/types/st-object.d.ts +8 -5
- package/dist/types/st-object.js +73 -74
- package/dist/types/st-object.js.map +1 -1
- package/dist/types/uint-16.d.ts +3 -4
- package/dist/types/uint-16.js +20 -33
- package/dist/types/uint-16.js.map +1 -1
- package/dist/types/uint-32.d.ts +3 -4
- package/dist/types/uint-32.js +23 -36
- package/dist/types/uint-32.js.map +1 -1
- package/dist/types/uint-64.d.ts +5 -6
- package/dist/types/uint-64.js +44 -48
- package/dist/types/uint-64.js.map +1 -1
- package/dist/types/uint-8.d.ts +3 -4
- package/dist/types/uint-8.js +21 -33
- package/dist/types/uint-8.js.map +1 -1
- package/dist/types/uint.d.ts +5 -5
- package/dist/types/uint.js +17 -27
- package/dist/types/uint.js.map +1 -1
- package/dist/types/vector-256.d.ts +3 -4
- package/dist/types/vector-256.js +28 -45
- package/dist/types/vector-256.js.map +1 -1
- package/dist/types/xchain-bridge.d.ts +44 -0
- package/dist/types/xchain-bridge.js +102 -0
- package/dist/types/xchain-bridge.js.map +1 -0
- package/dist/utils.d.ts +47 -0
- package/dist/utils.js +137 -0
- package/dist/utils.js.map +1 -0
- package/package.json +23 -33
- package/src/README.md +5 -0
- package/src/binary.ts +194 -0
- package/src/coretypes.ts +31 -0
- package/src/enums/README.md +144 -0
- package/src/enums/bytes.ts +74 -0
- package/src/enums/constants.ts +4 -0
- package/src/enums/definitions.json +3073 -0
- package/src/enums/field.ts +84 -0
- package/src/enums/index.ts +34 -0
- package/src/enums/utils-renumber.ts +134 -0
- package/src/enums/xrpl-definitions-base.ts +111 -0
- package/src/enums/xrpl-definitions.ts +32 -0
- package/src/hash-prefixes.ts +40 -0
- package/src/hashes.ts +75 -0
- package/src/index.ts +153 -0
- package/src/ledger-hashes.ts +191 -0
- package/src/quality.ts +38 -0
- package/src/serdes/binary-parser.ts +228 -0
- package/src/serdes/binary-serializer.ts +166 -0
- package/src/shamap.ts +186 -0
- package/src/types/account-id.ts +86 -0
- package/src/types/amount.ts +362 -0
- package/src/types/blob.ts +46 -0
- package/src/types/currency.ts +140 -0
- package/src/types/hash-128.ts +33 -0
- package/src/types/hash-160.ts +19 -0
- package/src/types/hash-192.ts +19 -0
- package/src/types/hash-256.ts +15 -0
- package/src/types/hash.ts +83 -0
- package/src/types/index.ts +66 -0
- package/src/types/issue.ts +96 -0
- package/src/types/path-set.ts +290 -0
- package/src/types/serialized-type.ts +122 -0
- package/src/types/st-array.ts +113 -0
- package/src/types/st-object.ts +192 -0
- package/src/types/uint-16.ts +53 -0
- package/src/types/uint-32.ts +59 -0
- package/src/types/uint-64.ts +104 -0
- package/src/types/uint-8.ts +52 -0
- package/src/types/uint.ts +60 -0
- package/src/types/vector-256.ts +79 -0
- package/src/types/xchain-bridge.ts +128 -0
- package/src/utils.ts +152 -0
- package/HISTORY.md +0 -74
- package/test/amount.test.js +0 -43
- package/test/binary-json.test.js +0 -47
- package/test/binary-parser.test.js +0 -397
- package/test/binary-serializer.test.js +0 -248
- package/test/fixtures/account-tx-transactions.db +0 -0
- package/test/fixtures/codec-fixtures.json +0 -4466
- package/test/fixtures/data-driven-tests.json +0 -3721
- package/test/fixtures/delivermin-tx-binary.json +0 -1
- package/test/fixtures/delivermin-tx.json +0 -98
- package/test/fixtures/deposit-preauth-tx-binary.json +0 -1
- package/test/fixtures/deposit-preauth-tx-meta-binary.json +0 -1
- package/test/fixtures/deposit-preauth-tx.json +0 -58
- package/test/fixtures/escrow-cancel-binary.json +0 -1
- package/test/fixtures/escrow-cancel-tx.json +0 -6
- package/test/fixtures/escrow-create-binary.json +0 -1
- package/test/fixtures/escrow-create-tx.json +0 -10
- package/test/fixtures/escrow-finish-binary.json +0 -1
- package/test/fixtures/escrow-finish-meta-binary.json +0 -1
- package/test/fixtures/escrow-finish-tx.json +0 -95
- package/test/fixtures/ledger-full-38129.json +0 -1
- package/test/fixtures/ledger-full-40000.json +0 -1
- package/test/fixtures/negative-unl.json +0 -12
- package/test/fixtures/payment-channel-claim-binary.json +0 -1
- package/test/fixtures/payment-channel-claim-tx.json +0 -8
- package/test/fixtures/payment-channel-create-binary.json +0 -1
- package/test/fixtures/payment-channel-create-tx.json +0 -11
- package/test/fixtures/payment-channel-fund-binary.json +0 -1
- package/test/fixtures/payment-channel-fund-tx.json +0 -7
- package/test/fixtures/signerlistset-tx-binary.json +0 -1
- package/test/fixtures/signerlistset-tx-meta-binary.json +0 -1
- package/test/fixtures/signerlistset-tx.json +0 -94
- package/test/fixtures/x-codec-fixtures.json +0 -188
- package/test/hash.test.js +0 -82
- package/test/ledger.test.js +0 -29
- package/test/lower-case-hex.test.js +0 -45
- package/test/pseudo-transaction.test.js +0 -38
- package/test/quality.test.js +0 -15
- package/test/shamap.test.js +0 -88
- package/test/signing-data-encoding.test.js +0 -129
- package/test/tx-encode-decode.test.js +0 -80
- package/test/types.test.js +0 -34
- package/test/uint.test.js +0 -40
- package/test/utils.js +0 -29
- package/test/x-address.test.js +0 -147
|
@@ -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
|
-
if (key.substring(0, 3) ===
|
|
109
|
-
console.log(
|
|
108
|
+
if (key.substring(0, 3) === 'tem') {
|
|
109
|
+
console.log(` "${key}": ${startingFromTemBADSENDXRPPATHS++},`);
|
|
110
110
|
}
|
|
111
|
-
else if (key.substring(0, 3) ===
|
|
112
|
-
console.log(
|
|
111
|
+
else if (key.substring(0, 3) === 'tef') {
|
|
112
|
+
console.log(` "${key}": ${startingFromTefFAILURE++},`);
|
|
113
113
|
}
|
|
114
|
-
else if (key.substring(0, 3) ===
|
|
115
|
-
console.log(
|
|
114
|
+
else if (key.substring(0, 3) === 'ter') {
|
|
115
|
+
console.log(` "${key}": ${startingFromTerRETRY++},`);
|
|
116
116
|
}
|
|
117
|
-
else if (key.substring(0, 3) ===
|
|
118
|
-
console.log(
|
|
117
|
+
else if (key.substring(0, 3) === 'tes') {
|
|
118
|
+
console.log(` "${key}": ${tesSUCCESS},`);
|
|
119
119
|
}
|
|
120
|
-
else if (key.substring(0, 3) ===
|
|
121
|
-
if (key ===
|
|
120
|
+
else if (key.substring(0, 3) === 'tec') {
|
|
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;IAC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,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,59 @@
|
|
|
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
|
+
this.type = new bytes_1.BytesLookup(enums.TYPES, constants_1.TYPE_WIDTH);
|
|
28
|
+
this.ledgerEntryType = new bytes_1.BytesLookup(enums.LEDGER_ENTRY_TYPES, constants_1.LEDGER_ENTRY_WIDTH);
|
|
29
|
+
this.transactionType = new bytes_1.BytesLookup(enums.TRANSACTION_TYPES, constants_1.TRANSACTION_TYPE_WIDTH);
|
|
30
|
+
this.transactionResult = new bytes_1.BytesLookup(enums.TRANSACTION_RESULTS, constants_1.TRANSACTION_RESULT_WIDTH);
|
|
31
|
+
this.field = new field_1.FieldLookup(enums.FIELDS, enums.TYPES);
|
|
32
|
+
this.transactionNames = Object.entries(enums.TRANSACTION_TYPES)
|
|
33
|
+
.filter(([_key, value]) => value >= 0)
|
|
34
|
+
.map(([key, _value]) => key);
|
|
35
|
+
this.dataTypes = {}; // Filled in via associateTypes
|
|
36
|
+
this.associateTypes(types);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Associates each Field to a corresponding class that TypeScript can recognize.
|
|
40
|
+
*
|
|
41
|
+
* @param types a list of type objects with the same name as the fields defined.
|
|
42
|
+
* Defaults to xrpl.js's core type definitions.
|
|
43
|
+
*/
|
|
44
|
+
associateTypes(types) {
|
|
45
|
+
// Overwrite any existing type definitions with the given types
|
|
46
|
+
this.dataTypes = Object.assign({}, this.dataTypes, types);
|
|
47
|
+
Object.values(this.field).forEach((field) => {
|
|
48
|
+
field.associatedType = this.dataTypes[field.type.name];
|
|
49
|
+
});
|
|
50
|
+
this.field['TransactionType'].associatedType = this.transactionType;
|
|
51
|
+
this.field['TransactionResult'].associatedType = this.transactionResult;
|
|
52
|
+
this.field['LedgerEntryType'].associatedType = this.ledgerEntryType;
|
|
53
|
+
}
|
|
54
|
+
getAssociatedTypes() {
|
|
55
|
+
return this.dataTypes;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.XrplDefinitionsBase = XrplDefinitionsBase;
|
|
59
|
+
//# 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;AA2G1C,sFA3GO,aAAK,OA2GP;AACL,4FA5Gc,mBAAW,OA4Gd;AA3Gb,mCAA+D;AAuG7D,4FAvGkB,mBAAW,OAuGlB;AAtGb,2CAKoB;AAUpB;;;GAGG;AACH,MAAM,mBAAmB;IAgBvB;;;;;;;;;;OAUG;IACH,YACE,KAAsB,EACtB,KAA4C;QAE5C,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 additionalTypes - A list of SerializedType objects with the same name as the fields defined.
|
|
18
|
+
* These types will be included in addition to the coreTypes used on mainnet.
|
|
19
|
+
*/
|
|
20
|
+
constructor(enums: DefinitionsData, additionalTypes?: Record<string, typeof SerializedType>);
|
|
21
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
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 additionalTypes - A list of SerializedType objects with the same name as the fields defined.
|
|
21
|
+
* These types will be included in addition to the coreTypes used on mainnet.
|
|
22
|
+
*/
|
|
23
|
+
constructor(enums, additionalTypes) {
|
|
24
|
+
const types = Object.assign({}, types_1.coreTypes, additionalTypes);
|
|
25
|
+
super(enums, types);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.XrplDefinitions = XrplDefinitions;
|
|
29
|
+
//# 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,eAAuD;QAEvD,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,iBAAS,EAAE,eAAe,CAAC,CAAA;QAC3D,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;IACrB,CAAC;CACF;AAnBD,0CAmBC"}
|
package/dist/hash-prefixes.d.ts
CHANGED
package/dist/hash-prefixes.js
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.HashPrefix = void 0;
|
|
4
|
+
const utils_1 = require("./utils");
|
|
4
5
|
/**
|
|
5
|
-
* Write a 32 bit integer to a
|
|
6
|
+
* Write a 32 bit integer to a Uint8Array
|
|
6
7
|
*
|
|
7
|
-
* @param uint32 32 bit integer to write to
|
|
8
|
-
* @returns a
|
|
8
|
+
* @param uint32 32 bit integer to write to Uint8Array
|
|
9
|
+
* @returns a Uint8Array with the bytes representation of uint32
|
|
9
10
|
*/
|
|
10
11
|
function bytes(uint32) {
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
const result = new Uint8Array(4);
|
|
13
|
+
(0, utils_1.writeUInt32BE)(result, uint32, 0);
|
|
13
14
|
return result;
|
|
14
15
|
}
|
|
15
16
|
/**
|
|
16
17
|
* Maps HashPrefix names to their byte representation
|
|
17
18
|
*/
|
|
18
|
-
|
|
19
|
+
const HashPrefix = {
|
|
19
20
|
transactionID: bytes(0x54584e00),
|
|
20
21
|
// transaction plus metadata
|
|
21
22
|
transaction: bytes(0x534e4400),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hash-prefixes.js","sourceRoot":"","sources":["../src/hash-prefixes.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,SAAS,KAAK,CAAC,MAAc;IAC3B,
|
|
1
|
+
{"version":3,"file":"hash-prefixes.js","sourceRoot":"","sources":["../src/hash-prefixes.ts"],"names":[],"mappings":";;;AAAA,mCAAuC;AAEvC;;;;;GAKG;AACH,SAAS,KAAK,CAAC,MAAc;IAC3B,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,CAAA;IAChC,IAAA,qBAAa,EAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,CAAA;IAChC,OAAO,MAAM,CAAA;AACf,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,GAA+B;IAC7C,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.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { BytesList } from "./serdes/binary-serializer";
|
|
1
|
+
import { Hash256 } from './types';
|
|
2
|
+
import { BytesList } from './serdes/binary-serializer';
|
|
4
3
|
/**
|
|
5
4
|
* Class for hashing with SHA512
|
|
6
5
|
* @extends BytesList So SerializedTypes can write bytes to a Sha512Half
|
|
@@ -13,20 +12,20 @@ declare class Sha512Half extends BytesList {
|
|
|
13
12
|
* @param bytes bytes to write to this.hash
|
|
14
13
|
* @returns the new Sha512Hash object
|
|
15
14
|
*/
|
|
16
|
-
static put(bytes:
|
|
15
|
+
static put(bytes: Uint8Array): Sha512Half;
|
|
17
16
|
/**
|
|
18
17
|
* Write bytes to an existing Sha512Hash
|
|
19
18
|
*
|
|
20
19
|
* @param bytes bytes to write to object
|
|
21
20
|
* @returns the Sha512 object
|
|
22
21
|
*/
|
|
23
|
-
put(bytes:
|
|
22
|
+
put(bytes: Uint8Array): Sha512Half;
|
|
24
23
|
/**
|
|
25
24
|
* Compute SHA512 hash and slice in half
|
|
26
25
|
*
|
|
27
26
|
* @returns half of a SHA512 hash
|
|
28
27
|
*/
|
|
29
|
-
finish256():
|
|
28
|
+
finish256(): Uint8Array;
|
|
30
29
|
/**
|
|
31
30
|
* Constructs a Hash256 from the Sha512Half object
|
|
32
31
|
*
|
|
@@ -40,12 +39,12 @@ declare class Sha512Half extends BytesList {
|
|
|
40
39
|
* @param args zero or more arguments to hash
|
|
41
40
|
* @returns the sha512half hash of the arguments.
|
|
42
41
|
*/
|
|
43
|
-
declare function sha512Half(...args:
|
|
42
|
+
declare function sha512Half(...args: Uint8Array[]): Uint8Array;
|
|
44
43
|
/**
|
|
45
44
|
* Construct a transactionID from a Serialized Transaction
|
|
46
45
|
*
|
|
47
46
|
* @param serialized bytes to hash
|
|
48
47
|
* @returns a Hash256 object
|
|
49
48
|
*/
|
|
50
|
-
declare function transactionID(serialized:
|
|
49
|
+
declare function transactionID(serialized: Uint8Array): Hash256;
|
|
51
50
|
export { Sha512Half, sha512Half, transactionID };
|
package/dist/hashes.js
CHANGED
|
@@ -1,33 +1,18 @@
|
|
|
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 (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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
3
|
exports.transactionID = exports.sha512Half = exports.Sha512Half = void 0;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
4
|
+
const hash_prefixes_1 = require("./hash-prefixes");
|
|
5
|
+
const types_1 = require("./types");
|
|
6
|
+
const binary_serializer_1 = require("./serdes/binary-serializer");
|
|
7
|
+
const sha512_1 = require("@xrplf/isomorphic/sha512");
|
|
21
8
|
/**
|
|
22
9
|
* Class for hashing with SHA512
|
|
23
10
|
* @extends BytesList So SerializedTypes can write bytes to a Sha512Half
|
|
24
11
|
*/
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
_this.hash = createHash("sha512");
|
|
30
|
-
return _this;
|
|
12
|
+
class Sha512Half extends binary_serializer_1.BytesList {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
this.hash = sha512_1.sha512.create();
|
|
31
16
|
}
|
|
32
17
|
/**
|
|
33
18
|
* Construct a new Sha512Hash and write bytes this.hash
|
|
@@ -35,38 +20,36 @@ var Sha512Half = /** @class */ (function (_super) {
|
|
|
35
20
|
* @param bytes bytes to write to this.hash
|
|
36
21
|
* @returns the new Sha512Hash object
|
|
37
22
|
*/
|
|
38
|
-
|
|
23
|
+
static put(bytes) {
|
|
39
24
|
return new Sha512Half().put(bytes);
|
|
40
|
-
}
|
|
25
|
+
}
|
|
41
26
|
/**
|
|
42
27
|
* Write bytes to an existing Sha512Hash
|
|
43
28
|
*
|
|
44
29
|
* @param bytes bytes to write to object
|
|
45
30
|
* @returns the Sha512 object
|
|
46
31
|
*/
|
|
47
|
-
|
|
32
|
+
put(bytes) {
|
|
48
33
|
this.hash.update(bytes);
|
|
49
34
|
return this;
|
|
50
|
-
}
|
|
35
|
+
}
|
|
51
36
|
/**
|
|
52
37
|
* Compute SHA512 hash and slice in half
|
|
53
38
|
*
|
|
54
39
|
* @returns half of a SHA512 hash
|
|
55
40
|
*/
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
};
|
|
41
|
+
finish256() {
|
|
42
|
+
return Uint8Array.from(this.hash.digest().slice(0, 32));
|
|
43
|
+
}
|
|
60
44
|
/**
|
|
61
45
|
* Constructs a Hash256 from the Sha512Half object
|
|
62
46
|
*
|
|
63
47
|
* @returns a Hash256 object
|
|
64
48
|
*/
|
|
65
|
-
|
|
66
|
-
return new
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
}(binary_serializer_1.BytesList));
|
|
49
|
+
finish() {
|
|
50
|
+
return new types_1.Hash256(this.finish256());
|
|
51
|
+
}
|
|
52
|
+
}
|
|
70
53
|
exports.Sha512Half = Sha512Half;
|
|
71
54
|
/**
|
|
72
55
|
* compute SHA512 hash of a list of bytes
|
|
@@ -74,13 +57,9 @@ exports.Sha512Half = Sha512Half;
|
|
|
74
57
|
* @param args zero or more arguments to hash
|
|
75
58
|
* @returns the sha512half hash of the arguments.
|
|
76
59
|
*/
|
|
77
|
-
function sha512Half() {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
args[_i] = arguments[_i];
|
|
81
|
-
}
|
|
82
|
-
var hash = new Sha512Half();
|
|
83
|
-
args.forEach(function (a) { return hash.put(a); });
|
|
60
|
+
function sha512Half(...args) {
|
|
61
|
+
const hash = new Sha512Half();
|
|
62
|
+
args.forEach((a) => hash.put(a));
|
|
84
63
|
return hash.finish256();
|
|
85
64
|
}
|
|
86
65
|
exports.sha512Half = sha512Half;
|
|
@@ -91,7 +70,7 @@ exports.sha512Half = sha512Half;
|
|
|
91
70
|
* @returns a Hash256 object
|
|
92
71
|
*/
|
|
93
72
|
function transactionID(serialized) {
|
|
94
|
-
return new
|
|
73
|
+
return new types_1.Hash256(sha512Half(hash_prefixes_1.HashPrefix.transactionID, serialized));
|
|
95
74
|
}
|
|
96
75
|
exports.transactionID = transactionID;
|
|
97
76
|
//# sourceMappingURL=hashes.js.map
|
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,mCAAiC;AACjC,kEAAsD;AACtD,qDAAiD;AAEjD;;;GAGG;AACH,MAAM,UAAW,SAAQ,6BAAS;IAAlC;;QACU,SAAI,GAAG,eAAM,CAAC,MAAM,EAAE,CAAA;IAwChC,CAAC;IAtCC;;;;;OAKG;IACH,MAAM,CAAC,GAAG,CAAC,KAAiB;QAC1B,OAAO,IAAI,UAAU,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;IACpC,CAAC;IAED;;;;;OAKG;IACH,GAAG,CAAC,KAAiB;QACnB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QACvB,OAAO,IAAI,CAAA;IACb,CAAC;IAED;;;;OAIG;IACH,SAAS;QACP,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;IACzD,CAAC;IAED;;;;OAIG;IACH,MAAM;QACJ,OAAO,IAAI,eAAO,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAA;IACtC,CAAC;CACF;AAwBQ,gCAAU;AAtBnB;;;;;GAKG;AACH,SAAS,UAAU,CAAC,GAAG,IAAkB;IACvC,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,UAAsB;IAC3C,OAAO,IAAI,eAAO,CAAC,UAAU,CAAC,0BAAU,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC,CAAA;AACtE,CAAC;AAEgC,sCAAa"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,32 +1,40 @@
|
|
|
1
|
-
import { decodeLedgerData } from
|
|
2
|
-
import { JsonObject } from
|
|
1
|
+
import { decodeLedgerData } from './ledger-hashes';
|
|
2
|
+
import { JsonObject } from './types/serialized-type';
|
|
3
|
+
import { XrplDefinitionsBase, TRANSACTION_TYPES, DEFAULT_DEFINITIONS } from './enums';
|
|
4
|
+
import { XrplDefinitions } from './enums/xrpl-definitions';
|
|
5
|
+
import { coreTypes } from './types';
|
|
3
6
|
/**
|
|
4
7
|
* Decode a transaction
|
|
5
8
|
*
|
|
6
9
|
* @param binary hex-string of the encoded transaction
|
|
10
|
+
* @param definitions Custom rippled types to use instead of the default. Used for sidechains and amendments.
|
|
7
11
|
* @returns the JSON representation of the transaction
|
|
8
12
|
*/
|
|
9
|
-
declare function decode(binary: string): JsonObject;
|
|
13
|
+
declare function decode(binary: string, definitions?: XrplDefinitionsBase): JsonObject;
|
|
10
14
|
/**
|
|
11
15
|
* Encode a transaction
|
|
12
16
|
*
|
|
13
17
|
* @param json The JSON representation of a transaction
|
|
18
|
+
* @param definitions Custom rippled types to use instead of the default. Used for sidechains and amendments.
|
|
19
|
+
*
|
|
14
20
|
* @returns A hex-string of the encoded transaction
|
|
15
21
|
*/
|
|
16
|
-
declare function encode(json: object): string;
|
|
22
|
+
declare function encode(json: object, definitions?: XrplDefinitionsBase): string;
|
|
17
23
|
/**
|
|
18
24
|
* Encode a transaction and prepare for signing
|
|
19
25
|
*
|
|
20
26
|
* @param json JSON object representing the transaction
|
|
21
27
|
* @param signer string representing the account to sign the transaction with
|
|
28
|
+
* @param definitions Custom rippled types to use instead of the default. Used for sidechains and amendments.
|
|
22
29
|
* @returns a hex string of the encoded transaction
|
|
23
30
|
*/
|
|
24
|
-
declare function encodeForSigning(json: object): string;
|
|
31
|
+
declare function encodeForSigning(json: object, definitions?: XrplDefinitionsBase): string;
|
|
25
32
|
/**
|
|
26
33
|
* Encode a transaction and prepare for signing with a claim
|
|
27
34
|
*
|
|
28
35
|
* @param json JSON object representing the transaction
|
|
29
36
|
* @param signer string representing the account to sign the transaction with
|
|
37
|
+
* @param definitions Custom rippled types to use instead of the default. Used for sidechains and amendments.
|
|
30
38
|
* @returns a hex string of the encoded transaction
|
|
31
39
|
*/
|
|
32
40
|
declare function encodeForSigningClaim(json: object): string;
|
|
@@ -35,9 +43,10 @@ declare function encodeForSigningClaim(json: object): string;
|
|
|
35
43
|
*
|
|
36
44
|
* @param json JSON object representing the transaction
|
|
37
45
|
* @param signer string representing the account to sign the transaction with
|
|
46
|
+
* @param definitions Custom rippled types to use instead of the default. Used for sidechains and amendments.
|
|
38
47
|
* @returns a hex string of the encoded transaction
|
|
39
48
|
*/
|
|
40
|
-
declare function encodeForMultisigning(json: object, signer: string): string;
|
|
49
|
+
declare function encodeForMultisigning(json: object, signer: string, definitions?: XrplDefinitionsBase): string;
|
|
41
50
|
/**
|
|
42
51
|
* Encode a quality value
|
|
43
52
|
*
|
|
@@ -52,14 +61,4 @@ declare function encodeQuality(value: string): string;
|
|
|
52
61
|
* @returns a string representing the quality
|
|
53
62
|
*/
|
|
54
63
|
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
|
-
};
|
|
65
|
-
export = _default;
|
|
64
|
+
export { decode, encode, encodeForSigning, encodeForSigningClaim, encodeForMultisigning, encodeQuality, decodeQuality, decodeLedgerData, TRANSACTION_TYPES, XrplDefinitions, XrplDefinitionsBase, DEFAULT_DEFINITIONS, coreTypes, };
|