UNPKG

1.03 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};
11export default class FrontblockApiClient implements FrontblockApi, Plugin {
12 protected apikey: string;
13 protected conf: FrontblockApiConf;
14 protected socket: any;
15 private started;
16 constructor(conf?: FrontblockApiConf);
17 exportRPCs(): socketioRPC[];
18 start(): void;
19 stop(): void;
20 subscribe<C extends Coin>(apikey: string, coin: C, account: AccountMap[C], callback: (tx: TransactionMap[C]) => void): Promise<SubscriptionResponse | ErrorResponse>;
21 unsubscribe(apikey: string, uid: string | SubscriptionResponse): Promise<ErrorResponse | SuccessResponse>;
22}