-
Notifications
You must be signed in to change notification settings - Fork 441
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
new account #29
Comments
Here's an example for a password protected keystore called //First you need a `KeystoreManager` instance:
guard let userDirectory = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first,
let keystoreManager = KeystoreManager.managerForPath(userDirectory + "/keystore")
else {
fatalError("Couldn't create a KeystoreManager.")
}
//Next you create the a new Keystore:
let newKeystore = try? EthereumKeystoreV3(password: "YOUR_PASSWORD")
// Then you save the created keystore to the file system:
let newKeystoreJSON = try? JSONEncoder().encode(newKeystore.keystoreParams)
FileManager.default.createFile(atPath: "\(keystoreManager.path)/keystore.json", contents: newKeystoreJSON, attributes: nil)
// Later you can retreive it:
if let address = keystoreManager.addresses?.first,
let retrievedKeystore = keystoreManager.walletForAddress(address) as? EthereumKeystoreV3 {
return retrievedKeystore
} |
Now there is an example in README how to create it, will also add how to attach it and why |
thanks, @matijakregar for great example Btw, here is "How to create account" example in readme: https://github.com/matterinc/web3swift#create-account |
It seems that the issue is resolved, so its closed |
Can have an example of creating a new account?
The text was updated successfully, but these errors were encountered: