mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 12:15:51 +00:00
JS: Add support for config accounts to UInt160.parseJson().
This commit is contained in:
committed by
Stefan Thomas
parent
8792871e48
commit
9f9ad852a1
@@ -14,7 +14,7 @@ var UInt160 = function () {
|
||||
};
|
||||
|
||||
UInt160.from_json = function (j) {
|
||||
return (new UInt160()).parse_json(j);
|
||||
return (new UInt160()).parse_json(j in accounts ? accounts[j].account : j);
|
||||
};
|
||||
|
||||
UInt160.prototype.clone = function() {
|
||||
@@ -140,6 +140,12 @@ Currency.prototype.to_human = function() {
|
||||
return this.value ? this.value : "XNS";
|
||||
};
|
||||
|
||||
var accounts = {};
|
||||
|
||||
var setAccounts = function (accounts_new) {
|
||||
accounts = accounts_new;
|
||||
};
|
||||
|
||||
var Amount = function () {
|
||||
// Json format:
|
||||
// integer : XNS
|
||||
@@ -394,6 +400,7 @@ Amount.prototype.parse_json = function(j) {
|
||||
return this;
|
||||
};
|
||||
|
||||
exports.setAccounts = setAccounts;
|
||||
exports.Amount = Amount;
|
||||
exports.Currency = Currency;
|
||||
exports.UInt160 = UInt160;
|
||||
|
||||
Reference in New Issue
Block a user