@berrywallet/core
Version:
Berrywallet main Core for work with common cryptocurrencies like Bitcoin, Ethereum, Dash, Litecoin
47 lines (46 loc) • 2.06 kB
TypeScript
/// <reference types="node" />
import { EventEmitter } from 'events';
import { Wallet } from '../../../';
import { Destructable } from '../../../utils';
import { Events } from '../../';
import { INetworkClient } from '../';
export declare enum TrackerEvent {
Connect = "connect",
Disconnect = "disconnect",
ConnectionError = "connection_error",
Error = "error",
Block = "block",
Tx = "tx",
}
export interface ITrackerClient extends Destructable, EventEmitter {
onConnect(callback: any): ITrackerClient;
onBlock(callback: Events.NewBlockCallback): ITrackerClient;
onAddrsTx(addrs: string[], callback: Events.NewTxCallback): ITrackerClient;
onTransactionConfirm(txid: string, callback: Events.NewTxCallback): ITrackerClient;
onDisconnect(callback: (...args: any[]) => void): ITrackerClient;
onConnectionError(callback: (...args: any[]) => void): ITrackerClient;
isAddrTrack(addr: string | Buffer): boolean;
}
export interface IAddressTrackEvent {
addrs: Buffer[];
callback?: Events.NewTxCallback;
}
export declare class TrackerClient<T extends INetworkClient> extends EventEmitter implements ITrackerClient {
protected debug: any;
protected readonly networkClient: T;
protected addrTxEvents: IAddressTrackEvent;
constructor(networkClient: T);
onConnect(callback: any): ITrackerClient;
onDisconnect(callback: any): ITrackerClient;
onConnectionError(callback: any): ITrackerClient;
onBlock(callback: Events.NewBlockCallback): ITrackerClient;
onTransactionConfirm(txid: string, callback: Events.NewTxCallback): ITrackerClient;
onAddrsTx(addrs: string[], callback: Events.NewTxCallback): ITrackerClient;
isAddrTrack(address: string | Buffer): boolean;
protected fireNewBlock(block: Wallet.Entity.Block): boolean;
protected fireConnect(): boolean;
protected fireDisconnect(): boolean;
protected fireConnectionError(error: Error): boolean;
protected fireTxidConfirmation(tx: Wallet.Entity.WalletTransaction): boolean;
destruct(): void;
}