Last active
March 2, 2019 06:29
-
-
Save glamperd/c4c4a21dadf708aaf6df923d12927b64 to your computer and use it in GitHub Desktop.
In-browser wallet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export async function createWallet(web3) { | |
console.log("Creating new random wallet"); | |
const mnemonic = bip39.generateMnemonic() | |
const wallet = await hdkey.fromMasterSeed(mnemonic).getWallet() | |
// const wallet = await web3.eth.accounts.create() | |
localStorage.setItem("delegateSigner", wallet.getAddressString()) | |
localStorage.setItem("mnemonic", mnemonic); | |
localStorage.setItem("privateKey", wallet.getPrivateKeyString()); | |
// update refunding variable on burn | |
localStorage.removeItem("refunding") | |
localStorage.removeItem("maxBalanceAfterRefund") | |
return wallet | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment