Skip to content

Add support for tuple types in ABI event and function signatures #7415

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

Conversation

AmineAfia
Copy link
Contributor

@AmineAfia AmineAfia commented Jun 23, 2025

[Dashboard] Fix: Improve ABI type handling for tuple types in webhook signatures

Notes for the reviewer

This PR adds support for properly handling tuple types in ABI event and function signatures. Previously, we were only extracting the basic type string, which doesn't correctly represent tuple structures. Now we recursively build the canonical type representation for tuples, including nested tuples and array dimensions.

How to test

The changes can be tested by creating webhooks with contracts that use tuple types in their events or functions. The signature extraction should now correctly represent the canonical format for these complex types.

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of tuple types in ABI inputs to ensure accurate event and function signature generation, especially for nested tuple structures.
  • New Features
    • Function signature labels in transaction filters are now truncated for better readability without affecting underlying data.

PR-Codex overview

This PR introduces enhancements to the handling of function signatures and ABI inputs in the FilterDetailsStep component and abiUtils. It includes a new utility function for canonical type extraction, improving how tuples are processed.

Detailed summary

  • In FilterDetailsStep.tsx, changed the label property to use truncateMiddle for better display of function names.
  • Added getCanonicalType function in abiUtils.ts to recursively determine the canonical type for ABI inputs, specifically handling tuples.
  • Updated extractEventSignatures and extractFunctionSignatures to use getCanonicalType for mapping input types instead of directly using the type property.

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

Copy link

vercel bot commented Jun 23, 2025

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

Name Status Preview Comments Updated (UTC)
thirdweb-www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 23, 2025 1:57pm
4 Skipped Deployments
Name Status Preview Comments Updated (UTC)
docs-v2 ⬜️ Skipped (Inspect) Jun 23, 2025 1:57pm
nebula ⬜️ Skipped (Inspect) Jun 23, 2025 1:57pm
thirdweb_playground ⬜️ Skipped (Inspect) Jun 23, 2025 1:57pm
wallet-ui ⬜️ Skipped (Inspect) Jun 23, 2025 1:57pm

@vercel vercel bot temporarily deployed to Preview – docs-v2 June 23, 2025 11:50 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground June 23, 2025 11:50 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui June 23, 2025 11:50 Inactive
@vercel vercel bot temporarily deployed to Preview – nebula June 23, 2025 11:50 Inactive
Copy link

changeset-bot bot commented Jun 23, 2025

⚠️ No Changeset found

Latest commit: 11b4d9e

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
Contributor

coderabbitai bot commented Jun 23, 2025

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

📥 Commits

Reviewing files that changed from the base of the PR and between 71c8e84 and 11b4d9e.

📒 Files selected for processing (2)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/components/FilterDetailsStep.tsx (1 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/utils/abiUtils.ts (3 hunks)
 __________________________________________________________________________________________________________________________________________________
< I've got a very particular set of skills. Skills I have acquired over a very long career. Skills that make me a nightmare for bugs in your code. >
 --------------------------------------------------------------------------------------------------------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ

Walkthrough

A new helper function, getCanonicalType, was introduced to recursively construct canonical type strings for ABI inputs, particularly supporting tuple types and nested components. The functions extractEventSignatures and extractFunctionSignatures were updated to utilize this helper, ensuring accurate canonical signature generation for events and functions. Additionally, function signature labels in the SignatureSelector component are now truncated in the UI when the filter type is "transaction" for improved display.

Changes

File Change Summary
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/utils/abiUtils.ts Added getCanonicalType helper for canonical type strings; updated signature extraction logic to use it
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/components/FilterDetailsStep.tsx Truncated function signature labels in SignatureSelector dropdown for "transaction" filter type

Sequence Diagram(s)

sequenceDiagram
    participant Caller
    participant abiUtils

    Caller->>abiUtils: extractEventSignatures(abi)
    abiUtils->>abiUtils: getCanonicalType(input) (recursive for tuples)
    abiUtils-->>Caller: Event signatures with canonical types

    Caller->>abiUtils: extractFunctionSignatures(abi)
    abiUtils->>abiUtils: getCanonicalType(input) (recursive for tuples)
    abiUtils-->>Caller: Function signatures with canonical types
Loading

Tip

CodeRabbit can generate a title for your PR based on the changes.

Add @coderabbitai placeholder anywhere in the title of your PR and CodeRabbit will replace it with a title based on the changes in the PR. You can change the placeholder by changing the reviews.auto_title_placeholder setting.

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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.

@github-actions github-actions bot added the Dashboard Involves changes to the Dashboard. label Jun 23, 2025
Copy link
Contributor 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.

@AmineAfia AmineAfia marked this pull request as ready for review June 23, 2025 11:50
@AmineAfia AmineAfia requested review from a team as code owners June 23, 2025 11:50
Copy link

codecov bot commented Jun 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 52.08%. Comparing base (ad5aabc) to head (11b4d9e).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7415   +/-   ##
=======================================
  Coverage   52.08%   52.08%           
=======================================
  Files         947      947           
  Lines       63636    63636           
  Branches     4222     4222           
=======================================
  Hits        33146    33146           
  Misses      30384    30384           
  Partials      106      106           
Flag Coverage Δ
packages 52.08% <ø> (ø)
🚀 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.

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: 1

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between ad5aabc and 79c0de3.

📒 Files selected for processing (1)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/utils/abiUtils.ts (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: Size
  • GitHub Check: Lint Packages
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: Unit Tests
  • GitHub Check: Build Packages
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (2)
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/utils/abiUtils.ts (2)

96-96: LGTM! Correct usage of the canonical type helper.

The integration of getCanonicalType in the event signature extraction is implemented correctly and will properly handle tuple types in event signatures.


178-178: LGTM! Correct usage of the canonical type helper.

The integration of getCanonicalType in the function signature extraction is implemented correctly and will properly handle tuple types in function signatures.

Copy link
Contributor

github-actions bot commented Jun 23, 2025

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 62.56 KB (0%) 1.3 s (0%) 549 ms (+53.59% 🔺) 1.8 s
thirdweb (cjs) 350.74 KB (0%) 7.1 s (0%) 2.9 s (+9.27% 🔺) 10 s
thirdweb (minimal + tree-shaking) 5.72 KB (0%) 115 ms (0%) 171 ms (+590.89% 🔺) 285 ms
thirdweb/chains (tree-shaking) 530 B (0%) 11 ms (0%) 76 ms (+1119.42% 🔺) 86 ms
thirdweb/react (minimal + tree-shaking) 19.61 KB (0%) 393 ms (0%) 113 ms (+110.37% 🔺) 505 ms

@AmineAfia AmineAfia force-pushed the Add_support_for_tuple_types_in_ABI_event_and_function_signatures branch from 79c0de3 to 71c8e84 Compare June 23, 2025 12:14
@vercel vercel bot temporarily deployed to Preview – docs-v2 June 23, 2025 12:14 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground June 23, 2025 12:14 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui June 23, 2025 12:14 Inactive
@vercel vercel bot temporarily deployed to Preview – nebula June 23, 2025 12:14 Inactive
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 (1)
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/components/FilterDetailsStep.tsx (1)

347-347: Consider optimizing truncation parameters for better UI display.

The truncation parameters (30, 15) seem unusually large for UI labels. This will result in labels up to 48 characters long (30 + "..." + 15) and only truncate strings longer than 45 characters. For improved display in dropdown options, consider using smaller values like (20, 8) or (15, 10) to ensure more consistent and compact label lengths.

Apply this diff for more reasonable truncation:

-                      label: truncateMiddle(sig.name, 30, 15),
+                      label: truncateMiddle(sig.name, 20, 8),

This would limit labels to a maximum of 31 characters (20 + "..." + 8) and truncate strings longer than 28 characters, providing better visual consistency in the dropdown.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 79c0de3 and 71c8e84.

📒 Files selected for processing (2)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/components/FilterDetailsStep.tsx (1 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/utils/abiUtils.ts (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/utils/abiUtils.ts
🧰 Additional context used
🧬 Code Graph Analysis (1)
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/components/FilterDetailsStep.tsx (1)
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/webhooks/utils/abiUtils.ts (1)
  • truncateMiddle (11-19)
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: Size
  • GitHub Check: Unit Tests
  • GitHub Check: Build Packages
  • GitHub Check: Lint Packages
  • GitHub Check: Analyze (javascript)

Copy link
Contributor

graphite-app bot commented Jun 23, 2025

Merge activity

# [Dashboard] Fix: Improve ABI type handling for tuple types in webhook signatures

## Notes for the reviewer
This PR adds support for properly handling tuple types in ABI event and function signatures. Previously, we were only extracting the basic type string, which doesn't correctly represent tuple structures. Now we recursively build the canonical type representation for tuples, including nested tuples and array dimensions.

## How to test
The changes can be tested by creating webhooks with contracts that use tuple types in their events or functions. The signature extraction should now correctly represent the canonical format for these complex types.

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **Bug Fixes**
  - Improved handling of tuple types in ABI inputs to ensure accurate event and function signature generation, especially for nested tuple structures.
- **New Features**
  - Function signature labels in transaction filters are now truncated for better readability without affecting underlying data.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR primarily enhances the handling of function signatures in the `FilterDetailsStep.tsx` component and improves the extraction of ABI input types in `abiUtils.ts`. It introduces a helper function to manage tuple types and modifies how function signatures are displayed.

### Detailed summary
- In `FilterDetailsStep.tsx`, updated the label for function signatures to use `truncateMiddle(sig.name, 30, 15)` for better readability.
- Added a new helper function `getCanonicalType` in `abiUtils.ts` to recursively handle tuple types in ABI inputs.
- Modified the extraction of canonical input types in both `extractEventSignatures` and `extractFunctionSignatures` to use `getCanonicalType` instead of directly mapping the type.

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

<!-- end pr-codex -->
@graphite-app graphite-app bot force-pushed the Add_support_for_tuple_types_in_ABI_event_and_function_signatures branch from 71c8e84 to 11b4d9e Compare June 23, 2025 13:49
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground June 23, 2025 13:49 Inactive
@vercel vercel bot temporarily deployed to Preview – nebula June 23, 2025 13:49 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui June 23, 2025 13:49 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 June 23, 2025 13:49 Inactive
@graphite-app graphite-app bot merged commit 11b4d9e into main Jun 23, 2025
23 checks passed
@graphite-app graphite-app bot deleted the Add_support_for_tuple_types_in_ABI_event_and_function_signatures branch June 23, 2025 13:57
@vercel vercel bot temporarily deployed to Production – nebula June 23, 2025 13:57 Inactive
@vercel vercel bot temporarily deployed to Production – wallet-ui June 23, 2025 13:57 Inactive
@vercel vercel bot temporarily deployed to Production – docs-v2 June 23, 2025 13:57 Inactive
@vercel vercel bot temporarily deployed to Production – thirdweb_playground June 23, 2025 13:58 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dashboard Involves changes to the Dashboard.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants