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

Bug fix for non-checksummed address #367

Merged
merged 9 commits into from
Jan 24, 2025
Merged

Bug fix for non-checksummed address #367

merged 9 commits into from
Jan 24, 2025

Conversation

milan-cb
Copy link
Contributor

@milan-cb milan-cb commented Jan 24, 2025

What changed? Why?

There was a bug in the fromModel function in asset.ts. On the backend side, any asset id is checksummed before retrieving its details, and when it returns a response to the SDK, its asset id is also checksummed. When a user enters a non-checksummed address, they will get an error since those two asset ids are not equivalent.

This change will allow users to use non-checksummed addresses without getting erroneous errors in their workflow.

Before:

await wallet.getBalance("0x8309fbdf021edf768dc13195741940ba544dea98")

ArgumentError: Unsupported asset ID: 0x8309fbdf021edf768dc13195741940ba544dea98

After:

await wallet.getBalance("0x8309fbdf021edf768dc13195741940ba544dea98")

0

Qualified Impact

This change should not be a breaking change for the SDK. The same logic of the check for asset ids exists, but with the normalization of cases, it prevents the bug of non-checksummed addresses and checksummed addresses being considered as unequal.

@milan-cb milan-cb changed the title Milan/psdk 894 Bug fix for non-checksummed address Jan 24, 2025
src/tests/asset_test.ts Outdated Show resolved Hide resolved
@milan-cb milan-cb requested a review from alex-stone January 24, 2025 19:08
Copy link
Contributor

@rohan-agarwal-coinbase rohan-agarwal-coinbase left a comment

Choose a reason for hiding this comment

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

Nice!

@milan-cb milan-cb merged commit cd78a03 into v0.16.0 Jan 24, 2025
6 checks passed
@milan-cb milan-cb deleted the milan/PSDK-894 branch January 24, 2025 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants