Skip to content
This repository was archived by the owner on Apr 17, 2026. It is now read-only.

fix: accept CAIP-2 EVM network ids in x402-client#14

Merged
seichris merged 6 commits intomainfrom
fix/issue-13-caip2-evm-network-ids
Apr 2, 2026
Merged

fix: accept CAIP-2 EVM network ids in x402-client#14
seichris merged 6 commits intomainfrom
fix/issue-13-caip2-evm-network-ids

Conversation

@seichris
Copy link
Copy Markdown
Collaborator

Summary

  • normalize CAIP-2 EVM network ids like \ to the canonical x402-client aliases before wallet matching and EVM chain lookup
  • apply the same normalization in bridge config resolution so CAIP-2 Base quotes work through the existing bridge path as well
  • add regression coverage for x402Pay, EVM signing, and bridge config lookup using CAIP-2 ids

Testing

  • npm run test --workspace @fastxyz/x402-client
  • npm run test

Closes #13

Copy link
Copy Markdown

@KcatMa KcatMa left a comment

Choose a reason for hiding this comment

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

Hey @seichris! LGTM. But should it pass the CI? I saw there were two failed checks.

@seichris
Copy link
Copy Markdown
Collaborator Author

seichris commented Apr 2, 2026

Tracked the CI failure down to the new Base bridge assertions. On GitHub Actions, @fastxyz/allset-sdk 0.1.8 exposes Base mainnet under the AllSet mainnet provider namespace, but x402-client was still resolving Base through the testnet namespace, so getBridgeConfig('base') and getBridgeConfig('eip155:8453') returned null in CI.\n\nPushed a fix to resolve Base through the AllSet mainnet namespace and updated the bridge-context test to match. This should unblock the two failing CI jobs on the next run.

@seichris seichris requested a review from KcatMa April 2, 2026 03:56
Copy link
Copy Markdown

@KcatMa KcatMa left a comment

Choose a reason for hiding this comment

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

LGTM

Comment thread packages/x402-client/src/bridge.ts Outdated
Comment on lines +111 to +114
const chainName = normalizedNetwork === 'ethereum-sepolia' ? 'ethereum-sepolia'
: normalizedNetwork === 'arbitrum-sepolia' ? 'arbitrum-sepolia'
: normalizedNetwork === 'base' ? 'base'
: normalizedNetwork;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Should we just use something like const chainName = normalizedNetwork or just use normalizedNetwork directly? I think this code will always equal normalizedNetwork

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes. That mapping was redundant; I removed it and now use normalizedNetwork directly in getBridgeConfig.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Makes sense

@seichris seichris merged commit 05c4efa into main Apr 2, 2026
2 checks passed
@seichris seichris deleted the fix/issue-13-caip2-evm-network-ids branch April 2, 2026 04:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

x402-client does not match CAIP-2 Base network id eip155:8453

2 participants