UNPKG

377 BJavaScriptView Raw
1import { hasBigInt } from '@polkadot/util';
2import { bip39ToEntropy, isReady } from '@polkadot/wasm-crypto';
3import { mnemonicToEntropy as jsToEntropy } from './bip39.js';
4export function mnemonicToEntropy(mnemonic, wordlist, onlyJs) {
5 return !hasBigInt || (!wordlist && !onlyJs && isReady())
6 ? bip39ToEntropy(mnemonic)
7 : jsToEntropy(mnemonic, wordlist);
8}