-
Notifications
You must be signed in to change notification settings - Fork 619
[SDK] Fix transaction parameter ordering in injected wallet #8109
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 transaction parameter ordering in injected wallet #8109
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
WalkthroughRefactors sendTransaction parameter construction within createAccount in packages/thirdweb/src/wallets/injected/index.ts to explicitly map transaction fields (to, from, value, gas, gasPrice, nonce, data, accessList) and handle authorizationList via ox__Authorization.toRpcList, removing prior object spread and avoiding implicit field forwarding. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant App
participant InjectedWallet as Injected Wallet (createAccount)
participant RPC as JSON-RPC Provider
App->>InjectedWallet: sendTransaction(tx)
note right of InjectedWallet: Build RPC params explicitly:<br/>to, from, value, gas, gasPrice, nonce,<br/>data, accessList, authorizationList (mapped)
InjectedWallet->>RPC: eth_sendTransaction(params)
RPC-->>InjectedWallet: txHash / error
InjectedWallet-->>App: result
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests
Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (1)
Comment |
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. This stack of pull requests is managed by Graphite. Learn more about stacking. |
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
🧹 Nitpick comments (3)
packages/thirdweb/src/wallets/injected/index.ts (3)
211-214: Good onauthorizationListRPC transform; consider normalizingaccessListtoo.Some providers expect RPC-shaped access list entries with checksummed addresses. Normalize to reduce provider variance.
Apply:
- authorizationList: tx.authorizationList - ? ox__Authorization.toRpcList(tx.authorizationList) - : undefined, - accessList: tx.accessList, + authorizationList: tx.authorizationList + ? ox__Authorization.toRpcList(tx.authorizationList) + : undefined, + accessList: tx.accessList + ? tx.accessList.map(({ address, storageKeys }) => ({ + address: getAddress(address), + storageKeys, + })) + : undefined,If you already guarantee
tx.accessListis in RPC shape (checksummed addresses, 0x-prefixedstorageKeys), feel free to skip this.
203-216: Preventtx.eip712from overriding sanitized fields by moving its spread earlier.Spreading
...tx.eip712last can overwritefrom,to,data, fee fields, etc. Place it before explicit mappings.- { - ...gasFees, - from: this.address, - gas: tx.gas ? numberToHex(tx.gas) : undefined, - nonce: tx.nonce ? numberToHex(tx.nonce) : undefined, - to: tx.to ? getAddress(tx.to) : undefined, - data: tx.data, - value: tx.value ? numberToHex(tx.value) : undefined, - authorizationList: tx.authorizationList - ? ox__Authorization.toRpcList(tx.authorizationList) - : undefined, - accessList: tx.accessList, - ...tx.eip712, - }, + { + ...gasFees, + ...tx.eip712, + from: this.address, + gas: tx.gas !== undefined ? numberToHex(tx.gas) : undefined, + nonce: tx.nonce !== undefined ? numberToHex(tx.nonce) : undefined, + to: tx.to ? getAddress(tx.to) : undefined, + data: tx.data, + value: tx.value !== undefined ? numberToHex(tx.value) : undefined, + authorizationList: tx.authorizationList + ? ox__Authorization.toRpcList(tx.authorizationList) + : undefined, + accessList: tx.accessList + ? tx.accessList.map(({ address, storageKeys }) => ({ + address: getAddress(address), + storageKeys, + })) + : undefined, + },
206-210: Preserve explicit 0 values fornonce,gas, andvalue.Truthiness checks drop zero; compare against
undefinedinstead to honor caller intent.- gas: tx.gas ? numberToHex(tx.gas) : undefined, - nonce: tx.nonce ? numberToHex(tx.nonce) : undefined, + gas: tx.gas !== undefined ? numberToHex(tx.gas) : undefined, + nonce: tx.nonce !== undefined ? numberToHex(tx.nonce) : undefined, to: tx.to ? getAddress(tx.to) : undefined, data: tx.data, - value: tx.value ? numberToHex(tx.value) : undefined, + value: tx.value !== undefined ? numberToHex(tx.value) : undefined,
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
packages/thirdweb/src/wallets/injected/index.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each file to one stateless, single-responsibility function for clarity
Re-use shared types from@/typesor localtypes.tsbarrels
Prefer type aliases over interface except for nominal shapes
Avoidanyandunknownunless unavoidable; narrow generics when possible
Choose composition over inheritance; leverage utility types (Partial,Pick, etc.)
Comment only ambiguous logic; avoid restating TypeScript in prose
**/*.{ts,tsx}: Use explicit function declarations and explicit return types in TypeScript
Limit each file to one stateless, single‑responsibility function
Re‑use shared types from@/typeswhere applicable
Prefertypealiases overinterfaceexcept for nominal shapes
Avoidanyandunknownunless unavoidable; narrow generics when possible
Prefer composition over inheritance; use utility types (Partial, Pick, etc.)
Lazy‑import optional features and avoid top‑level side‑effects to reduce bundle size
Files:
packages/thirdweb/src/wallets/injected/index.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (CLAUDE.md)
Load heavy dependencies inside async paths to keep initial bundle lean (lazy loading)
Files:
packages/thirdweb/src/wallets/injected/index.ts
packages/thirdweb/src/wallets/**
📄 CodeRabbit inference engine (CLAUDE.md)
packages/thirdweb/src/wallets/**: UnifiedWalletandAccountinterfaces in wallet architecture
Support for in-app wallets (social/email login)
Smart wallets with account abstraction
EIP-1193, EIP-5792, EIP-7702 standard support in wallet modules
Files:
packages/thirdweb/src/wallets/injected/index.ts
packages/thirdweb/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
packages/thirdweb/**/*.{ts,tsx}: Every public symbol must have comprehensive TSDoc with at least one compiling@exampleand a custom tag (@beta,@internal,@experimental, etc.)
Comment only ambiguous logic; avoid restating TypeScript in prose
Lazy‑load heavy dependencies inside async paths (e.g.,const { jsPDF } = await import("jspdf"))
Files:
packages/thirdweb/src/wallets/injected/index.ts
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Applies to packages/thirdweb/src/wallets/** : Unified `Wallet` and `Account` interfaces in wallet architecture
📚 Learning: 2025-07-18T19:19:55.613Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Applies to packages/thirdweb/src/wallets/** : Unified `Wallet` and `Account` interfaces in wallet architecture
Applied to files:
packages/thirdweb/src/wallets/injected/index.ts
🧬 Code graph analysis (1)
packages/thirdweb/src/wallets/injected/index.ts (1)
packages/thirdweb/src/exports/utils.ts (1)
numberToHex(82-82)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
- GitHub Check: E2E Tests (pnpm, esbuild)
- GitHub Check: E2E Tests (pnpm, vite)
- GitHub Check: Size
- GitHub Check: E2E Tests (pnpm, webpack)
- GitHub Check: Unit Tests
- GitHub Check: Lint Packages
- GitHub Check: Build Packages
- GitHub Check: Analyze (javascript)
🔇 Additional comments (1)
packages/thirdweb/src/wallets/injected/index.ts (1)
209-209: Explicitly includingdatalooks correct; confirm type is hex.If
tx.datacan be aUint8Arrayor non-0x string upstream, convert to hex before passing.Can you confirm
SendTransactionOption['data']is typed asHex? If not, we should normalize:- data: tx.data, + data: typeof tx.data === 'string' ? tx.data : (tx.data ? uint8ArrayToHex(tx.data) : undefined),
size-limit report 📦
|
Codecov Report❌ 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 #8109 +/- ##
==========================================
- Coverage 56.32% 56.32% -0.01%
==========================================
Files 906 906
Lines 59197 59198 +1
Branches 4179 4180 +1
==========================================
Hits 33345 33345
Misses 25747 25747
- Partials 105 106 +1
🚀 New features to boost your workflow:
|

PR-Codex overview
This PR focuses on updating the parameters in the
paramsarray within thepackages/thirdweb/src/wallets/injected/index.tsfile to include new properties and modify existing ones for transaction handling.Detailed summary
datato theparamsarray.authorizationListto include a conditional transformation withox__Authorization.toRpcList.accessListin theparamsarray.Summary by CodeRabbit
Bug Fixes
Improvements
Developer Notes