Drop Web3Swift usage in AccountsService

This commit is contained in:
Ivan Grachev 2021-07-12 21:47:41 +03:00
parent 7e9ca15b1f
commit ca52a484b5

View File

@ -1,14 +1,16 @@
// Copyright © 2021 Encrypted Ink. All rights reserved. // Copyright © 2021 Encrypted Ink. All rights reserved.
import Foundation import Foundation
import Web3Swift
import WalletCore import WalletCore
struct AccountsService { struct AccountsService {
static func validateAccountKey(_ key: String) -> Bool { static func validateAccountKey(_ key: String) -> Bool {
let address = try? EthPrivateKey(hex: key).address().value() if let data = Data(hexString: key) {
return address != nil return PrivateKey.isValid(data: data, curve: CoinType.ethereum.curve)
} else {
return false
}
} }
static func addAccount(privateKey: String) -> Account? { static func addAccount(privateKey: String) -> Account? {