{"version":3,"file":"ledger-bridge.mjs","sourceRoot":"","sources":["../src/ledger-bridge.ts"],"names":[],"mappings":"","sourcesContent":["import type LedgerHwAppEth from '@ledgerhq/hw-app-eth';\nimport type Transport from '@ledgerhq/hw-transport';\nimport type { EIP712Message } from '@ledgerhq/types-live';\n\nexport type GetPublicKeyParams = { hdPath: string };\nexport type GetPublicKeyResponse = Awaited<\n  ReturnType<LedgerHwAppEth['getAddress']>\n>;\n\nexport type LedgerSignTransactionParams = { hdPath: string; tx: string };\nexport type LedgerSignTransactionResponse = Awaited<\n  ReturnType<LedgerHwAppEth['signTransaction']>\n>;\n\nexport type LedgerSignMessageParams = { hdPath: string; message: string };\nexport type LedgerSignMessageResponse = Awaited<\n  ReturnType<LedgerHwAppEth['signPersonalMessage']>\n>;\n\nexport type LedgerSignTypedDataParams = {\n  hdPath: string;\n  message: EIP712Message;\n};\nexport type LedgerSignTypedDataResponse = Awaited<\n  ReturnType<LedgerHwAppEth['signEIP712HashedMessage']>\n>;\n\nexport type LedgerBridgeOptions = Record<string, unknown>;\n\nexport type LedgerBridge<T extends LedgerBridgeOptions> = {\n  isDeviceConnected: boolean;\n\n  init(): Promise<void>;\n\n  destroy(): Promise<void>;\n\n  /**\n   * Method to get the current configuration of the ledger bridge keyring.\n   */\n  getOptions(): Promise<T>;\n\n  /**\n   * Method to set the current configuration of the ledger bridge keyring.\n   *\n   * @param opts - An object contains configuration of the bridge.\n   */\n  setOptions(opts: T): Promise<void>;\n\n  attemptMakeApp(): Promise<boolean>;\n\n  updateTransportMethod(transportType: string | Transport): Promise<boolean>;\n\n  getPublicKey(params: GetPublicKeyParams): Promise<GetPublicKeyResponse>;\n\n  deviceSignTransaction(\n    params: LedgerSignTransactionParams,\n  ): Promise<LedgerSignTransactionResponse>;\n\n  deviceSignMessage(\n    params: LedgerSignMessageParams,\n  ): Promise<LedgerSignMessageResponse>;\n\n  deviceSignTypedData(\n    params: LedgerSignTypedDataParams,\n  ): Promise<LedgerSignTypedDataResponse>;\n};\n"]}