import { Component , OnInit } from '@angular/core' ; import { ApiService } from '@shared/services/api.service' ; import { GlobalService } from '@shared/services/global.service' ; import { WalletInfo } from '@shared/models/wallet-info' ; import { SnackbarService } from "ngx-snackbar" ; @ Component ( { selector : 'app-ext-pubkey' , templateUrl : './ext-pubkey.component.html' , styleUrls : [ './ext-pubkey.component.scss' ] } ) export class ExtPubkeyComponent implements OnInit { constructor ( private apiService , private globalService , private snackbarService ) { } public extPubKey : string ; public copied = false ; ngOnInit ( ) { const walletInfo = new WalletInfo ( this . globalService . getWalletName ( ) ) ; this . getExtPubKey ( walletInfo ) ; } private getExtPubKey ( walletInfo ) { this . apiService . getExtPubkey ( walletInfo ) . toPromise ( ) . then ( response => { this . extPubKey = response ; } ) ; } public onCopiedClick ( ) { this . copied = true ; this . snackbarService . add ( { msg : 'The Extended Public Key has been copied to your clipboard.' , customClass : 'notify-snack-bar' , action : { text : null } } ) ; } }