aboutsummaryrefslogtreecommitdiff
path: root/src/wallet.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2019-12-09 19:59:08 +0100
committerFlorian Dold <florian.dold@gmail.com>2019-12-09 19:59:08 +0100
commit6415564b9259a4a6a2f6ec9cb934eab3d56a1677 (patch)
tree577372a635b5503c1ad81b2af8523a839e790bb7 /src/wallet.ts
parent99bccae9fe1588f711e7606dc3c6d7dd4a25675a (diff)
downloadwallet-core-6415564b9259a4a6a2f6ec9cb934eab3d56a1677.tar.xz
tos
Diffstat (limited to 'src/wallet.ts')
-rw-r--r--src/wallet.ts51
1 files changed, 30 insertions, 21 deletions
diff --git a/src/wallet.ts b/src/wallet.ts
index bf1b11fbd..edfc0b09d 100644
--- a/src/wallet.ts
+++ b/src/wallet.ts
@@ -37,9 +37,8 @@ import * as Amounts from "./util/amounts";
import {
acceptWithdrawal,
- getWithdrawalInfo,
getWithdrawDetailsForUri,
- getWithdrawDetailsForAmount,
+ getExchangeWithdrawalInfo,
} from "./wallet-impl/withdraw";
import {
@@ -79,7 +78,7 @@ import {
TipStatus,
WalletBalance,
PreparePayResult,
- DownloadedWithdrawInfo,
+ BankWithdrawDetails,
WithdrawDetails,
AcceptWithdrawalResponse,
PurchaseDetails,
@@ -88,6 +87,7 @@ import {
HistoryQuery,
WalletNotification,
NotificationType,
+ ExchangeWithdrawDetails,
} from "./walletTypes";
import { Logger } from "./util/logging";
@@ -97,6 +97,7 @@ import {
updateExchangeFromUrl,
getExchangeTrust,
getExchangePaytoUri,
+ acceptExchangeTermsOfService,
} from "./wallet-impl/exchanges";
import { processReserve } from "./wallet-impl/reserves";
@@ -167,8 +168,11 @@ export class Wallet {
return getExchangePaytoUri(this.ws, exchangeBaseUrl, supportedTargetTypes);
}
- getWithdrawDetailsForAmount(baseUrl: any, amount: AmountJson): any {
- return getWithdrawDetailsForAmount(this.ws, baseUrl, amount);
+ getWithdrawDetailsForAmount(
+ exchangeBaseUrl: string,
+ amount: AmountJson,
+ ): Promise<ExchangeWithdrawDetails> {
+ return getExchangeWithdrawalInfo(this.ws, exchangeBaseUrl, amount);
}
addNotificationListener(f: (n: WalletNotification) => void): void {
@@ -194,13 +198,21 @@ export class Wallet {
await updateExchangeFromUrl(this.ws, pending.exchangeBaseUrl, forceNow);
break;
case "refresh":
- await processRefreshSession(this.ws, pending.refreshSessionId, forceNow);
+ await processRefreshSession(
+ this.ws,
+ pending.refreshSessionId,
+ forceNow,
+ );
break;
case "reserve":
await processReserve(this.ws, pending.reservePub, forceNow);
break;
case "withdraw":
- await processWithdrawSession(this.ws, pending.withdrawSessionId, forceNow);
+ await processWithdrawSession(
+ this.ws,
+ pending.withdrawSessionId,
+ forceNow,
+ );
break;
case "proposal-choice":
// Nothing to do, user needs to accept/reject
@@ -524,6 +536,13 @@ export class Wallet {
);
}
+ async acceptExchangeTermsOfService(
+ exchangeBaseUrl: string,
+ etag: string | undefined,
+ ) {
+ return acceptExchangeTermsOfService(this.ws, exchangeBaseUrl, etag);
+ }
+
async getDenoms(exchangeUrl: string): Promise<DenominationRecord[]> {
const denoms = await oneShotIterIndex(
this.db,
@@ -663,6 +682,10 @@ export class Wallet {
}
}
+ /**
+ * Inform the wallet that the status of a reserve has changed (e.g. due to a
+ * confirmation from the bank.).
+ */
public async handleNotifyReserve() {
const reserves = await oneShotIter(this.db, Stores.reserves).toArray();
for (const r of reserves) {
@@ -687,20 +710,6 @@ export class Wallet {
// strategy to test it.
}
- /**
- * Get information about a withdrawal from
- * a taler://withdraw URI.
- */
- async getWithdrawalInfo(
- talerWithdrawUri: string,
- ): Promise<DownloadedWithdrawInfo> {
- try {
- return getWithdrawalInfo(this.ws, talerWithdrawUri);
- } finally {
- this.latch.trigger();
- }
- }
-
async acceptWithdrawal(
talerWithdrawUri: string,
selectedExchange: string,