{"version":3,"file":"onekey-bridge.mjs","sourceRoot":"","sources":["../src/onekey-bridge.ts"],"names":[],"mappings":"","sourcesContent":["/* eslint-disable @typescript-eslint/no-redundant-type-constituents */\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/naming-convention */\nimport type {\n  ConnectSettings,\n  Params,\n  EVMSignedTx,\n  EVMSignTransactionParams,\n  EVMSignMessageParams,\n  EVMSignTypedDataParams,\n  EVMGetPublicKeyParams,\n} from '@onekeyfe/hd-core';\nimport type { EthereumMessageSignature } from '@onekeyfe/hd-transport';\n\ntype Unsuccessful = {\n  success: false;\n  payload: {\n    error: string;\n    code?: string | number;\n  };\n};\ntype Success<T> = {\n  success: true;\n  payload: T;\n};\ntype Response<T> = Promise<Success<T> | Unsuccessful>;\n\nexport type OneKeyBridge = {\n  model?: string;\n\n  on(event: string, callback: (event: any) => void): void;\n\n  off(event: string): void;\n\n  init(settings: Partial<ConnectSettings>): Promise<void>;\n\n  dispose(): Promise<void>;\n\n  updateTransportMethod(transportType: string): Promise<void>;\n\n  // OneKeySdk.getPublicKey has two overloads\n  // It is not possible to extract them from the library using utility types\n  getPublicKey(\n    params: Params<EVMGetPublicKeyParams>,\n  ): Response<{ publicKey: string; chainCode: string }>;\n\n  getPassphraseState(): Response<string | undefined>;\n\n  ethereumSignTransaction(\n    params: Params<EVMSignTransactionParams>,\n  ): Response<EVMSignedTx>;\n\n  ethereumSignMessage(\n    params: Params<EVMSignMessageParams>,\n  ): Response<EthereumMessageSignature>;\n\n  ethereumSignTypedData(\n    params: Params<EVMSignTypedDataParams>,\n  ): Response<EthereumMessageSignature>;\n};\n"]}