@transia/ripple-binary-codec 1.4.6-alpha.4 → 1.4.6-alpha.5
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/types/currency.js
CHANGED
|
@@ -13,7 +13,7 @@ const STANDARD_FORMAT_HEX_REGEX = /^0{24}[\x00-\x7F]{6}0{10}$/;
|
|
|
13
13
|
*/
|
|
14
14
|
function isoToBytes(iso) {
|
|
15
15
|
const bytes = buffer_1.Buffer.alloc(20);
|
|
16
|
-
if (iso !== '
|
|
16
|
+
if (iso !== 'XAH') {
|
|
17
17
|
const isoBytes = iso.split('').map((c) => c.charCodeAt(0));
|
|
18
18
|
bytes.set(isoBytes, 12);
|
|
19
19
|
}
|
|
@@ -27,7 +27,7 @@ function isIsoCode(iso) {
|
|
|
27
27
|
}
|
|
28
28
|
function isoCodeFromHex(code) {
|
|
29
29
|
const iso = code.toString();
|
|
30
|
-
if (iso === '
|
|
30
|
+
if (iso === 'XAH') {
|
|
31
31
|
return null;
|
|
32
32
|
}
|
|
33
33
|
if (isIsoCode(iso)) {
|
|
@@ -78,7 +78,7 @@ class Currency extends hash_160_1.Hash160 {
|
|
|
78
78
|
super(byteBuf !== null && byteBuf !== void 0 ? byteBuf : Currency.XRP.bytes);
|
|
79
79
|
const hex = this.bytes.toString('hex');
|
|
80
80
|
if (XRP_HEX_REGEX.test(hex)) {
|
|
81
|
-
this._iso = '
|
|
81
|
+
this._iso = 'XAH';
|
|
82
82
|
}
|
|
83
83
|
else if (STANDARD_FORMAT_HEX_REGEX.test(hex)) {
|
|
84
84
|
this._iso = isoCodeFromHex(this.bytes.slice(12, 15));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@transia/ripple-binary-codec",
|
|
3
|
-
"version": "1.4.6-alpha.
|
|
3
|
+
"version": "1.4.6-alpha.5",
|
|
4
4
|
"description": "XRP Ledger binary codec",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/*",
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"engines": {
|
|
41
41
|
"node": ">= 10"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "ac865e472ee71484a692fa4484106c7a0fa0865c"
|
|
44
44
|
}
|
|
@@ -2904,7 +2904,7 @@
|
|
|
2904
2904
|
"type_id": 6,
|
|
2905
2905
|
"is_native": true,
|
|
2906
2906
|
"type": "Amount",
|
|
2907
|
-
"error": "1000000000000 absolute
|
|
2907
|
+
"error": "1000000000000 absolute XAH is bigger than max native value 100000000000.0",
|
|
2908
2908
|
"is_negative": false
|
|
2909
2909
|
},
|
|
2910
2910
|
{
|
|
@@ -2912,7 +2912,7 @@
|
|
|
2912
2912
|
"type_id": 6,
|
|
2913
2913
|
"is_native": true,
|
|
2914
2914
|
"type": "Amount",
|
|
2915
|
-
"error": "10000000000000000000 absolute
|
|
2915
|
+
"error": "10000000000000000000 absolute XAH is bigger than max native value 100000000000.0",
|
|
2916
2916
|
"is_negative": true
|
|
2917
2917
|
}
|
|
2918
2918
|
]
|
package/test/hash.test.js
CHANGED
|
@@ -77,7 +77,7 @@ describe('Hash256', function () {
|
|
|
77
77
|
|
|
78
78
|
describe('Currency', function () {
|
|
79
79
|
test('Decoding allows dodgy XRP without throwing', function () {
|
|
80
|
-
const currencyCode = '
|
|
80
|
+
const currencyCode = '0000000000000000000000005841480000000000'
|
|
81
81
|
expect(Currency.from(currencyCode).toJSON()).toBe(currencyCode)
|
|
82
82
|
})
|
|
83
83
|
test('Currency code with lowercase letters decodes to ISO code', () => {
|
|
@@ -113,7 +113,7 @@ describe('Currency', function () {
|
|
|
113
113
|
|
|
114
114
|
test('can be constructed from a Buffer', function () {
|
|
115
115
|
const xrp = new Currency(Buffer.alloc(20))
|
|
116
|
-
expect(xrp.iso()).toBe('
|
|
116
|
+
expect(xrp.iso()).toBe('XAH')
|
|
117
117
|
})
|
|
118
118
|
test('Can handle non-standard currency codes', () => {
|
|
119
119
|
const currency = '015841551A748AD2C1F76FF6ECB0CCCD00000000'
|
|
@@ -58,7 +58,7 @@ describe('encoding and decoding tx_json', function () {
|
|
|
58
58
|
Sequence: 19,
|
|
59
59
|
LimitAmount: {
|
|
60
60
|
value: '200',
|
|
61
|
-
currency: '
|
|
61
|
+
currency: '0000000000000000000000005841480000000000',
|
|
62
62
|
issuer: 'r9hEDb4xBGRfBCcX3E4FirDWQBAYtpxC8K',
|
|
63
63
|
},
|
|
64
64
|
Fee: '10',
|