import * as CONSTANTS from './constants'; import * as P from './params'; import * as Device from './trezor/device'; import * as Mgmnt from './trezor/management'; import * as Protobuf from './trezor/protobuf'; import * as Account from './account'; import * as Bitcoin from './networks/bitcoin'; import * as Binance from './networks/binance'; import * as Cardano from './networks/cardano'; import * as CoinInfo from './networks/coinInfo'; import * as EOS from './networks/eos'; import * as Ethereum from './networks/ethereum'; import * as Lisk from './networks/lisk'; import * as NEM from './networks/nem'; import * as Ripple from './networks/ripple'; import * as Stellar from './networks/stellar'; import * as Tezos from './networks/tezos'; import * as Conflux from './networks/conflux'; import * as Starcoin from './networks/starcoin'; import * as Solana from './networks/solana'; import * as Misc from './misc'; import * as Events from './events'; import * as Blockchain from './backend/blockchain'; export namespace OneKeyConnect { /** * Set OneKeyConnect manifest. */ function manifest(params: P.Manifest): void; /** * Initializes OneKeyConnect. * `manifest` is required */ function init(settings: { manifest: P.Manifest } & Partial): Promise; /** * Retrieves the settings that OneKeyConnect was initialized with. */ function getSettings(): P.Response; function dispose(): void; function cancel(params?: string): void; function renderWebUSBButton(): void; function disableWebUSB(): void; /** * Event listeners */ function on(type: typeof CONSTANTS.DEVICE_EVENT, cb: (event: Device.DeviceEvent & { event: typeof CONSTANTS.DEVICE_EVENT }) => void): void; function on(type: typeof CONSTANTS.TRANSPORT_EVENT, cb: (event: Events.TransportEvent & { event: typeof CONSTANTS.TRANSPORT_EVENT }) => void): void; function on(type: typeof CONSTANTS.UI_EVENT, cb: (event: Events.UiEvent & { event: typeof CONSTANTS.UI_EVENT }) => void): void; function on(type: typeof CONSTANTS.BLOCKCHAIN_EVENT, cb: (event: Blockchain.BlockchainEvent & { event: typeof CONSTANTS.BLOCKCHAIN_EVENT }) => void): void; function on(type: Events.MessageWithoutPayload['type'], cb: () => void): void; function on(type: Events.DeviceMessage['type'], cb: (event: Events.DeviceMessage['payload']) => void): void; function on(type: Events.ButtonRequestMessage['type'], cb: (event: Events.ButtonRequestMessage['payload']) => void): void; function on(type: Events.AddressValidationMessage['type'], cb: (event: Events.AddressValidationMessage['payload']) => void): void; function on(type: Events.RequestPermission['type'], cb: (event: Events.RequestPermission['payload']) => void): void; function on(type: Events.RequestConfirmation['type'], cb: (event: Events.RequestConfirmation['payload']) => void): void; function on(type: Events.UnexpectedDeviceMode['type'], cb: (event: Events.UnexpectedDeviceMode['payload']) => void): void; function on(type: Events.FirmwareException['type'], cb: (event: Events.FirmwareException['payload']) => void): void; function on(type: typeof CONSTANTS.UI.BUNDLE_PROGRESS, cb: (event: Events.BundleProgress['payload']) => void): void; function on(type: Events.FirmwareProgress['type'], cb: (event: Events.FirmwareProgress['payload']) => void): void; function on(type: Events.CustomMessageRequest['type'], cb: (event: Events.CustomMessageRequest['payload']) => void): void; function off(type: string, cb: any): void; function removeAllListeners(): void; function uiResponse(response: Events.UiResponse): void; /** * Backend operations */ function blockchainEstimateFee( params: P.CommonParams & Blockchain.BlockchainEstimateFee, ): P.Response; function blockchainGetAccountBalanceHistory( params: Blockchain.BlockchainGetAccountBalanceHistory ): P.Response; function blockchainGetCurrentFiatRates( params: Blockchain.BlockchainGetCurrentFiatRates ): P.Response; function blockchainGetFiatRatesForTimestamps( params: Blockchain.BlockchainGetFiatRatesForTimestamps ): P.Response; function blockchainGetTransactions( params: P.CommonParams & Blockchain.BlockchainGetTransactions, ): P.Response; function blockchainSetCustomBackend( params: P.CommonParams & Blockchain.BlockchainSetCustomBackend, ): P.Response; function blockchainSubscribe( params: P.CommonParams & Blockchain.BlockchainSubscribe, ): P.Response; function blockchainSubscribeFiatRates( params: Blockchain.BlockchainSubscribeFiatRates ): P.Response; function blockchainUnsubscribe( params: P.CommonParams & Blockchain.BlockchainSubscribe, ): P.Response; function blockchainUnsubscribeFiatRates( params: Blockchain.BlockchainSubscribeFiatRates ): P.Response; function blockchainDisconnect( params: P.CommonParams & Blockchain.BlockchainDisconnect, ): P.Response; /** * Bitcoin and Bitcoin-like * Display requested address derived by given BIP32 path on device and * returns it to caller. User is asked to confirm the export on Trezor. */ function getAddress(params: P.CommonParams & Bitcoin.GetAddress): P.Response; function getAddress(params: P.CommonParams & P.Bundle): P.BundledResponse; /** * Bitcoin and Bitcoin-like * Retrieves BIP32 extended public derived by given BIP32 path. * User is presented with a description of the requested key and asked to * confirm the export. */ function getPublicKey(params: P.CommonParams & Bitcoin.GetPublicKey): P.Response; function getPublicKey( params: P.CommonParams & P.Bundle, ): P.BundledResponse; /** * Bitcoin and Bitcoin-like * Asks device to sign given inputs and outputs of pre-composed transaction. * User is asked to confirm all transaction details on Trezor. */ function signTransaction(params: P.CommonParams & Bitcoin.SignTransaction): P.Response; /** * Bitcoin, Bitcoin-like, Ethereum-like, Ripple * Broadcasts the transaction to the selected network. */ function pushTransaction(params: P.CommonParams & Bitcoin.PushTransaction): P.Response; /** * Bitcoin and Bitcoin-like * Requests a payment from the users wallet to a set of given outputs. * Internally a BIP-0044 account discovery is performed and user is presented * with a list of accounts. After account selection user is presented with * list of fee selection. After selecting a fee transaction is signed and * returned in hexadecimal format. Change output is added automatically, if * needed. */ function composeTransaction(params: P.CommonParams & Account.ComposeParams): P.Response; function composeTransaction( params: P.CommonParams & Account.PrecomposeParams, ): P.Response; /** * Bitcoin, Bitcoin-like, Ethereum-like, Ripple * Gets an info of specified account. */ function getAccountInfo(params: P.CommonParams & Account.GetAccountInfo): P.Response; function getAccountInfo( params: P.CommonParams & P.Bundle, ): P.BundledResponse; /** * Bitcoin and Bitcoin-like * Asks device to sign a message using the private key derived by given BIP32 * path. */ function signMessage(params: P.CommonParams & Bitcoin.SignMessage): P.Response; /** * Bitcoin and Bitcoin-like * Asks device to verify a message using the signer address and signature. */ function verifyMessage(params: P.CommonParams & Bitcoin.VerifyMessage): P.Response; // Binance function binanceGetAddress(params: P.CommonParams & Binance.BinanceGetAddress): P.Response; function binanceGetAddress( params: P.CommonParams & P.Bundle, ): P.BundledResponse; function binanceGetPublicKey( params: P.CommonParams & Binance.BinanceGetPublicKey, ): P.Response; function binanceGetPublicKey( params: P.CommonParams & P.Bundle, ): P.BundledResponse; function binanceSignTransaction( params: P.CommonParams & Binance.BinanceSignTransaction, ): P.Response; // Cardano (ADA) function cardanoGetAddress(params: P.CommonParams & Cardano.CardanoGetAddress): P.Response; function cardanoGetAddress( params: P.CommonParams & P.Bundle, ): P.BundledResponse; function cardanoGetPublicKey( params: P.CommonParams & Cardano.CardanoGetPublicKey, ): P.Response; function cardanoGetPublicKey( params: P.CommonParams & P.Bundle, ): P.BundledResponse; function cardanoSignTransaction( params: P.CommonParams & Cardano.CardanoSignTransaction, ): P.Response; // EOS function eosGetPublicKey(params: P.CommonParams & EOS.EosGetPublicKey): P.Response; function eosGetPublicKey( params: P.CommonParams & P.Bundle, ): P.BundledResponse; function eosSignTransaction(params: P.CommonParams & EOS.EosSignTransaction): P.Response; // Ethereum and Ethereum-like function ethereumGetAddress( params: P.CommonParams & Ethereum.EthereumGetAddress, ): P.Response; function ethereumGetAddress( params: P.CommonParams & P.Bundle, ): P.BundledResponse; function ethereumGetPublicKey( params: P.CommonParams & Ethereum.EthereumGetPublicKey, ): P.Response; function ethereumGetPublicKey( params: P.CommonParams & P.Bundle, ): P.BundledResponse; function ethereumSignTransaction( params: P.CommonParams & Ethereum.EthereumSignTransaction, ): P.Response; function ethereumSignTransaction( params: P.CommonParams & P.Bundle, ): P.BundledResponse; function ethereumSignMessage( params: P.CommonParams & Ethereum.EthereumSignMessage, ): P.Response; function ethereumSignMessageEIP712(params: P.CommonParams & Ethereum.EthereumSignMessageEIP712): P.Response; function ethereumVerifyMessage( params: P.CommonParams & Ethereum.EthereumVerifyMessage, ): P.Response; function ethereumSignTypedData( params: P.CommonParams & Ethereum.EthereumSignTypedData, ): P.Response; // Lisk function liskGetAddress(params: P.CommonParams & Lisk.LiskGetAddress): P.Response; function liskGetAddress( params: P.CommonParams & P.Bundle, ): P.BundledResponse; function liskGetPublicKey(params: P.CommonParams & Lisk.LiskGetPublicKey): P.Response; function liskGetPublicKey( params: P.CommonParams & P.Bundle, ): P.BundledResponse; function liskSignTransaction(params: P.CommonParams & Lisk.LiskSignTransaction): P.Response; function liskSignMessage(params: P.CommonParams & Lisk.LiskSignMessage): P.Response; function liskVerifyMessage(params: P.CommonParams & Lisk.LiskVerifyMessage): P.Response; // NEM function nemGetAddress(params: P.CommonParams & NEM.NEMGetAddress): P.Response; function nemGetAddress(params: P.CommonParams & P.Bundle): P.BundledResponse; function nemSignTransaction(params: P.CommonParams & NEM.NEMSignTransaction): P.Response; // Ripple function rippleGetAddress(params: P.CommonParams & Ripple.RippleGetAddress): P.Response; function rippleGetAddress( params: P.CommonParams & P.Bundle, ): P.BundledResponse; function rippleSignTransaction( params: P.CommonParams & Ripple.RippleSignTransaction, ): P.Response; // Stellar function stellarGetAddress(params: P.CommonParams & Stellar.StellarGetAddress): P.Response; function stellarGetAddress( params: P.CommonParams & P.Bundle, ): P.BundledResponse; function stellarSignTransaction( params: P.CommonParams & Stellar.StellarSignTransaction, ): P.Response; // // Tezos function tezosGetAddress(params: P.CommonParams & Tezos.TezosGetAddress): P.Response; function tezosGetAddress( params: P.CommonParams & P.Bundle, ): P.BundledResponse; function tezosGetPublicKey(params: P.CommonParams & Tezos.TezosGetPublicKey): P.Response; function tezosGetPublicKey( params: P.CommonParams & P.Bundle, ): P.BundledResponse; function tezosSignTransaction( params: P.CommonParams & Tezos.TezosSignTransaction, ): P.Response; // Conflux function confluxGetAddress(params: P.CommonParams & Conflux.ConfluxGetAddress): P.Response; function confluxGetAddress(params: P.CommonParams & P.Bundle): P.BundledResponse< Ethereum.EthereumAddress >; function confluxGetPublicKey(params: P.CommonParams & Ethereum.EthereumGetPublicKey): P.Response< Bitcoin.HDNodeResponse >; function confluxGetPublicKey( params: P.CommonParams & P.Bundle, ): P.BundledResponse; function confluxSignTransaction( params: P.CommonParams & Conflux.ConfluxSignTransaction, ): P.Response; function confluxSignTransaction( params: P.CommonParams & P.Bundle, ): P.BundledResponse; function confluxSignMessage( params: P.CommonParams & Ethereum.EthereumSignMessage, ): P.Response; function ConfluxSignMessageCIP23(params: P.CommonParams & Conflux.ConfluxSignMessageEIP712): P.Response; function confluxVerifyMessage( params: P.CommonParams & Ethereum.EthereumVerifyMessage, ): P.Response; // Solana function solanaGetAddress(params: P.CommonParams & Solana.SolanaGetAddress): P.Response; function solanaGetAddress(params: P.CommonParams & P.Bundle): P.BundledResponse; function solanaSignTransaction(params: P.CommonParams & Solana.SolanaSignTx): P.Response; function solanaSignTransaction(params: P.CommonParams & P.Bundle): P.BundledResponse; // Starcoin function starcoinGetAddress(params: P.CommonParams & Starcoin.StarcoinGetAddress): P.Response; function starcoinGetAddress(params: P.CommonParams & P.Bundle): P.BundledResponse; function starcoinGetPublicKey(params: P.CommonParams & Starcoin.StarcoinGetPublicKey): P.Response; function starcoinGetPublicKey(params: P.CommonParams & P.Bundle): P.BundledResponse; function starcoinSignTransaction(params: P.CommonParams & Starcoin.StarcoinSignTx): P.Response; function starcoinSignTransaction(params: P.CommonParams & P.Bundle): P.BundledResponse; function starcoinSignMessage(params: P.CommonParams & Starcoin.StarcoinSignMessage): P.Response; function starcoinVerifyMessage(params: P.CommonParams & Starcoin.StarcoinVerifyMessage): P.Response; /** * Challenge-response authentication via Trezor. * To protect against replay attacks you should use a server-side generated * and randomized challengeHidden for every attempt. You can also provide a * visual challenge that will be shown on the device. */ function requestLogin( params: P.CommonParams & (Misc.RequestLoginAsync | Misc.LoginChallenge), ): P.Response; /** * Asks device to encrypt value using the private key derived by given BIP32 * path and the given key. IV is always computed automatically. */ function cipherKeyValue(params: P.CommonParams & Misc.CipherKeyValue): P.Response; function cipherKeyValue( params: P.CommonParams & P.Bundle, ): P.BundledResponse; /** * Retrieves the set of features associated with the device. */ function getFeatures(params?: P.CommonParams): P.Response; /** * Retrieves device state associated with passphrase. */ function getDeviceState(params?: P.CommonParams): P.Response; /** * Resets device to factory defaults and removes all private data. */ function wipeDevice(params?: P.CommonParams): P.Response; /** * Performs device setup and generates a new seed. */ function resetDevice(params: P.CommonParams & Mgmnt.ResetDevice): P.Response; /** * Applies device setup */ function applySettings(params: P.CommonParams & Mgmnt.ApplySettings): P.Response; /** * Increment saved flag on device */ function applyFlags(params: P.CommonParams & Mgmnt.ApplyFlags): P.Response; /** * Change pin */ function changePin(params: P.CommonParams & Mgmnt.ChangePin): P.Response; /** * Sends FirmwareErase message followed by FirmwareUpdate message */ function firmwareUpdate( params: P.CommonParams & (Mgmnt.FirmwareUpdate | Mgmnt.FirmwareUpdateBinary), ): P.Response; /** * Asks device to initiate seed backup procedure */ function backupDevice(params?: P.CommonParams): P.Response; /** * reboot to bootloader */ function bixinReboot(params?: P.CommonParams): P.Response; /** * Ask device to initiate recovery procedure */ function recoveryDevice(params: P.CommonParams & Mgmnt.RecoveryDevice): P.Response; /** * Get static coin info */ function getCoinInfo(params: CoinInfo.GetCoinInfo): P.Response; // // Developer mode function customMessage(params: P.CommonParams & Misc.CustomMessage): P.Response; function debugLinkDecision(params?: P.CommonParams): P.Response<{ debugLink: true }>; function debugLinkGetState(params?: P.CommonParams): P.Response<{ debugLink: true }>; }