Skip to content

Commit ec935d9

Browse files
committed
Fixed more imports in this file
1 parent 16ea9ec commit ec935d9

File tree

1 file changed

+18
-37
lines changed

1 file changed

+18
-37
lines changed

packages/docs/pages/integrating-with-namada/sdk/setting-up-a-wallet.mdx

Lines changed: 18 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,15 @@ In the second part of the above function, the key is derived from the mnemonic p
6161
It is also possible to create the sdk wallet from scratch. This is more involved because it requires generating a new store for the wallet to exist in.
6262

6363
```rust
64-
use std::path::PathBuf;
65-
66-
use namada::{
67-
sdk::wallet::{
68-
alias::Alias, ConfirmationResponse, GenRestoreKeyError, Store, StoredKeypair, Wallet,
69-
WalletUtils,
64+
use namada_sdk::{
65+
wallet::{
66+
Store,
67+
StoredKeypair,
68+
Wallet,
69+
WalletIo,
7070
},
71-
types::{
72-
address::Address,
73-
key::{common::SecretKey, PublicKeyHash},
71+
address::Address,
72+
key::{common::SecretKey, PublicKeyHash},
7473
},
7574
};
7675
use rand::rngs::OsRng;
@@ -82,7 +81,7 @@ pub struct SdkWallet {
8281
impl SdkWallet {
8382
pub fn new(sk: SecretKey, nam_address: Address) -> Self {
8483
let store = Store::default();
85-
let mut wallet = Wallet::new(PathBuf::new(), store);
84+
let mut wallet = Wallet::new(SdkWalletUtils {}, store);
8685
let stored_keypair = StoredKeypair::Raw(sk.clone());
8786
let pk_hash = PublicKeyHash::from(&sk.to_public());
8887
let alias = "alice".to_string();
@@ -94,37 +93,19 @@ impl SdkWallet {
9493

9594
pub struct SdkWalletUtils {}
9695

97-
impl WalletUtils for SdkWalletUtils {
98-
type Storage = PathBuf;
99-
96+
impl WalletIo for SdkWalletUtils {
10097
type Rng = OsRng;
98+
}
10199

102-
fn read_decryption_password() -> zeroize::Zeroizing<std::string::String> {
103-
panic!("attempted to prompt for password in non-interactive mode");
104-
}
105-
106-
fn read_encryption_password() -> zeroize::Zeroizing<std::string::String> {
107-
panic!("attempted to prompt for password in non-interactive mode");
108-
}
109-
110-
fn read_alias(_prompt_msg: &str) -> std::string::String {
111-
panic!("attempted to prompt for alias in non-interactive mode");
112-
}
113-
114-
fn read_mnemonic_code() -> std::result::Result<namada::bip39::Mnemonic, GenRestoreKeyError> {
115-
panic!("attempted to prompt for mnemonic in non-interactive mode");
116-
}
117-
118-
fn read_mnemonic_passphrase(_confirm: bool) -> zeroize::Zeroizing<std::string::String> {
119-
panic!("attempted to prompt for mnemonic in non-interactive mode");
100+
impl Clone for SdkWalletUtils {
101+
fn clone(&self) -> Self {
102+
SdkWalletUtils::new()
120103
}
104+
}
121105

122-
fn show_overwrite_confirmation(
123-
_alias: &Alias,
124-
_alias_for: &str,
125-
) -> namada::sdk::wallet::store::ConfirmationResponse {
126-
// Automatically replace aliases in non-interactive mode
127-
ConfirmationResponse::Replace
106+
impl SdkWalletUtils {
107+
fn new() -> Self {
108+
Self {}
128109
}
129110
}
130111
```

0 commit comments

Comments
 (0)