import type { BaseAdapterConfig, SignedTransaction, Transaction } from '@tronweb3/tronwallet-abstract-adapter'; export type SelectAccount = (params: { accounts: Account[]; ledgerUtils: LedgerUtils; }) => Promise; export interface LedgerWalletConfig extends BaseAdapterConfig { /** * Initial total accounts to get once connection is created, default is 1 */ accountNumber?: number; /** * Hook function to call before connecting to ledger and geting accounts. * By default, a modal will popup to reminder user to prepare the ledger and enter Tron app. * You can specify a function to disable this modal. */ beforeConnect?: () => Promise | unknown; /** * Hook function to call after connecting to ledger and geting initial accounts. * The function should return the selected account including the index of account. * Following operations such as `signMessage` will use the selected account. */ selectAccount?: SelectAccount; /** * Function to get derivate BIP44 path by index. * Default is `44'/195'/${index}'/0/0` */ getDerivationPath?: (index: number) => string; } /** * getAccounts from Ledger */ export type GetAccounts = (from: number, to: number) => Promise; export type Account = { /** * The index to get BIP44 path. */ index: number; /** * The BIP44 path to derivate address. */ path: string; /** * The derivated address. */ address: string; }; export interface LedgerUtils { /** * Get accounts from ledger by index. `from` is included and `to` is excluded. * User can use the function to load more accounts. */ getAccounts: GetAccounts; /** * Request to get an address with specified index using getDerivationPath(index) to get BIP44 path. * If `display` is true, will request user to approve on ledger. * The promise will resove if user approve and reject if user cancel the operation. */ getAddress: (index: number, display: boolean) => Promise<{ publicKey: string; address: string; }>; } export declare class LedgerWallet { private accounts; private app; private transport; /** * Ledger can not handle concurrent requests, so every device operation is * chained onto this promise. A rejected operation is contained here, so a * failure can never leave the chain blocked. */ private queue; private selectedIndex; private config; private _address; constructor(config?: LedgerWalletConfig); get address(): string; connect(options?: { account: Omit; }): Promise; disconnect(): void; signPersonalMessage(message: string): Promise; signTransaction(transaction: Transaction | SignedTransaction): Promise; signTransactionHash(transaction: Transaction | SignedTransaction): Promise; private _withApp; private _mergeSignature; getAccounts: (from: number, to: number) => Promise; getAddress: (index: number, display?: boolean) => Promise<{ publicKey: string; address: string; }>; private getAccount; /** * Queue a device operation. Waiting is done by chaining onto the previous * operation instead of polling, so a caller can never wait forever on a * state flag that was never reset. */ private enqueue; private getPathForIndex; private makeApp; private cleanUp; } //# sourceMappingURL=LedgerWallet.d.ts.map