diff --git a/packages/taler-wallet-webextension/src/components/BankDetailsByPaytoType.tsx b/packages/taler-wallet-webextension/src/components/BankDetailsByPaytoType.tsx
index 182e82a3d..ac6f8541e 100644
--- a/packages/taler-wallet-webextension/src/components/BankDetailsByPaytoType.tsx
+++ b/packages/taler-wallet-webextension/src/components/BankDetailsByPaytoType.tsx
@@ -14,18 +14,24 @@
GNU Taler; see the file COPYING. If not, see
*/
-import { PaytoUri } from "@gnu-taler/taler-util";
+import {
+ AmountJson,
+ Amounts,
+ PaytoUri,
+ segwitMinAmount,
+} from "@gnu-taler/taler-util";
import { Fragment, h, VNode } from "preact";
import { useEffect, useRef, useState } from "preact/hooks";
import { useTranslationContext } from "../context/translation.js";
import { CopiedIcon, CopyIcon } from "../svg/index.js";
+import { Amount } from "./Amount.js";
import { ButtonBox, TooltipRight } from "./styled/index.js";
export interface BankDetailsProps {
payto: PaytoUri | undefined;
exchangeBaseUrl: string;
subject: string;
- amount: string | VNode;
+ amount: AmountJson;
}
export function BankDetailsByPaytoType({
@@ -35,8 +41,65 @@ export function BankDetailsByPaytoType({
amount,
}: BankDetailsProps): VNode {
const { i18n } = useTranslationContext();
+ if (!payto) return ;
- const firstPart = !payto ? undefined : !payto.isKnown ? (
+ if (payto.isKnown && payto.targetType === "bitcoin") {
+ const min = segwitMinAmount(amount.currency);
+ if (typeof window !== "undefined") {
+ //FIXME: generate (and possibly save in db?) in wallet-core
+ payto.generateSegwitAddress(subject);
+ }
+ return (
+
+
+
+ Bitcoin exchange need a transaction with 3 output, one output is the
+ exchange account and the other two are segwit fake address for
+ metadata with an minimum amount. Reserve pub : {subject}
+
+
+
+
+ In bitcoincore wallet use 'Add Recipient' button to add
+ two additional recipient and copy addresses and amounts
+
+
+ -
+ {payto.targetPath} {Amounts.stringifyValue(amount)} BTC
+
+ -
+ {payto.addr1} {Amounts.stringifyValue(min)} BTC
+
+ -
+ {payto.addr2} {Amounts.stringifyValue(min)} BTC
+
+
+
+ In Electrum wallet paste the following three lines in 'Pay
+ to' field :
+
+
+ -
+ {payto.targetPath},{Amounts.stringifyValue(amount)}
+
+ -
+ {payto.addr1},{Amounts.stringifyValue(min)}
+
+ -
+ {payto.addr2},{Amounts.stringifyValue(min)}
+
+
+
+ Make sure the amount show{" "}
+ {Amounts.stringifyValue(Amounts.sum([amount, min, min]).amount)}{" "}
+ BTC, else you have to change the base unit to BTC
+
+
+
+ );
+ }
+
+ const firstPart = !payto.isKnown ? (
Account}
value={payto.targetPath}
@@ -66,7 +129,7 @@ export function BankDetailsByPaytoType({
/>
Chosen amount}
- value={amount}
+ value={}
/>
Subject}
diff --git a/packages/taler-wallet-webextension/src/wallet/ReserveCreated.tsx b/packages/taler-wallet-webextension/src/wallet/ReserveCreated.tsx
index e656393ca..02d8fe6a8 100644
--- a/packages/taler-wallet-webextension/src/wallet/ReserveCreated.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/ReserveCreated.tsx
@@ -1,10 +1,4 @@
-import {
- AmountJson,
- Amounts,
- PaytoUri,
- segwitMinAmount,
- stringifyPaytoUri,
-} from "@gnu-taler/taler-util";
+import { AmountJson, PaytoUri, stringifyPaytoUri } from "@gnu-taler/taler-util";
import { Fragment, h, VNode } from "preact";
import { Amount } from "../components/Amount.js";
import { BankDetailsByPaytoType } from "../components/BankDetailsByPaytoType.js";
@@ -42,61 +36,10 @@ export function ReserveCreated({
}
function TransferDetails(): VNode {
if (!paytoURI) return ;
- if (paytoURI.isKnown && paytoURI.targetType === "bitcoin") {
- const min = segwitMinAmount();
- return (
-
-
-
- Bitcoin exchange need a transaction with 3 output, one output is
- the exchange account and the other two are segwit fake address for
- metadata with an minimum amount. Reserve pub : {reservePub}
-
-
-
-
- In bitcoincore wallet use 'Add Recipient' button to add
- two additional recipient and copy addresses and amounts
-
-
- -
- {paytoURI.targetPath} {Amounts.stringifyValue(amount)} BTC
-
- -
- {paytoURI.addr1} {Amounts.stringifyValue(min)} BTC
-
- -
- {paytoURI.addr2} {Amounts.stringifyValue(min)} BTC
-
-
-
- In Electrum wallet paste the following three lines in 'Pay
- to' field :
-
-
- -
- {paytoURI.targetPath},{Amounts.stringifyValue(amount)}
-
- -
- {paytoURI.addr1},{Amounts.stringifyValue(min)}
-
- -
- {paytoURI.addr2},{Amounts.stringifyValue(min)}
-
-
-
- Make sure the amount show{" "}
- {Amounts.stringifyValue(Amounts.sum([amount, min, min]).amount)}{" "}
- BTC, else you have to change the base unit to BTC
-
-
-
- );
- }
return (
}
+ amount={amount}
exchangeBaseUrl={exchangeBaseUrl}
payto={paytoURI}
subject={reservePub}
diff --git a/packages/taler-wallet-webextension/src/wallet/Transaction.tsx b/packages/taler-wallet-webextension/src/wallet/Transaction.tsx
index 62e40d029..4a6c218c7 100644
--- a/packages/taler-wallet-webextension/src/wallet/Transaction.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/Transaction.tsx
@@ -224,7 +224,7 @@ export function TransactionView({
WithdrawalType.ManualTransfer ? (
}
+ amount={Amounts.parseOrThrow(transaction.amountRaw)}
exchangeBaseUrl={transaction.exchangeBaseUrl}
payto={parsePaytoUri(
transaction.withdrawalDetails.exchangePaytoUris[0],