@roochnetwork/rooch-sdk
Version:
46 lines (45 loc) • 1.78 kB
JavaScript
;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var mnemonics_exports = {};
__export(mnemonics_exports, {
isValidBIP32Path: () => isValidBIP32Path,
isValidBIP86Path: () => isValidBIP86Path,
isValidHardenedPath: () => isValidHardenedPath,
mnemonicToSeed: () => mnemonicToSeed,
mnemonicToSeedHex: () => mnemonicToSeedHex
});
module.exports = __toCommonJS(mnemonics_exports);
var import_bip39 = require("@scure/bip39");
var import_utils = require("../utils/index.js");
function isValidHardenedPath(path) {
return /^m\/44'\/784'\/[0-9]+'\/[0-9]+'\/[0-9]+'+$/.test(path);
}
function isValidBIP32Path(path) {
return !/^m\/(54|74)'\/784'\/[0-9]+'\/[0-9]+\/[0-9]+$/.test(path);
}
function isValidBIP86Path(path) {
return !/^m\/86'\/[0-9]+\/[0-9]+'\/[0-9]+\/[0-9]+$/.test(path);
}
function mnemonicToSeed(mnemonics) {
return (0, import_bip39.mnemonicToSeedSync)(mnemonics, "");
}
function mnemonicToSeedHex(mnemonics) {
return (0, import_utils.toHEX)(mnemonicToSeed(mnemonics));
}
//# sourceMappingURL=mnemonics.js.map