From fd24b74d76ee6b1195c56990a005ac4abac5deca Mon Sep 17 00:00:00 2001 From: Dan Connolly Date: Fri, 13 Dec 2024 18:15:49 -0600 Subject: [PATCH] chore: inject RNG into generateMnemonic --- multichain-testing/tools/wallet.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/multichain-testing/tools/wallet.ts b/multichain-testing/tools/wallet.ts index 44e62ce684c..31be1c78e43 100644 --- a/multichain-testing/tools/wallet.ts +++ b/multichain-testing/tools/wallet.ts @@ -1,13 +1,14 @@ import { Bip39, Random } from '@cosmjs/crypto'; import { DirectSecp256k1HdWallet } from '@cosmjs/proto-signing'; -export function generateMnemonic(): string { - return Bip39.encode(Random.getBytes(16)).toString(); +export function generateMnemonic(getBytes = Random.getBytes): string { + return Bip39.encode(getBytes(16)).toString(); } export const createWallet = async ( bech32Prefix: string, - mnemonic: string = generateMnemonic(), + getBytes = Random.getBytes, + mnemonic: string = generateMnemonic(getBytes), ) => { return DirectSecp256k1HdWallet.fromMnemonic(mnemonic, { prefix: bech32Prefix,