Skip to content

Commit f549490

Browse files
authored
fix: split on whitespace in mnemonic parsing (#11257)
Update utils.rs
1 parent c802f29 commit f549490

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

crates/wallets/src/utils.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,11 @@ pub fn create_mnemonic_signer(
4242
index: u32,
4343
) -> Result<WalletSigner> {
4444
let mnemonic = if Path::new(mnemonic).is_file() {
45-
fs::read_to_string(mnemonic)?.replace('\n', "")
45+
fs::read_to_string(mnemonic)?
4646
} else {
4747
mnemonic.to_owned()
4848
};
49+
let mnemonic = mnemonic.split_whitespace().collect::<Vec<_>>().join(" ");
4950

5051
Ok(WalletSigner::from_mnemonic(&mnemonic, passphrase, hd_path, index)?)
5152
}

0 commit comments

Comments
 (0)