-
Notifications
You must be signed in to change notification settings - Fork 557
[SDK] Fix: stringify bigint erc20Value in useTransactionDetails #7360
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] Fix: stringify bigint erc20Value in useTransactionDetails #7360
Conversation
🦋 Changeset detectedLatest commit: 51d1bd9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughThe changes update the rendering logic of the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant PayTransactionPreview
participant TransactionWidget
User->>PayTransactionPreview: Render component
PayTransactionPreview->>TransactionWidget: Render with amount=100n
TransactionWidget-->>User: Display transaction UI
Possibly related PRs
Suggested reviewers
Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (1)
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (5)
💤 Files with no reviewable changes (2)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ Context from checks skipped due to timeout of 90000ms (8)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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. |
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.
Actionable comments posted: 0
🔭 Outside diff range comments (1)
packages/thirdweb/src/react/core/hooks/useTransactionDetails.ts (1)
55-61
:transaction.erc20Value?.toString()
risks cache-key collisions – stringify the amount, not the object
erc20Value
is later treated as an object (erc20Value.tokenAddress
,erc20Value.amountWei
).
Calling.toString()
on that object will coerce it to"[object Object]"
, meaning all ERC-20 values produce the same cache key segment. Different amounts or token addresses will therefore share React-Query cache entries → stale or cross-polluted results.- transaction.erc20Value?.toString(), + transaction.erc20Value + ? `${transaction.erc20Value.tokenAddress}-${transaction.erc20Value.amountWei.toString()}` + : undefined,This keeps the key stable while uniquely identifying both the token and the amount.
🧹 Nitpick comments (1)
apps/playground-web/src/components/pay/transaction-button.tsx (1)
35-37
: Unusedaccount
fetch in this component once gatedIf you decide to keep the widget unconditional, the
account
hook can be removed, otherwise it remains required for the conditional render above. Keep the import list tidy accordingly.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
apps/playground-web/src/components/pay/transaction-button.tsx
(1 hunks)packages/thirdweb/src/react/core/hooks/useTransactionDetails.ts
(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
apps/playground-web/src/components/pay/transaction-button.tsx (1)
apps/playground-web/src/lib/client.ts (1)
THIRDWEB_CLIENT
(20-43)
⏰ Context from checks skipped due to timeout of 90000ms (8)
- GitHub Check: E2E Tests (pnpm, vite)
- GitHub Check: Lint Packages
- GitHub Check: Size
- GitHub Check: E2E Tests (pnpm, esbuild)
- GitHub Check: E2E Tests (pnpm, webpack)
- GitHub Check: Unit Tests
- GitHub Check: Build Packages
- GitHub Check: Analyze (javascript)
🔇 Additional comments (1)
apps/playground-web/src/components/pay/transaction-button.tsx (1)
42-56
: ```shell
#!/bin/bashLocate and print the TransactionButton component for review
file=$(fd -t f "transaction-button.tsx")
echo "Found file: $file"
echo "---- Begin file content ----"
sed -n '1,200p' "$file"
echo "---- Continue file content ----"
sed -n '201,400p' "$file"</details> </blockquote></details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
size-limit report 📦
|
a1abdb9
to
9396cab
Compare
b5cb3fe
to
51d1bd9
Compare
Codecov ReportAttention: Patch coverage is
❌ Your patch status 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 #7360 +/- ##
=======================================
Coverage 52.35% 52.36%
=======================================
Files 939 939
Lines 63160 63160
Branches 4215 4216 +1
=======================================
+ Hits 33070 33073 +3
+ Misses 29983 29980 -3
Partials 107 107
🚀 New features to boost your workflow:
|
PR-Codex overview
This PR focuses on enhancing the
TransactionWidget
by allowing an explicit amount to be set and updating the handling oferc20Value
. It also removes outdated documentation regarding payment method toggling.Detailed summary
transaction.erc20Value
totransaction.erc20Value?.toString()
.amount={100n}
to theTransactionWidget
intransaction-button.tsx
.CheckoutWidget
andTransactionWidget
.Summary by CodeRabbit
Bug Fixes
Documentation