Skip to content

Conversation

@jnsdls
Copy link
Member

@jnsdls jnsdls commented Jul 24, 2025

Added gateway to the list of possible usage sources in @thirdweb-dev/service-utils. This enables tracking usage from the gateway API (platform v3).

@vercel
Copy link

vercel bot commented Jul 24, 2025

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

Name Status Preview Comments Updated (UTC)
docs-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 24, 2025 8:05pm
nebula ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 24, 2025 8:05pm
thirdweb_playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 24, 2025 8:05pm
thirdweb-www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 24, 2025 8:05pm
wallet-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 24, 2025 8:05pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 24, 2025

Walkthrough

The change introduces "gateway" as a new source value to the USAGE_V2_SOURCES array and the associated UsageV2Source type within the @thirdweb-dev/service-utils package. No other logic, structural, or functional changes are present.

Changes

File(s) Change Summary
packages/service-utils/src/core/usageV2.ts Added "gateway" to the USAGE_V2_SOURCES array and updated the UsageV2Source type accordingly.
.changeset/tasty-ducks-say.md Added a changeset describing the patch-level update for the new "gateway" usage source.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 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 48361f9 and 14aecc0.

📒 Files selected for processing (2)
  • .changeset/tasty-ducks-say.md (1 hunks)
  • packages/service-utils/src/core/usageV2.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{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

Files:

  • packages/service-utils/src/core/usageV2.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/service-utils/src/core/usageV2.ts
🧠 Learnings (1)
packages/service-utils/src/core/usageV2.ts (1)

Learnt from: gregfromstl
PR: #7450
File: packages/thirdweb/src/bridge/Webhook.ts:57-81
Timestamp: 2025-06-26T19:46:04.024Z
Learning: In the onramp webhook schema (packages/thirdweb/src/bridge/Webhook.ts), the currencyAmount field is intentionally typed as z.number() while other amount fields use z.string() because currencyAmount represents fiat currency amounts in decimals (like $10.50), whereas other amount fields represent token amounts in wei (very large integers that benefit from bigint representation). The different naming convention (currencyAmount vs amount) reflects this intentional distinction.

⏰ 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). (7)
  • GitHub Check: codecov/project
  • GitHub Check: Lint Packages
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: Size
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: Build Packages
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (2)
packages/service-utils/src/core/usageV2.ts (1)

13-14: Addition looks safe – double-check downstream routing

"gateway" is covered by the default branch in getTopicName, so topic resolution will be usage_v2.raw_gateway.
Please confirm that the gateway events should indeed be treated as trusted (server-side) data; if they originate from client contexts you may want to list it alongside "sdk" | "engine" in the untrusted section instead.

No code change required if the current classification is correct.

.changeset/tasty-ducks-say.md (1)

1-6: Changeset reads well

Message and bump level are clear; nothing else to add.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch Add_gateway_to_possible_usage_sources

🪧 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 generate unit tests to generate unit tests for 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.

Copy link
Member Author

jnsdls commented Jul 24, 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.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@codecov
Copy link

codecov bot commented Jul 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 56.31%. Comparing base (48361f9) to head (14aecc0).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7700   +/-   ##
=======================================
  Coverage   56.31%   56.31%           
=======================================
  Files         908      908           
  Lines       58177    58177           
  Branches     4207     4207           
=======================================
  Hits        32765    32765           
  Misses      25302    25302           
  Partials      110      110           
Flag Coverage Δ
packages 56.31% <ø> (ø)
🚀 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.

@github-actions
Copy link
Contributor

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 63.33 KB (0%) 1.3 s (0%) 186 ms (+121.38% 🔺) 1.5 s
thirdweb (cjs) 353.15 KB (0%) 7.1 s (0%) 653 ms (+11.05% 🔺) 7.8 s
thirdweb (minimal + tree-shaking) 5.7 KB (0%) 114 ms (0%) 79 ms (+1925.18% 🔺) 193 ms
thirdweb/chains (tree-shaking) 526 B (0%) 11 ms (0%) 12 ms (+507.64% 🔺) 22 ms
thirdweb/react (minimal + tree-shaking) 19.22 KB (0%) 385 ms (0%) 66 ms (+414.73% 🔺) 451 ms

@jnsdls jnsdls merged commit 9d8c7f1 into main Jul 24, 2025
27 checks passed
@jnsdls jnsdls deleted the Add_gateway_to_possible_usage_sources branch July 24, 2025 20:39
@joaquim-verges joaquim-verges mentioned this pull request Jul 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants