Problem
src/lib/soroban.ts is the most critical file in the codebase (all contract interactions flow through it) but has zero test coverage. The parsePoolsFromXdr, parseUserPositionFromXdr, and parseCreditsFromXdr stubs, the formatCredits / formatAssetAmount utilities, and the transaction-building logic in lockAssets / unlockAssets are all untested.
Acceptance Criteria
Relevant Files
src/lib/soroban.ts — file under test
__tests__/soroban.test.ts — create this file
package.json — confirm vitest is already in devDependencies (if not, add it)
Problem
src/lib/soroban.tsis the most critical file in the codebase (all contract interactions flow through it) but has zero test coverage. TheparsePoolsFromXdr,parseUserPositionFromXdr, andparseCreditsFromXdrstubs, theformatCredits/formatAssetAmountutilities, and the transaction-building logic inlockAssets/unlockAssetsare all untested.Acceptance Criteria
__tests__/soroban.test.tscovers at minimum:formatCredits: sub-1000, thousands (K), millions (M)formatLockTime: past timestamp → "Unlockable now"; future timestamps at day/hour/sub-hour granularitiesformatAssetAmount: native XLM and issued asset formattingparsePoolsFromXdr: a validScVec→ correctPoolInfo[]; empty vec →[]; malformed entry → skipped with warningparseUserPositionFromXdr: valid position map → fullUserPosition;nullScVal→nullparseCreditsFromXdr: i128 stroops → display string conversionOperation.invokeContractFunctionargs forlock_assets(amount as i128, address asScAddress)@stellar/stellar-sdkRPC methods (simulateTransaction,sendTransaction,getTransaction) are set up withvi.mockso tests run without a live RPC endpointpnpm vitest runsrc/lib/soroban.tsRelevant Files
src/lib/soroban.ts— file under test__tests__/soroban.test.ts— create this filepackage.json— confirmvitestis already in devDependencies (if not, add it)