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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/spicy-cooks-smoke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"thirdweb": minor
---

add berachain and berachain testnet in chains package
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { defineChain } from "../utils.js";

/**
* @chain
*/
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,
});
Comment on lines +6 to +17
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.

17 changes: 17 additions & 0 deletions packages/thirdweb/src/chains/chain-definitions/berachain.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { defineChain } from "../utils.js";

/**
* @chain
*/
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",
},
],
});
Comment on lines +6 to +17
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.

2 changes: 2 additions & 0 deletions packages/thirdweb/src/exports/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,5 @@ export { soneiumMinato } from "../chains/chain-definitions/soneium-minato.js";
export { treasure } from "../chains/chain-definitions/treasure.js";
export { treasureTopaz } from "../chains/chain-definitions/treasureTopaz.js";
export { monadTestnet } from "../chains/chain-definitions/monad-testnet.js";
export { berachain } from "../chains/chain-definitions/berachain.js";
export { berachainBepolia } from "../chains/chain-definitions/berachain-bepolia.js";
Comment on lines +86 to +87
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.

Loading