import { Component , OnInit } from "@angular/core" ; import { ModalController } from "@ionic/angular" ; import { Contact , Wallet } from "@/models/model" ; import { ArkApiProvider } from "@/services/ark-api/ark-api" ; import { UserDataService } from "@/services/user-data/user-data.interface" ; @ Component ( { templateUrl : "wallet-picker.modal.html" , } ) export class WalletPickerModal implements OnInit { public contacts = [ ] ; public wallets = [ ] ; public symbol : string ; constructor ( private modalCtrl , private userDataService , private arkApiProvider ) { } ngOnInit ( ) { const profile = this . userDataService . currentProfile ; const network = this . userDataService . currentNetwork ; this . symbol = network . symbol ; this . contacts = Object . values ( profile . contacts ) ; this . wallets = Object . values ( profile . wallets ) . filter ( ( wallet ) => this . arkApiProvider . validateAddress ( wallet . address ) ) . map ( ( wallet ) => ( { name : wallet . label , address : wallet . address , } ) ) ; } onPick ( wallet ) { this . modalCtrl . dismiss ( wallet ) ; } }