import { IBitcoinWallet } from '../wallet.interface'; import { IBitcoinProvider } from '../provider.interface'; import { Network } from 'ecpair/src/networks'; export declare const AddressType: { readonly p2pkh: "p2pkh"; readonly p2wpkh: "p2wpkh"; readonly 'p2wpkh-p2sh': "p2wpkh-p2sh"; }; /** * Defines the type of address. (p2pkh, p2wpkh, p2wpkh-p2sh) */ export type AddressType = (typeof AddressType)[keyof typeof AddressType]; export type AccountStore = { path: string; addressType: AddressType; }; export type AccountStoreWithAddress = AccountStore & { address: string; accountNumber: number; }; /** * Represents a bitcoin address with type returned by `IbitcoinMultiKeyWallet.getAddresses()`. */ export type BitcoinAddress = { address: string; type: AddressType; }; /** * Represents a payout from a wallet. * This is used for representing how much a internal wallet should pay * to an external address. */ export type Payout = { address: string; amt: number; fee: number; change: number; }; /** * A wallet implementation which manages multiple keys and their addresses according * to their bip standards. */ export interface IBitcoinMultiKeyWallet { provider: IBitcoinProvider; wallets(): IBitcoinWallet[]; walletByAddress(address: string): IBitcoinWallet; /** * Returns the first wallet in the list of wallets with the given type. */ walletByType(type: AddressType): IBitcoinWallet | undefined; getMnemonic(): Promise; getAddresses(): Promise; /** * Returns all the accounts generated by the wallet. * It includes accounts generated by * - `nextAccount()` * - `fromMnemonic()` * - `fromDisk()` */ getAccounts(): Promise; /** * Returns the balance of the wallet. * This is sum of all the balances of multiple keys in the multi-key wallet. */ getBalance(): Promise; /** * Not to be confused with provider.getNetwork(). * This returns the bitcoinjs-lib Network object. */ getNetwork(): Network; nextAccount(accountNumber?: number): Promise; /** * Sends funds to the given address. * * Multiple internal wallets are used to send the funds if the amount is greater than the balance of a single wallet. */ send(toAddress: string, amt: number, fee?: number): Promise; }