UNPKG

1.93 kBTypeScriptView Raw
1import { SubscriptionResponse, ErrorResponse, SuccessResponse } from "frontblock-generic/Service";
2import { Coin, AccountMap, TransactionMap } from "frontblock-generic/Types";
3import { Payment, PaymentService } from "./PaymentService";
4import { FrontblockConf } from "./Types";
5export declare class ServiceConf {
6 publicPort: number;
7 privatePort: number;
8 constructor(publicPort: number, privatePort: number);
9}
10export declare class WebConf {
11 httpPort: number;
12 constructor(httpPort: number);
13}
14export declare class PaymentServer implements PaymentService {
15 private publicSock;
16 private publicWsServer;
17 private privateSock;
18 private privateWsServer;
19 private frontBlock;
20 private apikey;
21 constructor(svcConf: ServiceConf, frontblockConf: FrontblockConf);
22 private subscriptionHandlerGenerator;
23 private streamHandlerGenerator;
24 createUsdValuePayment<C extends Coin>(currency: C, amount: number): Promise<Payment<C> | ErrorResponse>;
25 createCryptoPayment<C extends Coin>(currency: C, amount: number): Promise<Payment<C> | ErrorResponse>;
26 getPayment(paymentID: string | Payment<Coin>): Promise<Payment<Coin> | ErrorResponse>;
27 cancelPayment(paymentID: string | Payment<Coin>): Promise<SuccessResponse | ErrorResponse>;
28 resolvePayment(paymentID: string | Payment<Coin>): Promise<SuccessResponse | ErrorResponse>;
29 finalizePayment(paymentID: string | Payment<Coin>): Promise<SuccessResponse | ErrorResponse>;
30 streamPayments(callback: (payment: Payment<Coin>) => void): Promise<SubscriptionResponse | ErrorResponse>;
31 cancelStream(uid: string | SubscriptionResponse): Promise<ErrorResponse | SuccessResponse>;
32 subscribe<C extends Coin>(currency: C, account: AccountMap[C], callback: (tx: TransactionMap[C]) => void): Promise<SubscriptionResponse | ErrorResponse>;
33 unsubscribe(uid: string | SubscriptionResponse): Promise<ErrorResponse | SuccessResponse>;
34}