From e6dda6a93087545bbb53629a9d2c18f28dac303e Mon Sep 17 00:00:00 2001 From: keeri Date: Tue, 23 May 2023 13:35:14 +0000 Subject: [PATCH] receive page: auto-select account if it is the only account in the wallet --- src/app/components/receive/receive.component.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/app/components/receive/receive.component.ts b/src/app/components/receive/receive.component.ts index 1606cb6..ad11341 100644 --- a/src/app/components/receive/receive.component.ts +++ b/src/app/components/receive/receive.component.ts @@ -112,10 +112,14 @@ export class ReceiveComponent implements OnInit, OnDestroy { await this.updatePendingBlocks(); - // Set the account selected in the sidebar as default if (this.walletService.wallet.selectedAccount !== null) { + // Set the account selected in the sidebar as default this.pendingAccountModel = this.walletService.wallet.selectedAccount.id; this.onSelectedAccountChange(this.pendingAccountModel); + } else if (this.accounts.length === 1) { + // Auto-select account if it is the only account in the wallet + this.pendingAccountModel = this.accounts[0].id; + this.onSelectedAccountChange(this.pendingAccountModel); } // Listen as new transactions come in. Ignore the latest transaction that is already present on page load.