UNPKG

1.17 kBTypeScriptView Raw
1import { SubscriptionResponse, ErrorResponse, SuccessResponse } from "frontblock-generic/Service";
2import { Coin, AccountMap, TransactionMap } from "frontblock-generic/Types";
3import { FrontblockApi as FrontblockApi } from "frontblock-generic/Api";
4import { Plugin, socketioRPC } from "frontblock-generic/Plugin";
5export declare type FrontblockApiConf = {
6 apiHost: string;
7 apiPort: number;
8 tls?: boolean;
9 apiKey?: string;
10};
11/**
12 * Frontblock api connection lib
13 *
14 * Can be used solo and also is a valid frontblock plugin on the customer-side
15 */
16export default class FrontblockApiClient implements FrontblockApi, Plugin {
17 protected apikey: string;
18 protected conf: FrontblockApiConf;
19 protected socket: any;
20 private started;
21 constructor(conf?: FrontblockApiConf);
22 exportRPCs(): socketioRPC[];
23 start(): void;
24 stop(): void;
25 subscribe<C extends Coin>(apikey: string, coin: C, account: AccountMap[C], callback: (tx: TransactionMap[C]) => void): Promise<SubscriptionResponse | ErrorResponse>;
26 unsubscribe(apikey: string, uid: string): Promise<ErrorResponse | SuccessResponse>;
27 getPluginList(): Promise<string[]>;
28}