Merge pull request #1057 from nymtech/feature/fix_wallet_mnemonic
Add mnemonic just on creation, to display it
This commit is contained in:
@@ -92,6 +92,7 @@ mod test {
|
||||
crate::coin::Denom => "../src/types/rust/denom.ts",
|
||||
crate::utils::DelegationResult => "../src/types/rust/delegationresult.ts",
|
||||
crate::mixnet::account::Account => "../src/types/rust/account.ts",
|
||||
crate::mixnet::account::CreatedAccount => "../src/types/rust/createdaccount.ts",
|
||||
crate::mixnet::admin::TauriContractStateParams => "../src/types/rust/stateparams.ts",
|
||||
validator_client::models::CoreNodeStatusResponse => "../src/types/corenodestatusresponse.ts",
|
||||
validator_client::models::MixnodeStatus => "../src/types/rust/mixnodestatus.ts",
|
||||
|
||||
@@ -30,6 +30,13 @@ impl Account {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg_attr(test, derive(ts_rs::TS))]
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct CreatedAccount {
|
||||
account: Account,
|
||||
mnemonic: String,
|
||||
}
|
||||
|
||||
#[cfg_attr(test, derive(ts_rs::TS))]
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct Balance {
|
||||
@@ -74,10 +81,13 @@ pub async fn get_balance(
|
||||
#[tauri::command]
|
||||
pub async fn create_new_account(
|
||||
state: tauri::State<'_, Arc<RwLock<State>>>,
|
||||
) -> Result<Account, BackendError> {
|
||||
) -> Result<CreatedAccount, BackendError> {
|
||||
let rand_mnemonic = random_mnemonic();
|
||||
let account = connect_with_mnemonic(rand_mnemonic.to_string(), state).await?;
|
||||
Ok(account)
|
||||
Ok(CreatedAccount {
|
||||
account,
|
||||
mnemonic: rand_mnemonic.to_string(),
|
||||
})
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
import { Account } from "./account";
|
||||
|
||||
export interface CreatedAccount {
|
||||
account: Account;
|
||||
mnemonic: string;
|
||||
}
|
||||
Reference in New Issue
Block a user