ripple-binary-codec 2.7.0-smartescrow.0 → 2.8.0-smartcontract.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 +173 -270
- package/dist/enums/src/enums/definitions.json +173 -270
- package/dist/quality.js +15 -3
- package/dist/quality.js.map +1 -1
- package/dist/serdes/binary-parser.js +8 -2
- package/dist/serdes/binary-parser.js.map +1 -1
- package/dist/serdes/binary-serializer.d.ts +1 -1
- package/dist/serdes/binary-serializer.js +2 -2
- package/dist/serdes/binary-serializer.js.map +1 -1
- package/dist/src/enums/definitions.json +173 -270
- package/dist/src/quality.js +15 -3
- package/dist/src/quality.js.map +1 -1
- package/dist/src/serdes/binary-parser.js +8 -2
- package/dist/src/serdes/binary-parser.js.map +1 -1
- package/dist/src/serdes/binary-serializer.d.ts +1 -1
- package/dist/src/serdes/binary-serializer.js +2 -2
- package/dist/src/serdes/binary-serializer.js.map +1 -1
- package/dist/src/types/account-id.d.ts +2 -0
- package/dist/src/types/account-id.js +4 -0
- package/dist/src/types/account-id.js.map +1 -1
- package/dist/src/types/amount.d.ts +2 -1
- package/dist/src/types/amount.js +25 -4
- package/dist/src/types/amount.js.map +1 -1
- package/dist/src/types/blob.d.ts +2 -1
- package/dist/src/types/blob.js +3 -0
- package/dist/src/types/blob.js.map +1 -1
- package/dist/src/types/currency.d.ts +2 -0
- package/dist/src/types/currency.js +4 -0
- package/dist/src/types/currency.js.map +1 -1
- package/dist/src/types/data.d.ts +86 -0
- package/dist/src/types/data.js +252 -0
- package/dist/src/types/data.js.map +1 -0
- package/dist/src/types/dataType.d.ts +94 -0
- package/dist/src/types/dataType.js +145 -0
- package/dist/src/types/dataType.js.map +1 -0
- package/dist/src/types/hash-128.d.ts +2 -0
- package/dist/src/types/hash-128.js +4 -0
- package/dist/src/types/hash-128.js.map +1 -1
- package/dist/src/types/hash-160.d.ts +2 -0
- package/dist/src/types/hash-160.js +4 -0
- package/dist/src/types/hash-160.js.map +1 -1
- package/dist/src/types/hash-192.d.ts +2 -0
- package/dist/src/types/hash-192.js +4 -0
- package/dist/src/types/hash-192.js.map +1 -1
- package/dist/src/types/hash-256.d.ts +2 -0
- package/dist/src/types/hash-256.js +4 -0
- package/dist/src/types/hash-256.js.map +1 -1
- package/dist/src/types/index.d.ts +3 -1
- package/dist/src/types/index.js +7 -1
- package/dist/src/types/index.js.map +1 -1
- package/dist/src/types/int-32.d.ts +17 -8
- package/dist/src/types/int-32.js +25 -11
- package/dist/src/types/int-32.js.map +1 -1
- package/dist/src/types/int.d.ts +38 -0
- package/dist/src/types/int.js +57 -0
- package/dist/src/types/int.js.map +1 -0
- package/dist/src/types/issue.d.ts +2 -1
- package/dist/src/types/issue.js +3 -0
- package/dist/src/types/issue.js.map +1 -1
- package/dist/src/types/json.d.ts +173 -0
- package/dist/src/types/json.js +531 -0
- package/dist/src/types/json.js.map +1 -0
- package/dist/src/types/path-set.d.ts +2 -1
- package/dist/src/types/path-set.js +3 -0
- package/dist/src/types/path-set.js.map +1 -1
- package/dist/src/types/serialized-type.d.ts +43 -0
- package/dist/src/types/serialized-type.js +63 -1
- package/dist/src/types/serialized-type.js.map +1 -1
- package/dist/src/types/st-array.d.ts +2 -1
- package/dist/src/types/st-array.js +3 -0
- package/dist/src/types/st-array.js.map +1 -1
- package/dist/src/types/st-number.d.ts +2 -1
- package/dist/src/types/st-number.js +3 -0
- package/dist/src/types/st-number.js.map +1 -1
- package/dist/src/types/st-object.d.ts +2 -1
- package/dist/src/types/st-object.js +9 -1
- package/dist/src/types/st-object.js.map +1 -1
- package/dist/src/types/uint-16.d.ts +2 -0
- package/dist/src/types/uint-16.js +4 -0
- package/dist/src/types/uint-16.js.map +1 -1
- package/dist/src/types/uint-32.d.ts +2 -0
- package/dist/src/types/uint-32.js +4 -0
- package/dist/src/types/uint-32.js.map +1 -1
- package/dist/src/types/uint-64.d.ts +2 -0
- package/dist/src/types/uint-64.js +4 -0
- package/dist/src/types/uint-64.js.map +1 -1
- package/dist/src/types/uint-8.d.ts +2 -0
- package/dist/src/types/uint-8.js +4 -0
- package/dist/src/types/uint-8.js.map +1 -1
- package/dist/src/types/vector-256.d.ts +2 -1
- package/dist/src/types/vector-256.js +3 -0
- package/dist/src/types/vector-256.js.map +1 -1
- package/dist/src/types/xchain-bridge.d.ts +2 -1
- package/dist/src/types/xchain-bridge.js +3 -0
- package/dist/src/types/xchain-bridge.js.map +1 -1
- package/dist/src/utils.js +1 -1
- package/dist/src/utils.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/account-id.d.ts +2 -0
- package/dist/types/account-id.js +4 -0
- package/dist/types/account-id.js.map +1 -1
- package/dist/types/amount.d.ts +2 -1
- package/dist/types/amount.js +25 -4
- package/dist/types/amount.js.map +1 -1
- package/dist/types/blob.d.ts +2 -1
- package/dist/types/blob.js +3 -0
- package/dist/types/blob.js.map +1 -1
- package/dist/types/currency.d.ts +2 -0
- package/dist/types/currency.js +4 -0
- package/dist/types/currency.js.map +1 -1
- package/dist/types/data.d.ts +86 -0
- package/dist/types/data.js +252 -0
- package/dist/types/data.js.map +1 -0
- package/dist/types/dataType.d.ts +94 -0
- package/dist/types/dataType.js +145 -0
- package/dist/types/dataType.js.map +1 -0
- package/dist/types/hash-128.d.ts +2 -0
- package/dist/types/hash-128.js +4 -0
- package/dist/types/hash-128.js.map +1 -1
- package/dist/types/hash-160.d.ts +2 -0
- package/dist/types/hash-160.js +4 -0
- package/dist/types/hash-160.js.map +1 -1
- package/dist/types/hash-192.d.ts +2 -0
- package/dist/types/hash-192.js +4 -0
- package/dist/types/hash-192.js.map +1 -1
- package/dist/types/hash-256.d.ts +2 -0
- package/dist/types/hash-256.js +4 -0
- package/dist/types/hash-256.js.map +1 -1
- package/dist/types/index.d.ts +3 -1
- package/dist/types/index.js +7 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/int-32.d.ts +17 -8
- package/dist/types/int-32.js +25 -11
- package/dist/types/int-32.js.map +1 -1
- package/dist/types/int.d.ts +38 -0
- package/dist/types/int.js +57 -0
- package/dist/types/int.js.map +1 -0
- package/dist/types/issue.d.ts +2 -1
- package/dist/types/issue.js +3 -0
- package/dist/types/issue.js.map +1 -1
- package/dist/types/json.d.ts +173 -0
- package/dist/types/json.js +531 -0
- package/dist/types/json.js.map +1 -0
- package/dist/types/path-set.d.ts +2 -1
- package/dist/types/path-set.js +3 -0
- package/dist/types/path-set.js.map +1 -1
- package/dist/types/serialized-type.d.ts +43 -0
- package/dist/types/serialized-type.js +63 -1
- package/dist/types/serialized-type.js.map +1 -1
- package/dist/types/st-array.d.ts +2 -1
- package/dist/types/st-array.js +3 -0
- package/dist/types/st-array.js.map +1 -1
- package/dist/types/st-number.d.ts +2 -1
- package/dist/types/st-number.js +3 -0
- package/dist/types/st-number.js.map +1 -1
- package/dist/types/st-object.d.ts +2 -1
- package/dist/types/st-object.js +9 -1
- package/dist/types/st-object.js.map +1 -1
- package/dist/types/uint-16.d.ts +2 -0
- package/dist/types/uint-16.js +4 -0
- package/dist/types/uint-16.js.map +1 -1
- package/dist/types/uint-32.d.ts +2 -0
- package/dist/types/uint-32.js +4 -0
- package/dist/types/uint-32.js.map +1 -1
- package/dist/types/uint-64.d.ts +2 -0
- package/dist/types/uint-64.js +4 -0
- package/dist/types/uint-64.js.map +1 -1
- package/dist/types/uint-8.d.ts +2 -0
- package/dist/types/uint-8.js +4 -0
- package/dist/types/uint-8.js.map +1 -1
- package/dist/types/vector-256.d.ts +2 -1
- package/dist/types/vector-256.js +3 -0
- package/dist/types/vector-256.js.map +1 -1
- package/dist/types/xchain-bridge.d.ts +2 -1
- package/dist/types/xchain-bridge.js +3 -0
- package/dist/types/xchain-bridge.js.map +1 -1
- package/dist/utils.js +1 -1
- package/dist/utils.js.map +1 -1
- package/package.json +2 -2
- package/src/enums/definitions.json +173 -270
- package/src/quality.ts +13 -3
- package/src/serdes/binary-parser.ts +12 -2
- package/src/serdes/binary-serializer.ts +2 -2
- package/src/types/account-id.ts +5 -0
- package/src/types/amount.ts +25 -6
- package/src/types/blob.ts +5 -1
- package/src/types/currency.ts +5 -0
- package/src/types/data.ts +294 -0
- package/src/types/dataType.ts +178 -0
- package/src/types/hash-128.ts +5 -0
- package/src/types/hash-160.ts +5 -0
- package/src/types/hash-192.ts +5 -0
- package/src/types/hash-256.ts +5 -0
- package/src/types/index.ts +6 -0
- package/src/types/int-32.ts +27 -12
- package/src/types/int.ts +75 -0
- package/src/types/issue.ts +5 -1
- package/src/types/json.ts +650 -0
- package/src/types/path-set.ts +5 -1
- package/src/types/serialized-type.ts +67 -0
- package/src/types/st-array.ts +5 -1
- package/src/types/st-number.ts +5 -1
- package/src/types/st-object.ts +12 -2
- package/src/types/uint-16.ts +5 -0
- package/src/types/uint-32.ts +5 -0
- package/src/types/uint-64.ts +6 -1
- package/src/types/uint-8.ts +5 -0
- package/src/types/vector-256.ts +5 -1
- package/src/types/xchain-bridge.ts +5 -1
- package/src/utils.ts +1 -1
|
@@ -2,6 +2,69 @@ import { BytesList } from '../serdes/binary-serializer'
|
|
|
2
2
|
import { BinaryParser } from '../serdes/binary-parser'
|
|
3
3
|
import { XrplDefinitionsBase } from '../enums'
|
|
4
4
|
import { bytesToHex } from '@xrplf/isomorphic/utils'
|
|
5
|
+
import definitions from '../enums/definitions.json'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Enum for SerializedTypeID values used in XRPL
|
|
9
|
+
* These match the C++ implementation's STI_ constants
|
|
10
|
+
*/
|
|
11
|
+
export enum SerializedTypeID {
|
|
12
|
+
STI_NOTPRESENT = 0,
|
|
13
|
+
STI_UINT16 = 1,
|
|
14
|
+
STI_UINT32 = 2,
|
|
15
|
+
STI_UINT64 = 3,
|
|
16
|
+
STI_UINT128 = 4,
|
|
17
|
+
STI_UINT256 = 5,
|
|
18
|
+
STI_AMOUNT = 6,
|
|
19
|
+
STI_VL = 7,
|
|
20
|
+
STI_ACCOUNT = 8,
|
|
21
|
+
STI_NUMBER = 9,
|
|
22
|
+
STI_INT32 = 10,
|
|
23
|
+
STI_INT64 = 11,
|
|
24
|
+
|
|
25
|
+
STI_OBJECT = 14,
|
|
26
|
+
STI_ARRAY = 15,
|
|
27
|
+
|
|
28
|
+
STI_UINT8 = 16,
|
|
29
|
+
STI_UINT160 = 17,
|
|
30
|
+
STI_PATHSET = 18,
|
|
31
|
+
STI_VECTOR256 = 19,
|
|
32
|
+
STI_UINT96 = 20,
|
|
33
|
+
STI_UINT192 = 21,
|
|
34
|
+
STI_UINT384 = 22,
|
|
35
|
+
STI_UINT512 = 23,
|
|
36
|
+
STI_ISSUE = 24,
|
|
37
|
+
STI_XCHAIN_BRIDGE = 25,
|
|
38
|
+
STI_CURRENCY = 26,
|
|
39
|
+
STI_DATA = 27,
|
|
40
|
+
STI_DATATYPE = 28,
|
|
41
|
+
STI_JSON = 29,
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Maps built dynamically from definitions.json TYPES.
|
|
46
|
+
* This ensures type string names (e.g. "Hash256", "Hash128") stay in sync
|
|
47
|
+
* with the canonical definitions rather than using hardcoded uppercase variants.
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
// Map of type name strings to SerializedTypeID values
|
|
51
|
+
export const TYPE_STRING_TO_ID: Record<string, SerializedTypeID> = {}
|
|
52
|
+
|
|
53
|
+
// Map of numeric type codes to SerializedTypeID values
|
|
54
|
+
export const TYPE_NUMBER_TO_ID: Record<number, SerializedTypeID> = {}
|
|
55
|
+
|
|
56
|
+
// Map of SerializedTypeID values to type name strings
|
|
57
|
+
export const TYPE_ID_TO_STRING: Record<number, string> = {}
|
|
58
|
+
|
|
59
|
+
// Populate all three maps from definitions.json TYPES
|
|
60
|
+
for (const [name, id] of Object.entries(definitions.TYPES)) {
|
|
61
|
+
if (id >= 0) {
|
|
62
|
+
const typeId = id as SerializedTypeID
|
|
63
|
+
TYPE_STRING_TO_ID[name] = typeId
|
|
64
|
+
TYPE_NUMBER_TO_ID[id] = typeId
|
|
65
|
+
TYPE_ID_TO_STRING[typeId] = name
|
|
66
|
+
}
|
|
67
|
+
}
|
|
5
68
|
|
|
6
69
|
type JSON = string | number | boolean | null | undefined | JSON[] | JsonObject
|
|
7
70
|
|
|
@@ -77,6 +140,10 @@ class SerializedType {
|
|
|
77
140
|
toString(): string {
|
|
78
141
|
return this.toHex()
|
|
79
142
|
}
|
|
143
|
+
|
|
144
|
+
getSType(): SerializedTypeID {
|
|
145
|
+
return this.getSType()
|
|
146
|
+
}
|
|
80
147
|
}
|
|
81
148
|
|
|
82
149
|
/**
|
package/src/types/st-array.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DEFAULT_DEFINITIONS, XrplDefinitionsBase } from '../enums'
|
|
2
|
-
import { SerializedType, JsonObject } from './serialized-type'
|
|
2
|
+
import { SerializedType, JsonObject, SerializedTypeID } from './serialized-type'
|
|
3
3
|
import { STObject } from './st-object'
|
|
4
4
|
import { BinaryParser } from '../serdes/binary-parser'
|
|
5
5
|
import { concat } from '@xrplf/isomorphic/utils'
|
|
@@ -108,6 +108,10 @@ class STArray extends SerializedType {
|
|
|
108
108
|
|
|
109
109
|
return result
|
|
110
110
|
}
|
|
111
|
+
|
|
112
|
+
getSType(): SerializedTypeID {
|
|
113
|
+
return SerializedTypeID.STI_ARRAY
|
|
114
|
+
}
|
|
111
115
|
}
|
|
112
116
|
|
|
113
117
|
export { STArray }
|
package/src/types/st-number.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable complexity -- required for various checks */
|
|
2
2
|
import { BinaryParser } from '../serdes/binary-parser'
|
|
3
|
-
import { SerializedType } from './serialized-type'
|
|
3
|
+
import { SerializedType, SerializedTypeID } from './serialized-type'
|
|
4
4
|
import { writeInt32BE, writeInt64BE, readInt32BE, readInt64BE } from '../utils'
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -307,4 +307,8 @@ export class STNumber extends SerializedType {
|
|
|
307
307
|
fractionPart ? '.' + fractionPart : ''
|
|
308
308
|
}`
|
|
309
309
|
}
|
|
310
|
+
|
|
311
|
+
getSType(): SerializedTypeID {
|
|
312
|
+
return SerializedTypeID.STI_NUMBER
|
|
313
|
+
}
|
|
310
314
|
}
|
package/src/types/st-object.ts
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
Bytes,
|
|
5
5
|
XrplDefinitionsBase,
|
|
6
6
|
} from '../enums'
|
|
7
|
-
import { SerializedType, JsonObject } from './serialized-type'
|
|
7
|
+
import { SerializedType, JsonObject, SerializedTypeID } from './serialized-type'
|
|
8
8
|
import { xAddressToClassicAddress, isValidXAddress } from 'ripple-address-codec'
|
|
9
9
|
import { BinaryParser } from '../serdes/binary-parser'
|
|
10
10
|
import { BinarySerializer, BytesList } from '../serdes/binary-serializer'
|
|
@@ -151,7 +151,13 @@ class STObject extends SerializedType {
|
|
|
151
151
|
? STArray.from(xAddressDecoded[field.name], definitions)
|
|
152
152
|
: field.type.name === 'UInt64'
|
|
153
153
|
? UInt64.from(xAddressDecoded[field.name], field.name)
|
|
154
|
-
: field.associatedType
|
|
154
|
+
: field.associatedType?.from
|
|
155
|
+
? field.associatedType.from(xAddressDecoded[field.name])
|
|
156
|
+
: (() => {
|
|
157
|
+
throw new Error(
|
|
158
|
+
`Type ${field.type.name} for field ${field.name} is missing associatedType.from`,
|
|
159
|
+
)
|
|
160
|
+
})()
|
|
155
161
|
|
|
156
162
|
if (associatedValue == undefined) {
|
|
157
163
|
throw new TypeError(
|
|
@@ -201,6 +207,10 @@ class STObject extends SerializedType {
|
|
|
201
207
|
|
|
202
208
|
return accumulator
|
|
203
209
|
}
|
|
210
|
+
|
|
211
|
+
getSType(): SerializedTypeID {
|
|
212
|
+
return SerializedTypeID.STI_OBJECT
|
|
213
|
+
}
|
|
204
214
|
}
|
|
205
215
|
|
|
206
216
|
export { STObject }
|
package/src/types/uint-16.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { UInt } from './uint'
|
|
2
2
|
import { BinaryParser } from '../serdes/binary-parser'
|
|
3
3
|
import { readUInt16BE, writeUInt16BE } from '../utils'
|
|
4
|
+
import { SerializedTypeID } from './serialized-type'
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Derived UInt class for serializing/deserializing 16 bit UInt
|
|
@@ -48,6 +49,10 @@ class UInt16 extends UInt {
|
|
|
48
49
|
valueOf(): number {
|
|
49
50
|
return parseInt(readUInt16BE(this.bytes, 0))
|
|
50
51
|
}
|
|
52
|
+
|
|
53
|
+
getSType(): SerializedTypeID {
|
|
54
|
+
return SerializedTypeID.STI_UINT16
|
|
55
|
+
}
|
|
51
56
|
}
|
|
52
57
|
|
|
53
58
|
export { UInt16 }
|
package/src/types/uint-32.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { UInt } from './uint'
|
|
2
2
|
import { BinaryParser } from '../serdes/binary-parser'
|
|
3
3
|
import { readUInt32BE, writeUInt32BE } from '../utils'
|
|
4
|
+
import { SerializedTypeID } from './serialized-type'
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Derived UInt class for serializing/deserializing 32 bit UInt
|
|
@@ -54,6 +55,10 @@ class UInt32 extends UInt {
|
|
|
54
55
|
valueOf(): number {
|
|
55
56
|
return parseInt(readUInt32BE(this.bytes, 0), 10)
|
|
56
57
|
}
|
|
58
|
+
|
|
59
|
+
getSType(): SerializedTypeID {
|
|
60
|
+
return SerializedTypeID.STI_UINT32
|
|
61
|
+
}
|
|
57
62
|
}
|
|
58
63
|
|
|
59
64
|
export { UInt32 }
|
package/src/types/uint-64.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { BinaryParser } from '../serdes/binary-parser'
|
|
|
3
3
|
import { bytesToHex, concat, hexToBytes } from '@xrplf/isomorphic/utils'
|
|
4
4
|
import { readUInt32BE, writeUInt32BE } from '../utils'
|
|
5
5
|
import { DEFAULT_DEFINITIONS, XrplDefinitionsBase } from '../enums'
|
|
6
|
+
import { SerializedTypeID } from './serialized-type'
|
|
6
7
|
|
|
7
8
|
const HEX_REGEX = /^[a-fA-F0-9]{1,16}$/
|
|
8
9
|
const BASE10_REGEX = /^[0-9]{1,20}$/
|
|
@@ -51,7 +52,7 @@ class UInt64 extends UInt {
|
|
|
51
52
|
return val
|
|
52
53
|
}
|
|
53
54
|
|
|
54
|
-
let buf = new Uint8Array(UInt64.width)
|
|
55
|
+
let buf: Uint8Array = new Uint8Array(UInt64.width)
|
|
55
56
|
|
|
56
57
|
if (typeof val === 'number' && Number.isInteger(val)) {
|
|
57
58
|
if (val < 0) {
|
|
@@ -131,6 +132,10 @@ class UInt64 extends UInt {
|
|
|
131
132
|
toBytes(): Uint8Array {
|
|
132
133
|
return this.bytes
|
|
133
134
|
}
|
|
135
|
+
|
|
136
|
+
getSType(): SerializedTypeID {
|
|
137
|
+
return SerializedTypeID.STI_UINT64
|
|
138
|
+
}
|
|
134
139
|
}
|
|
135
140
|
|
|
136
141
|
export { UInt64 }
|
package/src/types/uint-8.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { UInt } from './uint'
|
|
|
2
2
|
import { BinaryParser } from '../serdes/binary-parser'
|
|
3
3
|
import { bytesToHex } from '@xrplf/isomorphic/utils'
|
|
4
4
|
import { writeUInt8 } from '../utils'
|
|
5
|
+
import { SerializedTypeID } from './serialized-type'
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Derived UInt class for serializing/deserializing 8 bit UInt
|
|
@@ -47,6 +48,10 @@ class UInt8 extends UInt {
|
|
|
47
48
|
valueOf(): number {
|
|
48
49
|
return parseInt(bytesToHex(this.bytes), 16)
|
|
49
50
|
}
|
|
51
|
+
|
|
52
|
+
getSType(): SerializedTypeID {
|
|
53
|
+
return SerializedTypeID.STI_UINT8
|
|
54
|
+
}
|
|
50
55
|
}
|
|
51
56
|
|
|
52
57
|
export { UInt8 }
|
package/src/types/vector-256.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SerializedType } from './serialized-type'
|
|
1
|
+
import { SerializedType, SerializedTypeID } from './serialized-type'
|
|
2
2
|
import { BinaryParser } from '../serdes/binary-parser'
|
|
3
3
|
import { Hash256 } from './hash-256'
|
|
4
4
|
import { BytesList } from '../serdes/binary-serializer'
|
|
@@ -74,6 +74,10 @@ class Vector256 extends SerializedType {
|
|
|
74
74
|
}
|
|
75
75
|
return result
|
|
76
76
|
}
|
|
77
|
+
|
|
78
|
+
getSType(): SerializedTypeID {
|
|
79
|
+
return SerializedTypeID.STI_VECTOR256
|
|
80
|
+
}
|
|
77
81
|
}
|
|
78
82
|
|
|
79
83
|
export { Vector256 }
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BinaryParser } from '../serdes/binary-parser'
|
|
2
2
|
|
|
3
3
|
import { AccountID } from './account-id'
|
|
4
|
-
import { JsonObject, SerializedType } from './serialized-type'
|
|
4
|
+
import { JsonObject, SerializedType, SerializedTypeID } from './serialized-type'
|
|
5
5
|
import { Issue, IssueObject } from './issue'
|
|
6
6
|
import { concat } from '@xrplf/isomorphic/utils'
|
|
7
7
|
|
|
@@ -123,6 +123,10 @@ class XChainBridge extends SerializedType {
|
|
|
123
123
|
})
|
|
124
124
|
return json as XChainBridgeObject
|
|
125
125
|
}
|
|
126
|
+
|
|
127
|
+
getSType(): SerializedTypeID {
|
|
128
|
+
return SerializedTypeID.STI_XCHAIN_BRIDGE
|
|
129
|
+
}
|
|
126
130
|
}
|
|
127
131
|
|
|
128
132
|
export { XChainBridge, XChainBridgeObject }
|
package/src/utils.ts
CHANGED
|
@@ -196,7 +196,7 @@ export function compare(a: TypedArray, b: TypedArray): 1 | -1 | 0 {
|
|
|
196
196
|
throw new Error('Cannot compare arrays of different length')
|
|
197
197
|
}
|
|
198
198
|
|
|
199
|
-
for (let i = 0; i < a.length
|
|
199
|
+
for (let i = 0; i < a.length; i += 1) {
|
|
200
200
|
if (a[i] > b[i]) return 1
|
|
201
201
|
if (a[i] < b[i]) return -1
|
|
202
202
|
}
|