UNPKG

@metamask/keyring-api

Version:
72 lines 3.2 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.CreateAccountOptionsStruct = exports.AccountCreationType = void 0; const keyring_utils_1 = require("@metamask/keyring-utils"); const bip44_1 = require("./bip44.cjs"); const private_key_1 = require("./private-key.cjs"); __exportStar(require("./bip44.cjs"), exports); __exportStar(require("./private-key.cjs"), exports); /** * Enum representing the different ways an account can be created. */ var AccountCreationType; (function (AccountCreationType) { /** * Represents an account created using a BIP-44 derivation path. */ AccountCreationType["Bip44DerivePath"] = "bip44:derive-path"; /** * Represents accounts created using a BIP-44 account index. * * More than one account can be created, for example, the keyring can create * multiple account types (e.g., P2PKH, P2TR, P2WPKH) for the same account * index. */ AccountCreationType["Bip44DeriveIndex"] = "bip44:derive-index"; /** * Represents accounts created through BIP-44 account discovery. * * More than one account can be created, for example, the keyring can create * multiple account types (e.g., P2PKH, P2TR, P2WPKH) for the same account * index. */ AccountCreationType["Bip44Discover"] = "bip44:discover"; /** * Represents an account imported from a private key. */ AccountCreationType["PrivateKeyImport"] = "private-key:import"; })(AccountCreationType || (exports.AccountCreationType = AccountCreationType = {})); /** * Struct for {@link CreateAccountOptions}. */ exports.CreateAccountOptionsStruct = (0, keyring_utils_1.selectiveUnion)((value) => { const accountCreationType = value?.type; switch (accountCreationType) { case AccountCreationType.Bip44DerivePath: return bip44_1.CreateAccountBip44DerivePathOptionsStruct; case AccountCreationType.Bip44DeriveIndex: return bip44_1.CreateAccountBip44DeriveIndexOptionsStruct; case AccountCreationType.Bip44Discover: return bip44_1.CreateAccountBip44DiscoverOptionsStruct; case AccountCreationType.PrivateKeyImport: return private_key_1.CreateAccountPrivateKeyOptionsStruct; default: // Return first struct as fallback - validation will fail with proper error indicating the type mismatch return bip44_1.CreateAccountBip44DerivePathOptionsStruct; } }); //# sourceMappingURL=index.cjs.map