mirror of
https://github.com/lil-org/tokenary.git
synced 2025-01-07 14:10:28 +03:00
Mirror Wallet changes in TokenaryWallet
This commit is contained in:
parent
17cd7b9878
commit
76130c3d40
16
Pods/TrustWalletCore/Sources/Wallet.swift
generated
16
Pods/TrustWalletCore/Sources/Wallet.swift
generated
@ -43,6 +43,22 @@ public final class Wallet: Hashable, Equatable {
|
||||
return account
|
||||
}
|
||||
|
||||
/// Returns the account for a specific coin and derivation.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - password: wallet encryption password
|
||||
/// - coin: coin type
|
||||
/// - derivation: derivation, a specific or default
|
||||
/// - Returns: the account
|
||||
/// - Throws: `KeyStore.Error.invalidPassword` if the password is incorrect.
|
||||
public func getAccount(password: String, coin: CoinType, derivation: Derivation) throws -> Account {
|
||||
let wallet = key.wallet(password: Data(password.utf8))
|
||||
guard let account = key.accountForCoinDerivation(coin: coin, derivation: derivation, wallet: wallet) else {
|
||||
throw KeyStore.Error.invalidPassword
|
||||
}
|
||||
return account
|
||||
}
|
||||
|
||||
/// Returns the accounts for a specific coins.
|
||||
///
|
||||
/// - Parameters:
|
||||
|
@ -24,6 +24,12 @@ final class TokenaryWallet: Hashable, Equatable {
|
||||
return account
|
||||
}
|
||||
|
||||
func getAccount(password: String, coin: CoinType, derivation: Derivation) throws -> Account {
|
||||
let wallet = key.wallet(password: Data(password.utf8))
|
||||
guard let account = key.accountForCoinDerivation(coin: coin, derivation: derivation, wallet: wallet) else { throw KeyStore.Error.invalidPassword }
|
||||
return account
|
||||
}
|
||||
|
||||
func getAccounts(password: String, coins: [CoinType]) throws -> [Account] {
|
||||
guard let wallet = key.wallet(password: Data(password.utf8)) else { throw KeyStore.Error.invalidPassword }
|
||||
return coins.compactMap({ key.accountForCoin(coin: $0, wallet: wallet) })
|
||||
|
Loading…
Reference in New Issue
Block a user