WietseWind / xrpl-secret-numbers

Generate XRPL Accounts with a number-based secret: 8 chunks of 6 digits
MIT License
24 stars 8 forks source link

Generate wallet on the basis of mnemonic #253

Closed rachna-khatnawlia closed 1 year ago

rachna-khatnawlia commented 1 year ago

How can we generate wallet on the basis of mnemonic provided in this SDK?

rachna-khatnawlia commented 1 year ago

Found Solution for this issue:

const createWallet = async (mnemonic, network) => { const { Account, Utils } = require("xrpl-secret-numbers"); const bip39 = require("bip39"); try { const entropy = bip39.mnemonicToEntropy(mnemonic); const entropyBytes = Buffer.from(entropy, "hex"); // console.log(entropy, entropyBytes, "entropy"); const secret = Utils.entropyToSecret(entropyBytes); // console.log(secret, "secret"); const account = new Account(secret); // console.log(account, "account xrp"); } catch (error) { console.log(error, "error in wallet creation"); } };