Skip to content

Conversation

@joaquim-verges
Copy link
Member

@joaquim-verges joaquim-verges commented Sep 24, 2025


PR-Codex overview

This PR focuses on updating the parameters in the params array within the packages/thirdweb/src/wallets/injected/index.ts file to include new properties and modify existing ones for transaction handling.

Detailed summary

  • Added data to the params array.
  • Updated authorizationList to include a conditional transformation with ox__Authorization.toRpcList.
  • Included accessList in the params array.

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

Summary by CodeRabbit

  • Bug Fixes

    • Improved reliability of sending transactions with injected wallets by explicitly setting transaction fields in RPC calls, reducing provider rejections and malformed parameter errors.
    • Restored support for authorization and access list fields where applicable, improving compatibility across networks and providers.
  • Improvements

    • More predictable transaction parameter formatting, leading to better interoperability with diverse RPC endpoints.
  • Developer Notes

    • No changes to public APIs or exported signatures.

@vercel
Copy link

vercel bot commented Sep 24, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
docs-v2 Ready Ready Preview Comment Sep 24, 2025 3:24am
nebula Ready Ready Preview Comment Sep 24, 2025 3:24am
thirdweb_playground Ready Ready Preview Comment Sep 24, 2025 3:24am
thirdweb-www Ready Ready Preview Comment Sep 24, 2025 3:24am
wallet-ui Ready Ready Preview Comment Sep 24, 2025 3:24am

@changeset-bot
Copy link

changeset-bot bot commented Sep 24, 2025

⚠️ No Changeset found

Latest commit: 66c4d37

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 24, 2025

Walkthrough

Refactors 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

Cohort / File(s) Summary
Injected wallet tx param construction
packages/thirdweb/src/wallets/injected/index.ts
Replaced ...tx spread with explicit RPC param assembly; added data and accessList; reintroduced authorizationList using ox__Authorization.toRpcList when present; maintained other fields explicitly; no exported API 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
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The PR description includes the repository template comment and a PR-Codex overview that documents the added data field, authorizationList transformation, and accessList insertion, but it does not fill the template's required sections such as "Notes for the reviewer" and "How to test" which remain as commented placeholders, so the description is incomplete for reviewers and testers. Please populate the template sections: add a "Notes for the reviewer" block highlighting any behavioral changes or decisions and a "How to test" section with manual steps or unit/integration test commands and expected results, and remove or replace the commented placeholders so reviewers have clear testing and review guidance.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The title "[SDK] Fix transaction parameter ordering in injected wallet" succinctly and accurately summarizes the primary change in this PR — updating the params array/ordering in packages/thirdweb/src/wallets/injected/index.ts to explicitly control fields like data, accessList, and authorizationList; it is concise, follows the repo prefix convention, and clearly reflects the main change.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch _SDK_Fix_transaction_parameter_ordering_in_injected_wallet

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • TEAM-0000: Entity not found: Issue - Could not find referenced Issue.

Comment @coderabbitai help to get the list of available commands and usage tips.

@joaquim-verges joaquim-verges marked this pull request as ready for review September 24, 2025 03:02
@github-actions github-actions bot added packages SDK Involves changes to the thirdweb SDK labels Sep 24, 2025
@joaquim-verges joaquim-verges requested review from a team as code owners September 24, 2025 03:02
Copy link
Member Author


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge-queue - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 on authorizationList RPC transform; consider normalizing accessList too.

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.accessList is in RPC shape (checksummed addresses, 0x-prefixed storageKeys), feel free to skip this.


203-216: Prevent tx.eip712 from overriding sanitized fields by moving its spread earlier.

Spreading ...tx.eip712 last can overwrite from, 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 for nonce, gas, and value.

Truthiness checks drop zero; compare against undefined instead 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.

📥 Commits

Reviewing files that changed from the base of the PR and between db145b5 and 66c4d37.

📒 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 @/types or local types.ts barrels
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless 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 @/types where applicable
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless 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/**: Unified Wallet and Account interfaces 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 @example and 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 including data looks correct; confirm type is hex.

If tx.data can be a Uint8Array or non-0x string upstream, convert to hex before passing.

Can you confirm SendTransactionOption['data'] is typed as Hex? If not, we should normalize:

-          data: tx.data,
+          data: typeof tx.data === 'string' ? tx.data : (tx.data ? uint8ArrayToHex(tx.data) : undefined),

@github-actions
Copy link
Contributor

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 64.07 KB (0%) 1.3 s (0%) 295 ms (+144.27% 🔺) 1.6 s
thirdweb (cjs) 361.6 KB (0%) 7.3 s (0%) 1.1 s (+13.34% 🔺) 8.3 s
thirdweb (minimal + tree-shaking) 5.73 KB (0%) 115 ms (0%) 92 ms (+1832.87% 🔺) 207 ms
thirdweb/chains (tree-shaking) 526 B (0%) 11 ms (0%) 57 ms (+1703.8% 🔺) 68 ms
thirdweb/react (minimal + tree-shaking) 19.14 KB (0%) 383 ms (0%) 133 ms (+1488.96% 🔺) 516 ms

@codecov
Copy link

codecov bot commented Sep 24, 2025

Codecov Report

❌ Patch coverage is 0% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.32%. Comparing base (db145b5) to head (66c4d37).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
packages/thirdweb/src/wallets/injected/index.ts 0.00% 5 Missing ⚠️

❌ 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     
Flag Coverage Δ
packages 56.32% <0.00%> (-0.01%) ⬇️
Files with missing lines Coverage Δ
packages/thirdweb/src/wallets/injected/index.ts 31.18% <0.00%> (-0.08%) ⬇️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

packages SDK Involves changes to the thirdweb SDK

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants