Skip to content

Commit

Permalink
wasm: expose accessing mnemonic from sw signer
Browse files Browse the repository at this point in the history
  • Loading branch information
RCasatta committed Dec 19, 2024
1 parent 210c5c1 commit cbff967
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lwk_wasm/src/signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ impl Signer {
self.inner.is_mainnet(),
)?)
}

pub fn mnemonic(&self) -> Mnemonic {
self.inner
.mnemonic()
.expect("wasm bindings always create signer via mnemonic and not via xpriv")
.into()
}
}

#[allow(dead_code)]
Expand Down Expand Up @@ -124,5 +131,7 @@ mod tests {
assert_eq!(signer.get_master_xpub().unwrap().fingerprint(), "73c5da0a");

assert_eq!(signer.keyorigin_xpub(Bip::bip49()).unwrap(), "[73c5da0a/49h/1h/0h]tpubDD7tXK8KeQ3YY83yWq755fHY2JW8Ha8Q765tknUM5rSvjPcGWfUppDFMpQ1ScziKfW3ZNtZvAD7M3u7bSs7HofjTD3KP3YxPK7X6hwV8Rk2");

assert_eq!(signer.mnemonic(), mnemonic);
}
}

0 comments on commit cbff967

Please sign in to comment.