@metamask/keyring-api
Version:
MetaMask Keyring API
37 lines • 1.24 kB
JavaScript
import { array, literal, object } from "@metamask/superstruct";
import { CaipChainIdStruct } from "./caip.mjs";
import { DerivationPathStruct } from "./derivation.mjs";
/**
* Account type tag.
*
* The main use of this enum is to tag the {@link DiscoveredAccount} type for
* future use.
*/
export var DiscoveredAccountType;
(function (DiscoveredAccountType) {
// BIP-44 compatible accounts.
DiscoveredAccountType["Bip44"] = "bip44";
})(DiscoveredAccountType || (DiscoveredAccountType = {}));
/**
* This struct represents a discovered BIP-44 compatible account.
*
* It supports BIP-44 in a non-strict way. The derivation path MUST HAVE at
* least 1 segment.
*/
export const DiscoveredBip44AccountStruct = object({
/**
* Account type.
*/
type: literal(`${DiscoveredAccountType.Bip44}`),
/**
* Account supported scopes (CAIP-2 chain IDs).
*/
scopes: array(CaipChainIdStruct),
/**
* The derivation path for this account. It MUST HAVE at least 1 segment.
*/
derivationPath: DerivationPathStruct,
});
// Could become a union if we have new discovered account type.
export const DiscoveredAccountStruct = DiscoveredBip44AccountStruct;
//# sourceMappingURL=discovery.mjs.map