diff options
Diffstat (limited to 'packages/taler-wallet-webextension/src/wxApi.ts')
| -rw-r--r-- | packages/taler-wallet-webextension/src/wxApi.ts | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/packages/taler-wallet-webextension/src/wxApi.ts b/packages/taler-wallet-webextension/src/wxApi.ts index bba8ea1d3..81f418d40 100644 --- a/packages/taler-wallet-webextension/src/wxApi.ts +++ b/packages/taler-wallet-webextension/src/wxApi.ts @@ -38,7 +38,8 @@ import { DeleteTransactionRequest, RetryTransactionRequest, } from "@gnu-taler/taler-util"; -import { OperationFailedError } from "@gnu-taler/taler-wallet-core"; +import { BackupProviderState, OperationFailedError } from "@gnu-taler/taler-wallet-core"; +import { BackupInfo } from "@gnu-taler/taler-wallet-core/src/operations/backup"; export interface ExtendedPermissionsResponse { newValue: boolean; @@ -132,18 +133,48 @@ export function getTransactions(): Promise<TransactionsResponse> { return callBackend("getTransactions", {}); } +interface CurrencyInfo { + name: string; + baseUrl: string; + pub: string; +} +interface ListOfKnownCurrencies { + auditors: CurrencyInfo[], + exchanges: CurrencyInfo[], +} + +/** + * Get a list of currencies from known auditors and exchanges + */ +export function listKnownCurrencies(): Promise<ListOfKnownCurrencies> { + return callBackend("listCurrencies", {}).then(result => { + console.log("result list", result) + const auditors = result.trustedAuditors.map((a: Record<string, string>) => ({ + name: a.currency, + baseUrl: a.auditorBaseUrl, + pub: a.auditorPub, + })) + const exchanges = result.trustedExchanges.map((a: Record<string, string>) => ({ + name: a.currency, + baseUrl: a.exchangeBaseUrl, + pub: a.exchangeMasterPub, + })) + return { auditors, exchanges } + }); +} + /** - * Get currency from known auditors and exchanges + * Get information about the current state of wallet backups. */ - export function listCurrencies(): Promise<TransactionsResponse> { - return callBackend("listCurrencies", {}); + export function getBackupInfo(): Promise<BackupInfo> { + return callBackend("getBackupInfo", {}) } /** * Retry a transaction * @param transactionId * @returns */ - export function retryTransaction(transactionId: string): Promise<void> { +export function retryTransaction(transactionId: string): Promise<void> { return callBackend("retryTransaction", { transactionId } as RetryTransactionRequest); |
