Skip to content

Commit 9fde1f3

Browse files
more work
1 parent 6271e4f commit 9fde1f3

File tree

5 files changed

+9
-19
lines changed

5 files changed

+9
-19
lines changed

dash-spv/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ async fn run() -> Result<(), Box<dyn std::error::Error>> {
230230
spv_wallet.base.create_wallet_from_mnemonic(
231231
"enemy check owner stumble unaware debris suffer peanut good fabric bleak outside",
232232
"",
233-
Some(network),
233+
&[network],
234234
None,
235235
key_wallet::wallet::initialization::WalletAccountCreationOptions::default(),
236236
)?;

key-wallet-ffi/src/wallet_manager.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -93,17 +93,7 @@ pub unsafe extern "C" fn wallet_manager_add_wallet_from_mnemonic_with_options(
9393
}
9494
};
9595

96-
let network_rust: Network = match network.try_into() {
97-
Ok(n) => n,
98-
Err(_) => {
99-
FFIError::set_error(
100-
error,
101-
FFIErrorCode::InvalidInput,
102-
"Must specify exactly one network".to_string(),
103-
);
104-
return false;
105-
}
106-
};
96+
let networks_rust = network.parse_networks();
10797

10898
unsafe {
10999
let manager_ref = &*manager;
@@ -130,7 +120,7 @@ pub unsafe extern "C" fn wallet_manager_add_wallet_from_mnemonic_with_options(
130120
match manager_guard.create_wallet_from_mnemonic(
131121
mnemonic_str,
132122
passphrase_str,
133-
network_rust,
123+
networks_rust.as_slice(),
134124
None, // birth_height
135125
creation_options,
136126
) {

key-wallet-manager/examples/wallet_creation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ fn main() {
4949
let result = manager.create_wallet_from_mnemonic(
5050
test_mnemonic,
5151
"", // No passphrase
52-
Network::Testnet,
52+
&[Network::Testnet],
5353
Some(100_000), // Birth height
5454
key_wallet::wallet::initialization::WalletAccountCreationOptions::Default,
5555
);

key-wallet-manager/src/wallet_manager/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ impl<T: WalletInfoInterface> WalletManager<T> {
115115
&mut self,
116116
mnemonic: &str,
117117
passphrase: &str,
118-
network: Network,
118+
networks: &[Network],
119119
birth_height: Option<u32>,
120120
account_creation_options: key_wallet::wallet::initialization::WalletAccountCreationOptions,
121121
) -> Result<WalletId, WalletError> {
@@ -124,14 +124,14 @@ impl<T: WalletInfoInterface> WalletManager<T> {
124124

125125
// Use appropriate wallet creation method based on whether a passphrase is provided
126126
let wallet = if passphrase.is_empty() {
127-
Wallet::from_mnemonic(mnemonic_obj, &[network], account_creation_options)
127+
Wallet::from_mnemonic(mnemonic_obj, networks, account_creation_options)
128128
.map_err(|e| WalletError::WalletCreation(e.to_string()))?
129129
} else {
130130
// For wallets with passphrase, use the provided options
131131
Wallet::from_mnemonic_with_passphrase(
132132
mnemonic_obj,
133133
passphrase.to_string(),
134-
&[network],
134+
networks,
135135
account_creation_options,
136136
)
137137
.map_err(|e| WalletError::WalletCreation(e.to_string()))?

key-wallet-manager/tests/integration_test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ fn test_wallet_manager_from_mnemonic() {
2929
let wallet_result = manager.create_wallet_from_mnemonic(
3030
&mnemonic.to_string(),
3131
"",
32-
Network::Testnet,
32+
&[Network::Testnet],
3333
None, // birth_height
34-
key_wallet::wallet::initialization::WalletAccountCreationOptions::Default,
34+
WalletAccountCreationOptions::Default,
3535
);
3636
assert!(wallet_result.is_ok(), "Failed to create wallet: {:?}", wallet_result);
3737
assert_eq!(manager.wallet_count(), 1);

0 commit comments

Comments
 (0)