Get suggested account for coin

This commit is contained in:
Ivan Grachev 2022-08-18 15:15:27 +03:00
parent ee3983e1da
commit f488fbadf6

View File

@ -84,6 +84,15 @@ final class WalletsManager {
}
}
func suggestedAccount(coin: CoinType) -> SpecificWalletAccount? {
for wallet in wallets {
if let account = wallet.accounts.first(where: { $0.coin == coin }) {
return SpecificWalletAccount(walletId: wallet.id, account: account)
}
}
return nil
}
private func createWallet(name: String, password: String) throws -> TokenaryWallet {
let key = StoredKey(name: name, password: Data(password.utf8))
let id = makeNewWalletId()