feat: add XDC Network and XDC Apothem testnet chain configs - #29
feat: add XDC Network and XDC Apothem testnet chain configs#29AnilChinchawale wants to merge 1 commit into
Conversation
📝 WalkthroughWalkthroughXDC mainnet and testnet chain configurations are added in ChangesXDC Chain Support
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Adds XDCMainnet ("xdc" / eip155:50) and XDCApothem ("xdc-testnet" /
eip155:51) to both chains.go (v1) and v2/chains.go (incl. the
chainConfigByNetwork registry). XDC is an EVM L1 (XDPoS) with native Circle
USDC supporting EIP-3009. USDC + EIP-712 domain verified on-chain: mainnet
0xfA2958CB79b0491CC627c1557F441eF849Ca8eb1, Apothem
0xb5AB69F7bBada22B28e79C8FFAECe55eF1c771D4 (name "USDC", version "2").
gofmt clean, go build ./... passes.
cf17264 to
d9d3447
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@v2/chains.go`:
- Around line 196-202: Add the missing XDC coverage in the chain verification
tests by updating TestGetChainID to include cases for eip155:50 and eip155:51,
and update TestEIP3009Parameters so the evmChains slice includes XDCMainnet and
XDCApothem. Use the existing test helpers in v2/chains_test.go to verify these
new chains resolve correctly and still expose EIP3009Name and EIP3009Version.
🪄 Autofix
❌ Autofix failed (check again to retry)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 0659b01e-b41b-4b38-9a4b-d1b2ffb0c5a4
📒 Files selected for processing (2)
chains.gov2/chains.go
🚧 Files skipped from review as they are similar to previous changes (1)
- chains.go
| NetworkXDC: XDCMainnet, | ||
| // EVM Testnets | ||
| NetworkBaseSepolia: BaseSepolia, | ||
| NetworkPolygonAmoy: PolygonAmoy, | ||
| NetworkAvalancheFuji: AvalancheFuji, | ||
| NetworkSepolia: Sepolia, | ||
| NetworkXDCTestnet: XDCApothem, |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect test coverage for newly added XDC networks/configs.
fd -a '^chains_test\.go$' v2 | xargs -I{} sh -c '
echo "== File: {} ==";
ast-grep outline "{}" --view expanded | sed -n "1,220p";
rg -n "TestGetChainID|TestEIP3009Parameters|eip155:50|eip155:51|NetworkXDC|NetworkXDCTestnet|XDCMainnet|XDCApothem" "{}";
'Repository: mark3labs/x402-go
Length of output: 813
🏁 Script executed:
sed -n '158,230p' v2/chains_test.go && echo "---SEPARATOR---" && sed -n '334,362p' v2/chains_test.goRepository: mark3labs/x402-go
Length of output: 2363
Add XDC Mainnet and Testnet to chain-config verification tests.
The v2/chains.go changes are internal valid, but the new XDC networks are missing from the coverage in v2/chains_test.go:
- In
TestGetChainID, add test cases foreip155:50(ChainID 50) andeip155:51(ChainID 51). - In
TestEIP3009Parameters, includeXDCMainnetandXDCApothemin theevmChainsslice to verify they correctly possess theEIP3009NameandEIP3009Versionfields.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@v2/chains.go` around lines 196 - 202, Add the missing XDC coverage in the
chain verification tests by updating TestGetChainID to include cases for
eip155:50 and eip155:51, and update TestEIP3009Parameters so the evmChains slice
includes XDCMainnet and XDCApothem. Use the existing test helpers in
v2/chains_test.go to verify these new chains resolve correctly and still expose
EIP3009Name and EIP3009Version.
|
An unexpected error occurred while generating fixes: Not Found - https://docs.github.com/rest/git/refs#get-a-reference |
Adds
XDCMainnet(networkxdc) andXDCApothem(xdc-testnet) tochains.go.XDC is an EVM-compatible L1 (XDPoS) with native Circle USDC supporting EIP-3009. USDC address + EIP-712 domain verified on-chain:
0xfA2958CB79b0491CC627c1557F441eF849Ca8eb10xb5AB69F7bBada22B28e79C8FFAECe55eF1c771D4gofmtclean,go build ./...passes.Summary by CodeRabbit