ripple-binary-codec 2.6.0 → 2.7.0-smartescrow.0
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/enums/definitions.json +76 -1
- package/dist/enums/src/enums/definitions.json +81 -1
- package/dist/src/enums/definitions.json +76 -1
- package/dist/src/types/hash-128.js +1 -1
- package/dist/src/types/hash-128.js.map +1 -1
- package/dist/src/types/hash-160.js +1 -1
- package/dist/src/types/hash-160.js.map +1 -1
- package/dist/src/types/hash-192.js +1 -1
- package/dist/src/types/hash-192.js.map +1 -1
- package/dist/src/types/index.d.ts +2 -1
- package/dist/src/types/index.js +4 -1
- package/dist/src/types/index.js.map +1 -1
- package/dist/src/types/int-32.d.ts +24 -0
- package/dist/src/types/int-32.js +50 -0
- package/dist/src/types/int-32.js.map +1 -0
- package/dist/src/types/st-number.js +88 -33
- package/dist/src/types/st-number.js.map +1 -1
- package/dist/src/types/uint-16.js +2 -2
- package/dist/src/types/uint-16.js.map +1 -1
- package/dist/src/types/uint-32.js +1 -1
- package/dist/src/types/uint-32.js.map +1 -1
- package/dist/src/types/uint-64.js +1 -1
- package/dist/src/types/uint-64.js.map +1 -1
- package/dist/src/types/uint-8.js +1 -1
- package/dist/src/types/uint-8.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/hash-128.js +1 -1
- package/dist/types/hash-128.js.map +1 -1
- package/dist/types/hash-160.js +1 -1
- package/dist/types/hash-160.js.map +1 -1
- package/dist/types/hash-192.js +1 -1
- package/dist/types/hash-192.js.map +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.js +4 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/int-32.d.ts +24 -0
- package/dist/types/int-32.js +50 -0
- package/dist/types/int-32.js.map +1 -0
- package/dist/types/st-number.js +88 -33
- package/dist/types/st-number.js.map +1 -1
- package/dist/types/uint-16.js +2 -2
- package/dist/types/uint-16.js.map +1 -1
- package/dist/types/uint-32.js +1 -1
- package/dist/types/uint-32.js.map +1 -1
- package/dist/types/uint-64.js +1 -1
- package/dist/types/uint-64.js.map +1 -1
- package/dist/types/uint-8.js +1 -1
- package/dist/types/uint-8.js.map +1 -1
- package/package.json +1 -1
- package/src/enums/definitions.json +81 -1
- package/src/types/hash-128.ts +1 -1
- package/src/types/hash-160.ts +1 -1
- package/src/types/hash-192.ts +1 -1
- package/src/types/index.ts +3 -0
- package/src/types/int-32.ts +57 -0
- package/src/types/st-number.ts +107 -31
- package/src/types/uint-16.ts +2 -2
- package/src/types/uint-32.ts +1 -1
- package/src/types/uint-64.ts +1 -1
- package/src/types/uint-8.ts +1 -1
package/dist/types/hash-192.js
CHANGED
|
@@ -7,7 +7,7 @@ const hash_1 = require("./hash");
|
|
|
7
7
|
*/
|
|
8
8
|
class Hash192 extends hash_1.Hash {
|
|
9
9
|
constructor(bytes) {
|
|
10
|
-
if (bytes
|
|
10
|
+
if ((bytes === null || bytes === void 0 ? void 0 : bytes.byteLength) === 0) {
|
|
11
11
|
bytes = Hash192.ZERO_192.bytes;
|
|
12
12
|
}
|
|
13
13
|
super(bytes !== null && bytes !== void 0 ? bytes : Hash192.ZERO_192.bytes);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hash-192.js","sourceRoot":"","sources":["../../src/types/hash-192.ts"],"names":[],"mappings":";;;AAAA,iCAA6B;AAE7B;;GAEG;AACH,MAAM,OAAQ,SAAQ,WAAI;IAIxB,YAAY,KAAkB;QAC5B,IAAI,KAAK,
|
|
1
|
+
{"version":3,"file":"hash-192.js","sourceRoot":"","sources":["../../src/types/hash-192.ts"],"names":[],"mappings":";;;AAAA,iCAA6B;AAE7B;;GAEG;AACH,MAAM,OAAQ,SAAQ,WAAI;IAIxB,YAAY,KAAkB;QAC5B,IAAI,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,UAAU,MAAK,CAAC,EAAE;YAC3B,KAAK,GAAG,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAA;SAC/B;QAED,KAAK,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;IACxC,CAAC;;AAGM,0BAAO;AAZE,aAAK,GAAG,EAAE,CAAA;AACV,gBAAQ,GAAY,IAAI,OAAO,CAAC,IAAI,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAA"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { Hash128 } from './hash-128';
|
|
|
6
6
|
import { Hash160 } from './hash-160';
|
|
7
7
|
import { Hash192 } from './hash-192';
|
|
8
8
|
import { Hash256 } from './hash-256';
|
|
9
|
+
import { Int32 } from './int-32';
|
|
9
10
|
import { PathSet } from './path-set';
|
|
10
11
|
import { STArray } from './st-array';
|
|
11
12
|
import { STObject } from './st-object';
|
|
@@ -16,4 +17,4 @@ import { UInt8 } from './uint-8';
|
|
|
16
17
|
import { Vector256 } from './vector-256';
|
|
17
18
|
import { type SerializedType } from './serialized-type';
|
|
18
19
|
declare const coreTypes: Record<string, typeof SerializedType>;
|
|
19
|
-
export { coreTypes, AccountID, Amount, Blob, Currency, Hash128, Hash160, Hash192, Hash256, PathSet, STArray, STObject, UInt8, UInt16, UInt32, UInt64, Vector256, };
|
|
20
|
+
export { coreTypes, AccountID, Amount, Blob, Currency, Hash128, Hash160, Hash192, Hash256, Int32, PathSet, STArray, STObject, UInt8, UInt16, UInt32, UInt64, Vector256, };
|
package/dist/types/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Vector256 = exports.UInt64 = exports.UInt32 = exports.UInt16 = exports.UInt8 = exports.STObject = exports.STArray = exports.PathSet = exports.Hash256 = exports.Hash192 = exports.Hash160 = exports.Hash128 = exports.Currency = exports.Blob = exports.Amount = exports.AccountID = exports.coreTypes = void 0;
|
|
3
|
+
exports.Vector256 = exports.UInt64 = exports.UInt32 = exports.UInt16 = exports.UInt8 = exports.STObject = exports.STArray = exports.PathSet = exports.Int32 = exports.Hash256 = exports.Hash192 = exports.Hash160 = exports.Hash128 = exports.Currency = exports.Blob = exports.Amount = exports.AccountID = exports.coreTypes = void 0;
|
|
4
4
|
const account_id_1 = require("./account-id");
|
|
5
5
|
Object.defineProperty(exports, "AccountID", { enumerable: true, get: function () { return account_id_1.AccountID; } });
|
|
6
6
|
const amount_1 = require("./amount");
|
|
@@ -17,6 +17,8 @@ const hash_192_1 = require("./hash-192");
|
|
|
17
17
|
Object.defineProperty(exports, "Hash192", { enumerable: true, get: function () { return hash_192_1.Hash192; } });
|
|
18
18
|
const hash_256_1 = require("./hash-256");
|
|
19
19
|
Object.defineProperty(exports, "Hash256", { enumerable: true, get: function () { return hash_256_1.Hash256; } });
|
|
20
|
+
const int_32_1 = require("./int-32");
|
|
21
|
+
Object.defineProperty(exports, "Int32", { enumerable: true, get: function () { return int_32_1.Int32; } });
|
|
20
22
|
const issue_1 = require("./issue");
|
|
21
23
|
const st_number_1 = require("./st-number");
|
|
22
24
|
const path_set_1 = require("./path-set");
|
|
@@ -46,6 +48,7 @@ const coreTypes = {
|
|
|
46
48
|
Hash160: hash_160_1.Hash160,
|
|
47
49
|
Hash192: hash_192_1.Hash192,
|
|
48
50
|
Hash256: hash_256_1.Hash256,
|
|
51
|
+
Int32: int_32_1.Int32,
|
|
49
52
|
Issue: issue_1.Issue,
|
|
50
53
|
Number: st_number_1.STNumber,
|
|
51
54
|
PathSet: path_set_1.PathSet,
|
package/dist/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;AAAA,6CAAwC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;AAAA,6CAAwC;AAqDtC,0FArDO,sBAAS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M;IACN,MAAM,EAAN,gBAAM;IACN,SAAS,EAAT,sBAAS;IACT,YAAY,EAAZ,4BAAY;CACb,CAAA;AAQC,8BAAS;AANX,2GAA2G;AAC3G,gFAAgF;AAChF,8FAA8F;AAC9F,2BAAmB,CAAC,cAAc,CAAC,SAAS,CAAC,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { UInt } from './uint';
|
|
2
|
+
import { BinaryParser } from '../serdes/binary-parser';
|
|
3
|
+
/**
|
|
4
|
+
* Derived Int class for serializing/deserializing 32 bit Int
|
|
5
|
+
*/
|
|
6
|
+
declare class Int32 extends UInt {
|
|
7
|
+
protected static readonly width: number;
|
|
8
|
+
static readonly defaultInt32: Int32;
|
|
9
|
+
constructor(bytes: Uint8Array);
|
|
10
|
+
static fromParser(parser: BinaryParser): UInt;
|
|
11
|
+
/**
|
|
12
|
+
* Construct a Int32 object from a number
|
|
13
|
+
*
|
|
14
|
+
* @param val Int32 object or number
|
|
15
|
+
*/
|
|
16
|
+
static from<T extends Int32 | number | string>(val: T): Int32;
|
|
17
|
+
/**
|
|
18
|
+
* get the value of a Int32 object
|
|
19
|
+
*
|
|
20
|
+
* @returns the number represented by this.bytes
|
|
21
|
+
*/
|
|
22
|
+
valueOf(): number;
|
|
23
|
+
}
|
|
24
|
+
export { Int32 };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Int32 = void 0;
|
|
4
|
+
const uint_1 = require("./uint");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
|
+
/**
|
|
7
|
+
* Derived Int class for serializing/deserializing 32 bit Int
|
|
8
|
+
*/
|
|
9
|
+
class Int32 extends uint_1.UInt {
|
|
10
|
+
constructor(bytes) {
|
|
11
|
+
super(bytes !== null && bytes !== void 0 ? bytes : Int32.defaultInt32.bytes);
|
|
12
|
+
}
|
|
13
|
+
static fromParser(parser) {
|
|
14
|
+
return new Int32(parser.read(Int32.width));
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Construct a Int32 object from a number
|
|
18
|
+
*
|
|
19
|
+
* @param val Int32 object or number
|
|
20
|
+
*/
|
|
21
|
+
static from(val) {
|
|
22
|
+
if (val instanceof Int32) {
|
|
23
|
+
return val;
|
|
24
|
+
}
|
|
25
|
+
const buf = new Uint8Array(Int32.width);
|
|
26
|
+
if (typeof val === 'string') {
|
|
27
|
+
const num = Number.parseInt(val);
|
|
28
|
+
(0, utils_1.writeInt32BE)(buf, num, 0);
|
|
29
|
+
return new Int32(buf);
|
|
30
|
+
}
|
|
31
|
+
if (typeof val === 'number') {
|
|
32
|
+
Int32.checkUintRange(val, -2147483648, 2147483647);
|
|
33
|
+
(0, utils_1.writeInt32BE)(buf, val, 0);
|
|
34
|
+
return new Int32(buf);
|
|
35
|
+
}
|
|
36
|
+
throw new Error('Cannot construct Int32 from given value');
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* get the value of a Int32 object
|
|
40
|
+
*
|
|
41
|
+
* @returns the number represented by this.bytes
|
|
42
|
+
*/
|
|
43
|
+
valueOf() {
|
|
44
|
+
return (0, utils_1.readInt32BE)(this.bytes, 0);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.Int32 = Int32;
|
|
48
|
+
Int32.width = 32 / 8; // 4
|
|
49
|
+
Int32.defaultInt32 = new Int32(new Uint8Array(Int32.width));
|
|
50
|
+
//# sourceMappingURL=int-32.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"int-32.js","sourceRoot":"","sources":["../../src/types/int-32.ts"],"names":[],"mappings":";;;AAAA,iCAA6B;AAE7B,oCAAoD;AAEpD;;GAEG;AACH,MAAM,KAAM,SAAQ,WAAI;IAItB,YAAY,KAAiB;QAC3B,KAAK,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,CAAA;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Constants for mantissa and exponent normalization per XRPL Number spec.
|
|
8
8
|
* These define allowed magnitude for mantissa and exponent after normalization.
|
|
9
9
|
*/
|
|
10
|
-
const MIN_MANTISSA = BigInt('
|
|
11
|
-
const MAX_MANTISSA = BigInt('
|
|
10
|
+
const MIN_MANTISSA = BigInt('1000000000000000000'); // 10^18
|
|
11
|
+
const MAX_MANTISSA = BigInt('9999999999999999999'); // 10^19 - 1
|
|
12
|
+
const MAX_INT64 = BigInt('9223372036854775807'); // 2^63 - 1, max signed 64-bit integer
|
|
12
13
|
const MIN_EXPONENT = -32768;
|
|
13
14
|
const MAX_EXPONENT = 32768;
|
|
14
15
|
const DEFAULT_VALUE_EXPONENT = -2147483648;
|
|
@@ -56,6 +57,11 @@ function extractNumberPartsFromString(val) {
|
|
|
56
57
|
}
|
|
57
58
|
if (expPart)
|
|
58
59
|
exponent += parseInt(expPart, 10);
|
|
60
|
+
// Remove trailing zeros from mantissa and adjust exponent
|
|
61
|
+
while (mantissaStr.length > 1 && mantissaStr.endsWith('0')) {
|
|
62
|
+
mantissaStr = mantissaStr.slice(0, -1);
|
|
63
|
+
exponent += 1;
|
|
64
|
+
}
|
|
59
65
|
let mantissa = BigInt(mantissaStr);
|
|
60
66
|
if (sign === '-')
|
|
61
67
|
mantissa = -mantissa;
|
|
@@ -65,7 +71,7 @@ function extractNumberPartsFromString(val) {
|
|
|
65
71
|
/**
|
|
66
72
|
* Normalize the mantissa and exponent to XRPL constraints.
|
|
67
73
|
*
|
|
68
|
-
* Ensures that after normalization, the mantissa is between MIN_MANTISSA and
|
|
74
|
+
* Ensures that after normalization, the mantissa is between MIN_MANTISSA and MAX_INT64.
|
|
69
75
|
* Adjusts the exponent as needed by shifting the mantissa left/right (multiplying/dividing by 10).
|
|
70
76
|
*
|
|
71
77
|
* @param mantissa - The unnormalized mantissa (BigInt).
|
|
@@ -76,16 +82,57 @@ function extractNumberPartsFromString(val) {
|
|
|
76
82
|
function normalize(mantissa, exponent) {
|
|
77
83
|
let m = mantissa < BigInt(0) ? -mantissa : mantissa;
|
|
78
84
|
const isNegative = mantissa < BigInt(0);
|
|
79
|
-
|
|
85
|
+
// Handle zero
|
|
86
|
+
if (m === BigInt(0)) {
|
|
87
|
+
return { mantissa: BigInt(0), exponent: DEFAULT_VALUE_EXPONENT };
|
|
88
|
+
}
|
|
89
|
+
// Grow mantissa until it reaches MIN_MANTISSA
|
|
90
|
+
while (m < MIN_MANTISSA && exponent > MIN_EXPONENT) {
|
|
80
91
|
exponent -= 1;
|
|
81
92
|
m *= BigInt(10);
|
|
82
93
|
}
|
|
94
|
+
let lastDigit = null;
|
|
95
|
+
// Shrink mantissa until it fits within MAX_MANTISSA
|
|
83
96
|
while (m > MAX_MANTISSA) {
|
|
84
|
-
if (exponent >= MAX_EXPONENT)
|
|
97
|
+
if (exponent >= MAX_EXPONENT) {
|
|
85
98
|
throw new Error('Mantissa and exponent are too large');
|
|
99
|
+
}
|
|
86
100
|
exponent += 1;
|
|
101
|
+
lastDigit = m % BigInt(10);
|
|
87
102
|
m /= BigInt(10);
|
|
88
103
|
}
|
|
104
|
+
// Handle underflow: if exponent too small or mantissa too small, throw error
|
|
105
|
+
if (exponent < MIN_EXPONENT || m < MIN_MANTISSA) {
|
|
106
|
+
throw new Error('Underflow: value too small to represent');
|
|
107
|
+
}
|
|
108
|
+
// Handle overflow: if exponent exceeds MAX_EXPONENT after growing.
|
|
109
|
+
if (exponent > MAX_EXPONENT) {
|
|
110
|
+
throw new Error('Exponent overflow: value too large to represent');
|
|
111
|
+
}
|
|
112
|
+
// Handle overflow: if mantissa exceeds MAX_INT64 (2^63-1) after growing.
|
|
113
|
+
if (m > MAX_INT64) {
|
|
114
|
+
if (exponent >= MAX_EXPONENT) {
|
|
115
|
+
throw new Error('Exponent overflow: value too large to represent');
|
|
116
|
+
}
|
|
117
|
+
exponent += 1;
|
|
118
|
+
lastDigit = m % BigInt(10);
|
|
119
|
+
m /= BigInt(10);
|
|
120
|
+
}
|
|
121
|
+
if (lastDigit != null && lastDigit >= BigInt(5)) {
|
|
122
|
+
m += BigInt(1);
|
|
123
|
+
// After rounding, mantissa may exceed MAX_INT64 again
|
|
124
|
+
if (m > MAX_INT64) {
|
|
125
|
+
if (exponent >= MAX_EXPONENT) {
|
|
126
|
+
throw new Error('Exponent overflow: value too large to represent');
|
|
127
|
+
}
|
|
128
|
+
lastDigit = m % BigInt(10);
|
|
129
|
+
exponent += 1;
|
|
130
|
+
m /= BigInt(10);
|
|
131
|
+
if (lastDigit >= BigInt(5)) {
|
|
132
|
+
m += BigInt(1);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
89
136
|
if (isNegative)
|
|
90
137
|
m = -m;
|
|
91
138
|
return { mantissa: m, exponent };
|
|
@@ -139,18 +186,8 @@ class STNumber extends serialized_type_1.SerializedType {
|
|
|
139
186
|
* @throws Error if val is not a valid number string.
|
|
140
187
|
*/
|
|
141
188
|
static fromValue(val) {
|
|
142
|
-
const { mantissa, exponent
|
|
143
|
-
|
|
144
|
-
let normalizedExponent;
|
|
145
|
-
if (mantissa === BigInt(0) && exponent === 0 && !isNegative) {
|
|
146
|
-
normalizedMantissa = BigInt(0);
|
|
147
|
-
normalizedExponent = DEFAULT_VALUE_EXPONENT;
|
|
148
|
-
}
|
|
149
|
-
else {
|
|
150
|
-
;
|
|
151
|
-
({ mantissa: normalizedMantissa, exponent: normalizedExponent } =
|
|
152
|
-
normalize(mantissa, exponent));
|
|
153
|
-
}
|
|
189
|
+
const { mantissa, exponent } = extractNumberPartsFromString(val);
|
|
190
|
+
const { mantissa: normalizedMantissa, exponent: normalizedExponent } = normalize(mantissa, exponent);
|
|
154
191
|
const bytes = new Uint8Array(12);
|
|
155
192
|
(0, utils_1.writeInt64BE)(bytes, normalizedMantissa, 0);
|
|
156
193
|
(0, utils_1.writeInt32BE)(bytes, normalizedExponent, 8);
|
|
@@ -171,35 +208,53 @@ class STNumber extends serialized_type_1.SerializedType {
|
|
|
171
208
|
*
|
|
172
209
|
* @returns String representation of the value
|
|
173
210
|
*/
|
|
174
|
-
// eslint-disable-next-line complexity -- required
|
|
175
211
|
toJSON() {
|
|
176
212
|
const b = this.bytes;
|
|
177
|
-
if (!b || b.length !== 12)
|
|
213
|
+
if (!b || (b === null || b === void 0 ? void 0 : b.length) !== 12)
|
|
178
214
|
throw new Error('STNumber internal bytes not set or wrong length');
|
|
179
215
|
// Signed 64-bit mantissa
|
|
180
216
|
const mantissa = (0, utils_1.readInt64BE)(b, 0);
|
|
181
217
|
// Signed 32-bit exponent
|
|
182
|
-
|
|
218
|
+
let exponent = (0, utils_1.readInt32BE)(b, 8);
|
|
183
219
|
// Special zero: XRPL encodes canonical zero as mantissa=0, exponent=DEFAULT_VALUE_EXPONENT.
|
|
184
220
|
if (mantissa === BigInt(0) && exponent === DEFAULT_VALUE_EXPONENT) {
|
|
185
221
|
return '0';
|
|
186
222
|
}
|
|
187
|
-
if (exponent === 0)
|
|
188
|
-
return mantissa.toString();
|
|
189
|
-
// Use scientific notation for small/large exponents, decimal otherwise
|
|
190
|
-
if (exponent < -25 || exponent > -5) {
|
|
191
|
-
return `${mantissa}e${exponent}`;
|
|
192
|
-
}
|
|
193
|
-
// Decimal rendering for -25 <= exp <= -5
|
|
194
223
|
const isNegative = mantissa < BigInt(0);
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
224
|
+
let mantissaAbs = isNegative ? -mantissa : mantissa;
|
|
225
|
+
// If mantissa < MIN_MANTISSA, it was shrunk for int64 serialization (mantissa > 2^63-1).
|
|
226
|
+
// Restore it for proper string rendering to match rippled's internal representation.
|
|
227
|
+
if (mantissaAbs !== BigInt(0) && mantissaAbs < MIN_MANTISSA) {
|
|
228
|
+
mantissaAbs *= BigInt(10);
|
|
229
|
+
exponent -= 1;
|
|
230
|
+
}
|
|
231
|
+
// For large mantissa range (default), rangeLog = 18
|
|
232
|
+
const rangeLog = 18;
|
|
233
|
+
// Use scientific notation for exponents that are too small or too large
|
|
234
|
+
// Condition from rippled: exponent != 0 AND (exponent < -(rangeLog + 10) OR exponent > -(rangeLog - 10))
|
|
235
|
+
// For rangeLog = 18: exponent != 0 AND (exponent < -28 OR exponent > -8)
|
|
236
|
+
if (exponent !== 0 &&
|
|
237
|
+
(exponent < -(rangeLog + 10) || exponent > -(rangeLog - 10))) {
|
|
238
|
+
// Strip trailing zeros from mantissa (matches rippled behavior)
|
|
239
|
+
let exp = exponent;
|
|
240
|
+
while (mantissaAbs !== BigInt(0) &&
|
|
241
|
+
mantissaAbs % BigInt(10) === BigInt(0) &&
|
|
242
|
+
exp < MAX_EXPONENT) {
|
|
243
|
+
mantissaAbs /= BigInt(10);
|
|
244
|
+
exp += 1;
|
|
245
|
+
}
|
|
246
|
+
const sign = isNegative ? '-' : '';
|
|
247
|
+
return `${sign}${mantissaAbs}e${exp}`;
|
|
248
|
+
}
|
|
249
|
+
// Decimal rendering for -(rangeLog + 10) <= exponent <= -(rangeLog - 10)
|
|
250
|
+
// i.e., -28 <= exponent <= -8, or exponent == 0
|
|
251
|
+
const padPrefix = rangeLog + 12; // 30
|
|
252
|
+
const padSuffix = rangeLog + 8; // 26
|
|
198
253
|
const mantissaStr = mantissaAbs.toString();
|
|
199
254
|
const rawValue = '0'.repeat(padPrefix) + mantissaStr + '0'.repeat(padSuffix);
|
|
200
|
-
const
|
|
201
|
-
const integerPart = rawValue.slice(0,
|
|
202
|
-
const fractionPart = rawValue.slice(
|
|
255
|
+
const offset = exponent + padPrefix + rangeLog + 1; // exponent + 49
|
|
256
|
+
const integerPart = rawValue.slice(0, offset).replace(/^0+/, '') || '0';
|
|
257
|
+
const fractionPart = rawValue.slice(offset).replace(/0+$/, '');
|
|
203
258
|
return `${isNegative ? '-' : ''}${integerPart}${fractionPart ? '.' + fractionPart : ''}`;
|
|
204
259
|
}
|
|
205
260
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"st-number.js","sourceRoot":"","sources":["../../src/types/st-number.ts"],"names":[],"mappings":";;;
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EAAE,CAAC,CAAA;QAE9D,OAAO,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,WAAW,GAC3C,YAAY,CAAC,CAAC,CAAC,GAAG,GAAG,YAAY,CAAC,CAAC,CAAC,EACtC,EAAE,CAAA;IACJ,CAAC;;AAzIH,4BA0IC;AAzIC,gDAAgD;AACzC,qBAAY,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAA"}
|
package/dist/types/uint-16.js
CHANGED
|
@@ -22,13 +22,13 @@ class UInt16 extends uint_1.UInt {
|
|
|
22
22
|
if (val instanceof UInt16) {
|
|
23
23
|
return val;
|
|
24
24
|
}
|
|
25
|
-
if (typeof val === 'number') {
|
|
25
|
+
if (typeof val === 'number' && Number.isInteger(val)) {
|
|
26
26
|
UInt16.checkUintRange(val, 0, 0xffff);
|
|
27
27
|
const buf = new Uint8Array(UInt16.width);
|
|
28
28
|
(0, utils_1.writeUInt16BE)(buf, val, 0);
|
|
29
29
|
return new UInt16(buf);
|
|
30
30
|
}
|
|
31
|
-
throw new Error('
|
|
31
|
+
throw new Error('Cannot construct UInt16 from given value');
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
34
|
* get the value of a UInt16 object
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uint-16.js","sourceRoot":"","sources":["../../src/types/uint-16.ts"],"names":[],"mappings":";;;AAAA,iCAA6B;AAE7B,oCAAsD;AAEtD;;GAEG;AACH,MAAM,MAAO,SAAQ,WAAI;IAMvB,YAAY,KAAiB;QAC3B,KAAK,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;IAC5C,CAAC;IAED,MAAM,CAAC,UAAU,CAAC,MAAoB;QACpC,OAAO,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAA;IAC9C,CAAC;IAED;;;;OAI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AC;;AAGM,wBAAM;AA5Ca,YAAK,GAAW,EAAE,GAAG,CAAC,CAAA,CAAC,IAAI;AACrC,oBAAa,GAAW,IAAI,MAAM,CAChD,IAAI,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,CAC7B,CAAA"}
|
package/dist/types/uint-32.js
CHANGED
|
@@ -28,7 +28,7 @@ class UInt32 extends uint_1.UInt {
|
|
|
28
28
|
(0, utils_1.writeUInt32BE)(buf, num, 0);
|
|
29
29
|
return new UInt32(buf);
|
|
30
30
|
}
|
|
31
|
-
if (typeof val === 'number') {
|
|
31
|
+
if (typeof val === 'number' && Number.isInteger(val)) {
|
|
32
32
|
UInt32.checkUintRange(val, 0, 0xffffffff);
|
|
33
33
|
(0, utils_1.writeUInt32BE)(buf, val, 0);
|
|
34
34
|
return new UInt32(buf);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uint-32.js","sourceRoot":"","sources":["../../src/types/uint-32.ts"],"names":[],"mappings":";;;AAAA,iCAA6B;AAE7B,oCAAsD;AAEtD;;GAEG;AACH,MAAM,MAAO,SAAQ,WAAI;IAMvB,YAAY,KAAiB;QAC3B,KAAK,CAAC,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;IAC5C,CAAC;IAED,MAAM,CAAC,UAAU,CAAC,MAAoB;QACpC,OAAO,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAA;IAC9C,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,IAAI,CAAqC,GAAM;QACpD,IAAI,GAAG,YAAY,MAAM,EAAE;YACzB,OAAO,GAAG,CAAA;SACX;QAED,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QAExC,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;YAC3B,MAAM,GAAG,GAAG,MAAM,CAAC,QAAQ,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GAAG,EAAE,CAAC,CAAC,CAAA;YAC1B,OAAO,IAAI,MAAM,CAAC,GAAG,CAAC,CAAA;SACvB;QAED,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAA;IAC7D,CAAC;IAED;;;;OAIG;IACH,OAAO;QACL,OAAO,QAAQ,CAAC,IAAA,oBAAY,EAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;IAClD,CAAC;;AAGM,wBAAM;AAlDa,YAAK,GAAW,EAAE,GAAG,CAAC,CAAA,CAAC,IAAI;AACrC,oBAAa,GAAW,IAAI,MAAM,CAChD,IAAI,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,CAC7B,CAAA"}
|
package/dist/types/uint-64.js
CHANGED
|
@@ -39,7 +39,7 @@ class UInt64 extends uint_1.UInt {
|
|
|
39
39
|
return val;
|
|
40
40
|
}
|
|
41
41
|
let buf = new Uint8Array(UInt64.width);
|
|
42
|
-
if (typeof val === 'number') {
|
|
42
|
+
if (typeof val === 'number' && Number.isInteger(val)) {
|
|
43
43
|
if (val < 0) {
|
|
44
44
|
throw new Error('value must be an unsigned integer');
|
|
45
45
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uint-64.js","sourceRoot":"","sources":["../../src/types/uint-64.ts"],"names":[],"mappings":";;;AAAA,iCAA6B;AAE7B,mDAAwE;AACxE,oCAAsD;AACtD,oCAAmE;AAEnE,MAAM,SAAS,GAAG,qBAAqB,CAAA;AACvC,MAAM,YAAY,GAAG,eAAe,CAAA;AACpC,MAAM,IAAI,GAAG,MAAM,CAAC,kBAAkB,CAAC,CAAA;AAEvC,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC;IACnC,eAAe;IACf,mBAAmB;IACnB,WAAW;IACX,cAAc;CACf,CAAC,CAAA;AAEF,SAAS,QAAQ,CAAC,SAAiB;IACjC,OAAO,oBAAoB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;AAC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IAAI,QAAQ,CAAC,SAAS,CAAC,EAAE;YACvB,OAAO,MAAM,CAAC,IAAI,GAAG,SAAS,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;SAC7C;QAED,OAAO,SAAS,CAAA;IAClB,CAAC;IAED;;;;OAIG;IACH,OAAO;QACL,MAAM,GAAG,GAAG,MAAM,CAAC,IAAA,oBAAY,EAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;QAC3D,MAAM,GAAG,GAAG,MAAM,CAAC,IAAA,oBAAY,EAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;QACxD,OAAO,CAAC,GAAG,IAAI,MAAM,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,CAAA;IAClC,CAAC;IAED;;;;OAIG;IACH,OAAO;QACL,OAAO,IAAI,CAAC,KAAK,CAAA;IACnB,CAAC;;AAGM,wBAAM;AA9Ga,YAAK,GAAW,EAAE,GAAG,CAAC,CAAA,CAAC,IAAI;AACrC,oBAAa,GAAW,IAAI,MAAM,CAChD,IAAI,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,CAC7B,CAAA"}
|
package/dist/types/uint-8.js
CHANGED
|
@@ -23,7 +23,7 @@ class UInt8 extends uint_1.UInt {
|
|
|
23
23
|
if (val instanceof UInt8) {
|
|
24
24
|
return val;
|
|
25
25
|
}
|
|
26
|
-
if (typeof val === 'number') {
|
|
26
|
+
if (typeof val === 'number' && Number.isInteger(val)) {
|
|
27
27
|
UInt8.checkUintRange(val, 0, 0xff);
|
|
28
28
|
const buf = new Uint8Array(UInt8.width);
|
|
29
29
|
(0, utils_2.writeUInt8)(buf, val, 0);
|
package/dist/types/uint-8.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uint-8.js","sourceRoot":"","sources":["../../src/types/uint-8.ts"],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,CAAC,CAAA;YAElC,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;YACvC,IAAA,kBAAU,EAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAA;YACvB,OAAO,IAAI,KAAK,CAAC,GAAG,CAAC,CAAA;SACtB;QAED,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAA;IAC5D,CAAC;IAED;;;;OAIG;IACH,OAAO;QACL,OAAO,QAAQ,CAAC,IAAA,kBAAU,EAAC,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAA;IAC7C,CAAC;;AAGM,sBAAK;AA1Cc,WAAK,GAAW,CAAC,GAAG,CAAC,CAAA,CAAC,IAAI;AACpC,kBAAY,GAAU,IAAI,KAAK,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -731,7 +731,7 @@
|
|
|
731
731
|
}
|
|
732
732
|
],
|
|
733
733
|
[
|
|
734
|
-
"
|
|
734
|
+
"PreviousPaymentDueDate",
|
|
735
735
|
{
|
|
736
736
|
"isSerialized": true,
|
|
737
737
|
"isSigningField": true,
|
|
@@ -850,6 +850,56 @@
|
|
|
850
850
|
"type": "UInt32"
|
|
851
851
|
}
|
|
852
852
|
],
|
|
853
|
+
[
|
|
854
|
+
"ExtensionComputeLimit",
|
|
855
|
+
{
|
|
856
|
+
"isSerialized": true,
|
|
857
|
+
"isSigningField": true,
|
|
858
|
+
"isVLEncoded": false,
|
|
859
|
+
"nth": 69,
|
|
860
|
+
"type": "UInt32"
|
|
861
|
+
}
|
|
862
|
+
],
|
|
863
|
+
[
|
|
864
|
+
"ExtensionSizeLimit",
|
|
865
|
+
{
|
|
866
|
+
"isSerialized": true,
|
|
867
|
+
"isSigningField": true,
|
|
868
|
+
"isVLEncoded": false,
|
|
869
|
+
"nth": 70,
|
|
870
|
+
"type": "UInt32"
|
|
871
|
+
}
|
|
872
|
+
],
|
|
873
|
+
[
|
|
874
|
+
"GasPrice",
|
|
875
|
+
{
|
|
876
|
+
"isSerialized": true,
|
|
877
|
+
"isSigningField": true,
|
|
878
|
+
"isVLEncoded": false,
|
|
879
|
+
"nth": 71,
|
|
880
|
+
"type": "UInt32"
|
|
881
|
+
}
|
|
882
|
+
],
|
|
883
|
+
[
|
|
884
|
+
"ComputationAllowance",
|
|
885
|
+
{
|
|
886
|
+
"isSerialized": true,
|
|
887
|
+
"isSigningField": true,
|
|
888
|
+
"isVLEncoded": false,
|
|
889
|
+
"nth": 72,
|
|
890
|
+
"type": "UInt32"
|
|
891
|
+
}
|
|
892
|
+
],
|
|
893
|
+
[
|
|
894
|
+
"GasUsed",
|
|
895
|
+
{
|
|
896
|
+
"isSerialized": true,
|
|
897
|
+
"isSigningField": true,
|
|
898
|
+
"isVLEncoded": false,
|
|
899
|
+
"nth": 73,
|
|
900
|
+
"type": "UInt32"
|
|
901
|
+
}
|
|
902
|
+
],
|
|
853
903
|
[
|
|
854
904
|
"IndexNext",
|
|
855
905
|
{
|
|
@@ -2100,6 +2150,16 @@
|
|
|
2100
2150
|
"type": "Blob"
|
|
2101
2151
|
}
|
|
2102
2152
|
],
|
|
2153
|
+
[
|
|
2154
|
+
"FinishFunction",
|
|
2155
|
+
{
|
|
2156
|
+
"isSerialized": true,
|
|
2157
|
+
"isSigningField": true,
|
|
2158
|
+
"isVLEncoded": true,
|
|
2159
|
+
"nth": 32,
|
|
2160
|
+
"type": "Blob"
|
|
2161
|
+
}
|
|
2162
|
+
],
|
|
2103
2163
|
[
|
|
2104
2164
|
"Account",
|
|
2105
2165
|
{
|
|
@@ -2490,6 +2550,16 @@
|
|
|
2490
2550
|
"type": "Int32"
|
|
2491
2551
|
}
|
|
2492
2552
|
],
|
|
2553
|
+
[
|
|
2554
|
+
"WasmReturnCode",
|
|
2555
|
+
{
|
|
2556
|
+
"isSerialized": true,
|
|
2557
|
+
"isSigningField": true,
|
|
2558
|
+
"isVLEncoded": false,
|
|
2559
|
+
"nth": 2,
|
|
2560
|
+
"type": "Int32"
|
|
2561
|
+
}
|
|
2562
|
+
],
|
|
2493
2563
|
[
|
|
2494
2564
|
"TransactionMetaData",
|
|
2495
2565
|
{
|
|
@@ -3531,6 +3601,7 @@
|
|
|
3531
3601
|
"tecUNFUNDED_AMM": 162,
|
|
3532
3602
|
"tecUNFUNDED_OFFER": 103,
|
|
3533
3603
|
"tecUNFUNDED_PAYMENT": 104,
|
|
3604
|
+
"tecWASM_REJECTED": 199,
|
|
3534
3605
|
"tecWRONG_ASSET": 194,
|
|
3535
3606
|
"tecXCHAIN_ACCOUNT_CREATE_PAST": 181,
|
|
3536
3607
|
"tecXCHAIN_ACCOUNT_CREATE_TOO_MANY": 182,
|
|
@@ -3549,6 +3620,7 @@
|
|
|
3549
3620
|
"tecXCHAIN_SELF_COMMIT": 184,
|
|
3550
3621
|
"tecXCHAIN_SENDING_ACCOUNT_MISMATCH": 179,
|
|
3551
3622
|
"tecXCHAIN_WRONG_CHAIN": 176,
|
|
3623
|
+
|
|
3552
3624
|
"tefALREADY": -198,
|
|
3553
3625
|
"tefBAD_ADD_AUTH": -197,
|
|
3554
3626
|
"tefBAD_AUTH": -196,
|
|
@@ -3568,9 +3640,12 @@
|
|
|
3568
3640
|
"tefNOT_MULTI_SIGNING": -184,
|
|
3569
3641
|
"tefNO_AUTH_REQUIRED": -191,
|
|
3570
3642
|
"tefNO_TICKET": -180,
|
|
3643
|
+
"tefNO_WASM": -177,
|
|
3571
3644
|
"tefPAST_SEQ": -190,
|
|
3572
3645
|
"tefTOO_BIG": -181,
|
|
3646
|
+
"tefWASM_FIELD_NOT_INCLUDED": -176,
|
|
3573
3647
|
"tefWRONG_PRIOR": -189,
|
|
3648
|
+
|
|
3574
3649
|
"telBAD_DOMAIN": -398,
|
|
3575
3650
|
"telBAD_PATH_COUNT": -397,
|
|
3576
3651
|
"telBAD_PUBLIC_KEY": -396,
|
|
@@ -3588,6 +3663,7 @@
|
|
|
3588
3663
|
"telNO_DST_PARTIAL": -393,
|
|
3589
3664
|
"telREQUIRES_NETWORK_ID": -385,
|
|
3590
3665
|
"telWRONG_NETWORK": -386,
|
|
3666
|
+
|
|
3591
3667
|
"temARRAY_EMPTY": -253,
|
|
3592
3668
|
"temARRAY_TOO_LARGE": -252,
|
|
3593
3669
|
"temBAD_AMM_TOKENS": -261,
|
|
@@ -3615,6 +3691,7 @@
|
|
|
3615
3691
|
"temBAD_TICK_SIZE": -269,
|
|
3616
3692
|
"temBAD_TRANSFER_FEE": -251,
|
|
3617
3693
|
"temBAD_TRANSFER_RATE": -280,
|
|
3694
|
+
"temBAD_WASM": -249,
|
|
3618
3695
|
"temBAD_WEIGHT": -270,
|
|
3619
3696
|
"temCANNOT_PREAUTH_SELF": -267,
|
|
3620
3697
|
"temDISABLED": -273,
|
|
@@ -3630,6 +3707,7 @@
|
|
|
3630
3707
|
"temREDUNDANT": -275,
|
|
3631
3708
|
"temRIPPLE_EMPTY": -274,
|
|
3632
3709
|
"temSEQ_AND_TICKET": -263,
|
|
3710
|
+
"temTEMP_DISABLED": -248,
|
|
3633
3711
|
"temUNCERTAIN": -265,
|
|
3634
3712
|
"temUNKNOWN": -264,
|
|
3635
3713
|
"temXCHAIN_BAD_PROOF": -259,
|
|
@@ -3638,6 +3716,7 @@
|
|
|
3638
3716
|
"temXCHAIN_BRIDGE_BAD_REWARD_AMOUNT": -255,
|
|
3639
3717
|
"temXCHAIN_BRIDGE_NONDOOR_OWNER": -257,
|
|
3640
3718
|
"temXCHAIN_EQUAL_DOOR_ACCOUNTS": -260,
|
|
3719
|
+
|
|
3641
3720
|
"terADDRESS_COLLISION": -86,
|
|
3642
3721
|
"terFUNDS_SPENT": -98,
|
|
3643
3722
|
"terINSUF_FEE_B": -97,
|
|
@@ -3653,6 +3732,7 @@
|
|
|
3653
3732
|
"terPRE_TICKET": -88,
|
|
3654
3733
|
"terQUEUED": -89,
|
|
3655
3734
|
"terRETRY": -99,
|
|
3735
|
+
|
|
3656
3736
|
"tesSUCCESS": 0
|
|
3657
3737
|
},
|
|
3658
3738
|
"TRANSACTION_TYPES": {
|
package/src/types/hash-128.ts
CHANGED
|
@@ -9,7 +9,7 @@ class Hash128 extends Hash {
|
|
|
9
9
|
static readonly ZERO_128: Hash128 = new Hash128(new Uint8Array(Hash128.width))
|
|
10
10
|
|
|
11
11
|
constructor(bytes: Uint8Array) {
|
|
12
|
-
if (bytes
|
|
12
|
+
if (bytes?.byteLength === 0) {
|
|
13
13
|
bytes = Hash128.ZERO_128.bytes
|
|
14
14
|
}
|
|
15
15
|
|