-
Notifications
You must be signed in to change notification settings - Fork 526
Fix: useWalletBalance
and the useActiveAccount
to work with 0x{string}
addresses instead of strings.
#6852
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
base: main
Are you sure you want to change the base?
Conversation
`0x{string}` addresses instead of strings.
|
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. |
@0xDAEF0F is attempting to deploy a commit to the thirdweb Team on Vercel. A member of the Team first needs to authorize it. |
Codecov ReportAttention: Patch coverage is
❌ Your patch check has failed because the patch coverage (0.00%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.
Additional details and impacted files@@ Coverage Diff @@
## main #6852 +/- ##
===========================================
- Coverage 55.31% 35.52% -19.79%
===========================================
Files 896 893 -3
Lines 57023 56891 -132
Branches 3971 2221 -1750
===========================================
- Hits 31541 20212 -11329
- Misses 25385 36608 +11223
+ Partials 97 71 -26
🚀 New features to boost your workflow:
|
I feel like if we're going to do this we should do it... for all addresses RETURNED by the SDK across the entire codebase I think there is no harm in RETURNING the more strict type everywhere, we obviously can't force existing users to PASS the more strict type everywhere because that would be a breaking change, but returning a stricter type should be non-breaking for everyone. @joaquim-verges @MananTank @gregfromstl for your thoughts on this |
also thanks @0xDAEF0F for kicking this off, we'll get to a resolution on the overall plan here from our side and we'll get this merged if it fits the direction we want to go down |
It’s technically a breaking change, but only in cases where the user wasn’t passing the address correctly to begin with. In that sense, it’s a good break; it surfaces a misuse that would have failed at runtime anyway. EDIT:
I don't know if type safety is a priority right now (ts is not real type safety anyways 😜) and if it's a good thing to mess so much with the codebase everywhere. Just trying to fix the GH issue. |
hm it's actually the other direction that this becomes doable without breaking every user:
returning a more strict type is completely non breaking because Happy for you to take a stab at this @0xDAEF0F - however this is definitely a big chunk of the codebase (even though only tiny individual parts) that will need to change. |
0x${string}
type across several files.0x{string}
type for addresses, improving type safety and developer experience.0x${string}
) in a single location, specifically in the deprecated fromViemWalletClient function, to maintain backward compatibility without introducing unnecessary changes elsewhere.solves issue #6810
PR-Codex overview
This PR focuses on enhancing type safety by changing the type of various
address
properties across multiple files to a more specific format, ensuring they conform to the Ethereum address pattern.Detailed summary
address
type fromAddress
to0x${string}
inwallet.ts
.viemAccount.address
to0x${string}
inviem.ts
.address
type to0x${string} | undefined
inuseWalletBalance.ts
.address
type to0x${string}
inTokenListScreen.tsx
.walletAddress
type fromstring
to0x${string}
inindex.ts
.