livepeer / livepeer/explorer

chore: prefer NEXT_PUBLIC_L2_RPC_URL over Infura so local forks receive traffic

Open Beginner friendly
#747 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
11
Forks
26
Avg merge
11h 58m
Merged PRs (30d)
16

Description

lib/chains.ts:107-117 builds the RPC list with Infura first and the configured override second:

[chain.arbitrum.id]: [
  `https://arbitrum-mainnet.infura.io/v3/${INFURA_KEY}`,
  process.env.NEXT_PUBLIC_L2_RPC_URL,
].filter(Boolean)

viem's fallback() prefers the first entry and only rolls over on failure, so setting NEXT_PUBLIC_L2_RPC_URL makes the custom endpoint a backup to Infura rather than a replacement. Traffic keeps going to mainnet Infura.

That blocks local fork testing: pointing the explorer at anvil --fork-url … --chain-id 42161 has no effect. Blanking INFURA_KEY is not an option either — lib/chains.ts:21 throws without it.

Fix

When NEXT_PUBLIC_L2_RPC_URL (and the L1 equivalent) is set, put it first, or make it exclusive.

Unblocks testing flows that should not touch mainnet — treasury proposal creation and the transaction-lifecycle work in #739 both need it.

Related

#664 — wagmi config missing transports, same area.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in lib/chains.ts:21 and lines 107-117, then trace how viem's fallback consumes the RPC list. Verify that configured NEXT_PUBLIC_L2_RPC_URL values receive local-fork traffic for both L2 and L1 while the existing Infura configuration still works when no override is set.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
blockchain
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.