Skip to content

feat: add berachain and berachain-bepolia chains #7343

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

Merged
merged 1 commit into from
Jun 19, 2025

Conversation

Yash094
Copy link
Member

@Yash094 Yash094 commented Jun 16, 2025


PR-Codex overview

This PR introduces new blockchain definitions for berachain and berachainBepolia, enhancing the thirdweb package with support for these chains.

Detailed summary

  • Updated .changeset/spicy-cooks-smoke.md to indicate a minor version change for thirdweb.
  • Added berachain and berachainBepolia exports in packages/thirdweb/src/exports/chains.ts.
  • Created berachain in packages/thirdweb/src/chains/chain-definitions/berachain.ts with specific properties.
  • Created berachainBepolia in packages/thirdweb/src/chains/chain-definitions/berachain-bepolia.ts with testnet properties.

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

Summary by CodeRabbit

  • New Features
    • Added support for the Berachain mainnet and Berachain Bepolia testnet networks, including native currency details and integrated block explorers for enhanced network visibility.

@Yash094 Yash094 requested review from a team as code owners June 16, 2025 14:35
Copy link

changeset-bot bot commented Jun 16, 2025

🦋 Changeset detected

Latest commit: 787118d

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

This PR includes changesets to release 3 packages
Name Type
thirdweb Minor
@thirdweb-dev/wagmi-adapter Patch
nebula 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

Copy link

vercel bot commented Jun 16, 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 Jun 19, 2025 6:11pm
login ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 19, 2025 6:11pm
nebula ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 19, 2025 6:11pm
thirdweb_playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 19, 2025 6:11pm
thirdweb-www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 19, 2025 6:11pm
wallet-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 19, 2025 6:11pm

Copy link
Contributor

graphite-app bot commented Jun 16, 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.

Copy link
Contributor

coderabbitai bot commented Jun 16, 2025

Walkthrough

Two new blockchain network definitions, "Berachain" and "Berachain Bepolia," were added using the defineChain utility. Both are exported as constants and included in the public chain exports, making them available for use in other parts of the codebase.

Changes

File(s) Change Summary
packages/thirdweb/src/chains/chain-definitions/berachain.ts, Added new chain definition for "Berachain" and exported as berachain.
packages/thirdweb/src/chains/chain-definitions/berachain-bepolia.ts Added new chain definition for "Berachain Bepolia" and exported as berachainBepolia.
packages/thirdweb/src/exports/chains.ts Added exports for berachain and berachainBepolia from their respective chain definition files.

Sequence Diagram(s)

sequenceDiagram
    participant App
    participant ChainsModule
    participant ChainDefinition

    App->>ChainsModule: Import { berachain, berachainBepolia }
    ChainsModule->>ChainDefinition: Retrieve chain details (ID, name, currency, explorer)
    ChainsModule-->>App: Provide chain definitions for use
Loading

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.

📜 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 d3fc3f5 and 787118d.

