Skip to content

Commit

Permalink
refactor: move logic
Browse files Browse the repository at this point in the history
  • Loading branch information
benalleng committed Oct 1, 2023
1 parent b9f5ab2 commit 13dbe7f
Showing 1 changed file with 12 additions and 21 deletions.
33 changes: 12 additions & 21 deletions src/routes/Send.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,16 @@ export default function Send() {
tags
);

sentDetails.amount = amountSats();
sentDetails.destination = address();
sentDetails.txid = txid;
sentDetails.fee_estimate = feeEstimate() ?? 0;
} else if (payjoinEnabled()) {
const txid = await state.mutiny_wallet?.send_payjoin(
address()!,
amountSats(),
tags
);
sentDetails.amount = amountSats();
sentDetails.destination = address();
sentDetails.txid = txid;
Expand All @@ -558,16 +568,6 @@ export default function Send() {
sentDetails.txid = txid;
sentDetails.fee_estimate = feeEstimate() ?? 0;
}
} else if (source() === "onchain" && payjoinEnabled()) {
const txid = await state.mutiny_wallet?.send_payjoin(
address()!,
amountSats(),
tags
);
sentDetails.amount = amountSats();
sentDetails.destination = address();
sentDetails.txid = txid;
sentDetails.fee_estimate = feeEstimate() ?? 0;
}
setSentDetails(sentDetails as SentDetails);
clearAll();
Expand All @@ -594,11 +594,7 @@ export default function Send() {
<DefaultMain>
<Show
when={
address() ||
pjUri() ||
invoice() ||
nodePubkey() ||
lnurlp()
address() || invoice() || nodePubkey() || lnurlp()
}
fallback={<BackLink />}
>
Expand Down Expand Up @@ -678,7 +674,6 @@ export default function Send() {
<Match
when={
address() ||
pjUri() ||
invoice() ||
nodePubkey() ||
lnurlp()
Expand All @@ -687,10 +682,7 @@ export default function Send() {
<MethodChooser
source={source()}
setSource={setSource}
both={
(!!address() || !!pjUri()) &&
!!invoice()
}
both={!!address() && !!invoice()}
/>
<Card title={i18n.t("send.destination")}>
<VStack>
Expand All @@ -699,7 +691,6 @@ export default function Send() {
description={description()}
invoice={invoice()}
address={address()}
pjUri={pjUri()}
nodePubkey={nodePubkey()}
lnurl={lnurlp()}
clearAll={clearAll}
Expand Down

0 comments on commit 13dbe7f

Please sign in to comment.