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

[SDK] get ERC20Value for claimToBatch #5157

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kien-ngo
Copy link
Contributor

@kien-ngo kien-ngo commented Oct 24, 2024

Problem solved

Short description of the bug fixed or feature added


PR-Codex overview

This PR focuses on enhancing the erc20Value type in prepare-transaction.ts and adding a new getERC20Value function in claimToBatch.ts to handle promise resolutions for ERC20 values in batch claims.

Detailed summary

  • Updated erc20Value type to allow a promise or undefined in prepare-transaction.ts.
  • Modified claimToBatch function to include erc20Value in the overrides.
  • Added getERC20Value function to resolve and aggregate ERC20 values from claims.
  • Implemented filtering and summation logic in getERC20Value.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Copy link

vercel bot commented Oct 24, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 24, 2024 5:26pm
thirdweb_playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 24, 2024 5:26pm
thirdweb-www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 24, 2024 5:26pm
wallet-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 24, 2024 5:26pm

Copy link

changeset-bot bot commented Oct 24, 2024

⚠️ No Changeset found

Latest commit: 7e93768

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

graphite-app bot commented Oct 24, 2024

Your org has enabled the Graphite merge queue for merging into main

Add the label “merge-queue” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix.

You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link.

@kien-ngo kien-ngo marked this pull request as ready for review October 24, 2024 10:54
Copy link
Contributor Author

kien-ngo commented Oct 24, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @kien-ngo and the rest of your teammates on Graphite Graphite

Comment on lines 53 to 56
overrides: {
erc20Value: () => getERC20Value(options),
...options.content,
},
Copy link

Choose a reason for hiding this comment

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

There appears to be a bug where options.content is being spread into the overrides object. This is incorrect as content contains claim parameters, not transaction overrides. The spread should be ...options.overrides instead to properly pass through any transaction override parameters.

Spotted by Graphite Reviewer

Is this helpful? React 👍 or 👎 to let us know.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Holy cow good bot!!!!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Resolved

Copy link
Member

Choose a reason for hiding this comment

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

good bot

@kien-ngo kien-ngo force-pushed the kien/get-erc20Value-for-batch branch from 1c3e58b to 550be2c Compare October 24, 2024 10:56
@kien-ngo kien-ngo force-pushed the kien/get-erc20Value-for-batch branch from 550be2c to e849966 Compare October 24, 2024 11:00
@kien-ngo kien-ngo force-pushed the kien/get-erc20Value-for-batch branch 2 times, most recently from 6090c75 to bc3f390 Compare October 24, 2024 11:04
@kien-ngo kien-ngo changed the base branch from main to kien/useUploadAirdrop October 24, 2024 11:04
Copy link
Contributor

github-actions bot commented Oct 24, 2024

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 42.9 KB (+0.04% 🔺) 859 ms (+0.04% 🔺) 2.6 s (-50.91% 🔽) 3.4 s
thirdweb (cjs) 102.73 KB (0%) 2.1 s (0%) 6.6 s (+13.78% 🔺) 8.6 s
thirdweb (minimal + tree-shaking) 4.84 KB (0%) 97 ms (0%) 255 ms (+40.16% 🔺) 352 ms
thirdweb/chains (tree-shaking) 498 B (0%) 10 ms (0%) 59 ms (-1.02% 🔽) 69 ms
thirdweb/react (minimal + tree-shaking) 17.34 KB (0%) 347 ms (0%) 615 ms (+29.56% 🔺) 962 ms

Copy link

codecov bot commented Oct 24, 2024

Codecov Report

Attention: Patch coverage is 64.86486% with 13 lines in your changes missing coverage. Please review.

Project coverage is 45.43%. Comparing base (2fdb69d) to head (7e93768).

Files with missing lines Patch % Lines
.../src/extensions/erc721/drops/write/claimToBatch.ts 64.86% 13 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5157      +/-   ##
==========================================
+ Coverage   45.42%   45.43%   +0.01%     
==========================================
  Files        1065     1065              
  Lines       55145    55181      +36     
  Branches     3970     3977       +7     
==========================================
+ Hits        25049    25072      +23     
- Misses      29404    29417      +13     
  Partials      692      692              
Flag Coverage Δ *Carryforward flag
legacy_packages 65.68% <ø> (ø) Carriedforward from 2fdb69d
packages 40.46% <64.86%> (+0.01%) ⬆️

*This pull request uses carry forward flags. Click here to find out more.

Files with missing lines Coverage Δ
...es/thirdweb/src/transaction/prepare-transaction.ts 100.00% <ø> (ø)
.../src/extensions/erc721/drops/write/claimToBatch.ts 77.88% <64.86%> (-7.41%) ⬇️

amountWei: bigint;
tokenAddress: Address;
}
| Promise<
Copy link
Member

Choose a reason for hiding this comment

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

make sure we're handling this being a promise where its used

Copy link
Contributor Author

Choose a reason for hiding this comment

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

so far I believe only getApprovalForTransaction is using it (which is the reason why you added erc20Value in the first place?) - I'll double check anyway

@MananTank MananTank removed their request for review October 28, 2024 14:57
@kien-ngo kien-ngo marked this pull request as draft November 1, 2024 05:55
@kien-ngo kien-ngo self-assigned this Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DO NOT MERGE This pull request is still in progress and is not ready to be merged. packages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants