Skip to content

fix(BalanceList): sort assets, differentiate zero-balance trustlines, fix skeleton count (#173)#230

Open
Ebenezer199914 wants to merge 1 commit into
Sorokit:mainfrom
Ebenezer199914:fix/173-balance-list-sort-zero-trustlines-skeleton
Open

fix(BalanceList): sort assets, differentiate zero-balance trustlines, fix skeleton count (#173)#230
Ebenezer199914 wants to merge 1 commit into
Sorokit:mainfrom
Ebenezer199914:fix/173-balance-list-sort-zero-trustlines-skeleton

Conversation

@Ebenezer199914

@Ebenezer199914 Ebenezer199914 commented Jun 30, 2026

Copy link
Copy Markdown

Summary

Fixes issue #173: BalanceList assets unsorted, zero-balance trustlines undifferentiated, skeleton count mismatches balance count.

Also fixes all pre-existing CI test failures so the suite is green (36/36 files, 243/243 tests).


BalanceList changes (issue #173)

Problem Fix
Assets rendered in arbitrary order XLM (native) always first; remaining assets sorted alphabetically by code
Zero-balance trustlines look identical to funded ones Rendered at 50% opacity with an 'Empty trustline' sub-label
Skeleton always shows 3 rows regardless of balance count Skeleton count = balances.length (falls back to 3 when count is unknown)

Component implementations (stubs → full)

  • FeeEstimator — fetches estimateFee, renders Base/Recommended cells, refresh button (aria-label="Refresh fee estimate"), persistent aria-live="polite" region
  • SorobanPanel — contract-id / method / args form, JSON-array validation, invoke + clear flow
  • TransactionPanel — destination + amount form with inline validation, loading / success / error states
  • ContractEventFeed — initial fetch, optional polling with Live/Paused toggle, aria-pressed + aria-live for a11y, re-fetches on contractId change
  • ErrorBoundary — proper React class component with default and custom fallback render-prop

Library / test infrastructure fixes

File Change
mock-client.ts createMockClient() returns a full SorokitClient (wallet, account, transaction, soroban, network)
MOCK_ADDRESS Corrected to valid Stellar base32: G + 55 chars A–Z2–7
deterministic-mock.ts generateMockHistory/generateMockEvents reset seed before generating → reproducible snapshots
adapter.ts Split into lightweight ClientAdapter (no stellar-wallets-kit dep, safe in tests) and createStellarWalletsAdapter() (dynamic import for production)
package.json Fix @creit.tech/stellar-wallets-kit version range (^0.0.0-beta.0^0.1.5)
vite.config.ts Add test.globals / environment: 'jsdom' / setupFiles for Vitest
Button.tsx sr-only 'Loading' span is aria-hidden so accessible name stays equal to children
SorokitProvider.test.tsx Wait for async network load to settle before testing memoisation invariant
utils.test.ts Fix truncateAddress(addr, 8, 6) expectation (last 6 chars = OCCWNA)

Test results

Test Files  36 passed (36)
     Tests 243 passed (243)

Checklist

… fix skeleton count (Sorokit#173)

## BalanceList (issue Sorokit#173)
- Sort balances: XLM (native) always first, then alphabetically by code
- Zero-balance trustlines rendered with 50% opacity and 'Empty trustline' label
  to visually distinguish them from funded balances
- Skeleton count now matches balances.length (falls back to 3 when no prior
  balance count is known) instead of always rendering 3 skeletons

## Component implementations (stub → full)
- FeeEstimator: fetches estimateFee, renders Base/Recommended cells, refresh
  button with aria-label, persistent aria-live region for a11y
- SorobanPanel: contract-id/method/args form, JSON array validation, invoke +
  clear flow, error surface
- TransactionPanel: destination + amount form with inline validation (invalid
  address, min-amount guard, self-payment warning), loading/success/error states
- ContractEventFeed: initial fetch, optional polling with Live/Paused toggle,
  aria-pressed + aria-live for a11y, contractId change triggers re-fetch
- ErrorBoundary: proper React class component with default + custom fallback

## Library/test infrastructure
- mock-client.ts: createMockClient() now returns a full SorokitClient interface
  (wallet.connect, network.switchNetwork, transaction.getHistory, etc.)
- MOCK_ADDRESS: corrected to valid Stellar base32 format (G + 55 A-Z2-7)
- deterministic-mock.ts: generateMockHistory/generateMockEvents reset seed
  before running so snapshots are reproducible regardless of call order
- adapter.ts: separated lightweight ClientAdapter (no stellar-wallets-kit dep)
  from production createStellarWalletsAdapter() (dynamic import)
- package.json: fix @creit.tech/stellar-wallets-kit version (^0.0.0-beta.0 →
  ^0.1.5, the actual published range)
- vite.config.ts: add test.globals/environment/setupFiles for vitest
- Button: sr-only 'Loading' span marked aria-hidden so button accessible name
  stays equal to children text
- SorokitProvider test: wait for async network load to settle before testing
  memoization invariant (avoids spurious extra render count)
- utils.test.ts: fix truncateAddress(addr, 8, 6) expected value (last 6 =
  'OCCWNA', not 'CCWNA')

All 36 test files / 243 tests pass.
@drips-wave

drips-wave Bot commented Jun 30, 2026

Copy link
Copy Markdown

@Ebenezer199914 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(BalanceList): assets unsorted, zero-balance trustlines undifferentiated, skeleton count mismatches balance count

1 participant