aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-webextension/src/wxApi.ts
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2021-07-01 00:35:41 -0300
committerSebastian <sebasjm@gmail.com>2021-07-01 00:35:50 -0300
commita8e4f2d612fcf29c1b19bed999441211ed51ac08 (patch)
tree92c3cc110f6a723f659523f1b6d891ee361c0694 /packages/taler-wallet-webextension/src/wxApi.ts
parent23dab91ee9e2ffcac381cc27183716b6881e0a88 (diff)
downloadwallet-core-a8e4f2d612fcf29c1b19bed999441211ed51ac08.tar.xz
take backup info from wallet-core
Diffstat (limited to 'packages/taler-wallet-webextension/src/wxApi.ts')
-rw-r--r--packages/taler-wallet-webextension/src/wxApi.ts41
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);