aboutsummaryrefslogtreecommitdiff
path: root/src/wallet.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2020-07-11 13:26:07 +0530
committerFlorian Dold <florian.dold@gmail.com>2020-07-11 13:26:07 +0530
commitafda237e5fd4b4d243423f0b4b686a22b5ab5d8a (patch)
treef8838c2078d40bc5d82dc4980766d13b421e4143 /src/wallet.ts
parent6e688975c75c52fe69286531615952d56114fcc7 (diff)
updated getWithdrawalDetailsForAmount
Diffstat (limited to 'src/wallet.ts')
-rw-r--r--src/wallet.ts19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/wallet.ts b/src/wallet.ts
index 780f8eafd..2b804ded7 100644
--- a/src/wallet.ts
+++ b/src/wallet.ts
@@ -67,10 +67,11 @@ import {
WithdrawDetails,
AcceptWithdrawalResponse,
PurchaseDetails,
- ExchangeWithdrawDetails,
+ ExchangeWithdrawDetails as ExchangeWithdrawalDetails,
RefreshReason,
ExchangeListItem,
ExchangesListRespose,
+ ManualWithdrawalDetails,
} from "./types/walletTypes";
import { Logger } from "./util/logging";
@@ -166,11 +167,21 @@ export class Wallet {
return getExchangePaytoUri(this.ws, exchangeBaseUrl, supportedTargetTypes);
}
- getWithdrawDetailsForAmount(
+ async getWithdrawalDetailsForAmount(
exchangeBaseUrl: string,
amount: AmountJson,
- ): Promise<ExchangeWithdrawDetails> {
- return getExchangeWithdrawalInfo(this.ws, exchangeBaseUrl, amount);
+ ): Promise<ManualWithdrawalDetails> {
+ const wi = await getExchangeWithdrawalInfo(this.ws, exchangeBaseUrl, amount);
+ const paytoUris = wi.exchangeInfo.wireInfo?.accounts.map((x) => x.payto_uri);
+ if (!paytoUris) {
+ throw Error("exchange is in invalid state");
+ }
+ return {
+ rawAmount: Amounts.stringify(amount),
+ effectiveAmount: Amounts.stringify(wi.selectedDenoms.totalCoinValue),
+ paytoUris,
+ tosAccepted: wi.termsOfServiceAccepted,
+ };
}
addNotificationListener(f: (n: WalletNotification) => void): void {