UNPKG

@mysten/sui

Version:

Sui TypeScript API(Work in Progress)

28 lines (27 loc) 736 B
import { toHex } from "@mysten/bcs"; import { mnemonicToSeedSync as bip39MnemonicToSeedSync } from "@scure/bip39"; function isValidHardenedPath(path) { if (!new RegExp("^m\\/44'\\/784'\\/[0-9]+'\\/[0-9]+'\\/[0-9]+'+$").test(path)) { return false; } return true; } function isValidBIP32Path(path) { if (!new RegExp("^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 toHex(mnemonicToSeed(mnemonics)); } export { isValidBIP32Path, isValidHardenedPath, mnemonicToSeed, mnemonicToSeedHex }; //# sourceMappingURL=mnemonics.js.map