📒 Files selected for processing (1)
  • .changeset/spicy-cooks-smoke.md (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .changeset/spicy-cooks-smoke.md
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: Size
  • GitHub Check: Unit Tests
  • GitHub Check: Build Packages
  • GitHub Check: Lint Packages
  • GitHub Check: Analyze (javascript)

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

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

🧹 Nitpick comments (1)
packages/thirdweb/src/chains/chain-definitions/berachain.ts (1)

3-5: Consider enriching JSDoc comment
A brief description (e.g., “Mainnet chain configuration for Berachain”) would improve clarity and aid downstream tooling that picks up the @chain tag.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 35a909a and bc0435c.

📒 Files selected for processing (3)
  • packages/thirdweb/src/chains/chain-definitions/berachain-bepolia.ts (1 hunks)
  • packages/thirdweb/src/chains/chain-definitions/berachain.ts (1 hunks)
  • packages/thirdweb/src/exports/chains.ts (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
packages/thirdweb/src/chains/chain-definitions/berachain-bepolia.ts (1)
packages/thirdweb/src/exports/chains.ts (2)
  • berachainBepolia (87-87)
  • defineChain (5-5)
packages/thirdweb/src/chains/chain-definitions/berachain.ts (1)
packages/thirdweb/src/exports/chains.ts (2)
  • berachain (86-86)
  • defineChain (5-5)
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: Build Packages
  • GitHub Check: Size
  • GitHub Check: Unit Tests
  • GitHub Check: Lint Packages
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (3)
packages/thirdweb/src/chains/chain-definitions/berachain.ts (1)

1-2: Skip import review

packages/thirdweb/src/chains/chain-definitions/berachain-bepolia.ts (2)

1-2: Skip import review


3-5: Skip JSDoc review

Comment on lines +6 to +17
export const berachain = /* @__PURE__ */ defineChain({
id: 80094,
name: "Berachain",
nativeCurrency: { name: "BERA", symbol: "BERA", decimals: 18 },
blockExplorers: [
{
name: "berascan",
url: "https://berascan.com/",
apiUrl: "https://api.berascan.com/api",
},
],
});
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Add required rpcUrls for connectivity
This definition currently lacks any RPC endpoints, so clients can’t connect to Berachain. Please include at least one RPC URL under rpcUrls (for example:

rpcUrls: {
  default: { http: ["https://rpc.berachain.com"] },
  public:  { http: ["https://rpc.berachain.com"] },
},

using the official RPC endpoints.

🤖 Prompt for AI Agents
In packages/thirdweb/src/chains/chain-definitions/berachain.ts between lines 6
and 17, the chain definition is missing the required rpcUrls property, which is
necessary for clients to connect to Berachain. Add an rpcUrls field with at
least one official RPC endpoint, for example, include rpcUrls: { default: {
http: ["https://rpc.berachain.com"] }, public: { http:
["https://rpc.berachain.com"] } } inside the defineChain object.

Comment on lines +6 to +17
export const berachainBepolia = /* @__PURE__ */ defineChain({
id: 80069,
name: "Berachain Bepolia",
nativeCurrency: { name: "BERA", symbol: "BERA", decimals: 18 },
blockExplorers: [
{
name: "beratrail",
url: "https://bepolia.beratrail.io/",
},
],
testnet: true,
});
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Add required rpcUrls and ensure explorer consistency

  • Include rpcUrls so that testnet clients can connect (e.g., rpcUrls: { default: { http: ["https://rpc.bepolia.berachain.com"] } }).
  • For consistency, verify if the BeraTrail explorer supports an API endpoint and, if so, add apiUrl to the block explorer entry.
🤖 Prompt for AI Agents
In packages/thirdweb/src/chains/chain-definitions/berachain-bepolia.ts between
lines 6 and 17, the chain definition is missing the required rpcUrls field
needed for testnet client connections. Add an rpcUrls property with the default
HTTP endpoint "https://rpc.bepolia.berachain.com". Also, check if the BeraTrail
block explorer supports an API endpoint; if it does, add an apiUrl field to the
blockExplorers entry to maintain consistency.

Comment on lines +86 to +87
export { berachain } from "../chains/chain-definitions/berachain.js";
export { berachainBepolia } from "../chains/chain-definitions/berachain-bepolia.js";
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Group exports by network type
berachain is a mainnet and should be placed in the mainnet section with other primary chains. berachainBepolia belongs in the testnet section. Please relocate these export lines to their respective groups to maintain logical ordering.

🤖 Prompt for AI Agents
In packages/thirdweb/src/exports/chains.ts around lines 86 to 87, the exports
for berachain and berachainBepolia are not grouped by network type. Move the
export of berachain to the mainnet section where other primary chains are
exported, and move the export of berachainBepolia to the testnet section to
maintain logical ordering by network type.

Copy link
Contributor

github-actions bot commented Jun 16, 2025

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 62.53 KB (0%) 1.3 s (0%) 226 ms (+168.49% 🔺) 1.5 s
thirdweb (cjs) 350.55 KB (0%) 7.1 s (0%) 718 ms (+13.88% 🔺) 7.8 s
thirdweb (minimal + tree-shaking) 5.7 KB (0%) 114 ms (0%) 72 ms (+901.22% 🔺) 186 ms
thirdweb/chains (tree-shaking) 531 B (0%) 11 ms (0%) 59 ms (+3554.96% 🔺) 70 ms
thirdweb/react (minimal + tree-shaking) 19.59 KB (0%) 392 ms (0%) 91 ms (+740.69% 🔺) 483 ms

Copy link
Member Author

Yash094 commented Jun 19, 2025

Merge activity

  • Jun 19, 6:51 AM UTC: The merge label 'merge-queue' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Jun 19, 6:56 AM UTC: The merge label 'merge-queue' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Jun 19, 6:58 AM UTC: The merge label 'merge-queue' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Jun 19, 6:59 AM UTC: The merge label 'merge-queue' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Jun 19, 6:02 PM UTC: The merge label 'merge-queue' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Jun 19, 6:02 PM UTC: gregfromstl added this pull request to the Graphite merge queue.
  • Jun 19, 6:12 PM UTC: Merged by the Graphite merge queue.

Copy link

codecov bot commented Jun 19, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 52.44%. Comparing base (70e024f) to head (787118d).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7343      +/-   ##
==========================================
+ Coverage   52.42%   52.44%   +0.01%     
==========================================
  Files         939      941       +2     
  Lines       63173    63199      +26     
  Branches     4223     4226       +3     
==========================================
+ Hits        33116    33142      +26     
  Misses      29950    29950              
  Partials      107      107              
Flag Coverage Δ
packages 52.44% <100.00%> (+0.01%) ⬆️
Files with missing lines Coverage Δ
.../src/chains/chain-definitions/berachain-bepolia.ts 100.00% <100.00%> (ø)
...thirdweb/src/chains/chain-definitions/berachain.ts 100.00% <100.00%> (ø)
🚀 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.

<!--

## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes"

If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000):

## Notes for the reviewer

Anything important to call out? Be sure to also clarify these in your comments.

## How to test

Unit tests, playground, etc.

-->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR introduces the `berachain` and `berachainBepolia` blockchain definitions to the `thirdweb` package, enhancing its chain support. It also updates the `chains` export file to include these new chains.

### Detailed summary
- Added `berachain` and `berachainBepolia` definitions in their respective files.
- Updated `packages/thirdweb/src/exports/chains.ts` to export `berachain` and `berachainBepolia`.
- Defined `berachain` with an ID of 80094 and a native currency of `BERA`.
- Defined `berachainBepolia` with an ID of 80069, marked as a testnet.

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

<!-- end pr-codex -->

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

- **New Features**
  - Added support for the Berachain mainnet and Berachain Bepolia testnet networks, including native currency details and integrated block explorers for enhanced network visibility.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@graphite-app graphite-app bot force-pushed the yash/add-berachain branch from 9bce565 to 787118d Compare June 19, 2025 18:03
@graphite-app graphite-app bot merged commit 787118d into main Jun 19, 2025
25 checks passed
@graphite-app graphite-app bot deleted the yash/add-berachain branch June 19, 2025 18:12
@graphite-app graphite-app bot removed the merge-queue Adds the pull request to Graphite's merge queue. label Jun 19, 2025
@joaquim-verges joaquim-verges mentioned this pull request Jun 19, 2025
@joaquim-verges joaquim-verges mentioned this pull request Jun 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.

2 participants