Skip to content

Conversation

@alecananian
Copy link
Contributor

@alecananian alecananian commented Jul 18, 2025

Fixes #7646

See above issue for error explanation - it boils down to type mismatches between PreparedTransaction and PreparedTransaction<any>


PR-Codex overview

This PR updates the transaction handling in the thirdweb package by transitioning from using PreparedTransaction to SendTransactionOptions["transaction"] across various hooks and actions, enhancing type safety and consistency in transaction processing.

Detailed summary

  • Updated SendBatchTransactionOptions to use SendTransactionOptions["transaction"] instead of PreparedTransaction[].
  • Modified useSendBatchTransaction to accept SendTransactionOptions["transaction"][].
  • Changed useSendAndConfirmTransaction to use SendTransactionOptions["transaction"] instead of PreparedTransaction.
  • Updated useSendTransactionCore to accept SendTransactionOptions["transaction"] instead of PreparedTransaction.

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

Summary by CodeRabbit

  • New Features

    • Updated React hooks to use core transaction types for improved consistency across transaction-related functionality.
  • Documentation

    • Added a changeset summarizing the update to transaction hooks.

@alecananian alecananian requested review from a team as code owners July 18, 2025 20:14
@changeset-bot
Copy link

changeset-bot bot commented Jul 18, 2025

🦋 Changeset detected

Latest commit: 2c983ee

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
thirdweb Patch
@thirdweb-dev/nebula Patch
@thirdweb-dev/wagmi-adapter Patch

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 18, 2025

Walkthrough

The changes update the type signatures of several React transaction hooks in the "thirdweb" package to use the core transaction types, specifically switching from PreparedTransaction to SendTransactionOptions["transaction"]. No logic or control flow is modified; only type imports and function signatures are updated. A changeset entry documents this patch.

Changes

File(s) Change Summary
.changeset/smooth-crabs-reply.md Added changeset documenting patch update for React hooks to use core transaction types.
packages/thirdweb/src/react/core/hooks/transaction/useSendAndConfirmTransaction.ts Updated type imports and function signature to use SendTransactionOptions["transaction"].
packages/thirdweb/src/react/core/hooks/transaction/useSendBatchTransaction.ts Changed type imports and mutation input type to SendTransactionOptions["transaction"][].
packages/thirdweb/src/react/core/hooks/transaction/useSendTransaction.ts Updated type imports and hook return type to SendTransactionOptions["transaction"].
packages/thirdweb/src/transaction/actions/send-batch-transaction.ts Changed SendBatchTransactionOptions.transactions type from PreparedTransaction[] to SendTransactionOptions["transaction"][].

Sequence Diagram(s)

sequenceDiagram
    participant ReactComponent
    participant useSendTransaction
    participant CoreTransaction

    ReactComponent->>useSendTransaction: Call mutateAsync(transaction)
    useSendTransaction->>CoreTransaction: Send transaction (type: SendTransactionOptions["transaction"])
    CoreTransaction-->>useSendTransaction: Return receipt or error
    useSendTransaction-->>ReactComponent: Return result
Loading
sequenceDiagram
    participant ReactComponent
    participant useSendBatchTransaction
    participant CoreTransaction

    ReactComponent->>useSendBatchTransaction: Call mutateAsync([transaction1, transaction2, ...])
    useSendBatchTransaction->>CoreTransaction: Send batch ([SendTransactionOptions["transaction"]])
    CoreTransaction-->>useSendBatchTransaction: Return receipts or error
    useSendBatchTransaction-->>ReactComponent: Return result
Loading
sequenceDiagram
    participant ReactComponent
    participant useSendAndConfirmTransaction
    participant CoreTransaction

    ReactComponent->>useSendAndConfirmTransaction: Call mutateAsync(transaction)
    useSendAndConfirmTransaction->>CoreTransaction: Send and confirm (type: SendTransactionOptions["transaction"])
    CoreTransaction-->>useSendAndConfirmTransaction: Return receipt or error
    useSendAndConfirmTransaction-->>ReactComponent: Return result
Loading

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8a88efa and 2c983ee.

📒 Files selected for processing (3)
  • packages/thirdweb/src/react/core/hooks/transaction/useSendAndConfirmTransaction.ts (2 hunks)
  • packages/thirdweb/src/react/core/hooks/transaction/useSendBatchTransaction.ts (2 hunks)
  • packages/thirdweb/src/react/core/hooks/transaction/useSendTransaction.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/thirdweb/src/react/core/hooks/transaction/useSendAndConfirmTransaction.ts
  • packages/thirdweb/src/react/core/hooks/transaction/useSendBatchTransaction.ts
  • packages/thirdweb/src/react/core/hooks/transaction/useSendTransaction.ts
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@vercel
Copy link

vercel bot commented Jul 18, 2025

@alecananian is attempting to deploy a commit to the thirdweb Team on Vercel.

A member of the Team first needs to authorize it.

@graphite-app
Copy link
Contributor

graphite-app bot commented Jul 18, 2025

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.

@github-actions github-actions bot added packages SDK Involves changes to the thirdweb SDK labels Jul 18, 2025
Copy link
Member

@joaquim-verges joaquim-verges left a comment

Choose a reason for hiding this comment

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

Good catch! thank you for this. merging

@codecov
Copy link

codecov bot commented Jul 21, 2025

Codecov Report

Attention: Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.

Project coverage is 36.07%. Comparing base (a48329b) to head (2c983ee).
Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
.../hooks/transaction/useSendAndConfirmTransaction.ts 0.00% 1 Missing ⚠️

❌ Your patch status has failed because the patch coverage (66.66%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

❗ There is a different number of reports uploaded between BASE (a48329b) and HEAD (2c983ee). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (a48329b) HEAD (2c983ee)
packages 2 1
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #7647       +/-   ##
===========================================
- Coverage   56.43%   36.07%   -20.37%     
===========================================
  Files         908      901        -7     
  Lines       58193    57696      -497     
  Branches     4226     2379     -1847     
===========================================
- Hits        32840    20812    -12028     
- Misses      25244    36807    +11563     
+ Partials      109       77       -32     
Flag Coverage Δ
packages 36.07% <66.66%> (-20.37%) ⬇️
Files with missing lines Coverage Δ
...react/core/hooks/transaction/useSendTransaction.ts 11.04% <100.00%> (ø)
.../src/transaction/actions/send-batch-transaction.ts 4.54% <ø> (-68.19%) ⬇️
.../hooks/transaction/useSendAndConfirmTransaction.ts 19.04% <0.00%> (-38.10%) ⬇️

... and 299 files 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.

@joaquim-verges joaquim-verges merged commit 823af01 into thirdweb-dev:main Jul 21, 2025
16 of 23 checks passed
@joaquim-verges joaquim-verges mentioned this pull request Jul 21, 2025
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.

react: transaction hooks incompatible with custom ABI contracts

2 participants