Skip to content

Commit

Permalink
chore: inject RNG into generateMnemonic
Browse files Browse the repository at this point in the history
  • Loading branch information
dckc committed Dec 14, 2024
1 parent b19bee0 commit fd24b74
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions multichain-testing/tools/wallet.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down

0 comments on commit fd24b74

Please sign in to comment.