Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ui(send): fee warning on sweeps #764

Draft
wants to merge 1 commit into
base: devel
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions src/components/Send/SweepBreakdown.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,13 @@
text-align: right;
}

.sweepBreakdownAnchor {
font-size: 0.8rem;
color: var(--bs-dark);
}

:root[data-theme='dark'] .sweepBreakdownAnchor {
color: var(--bs-light) !important;
}

:root[data-theme='dark'] .sweepBreakdownParagraph {
color: var(--bs-light) !important;
}

.accordionButton {
background-color: transparent;
color: var(--bs-dark);
display: flex;
justify-content: flex-end;
font-size: 0.8rem;
align-items: center;
height: 1rem;
padding: 0;
box-shadow: none;
Expand Down
84 changes: 46 additions & 38 deletions src/components/Send/SweepBreakdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Trans, useTranslation } from 'react-i18next'
import * as rb from 'react-bootstrap'
import { AccountBalanceSummary } from '../../context/BalanceSummary'
import Balance from '../Balance'
import Sprite from '../Sprite'
import { SATS } from '../../utils'

import styles from './SweepBreakdown.module.css'
Expand All @@ -12,9 +13,14 @@ type SweepAccordionToggleProps = {
function SweepAccordionToggle({ eventKey }: SweepAccordionToggleProps) {
const { t } = useTranslation()
return (
<button type="button" className={styles.accordionButton} onClick={rb.useAccordionButton(eventKey)}>
{t('send.button_sweep_amount_breakdown')}
</button>
<div>
<button type="button" className={styles.accordionButton} onClick={rb.useAccordionButton(eventKey)}>
<div className="badge rounded-pill bg-warning text-dark p-0 me-1">
<Sprite symbol="warn" width="16" height="16" />
</div>
{t('send.button_sweep_amount_breakdown')}
</button>
</div>
)
}

Expand Down Expand Up @@ -64,41 +70,43 @@ export function SweepBreakdown({ jarBalance }: SweepBreakdownProps) {
</tr>
</tbody>
</table>
<p className={`${styles.sweepBreakdownParagraph} mb-0 mt-4`}>
<Trans i18nKey="send.sweep_amount_breakdown_explanation">
A sweep transaction will consume all UTXOs of a mixdepth leaving no coins behind except those that have
been
<a
href="https://github.com/JoinMarket-Org/joinmarket-clientserver#wallet-features"
target="_blank"
rel="noopener noreferrer"
className={styles.sweepBreakdownAnchor}
>
frozen
</a>
or
<a
href="https://github.com/JoinMarket-Org/joinmarket-clientserver/blob/master/docs/fidelity-bonds.md"
target="_blank"
rel="noopener noreferrer"
className={styles.sweepBreakdownAnchor}
>
time-locked
</a>
. Mining fees and collaborator fees will be deducted from the amount so as to leave zero change. The
exact transaction amount can only be calculated by JoinMarket at the point when the transaction is made.
Therefore the estimated amount shown might deviate from the actually sent amount. Refer to the
<a
href="https://github.com/JoinMarket-Org/JoinMarket-Docs/blob/master/High-level-design.md#joinmarket-transaction-types"
target="_blank"
rel="noopener noreferrer"
className={styles.sweepBreakdownAnchor}
>
JoinMarket documentation
</a>
for more details.
</Trans>
</p>
<rb.Alert variant="warning">
<p className="mb-0">
<Trans i18nKey="send.sweep_amount_breakdown_explanation">
A sweep transaction will consume all UTXOs of a mixdepth leaving no coins behind except those that
have been
<a
href="https://github.com/JoinMarket-Org/joinmarket-clientserver#wallet-features"
target="_blank"
rel="noopener noreferrer"
className="alert-link"
>
frozen
</a>
or
<a
href="https://github.com/JoinMarket-Org/joinmarket-clientserver/blob/master/docs/fidelity-bonds.md"
target="_blank"
rel="noopener noreferrer"
className="alert-link"
>
time-locked
</a>
. Mining fees and collaborator fees will be deducted from the amount so as to leave zero change. The
exact transaction amount can only be calculated by JoinMarket at the point when the transaction is
made. Therefore the estimated amount shown might deviate from the actually sent amount. Refer to the
<a
href="https://github.com/JoinMarket-Org/JoinMarket-Docs/blob/master/High-level-design.md#joinmarket-transaction-types"
target="_blank"
rel="noopener noreferrer"
className="alert-link"
>
JoinMarket documentation
</a>
for more details.
</Trans>
</p>
</rb.Alert>
</rb.Accordion.Body>
</rb.Accordion.Item>
</rb.Accordion>
Expand Down