Created
March 31, 2023 10:46
-
-
Save Rami-Majdoub/6ecc51b95718f6c067c7164b308e8fa5 to your computer and use it in GitHub Desktop.
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
import { Wallet } from "ethers"; | |
async function main() { | |
// const wallet = new Wallet("private key") | |
// const wallet = Wallet.fromMnemonic("mnemonic") | |
const wallet = Wallet.createRandom(); | |
console.log(`Wallet mnemonic: ${wallet.mnemonic.phrase}`); | |
console.log(`Wallet encrypted:`); | |
console.log(await wallet.encrypt("")); | |
} | |
// We recommend this pattern to be able to use async/await everywhere | |
// and properly handle errors. | |
main() | |
.then(() => process.exit(0)) | |
.catch((error) => { | |
console.error(error); | |
process.exit(1); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment