fix: encoding issue with encoding non-traditional currency codes (#1857)

* add test

* fix decoding issue
This commit is contained in:
Mayukha Vadari
2021-12-02 14:43:26 -05:00
committed by GitHub
parent 8461ef6804
commit fe845de884
2 changed files with 8 additions and 1 deletions

View File

@@ -89,7 +89,7 @@ class Currency extends Hash160 {
if (this.bytes[0] !== 0) {
this._iso = null
} else if (code.toString('hex') === '000000') {
} else if (/^0*$/.test(this.bytes.toString('hex'))) {
this._iso = 'XRP'
} else {
this._iso = isoCodeFromHex(code)