Skip to content

Commit

Permalink
factor out _isClosed to MoneroWallet
Browse files Browse the repository at this point in the history
  • Loading branch information
woodser committed Jan 27, 2024
1 parent 50e321b commit 8a43b08
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/main/ts/wallet/MoneroWallet.ts
Expand Up @@ -69,6 +69,7 @@ export default class MoneroWallet {
protected connectionManager: MoneroConnectionManager;
protected connectionManagerListener: MoneroConnectionManagerListener;
protected listeners: MoneroWalletListener[] = [];
protected _isClosed = false;

/**
* Hidden constructor.
Expand Down Expand Up @@ -1382,6 +1383,7 @@ export default class MoneroWallet {
this.connectionManager = undefined;
this.connectionManagerListener = undefined;
this.listeners.splice(0, this.listeners.length);
this._isClosed = true;
}

/**
Expand All @@ -1390,7 +1392,7 @@ export default class MoneroWallet {
* @return {Promise<boolean>} true if the wallet is closed, false otherwise
*/
async isClosed(): Promise<boolean> {
throw new MoneroError("Not supported");
return this._isClosed;
}

// -------------------------------- PRIVATE ---------------------------------
Expand Down
2 changes: 0 additions & 2 deletions src/main/ts/wallet/MoneroWalletKeys.ts
Expand Up @@ -20,7 +20,6 @@ export class MoneroWalletKeys extends MoneroWallet {
protected cppAddress: string;
protected module: any;
protected walletProxy: MoneroWalletKeysProxy;
protected _isClosed: boolean;

// --------------------------- STATIC UTILITIES -----------------------------

Expand Down Expand Up @@ -169,7 +168,6 @@ export class MoneroWalletKeys extends MoneroWallet {
*/
constructor(cppAddress, walletProxy?: MoneroWalletKeysProxy) {
super();
this._isClosed = false;
if (!cppAddress && !walletProxy) throw new MoneroError("Must provide cppAddress or walletProxy");
if (walletProxy) this.walletProxy = walletProxy;
else {
Expand Down

0 comments on commit 8a43b08

Please sign in to comment.