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: address validation error behavior #5281

Merged
merged 17 commits into from Nov 25, 2022

Conversation

maxwellmattryan
Copy link
Contributor

@maxwellmattryan maxwellmattryan commented Nov 24, 2022

Summary

Please summarize your changes, describing what they are and why they were made.

Currently validateBech32Address and validateEthereumAddress are returning error strings instead of throwing actual errors.

Changelog

- Change address validation functions to return true if valid or throw error if invalid
- Change logic using address validation functions
- Re-organize crypto util module

Relevant Issues

Please list any related issues using development keywords.

Closes #5240

Testing

Platforms

Please select any platforms where your changes have been tested.

  • Desktop
    • MacOS
    • Linux
    • Windows
  • Mobile
    • iOS
    • Android

Instructions

Please describe the specific instructions, configurations, and/or test cases necessary to test and verify that your changes work as intended.

Test recipient address inputs with valid and invalid addresses / strings.

Checklist

Please tick all of the following boxes that are relevant to your changes.

  • I have followed the contribution guidelines for this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or modified tests that prove my changes work as intended
  • I have verified that new and existing unit tests pass locally with my changes
  • I have verified that my latest changes pass CI workflows for testing and linting
  • I have made corresponding changes to the documentation

@maxwellmattryan maxwellmattryan self-assigned this Nov 24, 2022
@maxwellmattryan maxwellmattryan added type:refactor Refactor code stardust Related to the Stardust Protocol labels Nov 24, 2022
@maxwellmattryan maxwellmattryan linked an issue Nov 24, 2022 that may be closed by this pull request
6 tasks
@maxwellmattryan maxwellmattryan marked this pull request as ready for review November 24, 2022 10:56
@Tuditi Tuditi mentioned this pull request Nov 24, 2022
12 tasks
Copy link
Contributor

@Tuditi Tuditi 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!

packages/shared/components/inputs/AliasInput.svelte Outdated Show resolved Hide resolved
Comment on lines +2 to +4

import { selectedAccount } from '@core/account/stores'

Copy link
Contributor

Choose a reason for hiding this comment

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

any reasons for the empty lines?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think Matt added this, since the import comes from another module

packages/shared/lib/core/nfts/utils/parseNftMetadata.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@MarkNerdi996 MarkNerdi996 left a comment

Choose a reason for hiding this comment

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

LGTM

@Tuditi Tuditi merged commit 22cd42d into stardust-develop Nov 25, 2022
@Tuditi Tuditi deleted the fix/address-validation-error-behavior branch November 25, 2022 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stardust Related to the Stardust Protocol type:refactor Refactor code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task]: Change the way errors are handled at address validation
3 participants