Context
All on-chain reads flow through a single ChainProvider abstraction. For v0.1 this manages a WebSocket connection to BNB Chain; the type is designed so multi-chain support in later milestones is a config change, not a rewrite.
Scope
charon-scanner/src/provider.rs with a ChainProvider struct wrapping an alloy provider
- Constructor takes
&ChainConfig from charon-core
test_connection() -> Result<u64> — fetches and returns the latest block number
- WebSocket connection via
ProviderBuilder::new().on_ws(WsConnect::new(url))
- Connection errors surface with chain name + URL in the error context (no panics / no unwraps)
Acceptance criteria
References
- PRD section 5b (Alloy Provider & WebSocket Connections)
Context
All on-chain reads flow through a single
ChainProviderabstraction. For v0.1 this manages a WebSocket connection to BNB Chain; the type is designed so multi-chain support in later milestones is a config change, not a rewrite.Scope
charon-scanner/src/provider.rswith aChainProviderstruct wrapping an alloy provider&ChainConfigfromcharon-coretest_connection() -> Result<u64>— fetches and returns the latest block numberProviderBuilder::new().on_ws(WsConnect::new(url))Acceptance criteria
ChainProvider::new(config)connects over WebSockettest_connection()returns the latest block number on a running BSC nodepubsub,ws, etc.) added tocharon-scanner/Cargo.tomlReferences