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: add starkid improvements #1301

Merged
merged 2 commits into from
Jan 29, 2025

Conversation

fricoben
Copy link
Contributor

Motivation and Resolution

Argent ran into a problem using useDecoded when decoding the domain Grug.stark, this should have been passed as grug.stark but they didn't have the isStarkDomain to do so easily.

Usage related changes

I'm addding two things to help wallet and devs in general:

  1. Adding isStarkDomain to permit manual verification
  2. Refactoring getAddressFromStarkName to make the function detect this kind of name errors in the future

@fricoben fricoben force-pushed the fix/starkid-improvements branch from 3047892 to cd2bfc4 Compare January 27, 2025 16:32
@@ -85,6 +85,12 @@ describe('deploy and test Wallet', () => {
expect(hexToDecimalString(address)).toEqual(hexToDecimalString(account.address));
});

test('Should throw error when invalid stark domain is provided', async () => {
await expect(account.getAddressFromStarkName('invalid-domain', namingAddress)).rejects.toThrow(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
await expect(account.getAddressFromStarkName('invalid-domain', namingAddress)).rejects.toThrow(
await expect(account.getAddressFromStarkName('InvalidDomain', namingAddress)).rejects.toThrow(

Since the opening ternary from getAddressFromStarkName appends .stark to the name input invalid-domain.stark ends up matching the isStarkDomain regex and the test fails.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep my bad, added a forbidden character _ so it works

@fricoben fricoben requested a review from penovicp January 28, 2025 14:06
@tabaktoni tabaktoni merged commit 51702db into starknet-io:develop Jan 29, 2025
3 checks passed
github-actions bot pushed a commit that referenced this pull request Jan 29, 2025
## [6.21.2](v6.21.1...v6.21.2) (2025-01-29)

### Bug Fixes

* add starkid improvements ([#1301](#1301)) ([51702db](51702db))
Copy link

🎉 This PR is included in version 6.21.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants