UNPKG

875 BPlain TextView Raw
1import Accounts from '../services/accounts'
2import { AccountInfo } from '../types/accounts'
3import * as IlpPacket from 'ilp-packet'
4
5export interface SubmitPaymentParams {
6 sourceAccount: string
7 destinationAccount: string
8 sourceAmount: string
9 destinationAmount: string
10 parsedPacket?: IlpPacket.IlpPrepare
11 result?: Buffer
12}
13
14/** API exposed by the connector to its backends */
15export interface BackendServices {
16 getInfo: (accountId: string) => AccountInfo | undefined
17 accounts?: Accounts
18}
19
20export interface BackendConstructor {
21 new (options: object, api: BackendServices): BackendInstance
22}
23
24export interface BackendInstance {
25 connect (): Promise<void>
26 getRate (sourceAccount: string, destinationAccount: string): Promise<number>
27 submitPayment (params: SubmitPaymentParams): Promise<void>
28 submitPacket? (params: SubmitPaymentParams): Promise<void>
29}