UNPKG

1.12 kBTypeScriptView Raw
1import { AccountInfo } from '../types/accounts';
2import { BackendInstance, BackendServices } from '../types/backend';
3export interface ECBBackendOptions {
4 spread: number;
5 ratesApiUrl: string;
6 mockData: ECBAPIData;
7}
8export interface ECBSaxNode {
9 name: string;
10 attributes: {
11 time?: number;
12 currency?: string;
13 rate?: number;
14 };
15}
16export interface ECBAPIData {
17 base: string;
18 date?: number;
19 rates: {
20 [key: string]: number;
21 };
22}
23export default class ECBBackend implements BackendInstance {
24 protected spread: number;
25 protected ratesApiUrl: string;
26 protected getInfo: (accountId: string) => AccountInfo | undefined;
27 protected rates: {
28 [key: string]: number;
29 };
30 protected currencies: string[];
31 private mockData;
32 constructor(opts: ECBBackendOptions, api: BackendServices);
33 connect(): Promise<void>;
34 _formatAmount(amount: string): string;
35 _formatAmountCeil(amount: string): string;
36 getRate(sourceAccount: string, destinationAccount: string): Promise<number>;
37 submitPayment(): Promise<undefined>;
38}