eth-onekey-bridge-keyring
Version:
A MetaMask compatible keyring, for OneKey hardware wallets
1 lines • 1.58 kB
Source Map (JSON)
{"version":3,"file":"onekey-bridge.mjs","sourceRoot":"","sources":["../src/onekey-bridge.ts"],"names":[],"mappings":"","sourcesContent":["import type {\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<TData> = {\n success: true;\n payload: TData;\n};\ntype Response<TData> = Promise<Success<TData> | Unsuccessful>;\n\n/**\n * Hardware UI event payload\n */\nexport type HardwareUIEvent = {\n error: string;\n code?: string | number;\n};\n\nexport type OneKeyBridge = {\n model?: string;\n\n init(): 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"]}