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 NEM from './networks/nem'; import * as Ripple from './networks/ripple'; import * as Stellar from './networks/stellar'; import * as Tezos from './networks/tezos'; import * as Misc from './misc'; import * as Events from './events'; import * as Blockchain from './backend/blockchain'; export namespace TrezorConnect { /** * Set TrezorConnect manifest. */ function manifest(params: P.Manifest): void; /** * Initializes TrezorConnect. * `manifest` is required */ function init(settings: { manifest: P.Manifest } & Partial): Promise; /** * Retrieves the settings that TrezorConnect 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 cardanoGetNativeScriptHash( params: P.CommonParams & Cardano.CardanoGetNativeScriptHash, ): P.Response; 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; /** * @param params Passing: * - {@link Ethereum.EthereumSignTypedData} is required for Trezor T * - {@link Ethereum.EthereumSignTypedHash} is required for Trezor 1 compatability */ function ethereumSignTypedData( params: P.CommonParams & (Ethereum.EthereumSignTypedData | Ethereum.EthereumSignTypedHashAndData), ): P.Response; function ethereumVerifyMessage( params: P.CommonParams & Ethereum.EthereumVerifyMessage, ): 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; /** * 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 & Protobuf.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, ): P.Response; function firmwareUpdate( params: P.CommonParams & Mgmnt.FirmwareUpdateBinary, ): P.Response; /** * Asks device to initiate seed backup procedure */ function backupDevice(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; /** * Reboots device (currently only T1 with fw >= 1.10.0) in bootloader mode */ function rebootToBootloader(params?: P.CommonParams): P.Response; /** * Set tor proxy for @trezor/blockchain-link connections */ function setProxy(params: Misc.SetProxy): P.Response; // // Developer mode function customMessage(params: P.CommonParams & Misc.CustomMessage): P.Response; }