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

fix: Hide "add to address book" when address already in the address book #3558

Merged
merged 2 commits into from
Apr 15, 2024

Conversation

daniel0ar
Copy link
Contributor

What it solves

Resolves #3531

How this PR fixes it

It adds a memo function value (isInAddressBook) to find address in address book (returns true if found) and adds this check before displaying the message (if not isInAddressBook then display message).

How to test it

  1. Go to a safe you own
  2. Add an address to the address book
  3. Start a send funds tx
  4. Copy/paste that address in the input
  5. Check that "add to address book" is not showing anymore.

Screenshots

image

@@ -35,6 +35,11 @@ const AddressBookInput = ({ name, canAdd, ...props }: AddressInputProps & { canA
[addressBookEntries, addressValue],
)

const isInAddressBook = useMemo(
Copy link
Member

Choose a reason for hiding this comment

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

Is this checking the eth address or the displayed name of an entry?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Eth address previously assigned to entry.label

Copy link
Member

@katspaugh katspaugh Apr 14, 2024

Choose a reason for hiding this comment

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

Thanks! A follow-up question: will it work if I enter a lowercase address but the address book contains a checksummed version of the same address? In some other places we use the sameAddress function for both variants to match.

Copy link
Contributor Author

@daniel0ar daniel0ar Apr 14, 2024

Choose a reason for hiding this comment

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

You're right hadn't thought of that, I will use the sameAddress function :)

Copy link
Member

@katspaugh katspaugh left a comment

Choose a reason for hiding this comment

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

Looks good, thanks a lot! 💚

@katspaugh katspaugh merged commit 586a593 into safe-global:dev Apr 15, 2024
2 of 12 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Apr 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Option to "add to address book" shown when the address already is in the addressbook
2 participants