{"version":3,"file":"keyring-capabilities.mjs","sourceRoot":"","sources":["../../../src/v2/api/keyring-capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,OAAO,EACP,aAAa,EACb,QAAQ,EACR,MAAM,EACN,OAAO,EACR,8BAA8B;AAG/B,OAAO,EAAE,iBAAiB,EAAE,2BAAuB;AACnD,OAAO,EACL,4BAA4B,EAC5B,4BAA4B,EAC7B,0BAAsB;AAEvB;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC;IAC9C;;OAEG;IACH,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAC1C;;OAEG;IACH,KAAK,EAAE,aAAa,CAClB,MAAM,CAAC;QACL;;WAEG;QACH,UAAU,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC;QACpC;;WAEG;QACH,WAAW,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC;QACrC;;WAEG;QACH,gBAAgB,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC;QAC1C;;WAEG;QACH,QAAQ,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC;KACnC,CAAC,CACH;IACD;;OAEG;IACH,UAAU,EAAE,aAAa,CACvB,MAAM,CAAC;QACL;;WAEG;QACH,aAAa,EAAE,aAAa,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;QACjE;;WAEG;QACH,aAAa,EAAE,aAAa,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;KAClE,CAAC,CACH;IACD;;;;;;OAMG;IACH,MAAM,EAAE,aAAa,CACnB,OAAO,CACL,MAAM,CAAC;QACL,cAAc,EAAE,OAAO,EAAE;KAC1B,CAAC,CACH,CACF;CACF,CAAC,CAAC","sourcesContent":["import {\n  array,\n  boolean,\n  exactOptional,\n  nonempty,\n  object,\n  partial,\n} from '@metamask/superstruct';\nimport type { Infer } from '@metamask/superstruct';\n\nimport { CaipChainIdStruct } from '../../api/caip';\nimport {\n  ExportPrivateKeyFormatStruct,\n  ImportPrivateKeyFormatStruct,\n} from './private-key';\n\n/**\n * Struct for {@link KeyringCapabilities}.\n */\nexport const KeyringCapabilitiesStruct = object({\n  /**\n   * List of CAIP-2 chain IDs that this keyring supports.\n   */\n  scopes: nonempty(array(CaipChainIdStruct)),\n  /**\n   * BIP-44 capabilities supported by this keyring.\n   */\n  bip44: exactOptional(\n    object({\n      /**\n       * Whether the keyring supports deriving accounts from a specific BIP-44 path.\n       */\n      derivePath: exactOptional(boolean()),\n      /**\n       * Whether the keyring supports deriving accounts from a BIP-44 account index.\n       */\n      deriveIndex: exactOptional(boolean()),\n      /**\n       * Whether the keyring supports deriving accounts from a range of BIP-44 account indices.\n       */\n      deriveIndexRange: exactOptional(boolean()),\n      /**\n       * Whether the keyring supports BIP-44 account discovery.\n       */\n      discover: exactOptional(boolean()),\n    }),\n  ),\n  /**\n   * Private key capabilities supported by this keyring.\n   */\n  privateKey: exactOptional(\n    object({\n      /**\n       * List of supported formats for importing private keys.\n       */\n      importFormats: exactOptional(array(ImportPrivateKeyFormatStruct)),\n      /**\n       * List of supported formats for exporting private keys.\n       */\n      exportFormats: exactOptional(array(ExportPrivateKeyFormatStruct)),\n    }),\n  ),\n  /**\n   * Indicates which Keyring methods accept non-standard options.\n   *\n   * When a method is set to `true`, it signals that the keyring implementation\n   * accepts custom options for that method, different from the standard API.\n   * This is a workaround for keyrings with very specific requirements.\n   */\n  custom: exactOptional(\n    partial(\n      object({\n        createAccounts: boolean(),\n      }),\n    ),\n  ),\n});\n\n/**\n * Type representing the capabilities supported by a keyring.\n *\n * @example\n * ```ts\n * const capabilities: KeyringCapabilities = {\n *   scopes: ['bip122:_'],\n *   bip44: {\n *     derivePath: true,\n *     deriveIndex: true,\n *     deriveIndexRange: true,\n *     discover: true,\n *   },\n *   privateKey: {\n *     importFormats: [\n *       { encoding: 'base58', type: 'bip122:p2sh' },\n *       { encoding: 'base58', type: 'bip122:p2tr' },\n *       { encoding: 'base58', type: 'bip122:p2pkh' },\n *       { encoding: 'base58', type: 'bip122:p2wpkh' },\n *     ],\n *     exportFormats: [\n *       { encoding: 'base58' },\n *       { encoding: 'base58' },\n *     ],\n *   },\n * };\n * ```\n */\nexport type KeyringCapabilities = Infer<typeof KeyringCapabilitiesStruct>;\n"]}