UNPKG

@yubing744/rooch-sdk

Version:
28 lines (27 loc) 709 B
import { mnemonicToSeedSync as bip39MnemonicToSeedSync } from "@scure/bip39"; import { toHexString } from "../hex"; function isValidHardenedPath(path) { if (!/^m\/44'\/784'\/[0-9]+'\/[0-9]+'\/[0-9]+'+$/.test(path)) { return false; } return true; } function isValidBIP32Path(path) { if (!/^m\/(54|74)'\/784'\/[0-9]+'\/[0-9]+\/[0-9]+$/.test(path)) { return false; } return true; } function mnemonicToSeed(mnemonics) { return bip39MnemonicToSeedSync(mnemonics, ""); } function mnemonicToSeedHex(mnemonics) { return toHexString(mnemonicToSeed(mnemonics)); } export { isValidBIP32Path, isValidHardenedPath, mnemonicToSeed, mnemonicToSeedHex }; //# sourceMappingURL=mnemonics.js.map