Where ? : components/swap/swap-interface.tsx
• A user opens the app and everything works normally
• The app creates a helper that talks to the blockchain
• That helper is built using the current wallet connection
• The wallet disconnects and reconnects in the background
• A new provider is created by the wallet
• The app keeps using the old helper without realizing it
• The old helper is still pointing to a dead connection
• The user clicks swap
• The call goes to the old provider
• The request fails even though the wallet looks connected
• This happens because the helper was never rebuilt
• Once the helper is recreated with the new provider
• All contract calls start working again
fix:
const contractClient = useMemo(
() => new ContractClient(writeContractAsync, publicClient, chainId),
`[chainId, writeContractAsync, publicClient]` // FIX: Add missing dependencies
);
@kaneki003 Please checkout this solution: #56