ripple-binary-codec 1.5.0-beta.3 → 1.5.0-beta.4
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.d.ts +21 -6
- package/dist/binary.js +28 -9
- package/dist/binary.js.map +1 -1
- package/dist/coretypes.d.ts +2 -2
- package/dist/coretypes.js +2 -1
- package/dist/coretypes.js.map +1 -1
- package/dist/enums/bytes.d.ts +1 -1
- package/dist/enums/bytes.js +24 -28
- package/dist/enums/bytes.js.map +1 -1
- package/dist/enums/definitions.json +78 -37
- package/dist/enums/field.d.ts +0 -1
- package/dist/enums/field.js +16 -22
- package/dist/enums/field.js.map +1 -1
- package/dist/enums/index.d.ts +12 -48
- package/dist/enums/index.js +18 -109
- package/dist/enums/index.js.map +1 -1
- package/dist/enums/src/enums/definitions.json +78 -37
- 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 +7 -30
- package/dist/enums/xrpl-definitions.js +12 -52
- package/dist/enums/xrpl-definitions.js.map +1 -1
- package/dist/index.d.ts +14 -6
- package/dist/index.js +24 -9
- package/dist/index.js.map +1 -1
- package/dist/ledger-hashes.d.ts +4 -1
- package/dist/ledger-hashes.js +4 -2
- package/dist/ledger-hashes.js.map +1 -1
- package/dist/serdes/binary-parser.d.ts +6 -3
- package/dist/serdes/binary-parser.js +5 -2
- package/dist/serdes/binary-parser.js.map +1 -1
- package/dist/serdes/binary-serializer.d.ts +1 -1
- package/dist/shamap.js +3 -1
- package/dist/shamap.js.map +1 -1
- package/dist/types/index.d.ts +3 -22
- package/dist/types/index.js +21 -8
- package/dist/types/index.js.map +1 -1
- package/dist/types/st-object.d.ts +6 -3
- package/dist/types/st-object.js +7 -5
- package/dist/types/st-object.js.map +1 -1
- package/package.json +6 -5
- package/test/definitions.test.js +100 -0
- package/test/fixtures/codec-fixtures.json +78 -78
- package/test/signing-data-encoding.test.js +103 -1
- package/dist/serdes/bytes-list.d.ts +0 -29
- package/dist/serdes/bytes-list.js +0 -48
- package/dist/serdes/bytes-list.js.map +0 -1
- package/dist/types/issued-currency.d.ts +0 -46
- package/dist/types/issued-currency.js +0 -108
- package/dist/types/issued-currency.js.map +0 -1
- package/dist/types/xchain-attestation-batch.d.ts +0 -44
- package/dist/types/xchain-attestation-batch.js +0 -90
- package/dist/types/xchain-attestation-batch.js.map +0 -1
package/dist/binary.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { BinaryParser } from './serdes/binary-parser';
|
|
|
2
2
|
import { AccountID } from './types/account-id';
|
|
3
3
|
import { BinarySerializer, BytesList } from './serdes/binary-serializer';
|
|
4
4
|
import { sha512Half, transactionID } from './hashes';
|
|
5
|
+
import { type XrplDefinitionsBase } from './enums';
|
|
5
6
|
import { JsonObject } from './types/serialized-type';
|
|
6
7
|
import { Buffer } from 'buffer/';
|
|
7
8
|
import { AmountObject } from './types/amount';
|
|
@@ -9,23 +10,29 @@ import { AmountObject } from './types/amount';
|
|
|
9
10
|
* Construct a BinaryParser
|
|
10
11
|
*
|
|
11
12
|
* @param bytes hex-string to construct BinaryParser from
|
|
13
|
+
* @param definitions rippled definitions used to parse the values of transaction types and such.
|
|
14
|
+
* Can be customized for sidechains and amendments.
|
|
12
15
|
* @returns A BinaryParser
|
|
13
16
|
*/
|
|
14
|
-
declare const makeParser: (bytes: string) => BinaryParser;
|
|
17
|
+
declare const makeParser: (bytes: string, definitions?: XrplDefinitionsBase) => BinaryParser;
|
|
15
18
|
/**
|
|
16
19
|
* Parse BinaryParser into JSON
|
|
17
20
|
*
|
|
18
21
|
* @param parser BinaryParser object
|
|
22
|
+
* @param definitions rippled definitions used to parse the values of transaction types and such.
|
|
23
|
+
* Can be customized for sidechains and amendments.
|
|
19
24
|
* @returns JSON for the bytes in the BinaryParser
|
|
20
25
|
*/
|
|
21
|
-
declare const readJSON: (parser: BinaryParser) => JsonObject;
|
|
26
|
+
declare const readJSON: (parser: BinaryParser, definitions?: XrplDefinitionsBase) => JsonObject;
|
|
22
27
|
/**
|
|
23
28
|
* Parse a hex-string into its JSON interpretation
|
|
24
29
|
*
|
|
25
30
|
* @param bytes hex-string to parse into JSON
|
|
31
|
+
* @param definitions rippled definitions used to parse the values of transaction types and such.
|
|
32
|
+
* Can be customized for sidechains and amendments.
|
|
26
33
|
* @returns JSON
|
|
27
34
|
*/
|
|
28
|
-
declare const binaryToJSON: (bytes: string) => JsonObject;
|
|
35
|
+
declare const binaryToJSON: (bytes: string, definitions?: XrplDefinitionsBase) => JsonObject;
|
|
29
36
|
/**
|
|
30
37
|
* Interface for passing parameters to SerializeObject
|
|
31
38
|
*
|
|
@@ -35,12 +42,13 @@ interface OptionObject {
|
|
|
35
42
|
prefix?: Buffer;
|
|
36
43
|
suffix?: Buffer;
|
|
37
44
|
signingFieldsOnly?: boolean;
|
|
45
|
+
definitions?: XrplDefinitionsBase;
|
|
38
46
|
}
|
|
39
47
|
/**
|
|
40
48
|
* Function to serialize JSON object representing a transaction
|
|
41
49
|
*
|
|
42
50
|
* @param object JSON object to serialize
|
|
43
|
-
* @param opts options for serializing, including optional prefix, suffix, and
|
|
51
|
+
* @param opts options for serializing, including optional prefix, suffix, signingFieldOnly, and definitions
|
|
44
52
|
* @returns A Buffer containing the serialized object
|
|
45
53
|
*/
|
|
46
54
|
declare function serializeObject(object: JsonObject, opts?: OptionObject): Buffer;
|
|
@@ -49,9 +57,12 @@ declare function serializeObject(object: JsonObject, opts?: OptionObject): Buffe
|
|
|
49
57
|
*
|
|
50
58
|
* @param transaction Transaction to serialize
|
|
51
59
|
* @param prefix Prefix bytes to put before the serialized object
|
|
60
|
+
* @param opts.definitions Custom rippled types to use instead of the default. Used for sidechains and amendments.
|
|
52
61
|
* @returns A Buffer with the serialized object
|
|
53
62
|
*/
|
|
54
|
-
declare function signingData(transaction: JsonObject, prefix?: Buffer
|
|
63
|
+
declare function signingData(transaction: JsonObject, prefix?: Buffer, opts?: {
|
|
64
|
+
definitions?: XrplDefinitionsBase;
|
|
65
|
+
}): Buffer;
|
|
55
66
|
/**
|
|
56
67
|
* Interface describing fields required for a Claim
|
|
57
68
|
*/
|
|
@@ -63,6 +74,7 @@ interface ClaimObject extends JsonObject {
|
|
|
63
74
|
* Serialize a signingClaim
|
|
64
75
|
*
|
|
65
76
|
* @param claim A claim object to serialize
|
|
77
|
+
* @param opts.definitions Custom rippled types to use instead of the default. Used for sidechains and amendments.
|
|
66
78
|
* @returns the serialized object with appropriate prefix
|
|
67
79
|
*/
|
|
68
80
|
declare function signingClaimData(claim: ClaimObject): Buffer;
|
|
@@ -71,7 +83,10 @@ declare function signingClaimData(claim: ClaimObject): Buffer;
|
|
|
71
83
|
*
|
|
72
84
|
* @param transaction transaction to serialize
|
|
73
85
|
* @param signingAccount Account to sign the transaction with
|
|
86
|
+
* @param opts.definitions Custom rippled types to use instead of the default. Used for sidechains and amendments.
|
|
74
87
|
* @returns serialized transaction with appropriate prefix and suffix
|
|
75
88
|
*/
|
|
76
|
-
declare function multiSigningData(transaction: JsonObject, signingAccount: string | AccountID
|
|
89
|
+
declare function multiSigningData(transaction: JsonObject, signingAccount: string | AccountID, opts?: {
|
|
90
|
+
definitions: XrplDefinitionsBase;
|
|
91
|
+
}): Buffer;
|
|
77
92
|
export { BinaryParser, BinarySerializer, BytesList, ClaimObject, makeParser, serializeObject, readJSON, multiSigningData, signingData, signingClaimData, binaryToJSON, sha512Half, transactionID, };
|
package/dist/binary.js
CHANGED
|
@@ -12,40 +12,47 @@ Object.defineProperty(exports, "BytesList", { enumerable: true, get: function ()
|
|
|
12
12
|
const hashes_1 = require("./hashes");
|
|
13
13
|
Object.defineProperty(exports, "sha512Half", { enumerable: true, get: function () { return hashes_1.sha512Half; } });
|
|
14
14
|
Object.defineProperty(exports, "transactionID", { enumerable: true, get: function () { return hashes_1.transactionID; } });
|
|
15
|
+
const enums_1 = require("./enums");
|
|
15
16
|
const bigInt = require("big-integer");
|
|
16
17
|
/**
|
|
17
18
|
* Construct a BinaryParser
|
|
18
19
|
*
|
|
19
20
|
* @param bytes hex-string to construct BinaryParser from
|
|
21
|
+
* @param definitions rippled definitions used to parse the values of transaction types and such.
|
|
22
|
+
* Can be customized for sidechains and amendments.
|
|
20
23
|
* @returns A BinaryParser
|
|
21
24
|
*/
|
|
22
|
-
const makeParser = (bytes) => new binary_parser_1.BinaryParser(bytes);
|
|
25
|
+
const makeParser = (bytes, definitions) => new binary_parser_1.BinaryParser(bytes, definitions);
|
|
23
26
|
exports.makeParser = makeParser;
|
|
24
27
|
/**
|
|
25
28
|
* Parse BinaryParser into JSON
|
|
26
29
|
*
|
|
27
30
|
* @param parser BinaryParser object
|
|
31
|
+
* @param definitions rippled definitions used to parse the values of transaction types and such.
|
|
32
|
+
* Can be customized for sidechains and amendments.
|
|
28
33
|
* @returns JSON for the bytes in the BinaryParser
|
|
29
34
|
*/
|
|
30
|
-
const readJSON = (parser) => parser.readType(types_1.coreTypes.STObject).toJSON();
|
|
35
|
+
const readJSON = (parser, definitions = enums_1.DEFAULT_DEFINITIONS) => parser.readType(types_1.coreTypes.STObject).toJSON(definitions);
|
|
31
36
|
exports.readJSON = readJSON;
|
|
32
37
|
/**
|
|
33
38
|
* Parse a hex-string into its JSON interpretation
|
|
34
39
|
*
|
|
35
40
|
* @param bytes hex-string to parse into JSON
|
|
41
|
+
* @param definitions rippled definitions used to parse the values of transaction types and such.
|
|
42
|
+
* Can be customized for sidechains and amendments.
|
|
36
43
|
* @returns JSON
|
|
37
44
|
*/
|
|
38
|
-
const binaryToJSON = (bytes) => readJSON(makeParser(bytes));
|
|
45
|
+
const binaryToJSON = (bytes, definitions) => readJSON(makeParser(bytes, definitions), definitions);
|
|
39
46
|
exports.binaryToJSON = binaryToJSON;
|
|
40
47
|
/**
|
|
41
48
|
* Function to serialize JSON object representing a transaction
|
|
42
49
|
*
|
|
43
50
|
* @param object JSON object to serialize
|
|
44
|
-
* @param opts options for serializing, including optional prefix, suffix, and
|
|
51
|
+
* @param opts options for serializing, including optional prefix, suffix, signingFieldOnly, and definitions
|
|
45
52
|
* @returns A Buffer containing the serialized object
|
|
46
53
|
*/
|
|
47
54
|
function serializeObject(object, opts = {}) {
|
|
48
|
-
const { prefix, suffix, signingFieldsOnly = false } = opts;
|
|
55
|
+
const { prefix, suffix, signingFieldsOnly = false, definitions } = opts;
|
|
49
56
|
const bytesList = new binary_serializer_1.BytesList();
|
|
50
57
|
if (prefix) {
|
|
51
58
|
bytesList.put(prefix);
|
|
@@ -53,7 +60,9 @@ function serializeObject(object, opts = {}) {
|
|
|
53
60
|
const filter = signingFieldsOnly
|
|
54
61
|
? (f) => f.isSigningField
|
|
55
62
|
: undefined;
|
|
56
|
-
types_1.coreTypes.STObject
|
|
63
|
+
types_1.coreTypes.STObject
|
|
64
|
+
.from(object, filter, definitions)
|
|
65
|
+
.toBytesSink(bytesList);
|
|
57
66
|
if (suffix) {
|
|
58
67
|
bytesList.put(suffix);
|
|
59
68
|
}
|
|
@@ -65,16 +74,22 @@ exports.serializeObject = serializeObject;
|
|
|
65
74
|
*
|
|
66
75
|
* @param transaction Transaction to serialize
|
|
67
76
|
* @param prefix Prefix bytes to put before the serialized object
|
|
77
|
+
* @param opts.definitions Custom rippled types to use instead of the default. Used for sidechains and amendments.
|
|
68
78
|
* @returns A Buffer with the serialized object
|
|
69
79
|
*/
|
|
70
|
-
function signingData(transaction, prefix = hash_prefixes_1.HashPrefix.transactionSig) {
|
|
71
|
-
return serializeObject(transaction, {
|
|
80
|
+
function signingData(transaction, prefix = hash_prefixes_1.HashPrefix.transactionSig, opts = {}) {
|
|
81
|
+
return serializeObject(transaction, {
|
|
82
|
+
prefix,
|
|
83
|
+
signingFieldsOnly: true,
|
|
84
|
+
definitions: opts.definitions,
|
|
85
|
+
});
|
|
72
86
|
}
|
|
73
87
|
exports.signingData = signingData;
|
|
74
88
|
/**
|
|
75
89
|
* Serialize a signingClaim
|
|
76
90
|
*
|
|
77
91
|
* @param claim A claim object to serialize
|
|
92
|
+
* @param opts.definitions Custom rippled types to use instead of the default. Used for sidechains and amendments.
|
|
78
93
|
* @returns the serialized object with appropriate prefix
|
|
79
94
|
*/
|
|
80
95
|
function signingClaimData(claim) {
|
|
@@ -100,15 +115,19 @@ exports.signingClaimData = signingClaimData;
|
|
|
100
115
|
*
|
|
101
116
|
* @param transaction transaction to serialize
|
|
102
117
|
* @param signingAccount Account to sign the transaction with
|
|
118
|
+
* @param opts.definitions Custom rippled types to use instead of the default. Used for sidechains and amendments.
|
|
103
119
|
* @returns serialized transaction with appropriate prefix and suffix
|
|
104
120
|
*/
|
|
105
|
-
function multiSigningData(transaction, signingAccount
|
|
121
|
+
function multiSigningData(transaction, signingAccount, opts = {
|
|
122
|
+
definitions: enums_1.DEFAULT_DEFINITIONS,
|
|
123
|
+
}) {
|
|
106
124
|
const prefix = hash_prefixes_1.HashPrefix.transactionMultiSig;
|
|
107
125
|
const suffix = types_1.coreTypes.AccountID.from(signingAccount).toBytes();
|
|
108
126
|
return serializeObject(transaction, {
|
|
109
127
|
prefix,
|
|
110
128
|
suffix,
|
|
111
129
|
signingFieldsOnly: true,
|
|
130
|
+
definitions: opts.definitions,
|
|
112
131
|
});
|
|
113
132
|
}
|
|
114
133
|
exports.multiSigningData = multiSigningData;
|
package/dist/binary.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"binary.js","sourceRoot":"","sources":["../src/binary.ts"],"names":[],"mappings":";AAAA,+BAA+B;;;AAE/B,mCAAmC;AACnC,0DAAqD;
|
|
1
|
+
{"version":3,"file":"binary.js","sourceRoot":"","sources":["../src/binary.ts"],"names":[],"mappings":";AAAA,+BAA+B;;;AAE/B,mCAAmC;AACnC,0DAAqD;AA+KnD,6FA/KO,4BAAY,OA+KP;AA7Kd,mDAA4C;AAC5C,kEAAwE;AA6KtE,iGA7KO,oCAAgB,OA6KP;AAChB,0FA9KyB,6BAAS,OA8KzB;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CC,4CAAgB;AAnClB;;;;;;;GAOG;AACH,SAAS,gBAAgB,CACvB,WAAuB,EACvB,cAAkC,EAClC,OAA6C;IAC3C,WAAW,EAAE,2BAAmB;CACjC;IAED,MAAM,MAAM,GAAG,0BAAU,CAAC,mBAAmB,CAAA;IAC7C,MAAM,MAAM,GAAG,iBAAS,CAAC,SAAS,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,OAAO,EAAE,CAAA;IACjE,OAAO,eAAe,CAAC,WAAW,EAAE;QAClC,MAAM;QACN,MAAM;QACN,iBAAiB,EAAE,IAAI;QACvB,WAAW,EAAE,IAAI,CAAC,WAAW;KAC9B,CAAC,CAAA;AACJ,CAAC;AAUC,4CAAgB"}
|
package/dist/coretypes.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Field, TransactionType, LedgerEntryType, Type, TransactionResult } from './enums';
|
|
1
|
+
import { DEFAULT_DEFINITIONS, Field, TransactionType, LedgerEntryType, Type, TransactionResult } from './enums';
|
|
2
2
|
import * as types from './types';
|
|
3
3
|
import * as binary from './binary';
|
|
4
4
|
import { ShaMap } from './shamap';
|
|
@@ -6,4 +6,4 @@ import * as ledgerHashes from './ledger-hashes';
|
|
|
6
6
|
import * as hashes from './hashes';
|
|
7
7
|
import { quality } from './quality';
|
|
8
8
|
import { HashPrefix } from './hash-prefixes';
|
|
9
|
-
export { hashes, binary, ledgerHashes, Field, TransactionType, LedgerEntryType, Type, TransactionResult, quality, HashPrefix, ShaMap, types, };
|
|
9
|
+
export { hashes, binary, ledgerHashes, DEFAULT_DEFINITIONS, Field, TransactionType, LedgerEntryType, Type, TransactionResult, quality, HashPrefix, ShaMap, types, };
|
package/dist/coretypes.js
CHANGED
|
@@ -23,8 +23,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.types = exports.ShaMap = exports.HashPrefix = exports.quality = exports.TransactionResult = exports.Type = exports.LedgerEntryType = exports.TransactionType = exports.Field = exports.ledgerHashes = exports.binary = exports.hashes = void 0;
|
|
26
|
+
exports.types = exports.ShaMap = exports.HashPrefix = exports.quality = exports.TransactionResult = exports.Type = exports.LedgerEntryType = exports.TransactionType = exports.Field = exports.DEFAULT_DEFINITIONS = exports.ledgerHashes = exports.binary = exports.hashes = void 0;
|
|
27
27
|
const enums_1 = require("./enums");
|
|
28
|
+
Object.defineProperty(exports, "DEFAULT_DEFINITIONS", { enumerable: true, get: function () { return enums_1.DEFAULT_DEFINITIONS; } });
|
|
28
29
|
Object.defineProperty(exports, "Field", { enumerable: true, get: function () { return enums_1.Field; } });
|
|
29
30
|
Object.defineProperty(exports, "TransactionType", { enumerable: true, get: function () { return enums_1.TransactionType; } });
|
|
30
31
|
Object.defineProperty(exports, "LedgerEntryType", { enumerable: true, get: function () { return enums_1.LedgerEntryType; } });
|
package/dist/coretypes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coretypes.js","sourceRoot":"","sources":["../src/coretypes.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"coretypes.js","sourceRoot":"","sources":["../src/coretypes.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAOgB;AAad,oGAnBA,2BAAmB,OAmBA;AACnB,sFAnBA,aAAK,OAmBA;AACL,gGAnBA,uBAAe,OAmBA;AACf,gGAnBA,uBAAe,OAmBA;AACf,qFAnBA,YAAI,OAmBA;AACJ,kGAnBA,yBAAiB,OAmBA;AAjBnB,+CAAgC;AAqB9B,sBAAK;AApBP,iDAAkC;AAShC,wBAAM;AARR,qCAAiC;AAkB/B,uFAlBO,eAAM,OAkBP;AAjBR,8DAA+C;AAQ7C,oCAAY;AAPd,iDAAkC;AAKhC,wBAAM;AAJR,uCAAmC;AAajC,wFAbO,iBAAO,OAaP;AAZT,mDAA4C;AAa1C,2FAbO,0BAAU,OAaP"}
|
package/dist/enums/bytes.d.ts
CHANGED
package/dist/enums/bytes.js
CHANGED
|
@@ -1,42 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BytesLookup = exports.Bytes = void 0;
|
|
4
|
-
|
|
4
|
+
const buffer_1 = require("buffer/");
|
|
5
5
|
/*
|
|
6
6
|
* @brief: Bytes, name, and ordinal representing one type, ledger_type, transaction type, or result
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
class Bytes {
|
|
9
|
+
constructor(name, ordinal, ordinalWidth) {
|
|
10
10
|
this.name = name;
|
|
11
11
|
this.ordinal = ordinal;
|
|
12
12
|
this.ordinalWidth = ordinalWidth;
|
|
13
13
|
this.bytes = buffer_1.Buffer.alloc(ordinalWidth);
|
|
14
|
-
for (
|
|
14
|
+
for (let i = 0; i < ordinalWidth; i++) {
|
|
15
15
|
this.bytes[ordinalWidth - i - 1] = (ordinal >>> (i * 8)) & 0xff;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
toJSON() {
|
|
19
19
|
return this.name;
|
|
20
|
-
}
|
|
21
|
-
|
|
20
|
+
}
|
|
21
|
+
toBytesSink(sink) {
|
|
22
22
|
sink.put(this.bytes);
|
|
23
|
-
}
|
|
24
|
-
|
|
23
|
+
}
|
|
24
|
+
toBytes() {
|
|
25
25
|
return this.bytes;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
}());
|
|
26
|
+
}
|
|
27
|
+
}
|
|
29
28
|
exports.Bytes = Bytes;
|
|
30
29
|
/*
|
|
31
30
|
* @brief: Collection of Bytes objects, mapping bidirectionally
|
|
32
31
|
*/
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
var _this = this;
|
|
32
|
+
class BytesLookup {
|
|
33
|
+
constructor(types, ordinalWidth) {
|
|
36
34
|
this.ordinalWidth = ordinalWidth;
|
|
37
|
-
Object.entries(types).forEach(
|
|
38
|
-
|
|
39
|
-
_this.add(k, v);
|
|
35
|
+
Object.entries(types).forEach(([k, v]) => {
|
|
36
|
+
this.add(k, v);
|
|
40
37
|
});
|
|
41
38
|
}
|
|
42
39
|
/**
|
|
@@ -46,23 +43,22 @@ var BytesLookup = /** @class */ (function () {
|
|
|
46
43
|
* @param value - The numeric value for the field.
|
|
47
44
|
* @throws if the name or value already exist in the lookup because it's unclear how to decode.
|
|
48
45
|
*/
|
|
49
|
-
|
|
46
|
+
add(name, value) {
|
|
50
47
|
if (this[name]) {
|
|
51
|
-
throw new SyntaxError(
|
|
48
|
+
throw new SyntaxError(`Attempted to add a value with a duplicate name "${name}". This is not allowed because it is unclear how to decode.`);
|
|
52
49
|
}
|
|
53
50
|
if (this[value.toString()]) {
|
|
54
|
-
throw new SyntaxError(
|
|
51
|
+
throw new SyntaxError(`Attempted to add a duplicate value under a different name (Given name: "${name}" and previous name: "${this[value.toString()]}. This is not allowed because it is unclear how to decode.\nGiven value: ${value.toString()}`);
|
|
55
52
|
}
|
|
56
53
|
this[name] = new Bytes(name, value, this.ordinalWidth);
|
|
57
54
|
this[value.toString()] = this[name];
|
|
58
|
-
}
|
|
59
|
-
|
|
55
|
+
}
|
|
56
|
+
from(value) {
|
|
60
57
|
return value instanceof Bytes ? value : this[value];
|
|
61
|
-
}
|
|
62
|
-
|
|
58
|
+
}
|
|
59
|
+
fromParser(parser) {
|
|
63
60
|
return this.from(parser.readUIntN(this.ordinalWidth).toString());
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
}());
|
|
61
|
+
}
|
|
62
|
+
}
|
|
67
63
|
exports.BytesLookup = BytesLookup;
|
|
68
64
|
//# sourceMappingURL=bytes.js.map
|
package/dist/enums/bytes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bytes.js","sourceRoot":"","sources":["../../src/enums/bytes.ts"],"names":[],"mappings":";;;AAC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AAW,CACnB,mDAAmD,IAAI,6DAA6D,CACrH,CAAA;SACF;QACD,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,EAAE;YAC1B,MAAM,IAAI,WAAW,CACnB,2EAA2E,IAAI,yBAC7E,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CACvB,4EAA4E,KAAK,CAAC,QAAQ,EAAE,EAAE,CAC/F,CAAA;SACF;QACD,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,YAAY,CAAC,CAAA;QACtD,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAA;IACrC,CAAC;IAED,IAAI,CAAC,KAAqB;QACxB,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAE,IAAI,CAAC,KAAK,CAAW,CAAA;IAChE,CAAC;IAED,UAAU,CAAC,MAAoB;QAC7B,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAA;IAClE,CAAC;CACF;AAtCD,kCAsCC"}
|
|
@@ -297,6 +297,16 @@
|
|
|
297
297
|
"type": "UInt16"
|
|
298
298
|
}
|
|
299
299
|
],
|
|
300
|
+
[
|
|
301
|
+
"DiscountedFee",
|
|
302
|
+
{
|
|
303
|
+
"nth": 6,
|
|
304
|
+
"isVLEncoded": false,
|
|
305
|
+
"isSerialized": true,
|
|
306
|
+
"isSigningField": true,
|
|
307
|
+
"type": "UInt16"
|
|
308
|
+
}
|
|
309
|
+
],
|
|
300
310
|
[
|
|
301
311
|
"Version",
|
|
302
312
|
{
|
|
@@ -347,6 +357,16 @@
|
|
|
347
357
|
"type": "UInt16"
|
|
348
358
|
}
|
|
349
359
|
],
|
|
360
|
+
[
|
|
361
|
+
"NetworkID",
|
|
362
|
+
{
|
|
363
|
+
"nth": 1,
|
|
364
|
+
"isVLEncoded": false,
|
|
365
|
+
"isSerialized": true,
|
|
366
|
+
"isSigningField": true,
|
|
367
|
+
"type": "UInt32"
|
|
368
|
+
}
|
|
369
|
+
],
|
|
350
370
|
[
|
|
351
371
|
"Flags",
|
|
352
372
|
{
|
|
@@ -788,7 +808,7 @@
|
|
|
788
808
|
}
|
|
789
809
|
],
|
|
790
810
|
[
|
|
791
|
-
"
|
|
811
|
+
"LockCount",
|
|
792
812
|
{
|
|
793
813
|
"nth": 47,
|
|
794
814
|
"isVLEncoded": false,
|
|
@@ -798,7 +818,7 @@
|
|
|
798
818
|
}
|
|
799
819
|
],
|
|
800
820
|
[
|
|
801
|
-
"
|
|
821
|
+
"VoteWeight",
|
|
802
822
|
{
|
|
803
823
|
"nth": 48,
|
|
804
824
|
"isVLEncoded": false,
|
|
@@ -808,9 +828,9 @@
|
|
|
808
828
|
}
|
|
809
829
|
],
|
|
810
830
|
[
|
|
811
|
-
"
|
|
831
|
+
"FirstNFTokenSequence",
|
|
812
832
|
{
|
|
813
|
-
"nth":
|
|
833
|
+
"nth": 50,
|
|
814
834
|
"isVLEncoded": false,
|
|
815
835
|
"isSerialized": true,
|
|
816
836
|
"isSigningField": true,
|
|
@@ -1548,9 +1568,9 @@
|
|
|
1548
1568
|
}
|
|
1549
1569
|
],
|
|
1550
1570
|
[
|
|
1551
|
-
"
|
|
1571
|
+
"LockedBalance",
|
|
1552
1572
|
{
|
|
1553
|
-
"nth":
|
|
1573
|
+
"nth": 21,
|
|
1554
1574
|
"isVLEncoded": false,
|
|
1555
1575
|
"isSerialized": true,
|
|
1556
1576
|
"isSigningField": true,
|
|
@@ -1558,9 +1578,9 @@
|
|
|
1558
1578
|
}
|
|
1559
1579
|
],
|
|
1560
1580
|
[
|
|
1561
|
-
"
|
|
1581
|
+
"BaseFeeDrops",
|
|
1562
1582
|
{
|
|
1563
|
-
"nth":
|
|
1583
|
+
"nth": 22,
|
|
1564
1584
|
"isVLEncoded": false,
|
|
1565
1585
|
"isSerialized": true,
|
|
1566
1586
|
"isSigningField": true,
|
|
@@ -1568,9 +1588,9 @@
|
|
|
1568
1588
|
}
|
|
1569
1589
|
],
|
|
1570
1590
|
[
|
|
1571
|
-
"
|
|
1591
|
+
"ReserveBaseDrops",
|
|
1572
1592
|
{
|
|
1573
|
-
"nth":
|
|
1593
|
+
"nth": 23,
|
|
1574
1594
|
"isVLEncoded": false,
|
|
1575
1595
|
"isSerialized": true,
|
|
1576
1596
|
"isSigningField": true,
|
|
@@ -1578,9 +1598,9 @@
|
|
|
1578
1598
|
}
|
|
1579
1599
|
],
|
|
1580
1600
|
[
|
|
1581
|
-
"
|
|
1601
|
+
"ReserveIncrementDrops",
|
|
1582
1602
|
{
|
|
1583
|
-
"nth":
|
|
1603
|
+
"nth": 24,
|
|
1584
1604
|
"isVLEncoded": false,
|
|
1585
1605
|
"isSerialized": true,
|
|
1586
1606
|
"isSigningField": true,
|
|
@@ -1588,9 +1608,39 @@
|
|
|
1588
1608
|
}
|
|
1589
1609
|
],
|
|
1590
1610
|
[
|
|
1591
|
-
"
|
|
1611
|
+
"LPTokenOut",
|
|
1592
1612
|
{
|
|
1593
|
-
"nth":
|
|
1613
|
+
"nth": 25,
|
|
1614
|
+
"isVLEncoded": false,
|
|
1615
|
+
"isSerialized": true,
|
|
1616
|
+
"isSigningField": true,
|
|
1617
|
+
"type": "Amount"
|
|
1618
|
+
}
|
|
1619
|
+
],
|
|
1620
|
+
[
|
|
1621
|
+
"LPTokenIn",
|
|
1622
|
+
{
|
|
1623
|
+
"nth": 26,
|
|
1624
|
+
"isVLEncoded": false,
|
|
1625
|
+
"isSerialized": true,
|
|
1626
|
+
"isSigningField": true,
|
|
1627
|
+
"type": "Amount"
|
|
1628
|
+
}
|
|
1629
|
+
],
|
|
1630
|
+
[
|
|
1631
|
+
"EPrice",
|
|
1632
|
+
{
|
|
1633
|
+
"nth": 27,
|
|
1634
|
+
"isVLEncoded": false,
|
|
1635
|
+
"isSerialized": true,
|
|
1636
|
+
"isSigningField": true,
|
|
1637
|
+
"type": "Amount"
|
|
1638
|
+
}
|
|
1639
|
+
],
|
|
1640
|
+
[
|
|
1641
|
+
"Price",
|
|
1642
|
+
{
|
|
1643
|
+
"nth": 28,
|
|
1594
1644
|
"isVLEncoded": false,
|
|
1595
1645
|
"isSerialized": true,
|
|
1596
1646
|
"isSigningField": true,
|
|
@@ -1618,7 +1668,7 @@
|
|
|
1618
1668
|
}
|
|
1619
1669
|
],
|
|
1620
1670
|
[
|
|
1621
|
-
"
|
|
1671
|
+
"LPTokenBalance",
|
|
1622
1672
|
{
|
|
1623
1673
|
"nth": 31,
|
|
1624
1674
|
"isVLEncoded": false,
|
|
@@ -1957,16 +2007,6 @@
|
|
|
1957
2007
|
"type": "AccountID"
|
|
1958
2008
|
}
|
|
1959
2009
|
],
|
|
1960
|
-
[
|
|
1961
|
-
"AMMAccount",
|
|
1962
|
-
{
|
|
1963
|
-
"nth": 11,
|
|
1964
|
-
"isVLEncoded": true,
|
|
1965
|
-
"isSerialized": true,
|
|
1966
|
-
"isSigningField": true,
|
|
1967
|
-
"type": "AccountID"
|
|
1968
|
-
}
|
|
1969
|
-
],
|
|
1970
2010
|
[
|
|
1971
2011
|
"HookAccount",
|
|
1972
2012
|
{
|
|
@@ -2360,7 +2400,7 @@
|
|
|
2360
2400
|
[
|
|
2361
2401
|
"AuctionSlot",
|
|
2362
2402
|
{
|
|
2363
|
-
"nth":
|
|
2403
|
+
"nth": 26,
|
|
2364
2404
|
"isVLEncoded": false,
|
|
2365
2405
|
"isSerialized": true,
|
|
2366
2406
|
"isSigningField": true,
|
|
@@ -2370,7 +2410,7 @@
|
|
|
2370
2410
|
[
|
|
2371
2411
|
"AuthAccount",
|
|
2372
2412
|
{
|
|
2373
|
-
"nth":
|
|
2413
|
+
"nth": 27,
|
|
2374
2414
|
"isVLEncoded": false,
|
|
2375
2415
|
"isSerialized": true,
|
|
2376
2416
|
"isSigningField": true,
|
|
@@ -2510,7 +2550,7 @@
|
|
|
2510
2550
|
[
|
|
2511
2551
|
"VoteSlots",
|
|
2512
2552
|
{
|
|
2513
|
-
"nth":
|
|
2553
|
+
"nth": 12,
|
|
2514
2554
|
"isVLEncoded": false,
|
|
2515
2555
|
"isSerialized": true,
|
|
2516
2556
|
"isSigningField": true,
|
|
@@ -2610,7 +2650,7 @@
|
|
|
2610
2650
|
[
|
|
2611
2651
|
"AuthAccounts",
|
|
2612
2652
|
{
|
|
2613
|
-
"nth":
|
|
2653
|
+
"nth": 25,
|
|
2614
2654
|
"isVLEncoded": false,
|
|
2615
2655
|
"isSerialized": true,
|
|
2616
2656
|
"isSigningField": true,
|
|
@@ -2632,6 +2672,9 @@
|
|
|
2632
2672
|
"telCAN_NOT_QUEUE_BLOCKED": -389,
|
|
2633
2673
|
"telCAN_NOT_QUEUE_FEE": -388,
|
|
2634
2674
|
"telCAN_NOT_QUEUE_FULL": -387,
|
|
2675
|
+
"telWRONG_NETWORK": -386,
|
|
2676
|
+
"telREQUIRES_NETWORK_ID": -385,
|
|
2677
|
+
"telNETWORK_ID_MAKES_TX_NON_CANONICAL": -384,
|
|
2635
2678
|
"temMALFORMED": -299,
|
|
2636
2679
|
"temBAD_AMOUNT": -298,
|
|
2637
2680
|
"temBAD_CURRENCY": -297,
|
|
@@ -2670,7 +2713,7 @@
|
|
|
2670
2713
|
"temUNKNOWN": -264,
|
|
2671
2714
|
"temSEQ_AND_TICKET": -263,
|
|
2672
2715
|
"temBAD_NFTOKEN_TRANSFER_FEE": -262,
|
|
2673
|
-
"
|
|
2716
|
+
"temBAD_AMM_TOKENS": -261,
|
|
2674
2717
|
"temEQUAL_DOOR_ACCOUNTS": -259,
|
|
2675
2718
|
"temBAD_XCHAIN_PROOF": -258,
|
|
2676
2719
|
"temSIDECHAIN_BAD_ISSUES": -257,
|
|
@@ -2759,13 +2802,10 @@
|
|
|
2759
2802
|
"tecINSUFFICIENT_FUNDS": 159,
|
|
2760
2803
|
"tecOBJECT_NOT_FOUND": 160,
|
|
2761
2804
|
"tecINSUFFICIENT_PAYMENT": 161,
|
|
2762
|
-
"
|
|
2805
|
+
"tecUNFUNDED_AMM": 162,
|
|
2763
2806
|
"tecAMM_BALANCE": 163,
|
|
2764
|
-
"
|
|
2765
|
-
"
|
|
2766
|
-
"tecAMM_INVALID_TOKENS": 166,
|
|
2767
|
-
"tecAMM_FAILED_BID": 167,
|
|
2768
|
-
"tecAMM_FAILED_VOTE": 168,
|
|
2807
|
+
"tecAMM_FAILED": 164,
|
|
2808
|
+
"tecAMM_INVALID_TOKENS": 165,
|
|
2769
2809
|
"tecBAD_XCHAIN_TRANSFER_ISSUE": 171,
|
|
2770
2810
|
"tecXCHAIN_NO_CLAIM_ID": 172,
|
|
2771
2811
|
"tecXCHAIN_BAD_CLAIM_ID": 173,
|
|
@@ -2782,7 +2822,8 @@
|
|
|
2782
2822
|
"tecXCHAIN_PAYMENT_FAILED": 184,
|
|
2783
2823
|
"tecXCHAIN_SELF_COMMIT": 185,
|
|
2784
2824
|
"tecXCHAIN_BAD_PUBLIC_KEY_ACCOUNT_PAIR": 186,
|
|
2785
|
-
"
|
|
2825
|
+
"tecREQUIRES_FLAG": 187,
|
|
2826
|
+
"tecPRECISION_LOSS": 188
|
|
2786
2827
|
},
|
|
2787
2828
|
"TRANSACTION_TYPES": {
|
|
2788
2829
|
"Invalid": -1,
|
package/dist/enums/field.d.ts
CHANGED
|
@@ -25,6 +25,5 @@ export interface FieldInstance {
|
|
|
25
25
|
}
|
|
26
26
|
export declare class FieldLookup {
|
|
27
27
|
constructor(fields: Array<[string, FieldInfo]>, types: Record<string, number>);
|
|
28
|
-
add(name: string, field_info: FieldInfo, typeOrdinal: number): void;
|
|
29
28
|
fromString(value: string): FieldInstance;
|
|
30
29
|
}
|