ripple-binary-codec
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -56,2 +56,8 @@ "use strict"; | ||
AccountID.fromBase58 = function (value) { | ||
if (ripple_address_codec_1.isValidXAddress(value)) { | ||
var classic = ripple_address_codec_1.xAddressToClassicAddress(value); | ||
if (classic.tag !== false) | ||
throw new Error("Only allowed to have tag on Account or Destination"); | ||
value = classic.classicAddress; | ||
} | ||
return new AccountID(buffer_1.Buffer.from(ripple_address_codec_1.decodeAccountID(value))); | ||
@@ -58,0 +64,0 @@ }; |
@@ -110,17 +110,13 @@ "use strict"; | ||
var type = hopParser.readUInt8(); | ||
var account, currency, issuer = undefined; | ||
var result = {}; | ||
if (type & TYPE_ACCOUNT) { | ||
account = account_id_1.AccountID.fromParser(hopParser).toJSON(); | ||
result.account = account_id_1.AccountID.fromParser(hopParser).toJSON(); | ||
} | ||
if (type & TYPE_CURRENCY) { | ||
currency = currency_1.Currency.fromParser(hopParser).toJSON(); | ||
result.currency = currency_1.Currency.fromParser(hopParser).toJSON(); | ||
} | ||
if (type & TYPE_ISSUER) { | ||
issuer = account_id_1.AccountID.fromParser(hopParser).toJSON(); | ||
result.issuer = account_id_1.AccountID.fromParser(hopParser).toJSON(); | ||
} | ||
return { | ||
account: account, | ||
issuer: issuer, | ||
currency: currency, | ||
}; | ||
return result; | ||
}; | ||
@@ -127,0 +123,0 @@ /** |
@@ -74,3 +74,3 @@ "use strict"; | ||
} | ||
throw new Error("Cannot construct Currency from value given"); | ||
throw new Error("Cannot construct STArray from value given"); | ||
}; | ||
@@ -77,0 +77,0 @@ /** |
# ripple-binary-codec Release History | ||
## 1.1.1 (2021-02-12) | ||
- PathSet.toJSON() does not return undefined values | ||
- Add support for X-Addresses in Issued Currency Amounts | ||
- Fix STArray error message | ||
## 1.1.0 (2020-12-03) | ||
@@ -4,0 +9,0 @@ - Add support for Tickets (TicketBatch amendment) |
{ | ||
"name": "ripple-binary-codec", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "XRP Ledger binary codec", | ||
@@ -5,0 +5,0 @@ "files": [ |
@@ -98,2 +98,26 @@ const { encode, decode } = require("./../dist/index"); | ||
let json_issued_x = { | ||
TakerPays: { | ||
currency: "USD", | ||
issuer: "X7WZKEeNVS2p9Tire9DtNFkzWBZbFtJHWxDjN9fCrBGqVA4", | ||
value: "7072.8", | ||
}, | ||
}; | ||
let json_issued_r = { | ||
TakerPays: { | ||
currency: "USD", | ||
issuer: "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B", | ||
value: "7072.8", | ||
}, | ||
}; | ||
let json_issued_with_tag = { | ||
TakerPays: { | ||
currency: "USD", | ||
issuer: "X7WZKEeNVS2p9Tire9DtNFkzWBZbFtSiS2eDBib7svZXuc2", | ||
value: "7072.8", | ||
}, | ||
}; | ||
describe("X-Address Account is equivalent to a classic address w/ SourceTag", () => { | ||
@@ -118,2 +142,6 @@ let encoded_x = encode(json_x1); | ||
}); | ||
test("Encodes issued currency w/ x-address", () => { | ||
expect(encode(json_issued_x)).toEqual(encode(json_issued_r)); | ||
}); | ||
}); | ||
@@ -133,2 +161,8 @@ | ||
}); | ||
test("Throws when issued currency has tag", () => { | ||
expect(() => encode(json_issued_with_tag)).toThrow( | ||
"Only allowed to have tag on Account or Destination" | ||
); | ||
}); | ||
}); | ||
@@ -135,0 +169,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
0
1083667
144
16617