Context
The frontend bundle includes ABI definitions for all deployed contracts, even those rarely used. This inflates bundle size and increases load time.
Current Limitation/Problem
All contract ABIs (Soroban + EVM) are bundled eagerly. For a merchant using only Stellar, EVM ABIs are unnecessary payload. Similarly, chain configuration data is loaded upfront.
Expected Outcome
Dynamic lazy loading of contract ABIs and chain metadata based on user context (connected chains, active features). ABIs are fetched only when needed.
Acceptance Criteria
- Split ABI files into per-chain, per-contract chunks
- Lazy-load ABIs when user interacts with a specific chain
- Cache loaded ABIs in IndexedDB for repeat visits
- Chain configuration data (RPC URLs, explorer URLs, token lists) loaded on demand
- Loading states for ABI-dependent operations
- Fallback: static ABI bundle for offline use
- Bundle size: conditionally loaded ABIs reduce initial JS by 200KB+
- Network: ABI chunks are cacheable with long max-age
Technical Scope
frontend/src/lib/contracts/abi-loader.ts - dynamic ABI loader
- Code splitting: per-chain ABI entry points
- IndexedDB caching for ABIs
frontend/src/hooks/useContract.ts - lazy ABI loading hook
- Webpack chunk configuration for ABI files
- Edge cases: ABI version mismatch, loading failures, concurrent chain switching
Context
The frontend bundle includes ABI definitions for all deployed contracts, even those rarely used. This inflates bundle size and increases load time.
Current Limitation/Problem
All contract ABIs (Soroban + EVM) are bundled eagerly. For a merchant using only Stellar, EVM ABIs are unnecessary payload. Similarly, chain configuration data is loaded upfront.
Expected Outcome
Dynamic lazy loading of contract ABIs and chain metadata based on user context (connected chains, active features). ABIs are fetched only when needed.
Acceptance Criteria
Technical Scope
frontend/src/lib/contracts/abi-loader.ts- dynamic ABI loaderfrontend/src/hooks/useContract.ts- lazy ABI loading hook