1 | import { AccountInfo } from '../types/accounts';
|
2 | import { BackendInstance, BackendServices } from '../types/backend';
|
3 | export interface ECBBackendOptions {
|
4 | spread: number;
|
5 | ratesApiUrl: string;
|
6 | mockData: ECBAPIData;
|
7 | }
|
8 | export interface ECBSaxNode {
|
9 | name: string;
|
10 | attributes: {
|
11 | time?: number;
|
12 | currency?: string;
|
13 | rate?: number;
|
14 | };
|
15 | }
|
16 | export interface ECBAPIData {
|
17 | base: string;
|
18 | date?: number;
|
19 | rates: {
|
20 | [key: string]: number;
|
21 | };
|
22 | }
|
23 | export 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 | }
|