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

feat(suite-native): advanced recipient address validation #15521

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

PeKne
Copy link
Contributor

@PeKne PeKne commented Nov 22, 2024

Description

  • advanced recipient address validation (taproot, bech32 uppercase and LTC + BCH deprecated addresses)

Resolve #15403

@PeKne PeKne added the mobile Suite Lite issues and PRs label Nov 22, 2024
@PeKne PeKne requested a review from a team as a code owner November 22, 2024 12:44
Copy link

🚀 Expo preview is ready!

  • Project → trezor-suite-preview
  • Platforms → android, ios
  • Scheme → trezorsuitelite
  • Runtime Version → 11
  • More info

Learn more about 𝝠 Expo Github Action

isAddressValid(value, networkSymbol) &&
!isAddressDeprecated(value, networkSymbol) &&
!isBech32AddressUppercase(value) && // bech32 addresses are valid as uppercase but are not accepted by Trezor
!(isTaprootAddress(value, networkSymbol) && isTaprootUnavailable) // bech32m/Taproot addresses are valid but may not be supported by older FW
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not a fan of ! in front of a complex boolean expression. I'd rename isTaprootUnavailable to isTaprootAvailable and simplify the negation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't understand. If I will change it to isTaprootAvailable I will have to check for !isTaprootAvailable. I want to return false from this function in case that in the ADDRESS IS TAPROOT and TAPROOT IS UNAVAILABLE.

Feel free to add change suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mobile Suite Lite issues and PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Send coins - Advanced address validation
2 participants