mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-29 16:45:49 +00:00
JS: Fix for multiple Account instances (which caused multiple subscriptions.)
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
// Routines for working with an account.
|
// Routines for working with an account.
|
||||||
//
|
//
|
||||||
|
// You should not instantiate this class yourself, instead use Remote#account.
|
||||||
|
//
|
||||||
// Events:
|
// Events:
|
||||||
// wallet_clean : True, iff the wallet has been updated.
|
// wallet_clean : True, iff the wallet has been updated.
|
||||||
// wallet_dirty : True, iff the wallet needs to be updated.
|
// wallet_dirty : True, iff the wallet needs to be updated.
|
||||||
|
|||||||
@@ -1111,11 +1111,17 @@ Remote.prototype.request_owner_count = function (account, current) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Remote.prototype.account = function (accountId) {
|
Remote.prototype.account = function (accountId) {
|
||||||
|
accountId = UInt160.json_rewrite(accountId);
|
||||||
|
|
||||||
|
if (!this._accounts[accountId]) {
|
||||||
var account = new Account(this, accountId);
|
var account = new Account(this, accountId);
|
||||||
|
|
||||||
if (!account.is_valid()) return account;
|
if (!account.is_valid()) return account;
|
||||||
|
|
||||||
return this._accounts[account.to_json()] = account;
|
this._accounts[accountId] = account;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this._accounts[accountId];
|
||||||
};
|
};
|
||||||
|
|
||||||
Remote.prototype.book = function (currency_out, issuer_out,
|
Remote.prototype.book = function (currency_out, issuer_out,
|
||||||
@@ -1130,7 +1136,7 @@ Remote.prototype.book = function (currency_out, issuer_out,
|
|||||||
// Return the next account sequence if possible.
|
// Return the next account sequence if possible.
|
||||||
// <-- undefined or Sequence
|
// <-- undefined or Sequence
|
||||||
Remote.prototype.account_seq = function (account, advance) {
|
Remote.prototype.account_seq = function (account, advance) {
|
||||||
var account = UInt160.json_rewrite(account);
|
account = UInt160.json_rewrite(account);
|
||||||
var account_info = this.accounts[account];
|
var account_info = this.accounts[account];
|
||||||
var seq;
|
var seq;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user