{"version":3,"file":"permissions.mjs","sourceRoot":"","sources":["../../src/types/permissions.ts"],"names":[],"mappings":"","sourcesContent":["import type { SupportedCurve } from '@metamask/key-tree';\nimport type { CaipChainId, JsonRpcParams } from '@metamask/utils';\n\nexport type EmptyObject = Record<string, never>;\n\ntype CronjobRequest = {\n  /**\n   * The request to provide to the `onCronjob` handler for the Snap to determine\n   * how to handle the request, when the cronjob is triggered.\n   */\n  request: {\n    /**\n     * The method to call. This can be an arbitrary method, and is provided to\n     * the `onCronjob` handler for the Snap to determine how to handle the\n     * request.\n     */\n    method: string;\n\n    /**\n     * The parameters to pass to the method. This can be used to provide\n     * additional information about the request, and is provided to the\n     * `onCronjob` handler for the Snap to determine how to handle the request.\n     */\n    params?: JsonRpcParams;\n  };\n};\n\ntype CronjobWithExpression = CronjobRequest & {\n  expression: string;\n};\n\ntype CronjobWithDuration = CronjobRequest & {\n  duration: string;\n};\n\nexport type Cronjob = CronjobWithExpression | CronjobWithDuration;\n\nexport type NameLookupMatchers =\n  | {\n      tlds: string[];\n    }\n  | {\n      schemes: string[];\n    }\n  | {\n      tlds: string[];\n      schemes: string[];\n    };\n\nexport type Bip32Entropy = {\n  /**\n   * The curve to use for the derived key. This must be a curve supported by\n   * [`@metamask/key-tree`](https://npmjs.com/package/@metamask/key-tree).\n   */\n  curve: SupportedCurve;\n\n  /**\n   * The derivation path to use for the derived key, represented as an array of\n   * path segments. For example, the path `m/44'/1'/0'/0/0` would be represented\n   * as `['m', \"44'\", \"1'\", \"0'\", '0', '0']`.\n   */\n  path: string[];\n};\n\nexport type Bip44Entropy = {\n  /**\n   * The coin type to use for the derived key, as specified in the\n   * [SLIP-44 registry](https://github.com/satoshilabs/slips/blob/master/slip-0044.md).\n   */\n  coinType: number;\n};\n\nexport type RequestedSnap = {\n  version?: string;\n};\n\nexport type InitialPermissions = Partial<{\n  'endowment:cronjob': {\n    jobs?: Cronjob[];\n    maxRequestTime?: number;\n  };\n  'endowment:ethereum-provider': EmptyObject;\n  'endowment:keyring': {\n    allowedOrigins?: string[];\n    maxRequestTime?: number;\n  };\n  'endowment:lifecycle-hooks'?: {\n    maxRequestTime?: number;\n  };\n  'endowment:name-lookup': {\n    chains?: CaipChainId[];\n    matchers?: NameLookupMatchers;\n    maxRequestTime?: number;\n  };\n  'endowment:network-access': EmptyObject;\n  'endowment:page-home'?: {\n    maxRequestTime?: number;\n  };\n  'endowment:page-settings'?: {\n    maxRequestTime?: number;\n  };\n  'endowment:rpc': {\n    dapps?: boolean;\n    snaps?: boolean;\n    allowedOrigins?: string[];\n    maxRequestTime?: number;\n  };\n  'endowment:signature-insight': {\n    allowSignatureOrigin?: boolean;\n    maxRequestTime?: number;\n  };\n  'endowment:transaction-insight': {\n    allowTransactionOrigin?: boolean;\n    maxRequestTime?: number;\n  };\n  'endowment:webassembly': EmptyObject;\n\n  /* eslint-disable @typescript-eslint/naming-convention */\n  snap_dialog: EmptyObject;\n  snap_getBip32Entropy: Bip32Entropy[];\n  snap_getBip32PublicKey: Bip32Entropy[];\n  snap_getBip44Entropy: Bip44Entropy[];\n  snap_getEntropy: EmptyObject;\n  snap_getLocale: EmptyObject;\n  snap_manageAccounts: EmptyObject;\n  snap_manageState: EmptyObject;\n  snap_notify: EmptyObject;\n  wallet_snap: Record<string, RequestedSnap>;\n  /* eslint-enable @typescript-eslint/naming-convention */\n}>;\n"]}