input-output-hk / js-cardano-wasm

various cardano javascript using wasm bindings
MIT License
31 stars 21 forks source link

Add daedalus master key export #77

Closed SebastienGllmt closed 5 years ago

SebastienGllmt commented 5 years ago

This PR makes it easy to get the master key from a Daedalus mnemonic. I've had to do this fairly often myself also so it seems like it's a useful feature and very simple change.

Here is how you use it.

Wallet
  .then(Wallet => {
    const daedalusMnemonic = 'note park thrive ignore spare latin common balance clap soup school tiny';
    const daedalusEntropy = Wallet.Entropy.from_english_mnemonics(daedalusMnemonic);
    const daedalusWallet = Wallet.DaedalusWallet.recover(daedalusEntropy);
    console.log(daedalusWallet.master_key().to_hex());
  })
mmo2112 commented 5 years ago

@SebastienGllmt, now I need to build lib.rs to wasm file to use your export function, example in your project is cardano_wallet_bg.wasm right? I'm getting hard while trying to build project js-cardano-wasm lib...

SebastienGllmt commented 5 years ago

@mmo2112 you just need to run wasm-pack build then you can test it with npm run serve

mmo2112 commented 5 years ago

@SebastienGllmt, I wanna build it to node modules lib and then reuse it in by using const cardano = require('cardano-wallet');. I have an extra question, may I build it to java? Because I'm low level and working with few supported language such as java and javascript (prefer java but the current meta is js/NodeJS), I have searched in a period of time for java support but returns none result, then I switch to js/Nodejs. Thank you very much for hard support.

SebastienGllmt commented 5 years ago

Not sure how good the technology is for running either WASM or Javascript in Java is. Can't really help you on that one.