Skip to content
This repository has been archived by the owner on May 24, 2021. It is now read-only.

Commit

Permalink
Add current account service
Browse files Browse the repository at this point in the history
  • Loading branch information
Rowan de Haas committed Jul 30, 2019
1 parent e7f29c4 commit ced4504
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
27 changes: 27 additions & 0 deletions StratisCore.UI/src/app/shared/services/current-account.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { Injectable } from '@angular/core';

/*
* Used to maintain the state of the currently selected address in CirrusCore.
*/
@Injectable({
providedIn: 'root'
})
export class CurrentAccountService {

address: string;

constructor() { }

getAddress() {
return this.address;
}

setAddress(value: string) {
this.address = value;
}

hasActiveAddress() {
return !!this.address;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { ModalService } from '@shared/services/modal.service';
import { catchError, takeUntil, switchMap } from 'rxjs/operators';
import { of, Subject } from 'rxjs';
import { CurrentAccountService } from '@shared/services/current-account.service';

@Component({
selector: 'app-address-selection',
Expand All @@ -23,7 +24,8 @@ export class AddressSelectionComponent implements OnInit {
unsubscribe: Subject<void> = new Subject();

constructor(private globalService: GlobalService,
private smartContractsService: SmartContractsServiceBase) {
private smartContractsService: SmartContractsServiceBase,
private currentAccountService: CurrentAccountService) {

this.coinUnit = this.globalService.getCoinUnit();
this.walletName = this.globalService.getWalletName();
Expand Down

0 comments on commit ced4504

Please sign in to comment.