aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-webextension/src/wallet
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-wallet-webextension/src/wallet')
-rw-r--r--packages/taler-wallet-webextension/src/wallet/ManualWithdrawPage.tsx14
-rw-r--r--packages/taler-wallet-webextension/src/wallet/ReserveCreated.tsx18
2 files changed, 20 insertions, 12 deletions
diff --git a/packages/taler-wallet-webextension/src/wallet/ManualWithdrawPage.tsx b/packages/taler-wallet-webextension/src/wallet/ManualWithdrawPage.tsx
index 05c518508..bea8f0029 100644
--- a/packages/taler-wallet-webextension/src/wallet/ManualWithdrawPage.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/ManualWithdrawPage.tsx
@@ -19,6 +19,8 @@ import {
AmountJson,
Amounts,
NotificationType,
+ parsePaytoUri,
+ PaytoUri,
} from "@gnu-taler/taler-util";
import { h, VNode } from "preact";
import { useState } from "preact/hooks";
@@ -41,6 +43,8 @@ export function ManualWithdrawPage({ currency, onCancel }: Props): VNode {
response: AcceptManualWithdrawalResult;
exchangeBaseUrl: string;
amount: AmountJson;
+ paytoURI: PaytoUri | undefined;
+ payto: string;
}
| undefined
>(undefined);
@@ -60,7 +64,12 @@ export function ManualWithdrawPage({ currency, onCancel }: Props): VNode {
exchangeBaseUrl,
Amounts.stringify(amount),
);
- setSuccess({ exchangeBaseUrl, response, amount });
+ const payto = response.exchangePaytoUris[0];
+ const paytoURI = parsePaytoUri(payto);
+ if (paytoURI && paytoURI.isKnown && paytoURI.targetType === "bitcoin") {
+ paytoURI.generateSegwitAddress(response.reservePub);
+ }
+ setSuccess({ exchangeBaseUrl, response, amount, paytoURI, payto });
} catch (e) {
if (e instanceof Error) {
setError(e.message);
@@ -75,7 +84,8 @@ export function ManualWithdrawPage({ currency, onCancel }: Props): VNode {
return (
<ReserveCreated
reservePub={success.response.reservePub}
- payto={success.response.exchangePaytoUris[0]}
+ paytoURI={success.paytoURI}
+ payto={success.payto}
exchangeBaseUrl={success.exchangeBaseUrl}
amount={success.amount}
onCancel={onCancel}
diff --git a/packages/taler-wallet-webextension/src/wallet/ReserveCreated.tsx b/packages/taler-wallet-webextension/src/wallet/ReserveCreated.tsx
index 526daa7a1..84a2a7441 100644
--- a/packages/taler-wallet-webextension/src/wallet/ReserveCreated.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/ReserveCreated.tsx
@@ -4,6 +4,7 @@ import {
Amounts,
segwitMinAmount,
generateFakeSegwitAddress,
+ PaytoUri,
} from "@gnu-taler/taler-util";
import { Fragment, h, VNode } from "preact";
import { BankDetailsByPaytoType } from "../components/BankDetailsByPaytoType";
@@ -13,6 +14,7 @@ import { useTranslationContext } from "../context/translation";
import { amountToString } from "../utils/index";
export interface Props {
reservePub: string;
+ paytoURI: PaytoUri | undefined;
payto: string;
exchangeBaseUrl: string;
amount: AmountJson;
@@ -21,13 +23,13 @@ export interface Props {
export function ReserveCreated({
reservePub,
+ paytoURI,
payto,
onCancel,
exchangeBaseUrl,
amount,
}: Props): VNode {
const { i18n } = useTranslationContext();
- const paytoURI = parsePaytoUri(payto);
if (!paytoURI) {
return (
<div>
@@ -39,11 +41,7 @@ export function ReserveCreated({
}
function TransferDetails(): VNode {
if (!paytoURI) return <Fragment />;
- if (paytoURI.targetType === "bitcoin") {
- const { segwitAddr1, segwitAddr2 } = generateFakeSegwitAddress(
- reservePub,
- paytoURI.targetPath,
- );
+ if (paytoURI.isKnown && paytoURI.targetType === "bitcoin") {
const min = segwitMinAmount();
return (
<section>
@@ -64,10 +62,10 @@ export function ReserveCreated({
{paytoURI.targetPath} {Amounts.stringifyValue(amount)} BTC
</li>
<li>
- {segwitAddr1} {Amounts.stringifyValue(min)} BTC
+ {paytoURI.addr1} {Amounts.stringifyValue(min)} BTC
</li>
<li>
- {segwitAddr2} {Amounts.stringifyValue(min)} BTC
+ {paytoURI.addr2} {Amounts.stringifyValue(min)} BTC
</li>
</ul>
<i18n.Translate>
@@ -79,10 +77,10 @@ export function ReserveCreated({
{paytoURI.targetPath},{Amounts.stringifyValue(amount)}
</li>
<li>
- {segwitAddr1},{Amounts.stringifyValue(min)}
+ {paytoURI.addr1},{Amounts.stringifyValue(min)}
</li>
<li>
- {segwitAddr2},{Amounts.stringifyValue(min)}
+ {paytoURI.addr2},{Amounts.stringifyValue(min)}
</li>
</ul>
<i18n.Translate>