mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-22 13:15:49 +00:00
fix(path-set): do not return undefined values in toJSON function (#118)
This commit is contained in:
@@ -117,26 +117,20 @@ class Hop extends SerializedType {
|
|||||||
const hopParser = new BinaryParser(this.bytes.toString("hex"));
|
const hopParser = new BinaryParser(this.bytes.toString("hex"));
|
||||||
const type = hopParser.readUInt8();
|
const type = hopParser.readUInt8();
|
||||||
|
|
||||||
let account,
|
const result: HopObject = {};
|
||||||
currency,
|
|
||||||
issuer: string | undefined = undefined;
|
|
||||||
if (type & TYPE_ACCOUNT) {
|
if (type & TYPE_ACCOUNT) {
|
||||||
account = (AccountID.fromParser(hopParser) as AccountID).toJSON();
|
result.account = (AccountID.fromParser(hopParser) as AccountID).toJSON();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type & TYPE_CURRENCY) {
|
if (type & TYPE_CURRENCY) {
|
||||||
currency = (Currency.fromParser(hopParser) as Currency).toJSON();
|
result.currency = (Currency.fromParser(hopParser) as Currency).toJSON();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type & TYPE_ISSUER) {
|
if (type & TYPE_ISSUER) {
|
||||||
issuer = (AccountID.fromParser(hopParser) as AccountID).toJSON();
|
result.issuer = (AccountID.fromParser(hopParser) as AccountID).toJSON();
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return result;
|
||||||
account: account,
|
|
||||||
issuer: issuer,
|
|
||||||
currency: currency,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user