-
Notifications
You must be signed in to change notification settings - Fork 97
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(earn): add function for preparing supply transaction #5405
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5405 +/- ##
=======================================
Coverage 86.14% 86.15%
=======================================
Files 744 745 +1
Lines 30291 30333 +42
Branches 5181 5186 +5
=======================================
+ Hits 26094 26133 +39
- Misses 3969 3972 +3
Partials 228 228
... and 1 file with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
src/earn/prepareTransactions.ts
Outdated
// amount in smallest unit | ||
const amountToSupply = parseUnits(amount, token.decimals) | ||
|
||
if (!token.address) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i've been nagging people to use the viem type guard in places like this:
if (!token.address || !isAddress(token.address) {
src/earn/prepareTransactions.ts
Outdated
const approvedAllowanceForSpender = await publicClient[ | ||
networkIdToNetwork[token.networkId] | ||
].readContract({ | ||
address: token.address as Address, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...then you can drop the type assertions and maybe feel good about that.
…#5405) ### Description Mostly based off of swap transaction preparation ### Test plan Unit tests, manually preparing a tx ### Related issues - Part of ACT-1178 ### Backwards compatibility Yes ### Network scalability If a new NetworkId and/or Network are added in the future, the changes in this PR will: - [x] Continue to work without code changes, OR trigger a compilation error (guaranteeing we find it when a new network is added)
Description
Mostly based off of swap transaction preparation
Test plan
Unit tests, manually preparing a tx
Related issues
Backwards compatibility
Yes
Network scalability
If a new NetworkId and/or Network are added in the future, the changes in this PR will: