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

frontend/coin-control: add address reuse warning #2724

Merged
merged 2 commits into from
Jun 4, 2024

Conversation

strmci
Copy link
Collaborator

@strmci strmci commented May 20, 2024

Add a warning to the coin control modal when a user selects one or more UTXOs from reused addresses. The warning: "One or more UTXOs have a reused address. Be aware the receiver will see all UTXOs associated with those addresses."

The UTXOs now have red badge when their address was re-used.

Copy link
Collaborator

@Beerosagos Beerosagos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Just noticed a small bug.

I also feel like the duplicated address should be somehow highlighted. Otherwise it can be hard to find those out.

{utxo.address}
</span>
<div>
<Status hidden={!hasAddressReuse} type="warning" className="m-bottom-default">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is repeated for each utxo's script type (see image). It should be at an upper level, I guess.

image

@strmci strmci force-pushed the coincontrol branch 4 times, most recently from bebb863 to c3a2cd2 Compare May 24, 2024 13:37
@strmci
Copy link
Collaborator Author

strmci commented May 24, 2024

@Beerosagos @thisconnect

  • fixed the repeated warning for each UTXO's script type
  • the warning is shown only when the user selects the UTXO from the reused address
  • I changed the warning from Status to Message so it is not all red
  • added a badge to all UTXOs from re-used addresses
  • CHANGELOG updated

PTAL

image

Copy link
Collaborator

@Beerosagos Beerosagos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with a couple nits 👍

Nit: maybe we can vertically center better the badge?

image

@@ -56,6 +58,7 @@ export const UTXOs = ({
const { t } = useTranslation();
const [utxos, setUtxos] = useState<TUTXO[]>([]);
const [selectedUTXOs, setSelectedUTXOs] = useState<TSelectedUTXOs>({});
const [showAddressReusedMessage, setShowAddressReusedMessage] = useState(0);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I find the name of this const slightly misleading. Maybe smth like selectedReusedAddresses? Since it is a number and not a bool.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to reusedAddressUTXOs.

@thisconnect
Copy link
Collaborator

Nit: maybe we can vertically center better the badge?

I'll take a look, ideally badge would be nice and inline with text. Not sure yet what causes this.

@strmci strmci force-pushed the coincontrol branch 3 times, most recently from c4b34db to dc0e54e Compare May 28, 2024 12:16
@thisconnect
Copy link
Collaborator

I'll take a look, ideally badge would be nice and inline with text. Not sure yet what causes this.

tl;dr it was a combination of inconsitent line-heights (parent element) and vertical centering.

branch with fix
https://github.com/thisconnect/bitbox-wallet-app/tree/frontend-fix-badge-centering

diff
https://github.com/BitBoxSwiss/bitbox-wallet-app/compare/master...thisconnect:frontend-fix-badge-centering?expand=1

@strmci @Beerosagos let me know if you want to merge this PR first and if I should open a followup PR or feel free to chery-pick my commit into this change.

@strmci
Copy link
Collaborator Author

strmci commented May 30, 2024

@thisconnect
I cherry-picked your Badge improvement, thanks.

strmci and others added 2 commits May 30, 2024 17:57
Add a warning to the coin control modal when a user
selects  one or more UTXOs from reused addresses.
The warning: "One or more UTXOs have a reused address.
Be aware  the receiver will see all UTXOs associated
with those addresses."

The UTXOs now have red badge when their address was
re-used.
Badges are not vertically aligned consistently in all places. This
was caused mostly as badges were centerd vertically but then had
slightly different line-height.

Badges behave like text and usually have `display: inline;`.

Changed line-height to be consistent and vertical alignment to
baseline, so that the badge text stands on the same line as the
other text.

Badges currently appear in the following components:
- account selector can have badge with icon only
- sidebar shows badge for connected keystore with icon and text
- reused utxo's in coincontrol have badge with warning text
- account summary balance have badge for connected keystore
- exchange options show best-deal or fast badge
- manage-accounts shows badge for connected keystore
@strmci strmci merged commit 523a702 into BitBoxSwiss:master Jun 4, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants