/// import EventEmitter from "events"; declare const Network: any; declare type HWOpts = { network: string; host: string; port: number; apiKey?: string; memory?: boolean; location?: string; }; declare type WalletInfo = { network: 'main' | 'simnet' | 'regtest' | 'testnet'; wid: number; id: string; watchOnly: boolean; accountDepth: number; token: string; tokenDepth: number; master: MasterInfo; balance: BalanceInfo; }; declare type MasterInfo = { encrypted: boolean; until?: number; iv?: string; ciphertext?: string; algorithm?: string; n?: number; r?: number; p?: number; key?: string; mnemonic?: string; }; declare type BalanceInfo = { account: number; tx: number; coin: number; unconfirmed: number; confirmed: number; lockedUnconfirmed: number; lockedConfirmed: number; }; declare type AccountInfo = { name: string; initialized: boolean; watchOnly: boolean; type: string; m: number; n: number; accountIndex: number; receiveDepth: number; changeDepth: number; lookahead: number; receiveAddress: string; changeAddress: string; accountKey: string; keys: string[]; balance: BalanceInfo; }; /** * Standalone hsd wallet module * @extends EventEmitter */ export default class HW extends EventEmitter { /** * Instance of the wallet client in hsd */ private _walletClient; /** * Instance of the wallet db in hsd */ private _wdb; /** * Current network (default: `main`) */ network: typeof Network; /** * Create a HW instance. * @constructor * @param {HWOpts} options */ constructor(options: HWOpts); /** * Open WalletDB * @return {Promise} */ open(): Promise; /** * Close WalletDB * @return {Promise} */ close(): Promise; /** * Rescan blockchain from a given height. * @param {Number?} height * @returns {Promise} */ rescan(height?: number): Promise; /** * Resend all pending transactions. * @returns {Promise} */ resend(): Promise; /** * Backup the wallet db. * @param {String} path * @returns {Promise} */ backup(path: string): Promise; /** * Get a list of all walets * @returns {Promise} Wallet IDs */ getWallets(): Promise; /** * Get wallet * @param walletId * @returns {Promise} WalletInfo */ getWallet(walletId: string): Promise; /** * Get wallet master * @param walletId * @returns {Promise} MasterInfo */ getWalletMaster(walletId: string): Promise; /** * Create new wallet * @param walletOptions * @returns {Promise} WalletInfo */ createWallet(walletOptions?: { id?: string; type?: string; master?: string; passphrase?: string; mnemonic?: string; accountKey?: string; m?: number; n?: number; witness?: boolean; watchOnly?: boolean; }): Promise; /** * List account names and indexes from the db. * @param {Number} walletId * @returns {Promise} - Account IDs */ getAccounts(walletId: string): Promise; /** * Get account names from a specific wallet. * @param {String} walletId * @param {Number|String} accountIndex * @returns {Promise} - AccountInfo */ getAccount(walletId: string, accountIndex: number | string): Promise; /** * Create an account. Requires passphrase if master key is encrypted. * @param {String} walletId * @param accountOptions * @returns {Promise} - AccountInfo */ createAccount(walletId: string, accountOptions?: { passphrase?: string; accountKey?: string; account?: string; witness?: boolean; watchOnly?: boolean; type?: string; m?: number; n?: number; lookahead?: number; }): Promise; /** * Change or set master key's passphrase. * @param {String} walletId * @param {String|Buffer} passphrase * @param {String|Buffer} oldPassphrase * @returns {Promise} */ setPassphrase(walletId: string, passphrase: string | Buffer, oldPassphrase: string | Buffer): Promise; /** * Destroy the key by zeroing the * privateKey and chainCode. Stop * the timer if there is one. * @param {String} walletId * @returns {Promise} */ lockWallet(walletId: string): Promise; /** * Decrypt the key and set a timeout to destroy decrypted data. * @param {String} walletId * @param {Buffer|String} passphrase - Zero this yourself. * @param {Number} [timeout=60000] timeout in ms. * @returns {Promise} - Returns {@link HDPrivateKey}. */ unlockWallet(walletId: string, passphrase: string | Buffer, timeout?: number): Promise; /** * Import a keyring (will not exist on derivation chain). * Rescanning must be invoked manually. * @param {String} walletId * @param walletOptions * @returns {Promise} */ importKey(walletId: string, walletOptions?: { account?: string; passphrase?: string; publicKey?: Buffer; privateKey?: string; address?: string; }): Promise; /** * Generate new token * @param walletId * @param passphrase */ generateNewToken(walletId: string, passphrase: string): Promise; /** * Send a transaction * @param walletId * @param passphrase * @param txOptions * @returns {Promise}. */ sendTx(walletId: string, passphrase: string, txOptions: any): Promise; /** * Create a transaction * @param walletId * @param passphrase * @param txOptions * @param sign */ createTx(walletId: string, passphrase: string, txOptions: any, sign?: boolean): Promise; /** * Sign a raw transaction * @param walletId * @param passphrase * @param raw */ signTx(walletId: string, passphrase: string, raw: Buffer): Promise; /** * Zap Wallet TXs * @param walletId * @param account * @param age */ zap(walletId: string, account: string, age: number): Promise; /** * Abandon Tx * @param walletId * @param hash */ abandon(walletId: string, hash: string): Promise; /** * List Blocks * @param walletId */ getBlocks(walletId: string): Promise; getBlock(walletId: string, height: number): Promise; addSharedKey(walletId: string, account: string, accountKey: string): Promise; removeSharedKey(walletId: string, account: string, accountKey: string): Promise; getKey(walletId: string, address: string): Promise; getPrivateKey(walletId: string, passphrase: string, address: string): Promise; createReceive(walletId: string, account: string): Promise; createChange(walletId: string, account: string): Promise; getBalance(walletId: string, account: string): Promise; getCoins(walletId: string, account: string): Promise; getLocked(walletId: string): Promise; lockCoin(walletId: string, hash: string, coinIndex: number): Promise; unlockCoin(walletId: string, hash: string, coinIndex: number): Promise; getCoin(walletId: string, hash: string, coinIndex: number): Promise; getHistory(walletId: string, account: string): Promise; getPending(walletId: string, account: string): Promise; getRange(walletId: string, account: string, rangeOption?: { start?: number; end?: number; limit?: number; reverse?: boolean; }): Promise; getLast(walletId: string, account: string, limit: number): Promise; getTx(walletId: string, hash: Buffer): Promise; resendByWallet(walletId: string): Promise; getNames(walletId: string): Promise; getNameStateByName(walletId: string, name: string): Promise; getAunctions(walletId: string): Promise; getAunctionsByName(walletId: string, name: string): Promise; getBids(walletId: string, own?: boolean): Promise; getBidsByName(walletId: string, name: string, _own?: boolean): Promise; getReveals(walletId: string, own?: boolean): Promise; getRevealsByName(walletId: string, name: string, _own?: boolean): Promise; getResourceByName(walletId: string, name: string): Promise; generateNonce(walletId: string, name: string, options?: { address?: string; bid?: number; }): Promise<{ address: any; blind: any; nonce: any; bid: any; name: string; nameHash: any; } | null>; importNonce(walletId: string, options?: { name?: string; address?: string; bid?: number; }): Promise; createOpen(walletId: string, opt?: { name?: string; force?: boolean; passphrase?: string; broadcast?: boolean; sign?: boolean; }): Promise; createBid(walletId: string, opt?: { name?: string; bid?: number; lockup?: number; passphrase?: string; broadcast?: boolean; sign?: boolean; }): Promise; createReveal(walletId: string, opt?: { name?: string; passphrase?: string; broadcast?: boolean; sign?: boolean; }): Promise; createRedeem(walletId: string, opt?: { name?: string; passphrase?: string; broadcast?: boolean; sign?: boolean; }): Promise; createUpdate(walletId: string, opt?: { name?: string; passphrase?: string; broadcast?: boolean; sign?: boolean; data?: any; }): Promise; createRenewal(walletId: string, opt?: { name?: string; passphrase?: string; broadcast?: boolean; sign?: boolean; }): Promise; createTransfer(walletId: string, opt?: { name?: string; address?: string; passphrase?: string; broadcast?: boolean; sign?: boolean; }): Promise; createCancel(walletId: string, opt?: { name?: string; passphrase?: string; broadcast?: boolean; sign?: boolean; }): Promise; createFinalize(walletId: string, opt?: { name?: string; passphrase?: string; broadcast?: boolean; sign?: boolean; }): Promise; createRevoke(walletId: string, opt?: { name?: string; passphrase?: string; broadcast?: boolean; sign?: boolean; }): Promise; } export {};