Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 20, 2026

QuickNode returns arb and optimism identifiers for Arbitrum/Optimism networks, but the current mapping expects arbitrum and optimism-mainnet, causing startup to skip those endpoints. This change aligns QuickNode inputs with the internal network-id mapping so enabled Arbitrum/Optimism endpoints are recognized.

  • QuickNode alias normalization
    • Accept arb/optimism aliases and map them to the existing Arbitrum/Optimism network identifiers.
  • Mapping coverage
    • Extend mapping tests to cover alias handling.
# quicknode: chain='arb', network='arbitrum-mainnet' -> Chain.Arbitrum + QuickNodeNetwork.ArbitrumMainnet
# quicknode: chain='optimism', network='optimism'     -> Chain.Optimism + QuickNodeNetwork.OptimismMainnet

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 6 commits January 20, 2026 08:39
Co-authored-by: hyacinthus <488292+hyacinthus@users.noreply.github.com>
Co-authored-by: hyacinthus <488292+hyacinthus@users.noreply.github.com>
Co-authored-by: hyacinthus <488292+hyacinthus@users.noreply.github.com>
Co-authored-by: hyacinthus <488292+hyacinthus@users.noreply.github.com>
Co-authored-by: hyacinthus <488292+hyacinthus@users.noreply.github.com>
Co-authored-by: hyacinthus <488292+hyacinthus@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix QuickNode and network-id mapping issues Normalize QuickNode arb/optimism network mapping Jan 20, 2026
Copilot AI requested a review from hyacinthus January 20, 2026 08:52
@hyacinthus hyacinthus marked this pull request as ready for review January 20, 2026 08:54
Copilot AI review requested due to automatic review settings January 20, 2026 08:54
@hyacinthus hyacinthus merged commit 38d894c into main Jan 20, 2026
8 checks passed
@hyacinthus hyacinthus deleted the copilot/fix-quicknode-network-mapping branch January 20, 2026 08:56
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes QuickNode network mapping issues by adding alias support for non-standard chain and network identifiers returned by QuickNode's API. The implementation normalizes QuickNode's short-form identifiers (arb, optimism) to match the existing enum values used throughout the codebase.

Changes:

  • Added alias mappings for QuickNode chain identifier arbarbitrum and network identifier optimismoptimism-mainnet
  • Updated init_chain_configs to apply alias normalization before enum construction
  • Added test coverage for alias mapping functionality

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
intentkit/utils/chain.py Added QUICKNODE_CHAIN_ALIASES and QUICKNODE_NETWORK_ALIASES dictionaries; updated init_chain_configs to normalize identifiers using these aliases before creating Chain and QuickNodeNetwork enums
tests/utils/test_chain.py Added test helper classes (DummyResponse, DummyClient) and test_quicknode_chain_provider_alias_mapping test case to verify alias mapping functionality

Comment on lines +83 to +108
def test_quicknode_chain_provider_alias_mapping(monkeypatch: pytest.MonkeyPatch):
# QuickNode can return chain "arb" with network "optimism"; both should map.
payload = {
"data": [
{
"chain": "arb",
"network": "optimism",
"http_url": "https://quicknode",
"ens_url": "https://ens",
"wss_url": "wss://quicknode",
}
]
}

monkeypatch.setattr(
chain_utils.httpx,
"Client",
lambda *_, **__: DummyClient(payload),
)

provider = QuicknodeChainProvider("test-key")
provider.init_chain_configs()

config = provider.chain_configs[QuickNodeNetwork.OptimismMainnet]
assert config.chain is Chain.Arbitrum
assert config.network is QuickNodeNetwork.OptimismMainnet
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

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

The test uses an unrealistic combination of QuickNode identifiers. According to the PR description, QuickNode returns:

  • chain='arb', network='arbitrum-mainnet' for Arbitrum endpoints
  • chain='optimism', network='optimism' for Optimism endpoints

This test combines chain='arb' with network='optimism', which doesn't represent an actual QuickNode response. While the test technically validates that both aliases work, it doesn't test the real-world scenarios that were causing the startup errors. Consider adding separate test cases for each actual QuickNode response pattern.

Copilot uses AI. Check for mistakes.


def test_quicknode_chain_provider_alias_mapping(monkeypatch: pytest.MonkeyPatch):
# QuickNode can return chain "arb" with network "optimism"; both should map.
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

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

The comment states "QuickNode can return chain 'arb' with network 'optimism'" but this is misleading. According to the PR description, QuickNode returns chain='arb' with network='arbitrum-mainnet' for Arbitrum, and chain='optimism' with network='optimism' for Optimism. The comment should accurately describe what the test is validating.

Suggested change
# QuickNode can return chain "arb" with network "optimism"; both should map.
# Simulate QuickNode returning chain "arb" with network "optimism" and verify both aliases map correctly.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants