UNPKG

@onekeyfe/blockchain-link

Version:

High-level javascript interface for blockchain communication

40 lines (39 loc) 1.55 kB
import { Response, BlockchainSettings, SubscriptionAccountInfo } from '../types'; declare class WorkerCommon { post: (data: Response) => void; settings: BlockchainSettings; debugPrefix: string; addresses: string[]; accounts: SubscriptionAccountInfo[]; subscription: { [key: string]: boolean; }; constructor(postFn: (data: Response) => void); handshake(): void; setSettings(s: BlockchainSettings): void; getSettings(): BlockchainSettings; errorHandler({ id, error }: { id: number; error: any; }): void; response(data: Response): void; validateAddresses(addr: string[]): string[]; addAddresses(addr: string[]): string[]; getAddresses(): string[]; removeAddresses(addr: string[]): string[]; validateAccounts(acc: SubscriptionAccountInfo[]): SubscriptionAccountInfo[]; getAccountAddresses(acc: SubscriptionAccountInfo): string[]; addAccounts(acc: SubscriptionAccountInfo[]): SubscriptionAccountInfo[]; getAccount(address: string): SubscriptionAccountInfo | undefined; getAccounts(): SubscriptionAccountInfo[]; removeAccounts(acc: SubscriptionAccountInfo[]): SubscriptionAccountInfo[]; addSubscription(type: string): void; getSubscription(type: string): boolean; hasSubscriptions(): boolean; removeSubscription(type: string): void; clearSubscriptions(): void; shuffleEndpoints(a: string[]): string[]; removeEmpty(obj: Response): Response; debug(...args: any[]): void; } export default WorkerCommon;