Merge PR #143: node -- remember a created wallet in the store catalogue
This commit is contained in:
commit
511c9e921d
3 changed files with 262 additions and 15 deletions
|
|
@ -587,11 +587,16 @@ impl Wire {
|
|||
/// Create a new spend-capable wallet. Returns the 25-word seed once so the
|
||||
/// UI can show a backup screen. The user does not paste a key on this path.
|
||||
/// Requires `ONIONWIRE_WALLET_RPC` pointed at a `--wallet-dir` RPC.
|
||||
///
|
||||
/// The core also records the new wallet in its catalogue (`Node::wallet_create`
|
||||
/// returns the stored row); the seed is what this surface carries.
|
||||
pub async fn create_wallet(&self, password: String) -> WResult<String> {
|
||||
self.node()?
|
||||
Ok(self
|
||||
.node()?
|
||||
.wallet_create(&password)
|
||||
.await
|
||||
.map_err(WireError::new)
|
||||
.map_err(WireError::new)?
|
||||
.seed)
|
||||
}
|
||||
|
||||
/// Re-read this wallet's 25-word seed so the UI can offer a "back up seed"
|
||||
|
|
@ -606,12 +611,14 @@ impl Wire {
|
|||
}
|
||||
|
||||
/// Import a wallet from an existing 25-word seed. This is the only path
|
||||
/// that takes a user-supplied secret.
|
||||
/// that takes a user-supplied secret. Like a create, the core records the
|
||||
/// imported wallet in its catalogue.
|
||||
pub async fn import_wallet(&self, password: String, seed: String) -> WResult<()> {
|
||||
self.node()?
|
||||
.wallet_restore(&password, &seed)
|
||||
.await
|
||||
.map_err(WireError::new)
|
||||
.map(|_| ())
|
||||
}
|
||||
|
||||
/// Start the app-owned wallet child (`monero-wallet-rpc`, plus `monerod` for
|
||||
|
|
|
|||
Loading…
Reference in a new issue