refactor(dev-hub): source Lazer contract addresses from contract_manager#3628
refactor(dev-hub): source Lazer contract addresses from contract_manager#3628
Conversation
Replace the hardcoded EVM Mainnets / EVM Testnets tables on the Pyth Pro (Lazer) contract-addresses docs page with a LazerTable component that reads from contract_manager's EvmLazerContracts and EvmChains stores. Display names and block explorer URLs resolve via viem-first with a small override file for chains viem doesn't cover (Ethereal mainnet and Ethereal Testnet V2) or where the preferred display name differs (Ethereum Sepolia, Soneium, Tempo). Adds read-only exports (evmChains, evmLazerContracts) to contract_manager/utils/utils.ts so developer-hub consumes the data via an already-working package export path, matching the pattern api-reference uses. Bumps the workspace catalog viem pin from ^2.39.0 to ^2.48.4 so the component can rely on native viem coverage for Fluent, MegaETH, Tempo, and Tempo Testnet (previously override-only). Direct viem pins in contract_manager and price_pusher are intentionally left alone. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🤖 llms.txt Content ReviewAnalyzed documentation changes — no updates to curated content required. Products reviewed:
Files analyzed |
There was a problem hiding this comment.
🚩 Pre-existing bug in getEvmChainRpcUrl uses parseInt on non-numeric chain ID
The existing getEvmChainRpcUrl function at contract_manager/src/utils/utils.ts:58-59 does Number.parseInt(chain.id, 10) where chain.id is a string like "arbitrum", which returns NaN. This means viem chain lookup always fails and the function returns undefined. This is a pre-existing bug unrelated to this PR, but worth noting since the PR's new getViemChain in LazerTable/index.tsx:21-22 correctly uses the numeric networkId instead — showing the right pattern.
(Refers to lines 58-59)
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bf60765c2d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| <LazerTable isMainnet={true} /> | ||
|
|
||
| ## EVM Testnets | ||
|
|
||
| | Network | Contract Address | | ||
| | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| | Arbitrum Sepolia | <CopyAddress address="0xACeA761c27A909d4D3895128EBe6370FDE2dF481" url="https://sepolia.arbiscan.io/address/0xACeA761c27A909d4D3895128EBe6370FDE2dF481" /> | | ||
| | Base Sepolia | <CopyAddress address="0xACeA761c27A909d4D3895128EBe6370FDE2dF481" url="https://sepolia.basescan.org/address/0xACeA761c27A909d4D3895128EBe6370FDE2dF481" /> | | ||
| | Ethereal Testnet V2 | <CopyAddress address="0x4D4772F06c595F69FB57039599a180536FDE8245" url="https://explorer-ethereal-testnet-0.t.conduit.xyz/address/0x4D4772F06c595F69FB57039599a180536FDE8245" /> | | ||
| | Ethereum Sepolia | <CopyAddress address="0xACeA761c27A909d4D3895128EBe6370FDE2dF481" url="https://sepolia.etherscan.io/address/0xACeA761c27A909d4D3895128EBe6370FDE2dF481" /> | | ||
| | Optimism Sepolia | <CopyAddress address="0xACeA761c27A909d4D3895128EBe6370FDE2dF481" url="https://sepolia-optimism.etherscan.io/address/0xACeA761c27A909d4D3895128EBe6370FDE2dF481" /> | | ||
| | Soneium Minato | <CopyAddress address="0xACeA761c27A909d4D3895128EBe6370FDE2dF481" url="https://soneium-minato.blockscout.com/address/0xACeA761c27A909d4D3895128EBe6370FDE2dF481" /> | | ||
| | Monad Testnet | <CopyAddress address="0xACeA761c27A909d4D3895128EBe6370FDE2dF481" url="https://testnet.monadexplorer.com/address/0xACeA761c27A909d4D3895128EBe6370FDE2dF481" /> | | ||
| | Sonic Testnet | <CopyAddress address="0xACeA761c27A909d4D3895128EBe6370FDE2dF481" url="https://testnet.sonicscan.org/address/0xACeA761c27A909d4D3895128EBe6370FDE2dF481" /> | | ||
| | Tempo Testnet | <CopyAddress address="0xACeA761c27A909d4D3895128EBe6370FDE2dF481" url="https://explore.tempo.xyz/address/0xACeA761c27A909d4D3895128EBe6370FDE2dF481" /> | | ||
| <LazerTable isMainnet={false} /> |
There was a problem hiding this comment.
Keep EVM addresses in MDX source for LLM exports
Replacing the literal EVM address tables with <LazerTable .../> means the markdown/LLM export path now loses the actual addresses: getLLMText (in apps/developer-hub/src/lib/get-llm-text.ts) processes MDX source text and does not execute React components, so /mdx/... and LLM-oriented consumers will only see component tags instead of contract data. This regresses machine-readable contract-address docs for any workflow that relies on those endpoints.
Useful? React with 👍 / 👎.
The previous ^2.23.5 caret range slid forward to viem 2.48.4 after the workspace catalog was bumped, which pulled in ox 0.14.20 whose webauthn .ts sources reference DOM globals (window, AuthenticatorAttestationResponse). contract_manager's node-only tsconfig.build has lib: ["esnext"] with no DOM, so tsc --emitDeclarationOnly fails when walking ox via viem's types. Exact-pin contract_manager's viem at 2.23.5 (paired with ox 0.6.x, which has no DOM-only source) so the catalog bump no longer affects this package's build. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
| const explorer = | ||
| override?.explorer ?? viemChain?.blockExplorers?.default.url; |
There was a problem hiding this comment.
🚩 Explorer URLs may differ from previously hardcoded values for some chains
The old MDX had hardcoded explorer URLs (e.g. https://www.megaexplorer.xyz for MegaETH, https://monadvision.com for Monad, https://soneium.blockscout.com for Soneium). The new LazerTable falls back to viem's blockExplorers.default.url when no override exists in LazerDeploymentsConfig. If viem's chain definition for MegaETH (networkId 4326), Monad (143), Fluent (25363), or other newer chains doesn't include a blockExplorers entry, those rows will render without an explorer link — a subtle regression from the old hardcoded table. Similarly, if viem provides a different explorer URL than what was previously used, the link destination changes. Consider adding overrides in lazer-deployments-config.ts for chains where viem may not match the desired explorer, or verify the viem output for each chain during review.
Was this helpful? React with 👍 or 👎 to provide feedback.
Switches contract_manager back to catalog viem per REVIEW.md's "prefer catalog: versions" guideline. The previous exact-pin at 2.23.5 was a workaround for tsc emitting declarations picking up ox@0.14.x raw .ts source files that reference DOM globals (window, AuthenticatorAttestationResponse, etc). Adds "dom" to tsconfig.json's lib so tsc has the relevant browser globals when walking those transitive .ts files. No runtime impact — contract_manager is still node-only and none of its source uses DOM APIs. price_pusher is intentionally left on its own ^2.19.4 pin for now. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
| const humanize = (chainId: string): string => | ||
| chainId | ||
| .split("_") | ||
| .map((part) => part.charAt(0).toUpperCase() + part.slice(1)) | ||
| .join(" "); |
There was a problem hiding this comment.
🚩 Chain display names depend on viem coverage — fallback humanize may produce suboptimal names
For chains not in viem and without an override in LazerDeploymentsConfig, the humanize function splits on _ and title-cases each word. This means e.g. megaeth → "Megaeth" (not "MegaETH"), sonic_blaze_testnet → "Sonic Blaze Testnet" (old table said "Sonic Testnet"), arc_testnet → "Arc Testnet", bsc → "Bsc" (not "BSC"). Whether viem covers these chains at version ^2.48.4 determines if better names are available. The reviewer should verify the rendered output for all chains, especially those with non-standard capitalization like BSC and MegaETH.
Was this helpful? React with 👍 or 👎 to provide feedback.
Summary
LazerTablecomponent that reads addresses fromcontract_manager'sEvmLazerContractsandEvmChainsstores.viemfirst, falling back to a small override file (lazer-deployments-config.ts) for chains viem doesn't cover (Ethereal mainnet / Ethereal Testnet V2) and for a few display-name tweaks (Ethereum Sepolia, Soneium, Tempo).viempin from^2.39.0→^2.48.4so Fluent, MegaETH, Tempo, and Tempo Testnet can come from viem natively instead of overrides. Directviempins incontract_managerandprice_pusherare left untouched.