Skip to content

Performance: Implement Lazy Loading for Contract ABIs and Chain Data #507

Description

@Smartdevs17

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

Metadata

Metadata

Assignees

Labels

200-points200 point issueStellar WaveIssues in the Stellar wave programdrips-waveIssues in the Drips Wave programhighHigh complexity issue

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions