diff --git a/StratisCore.UI/src/app/wallet/receive/receive.component.html b/StratisCore.UI/src/app/wallet/receive/receive.component.html
index 17dc00db..be49d936 100644
--- a/StratisCore.UI/src/app/wallet/receive/receive.component.html
+++ b/StratisCore.UI/src/app/wallet/receive/receive.component.html
@@ -22,55 +22,57 @@
Receive
+
+
+
-
-
-
+
-
-
-
+
+
+
+
Your address has
been copied to your clipboard.
diff --git a/StratisCore.UI/src/app/wallet/receive/receive.component.ts b/StratisCore.UI/src/app/wallet/receive/receive.component.ts
index d3ac0358..d8e21999 100644
--- a/StratisCore.UI/src/app/wallet/receive/receive.component.ts
+++ b/StratisCore.UI/src/app/wallet/receive/receive.component.ts
@@ -7,6 +7,7 @@ import { ModalService } from '@shared/services/modal.service';
import { WalletInfo } from '@shared/models/wallet-info';
import { NgbModal, NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
+import { CurrentAccountService } from '@shared/services/current-account.service';
@Component({
selector: 'receive-component',
@@ -15,7 +16,8 @@ import { NgbModal, NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
})
export class ReceiveComponent {
- constructor(private apiService: ApiService, private globalService: GlobalService, public activeModal: NgbActiveModal, private genericModalService: ModalService) {}
+ accountsEnabled: boolean;
+ constructor(private apiService: ApiService, private globalService: GlobalService, public activeModal: NgbActiveModal, private genericModalService: ModalService, private currentAccountService: CurrentAccountService) {}
public address: any = "";
public qrString: any;
@@ -33,7 +35,15 @@ export class ReceiveComponent {
ngOnInit() {
this.sidechainEnabled = this.globalService.getSidechainEnabled();
- this.getUnusedReceiveAddresses();
+ this.accountsEnabled = this.sidechainEnabled && this.currentAccountService.hasActiveAddress();
+
+ if (!this.accountsEnabled) {
+ this.getUnusedReceiveAddresses();
+ }
+ else {
+ // If accounts are enabled, we just use the account address
+ this.getAccountAddress();
+ }
}
public onCopiedClick() {
@@ -56,13 +66,22 @@ export class ReceiveComponent {
.subscribe(
response => {
this.address = response;
- // TODO: fix this later to use the actual sidechain name instead of 'cirrus'
- const networkName = this.globalService.getSidechainEnabled() ? 'cirrus' : 'stratis';
- this.qrString = `${networkName}:${response}`;
+ this.setQrString(response);
}
);
}
+ private getAccountAddress() {
+ this.address = this.currentAccountService.getAddress();
+ this.setQrString(this.address);
+ }
+
+ private setQrString(address: string) {
+ // TODO: fix this later to use the actual sidechain name instead of 'cirrus'
+ const networkName = this.globalService.getSidechainEnabled() ? 'cirrus' : 'stratis';
+ this.qrString = `${networkName}:${address}`;
+ }
+
private getAddresses() {
let walletInfo = new WalletInfo(this.globalService.getWalletName())
this.apiService.getAllAddresses(walletInfo)