mirror of
https://github.com/lil-org/tokenary.git
synced 2025-01-08 06:36:33 +03:00
Drop Web3Swift usage in AccountsService
This commit is contained in:
parent
7e9ca15b1f
commit
ca52a484b5
@ -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? {
|
||||||
|
Loading…
Reference in New Issue
Block a user