Problem
@stellar/stellar-sdk and @chakra-ui/react are imported at the top level in multiple files. The soroban.ts singleton is instantiated on module import (sorobanService.initialize() runs immediately). This means the Stellar SDK — which includes XDR codegen weighing ~400 KB minified — is in the initial JS bundle and blocks the first meaningful paint even for unauthenticated visitors who only want to read the home page or leaderboard.
Expected Behaviour
The Soroban SDK is loaded lazily only when the user initiates a wallet connection or a contract interaction. The farm page renders its skeleton immediately from the Next.js static export without waiting for the SDK.
Acceptance Criteria
Relevant Files
src/lib/soroban.ts — dynamic imports inside methods
src/app/layout.tsx — Chakra provider isolation
next.config.ts — add @next/bundle-analyzer in development
.github/workflows/ — add Lighthouse CI step
Problem
@stellar/stellar-sdkand@chakra-ui/reactare imported at the top level in multiple files. Thesoroban.tssingleton is instantiated on module import (sorobanService.initialize()runs immediately). This means the Stellar SDK — which includes XDR codegen weighing ~400 KB minified — is in the initial JS bundle and blocks the first meaningful paint even for unauthenticated visitors who only want to read the home page or leaderboard.Expected Behaviour
The Soroban SDK is loaded lazily only when the user initiates a wallet connection or a contract interaction. The farm page renders its skeleton immediately from the Next.js static export without waiting for the SDK.
Acceptance Criteria
src/lib/soroban.tsis refactored soSorobanServicemethods import from@stellar/stellar-sdkvia dynamicimport()inside each method body (or via a lazy initializer pattern) rather than at the module top levelsorobanService.initialize()is removed from the module level and called lazily on first actual contract call@chakra-ui/reactserver components are split:src/app/layout.tsxonly imports theChakraProvider(which must be'use client'); it does NOT import individual Chakra components at the layout levelnext buildoutput shows the route/chunk is ≤ 150 KB (first load JS) — measured via@next/bundle-analyzerRelevant Files
src/lib/soroban.ts— dynamic imports inside methodssrc/app/layout.tsx— Chakra provider isolationnext.config.ts— add@next/bundle-analyzerin development.github/workflows/— add Lighthouse CI step