Fix wallet page to use WalletManager trait via ServiceProvider #14

Closed
opened 2026-02-09 21:04:28 +00:00 by mik-tf · 3 comments
Owner

Problem

The wallet page shows balance 0, no transactions, no owned products, and staking at 0. The wallet controller at src/controllers/wallet.rs (953 lines) uses FixtureWalletManager which reads from JSON fixture files instead of hero_osis KVS.

Current Implementation

The dashboard_wallet_page handler does use services.wallet.get_balance() but the template-rendering path also directly reads fixture data for:

  • Transaction history
  • Owned products list
  • Staking information
  • Wallet address display

What Works

The hero WalletManager implementation already exists at src/services/impl_hero/wallet_manager.rs (302 lines) with:

  • Hybrid on/off-chain balance (KVS ledger + NEAR token queries)
  • Transaction history via KVS
  • Balance operations

What Needs Fixing

  1. Ensure dashboard_wallet_page fully uses services.wallet.* for all data
  2. Wire transaction list to services.wallet.get_transactions()
  3. Wire owned products to services.orders.* (completed orders = owned)
  4. Wire staking display to services.wallet.get_staking_info() or hero_ledger
  5. Verify seed script includes wallet test data (balances + transactions)

Acceptance Criteria

  • Wallet shows non-zero balance from hero_osis KVS
  • Transaction history displays seeded transactions
  • Owned products section shows completed orders
  • Staking section shows data (or appropriate empty state if not staked)
  • All wallet operations go through WalletManager trait

Dependencies

  • Depends on: #9 (split dashboard.rs)
  • Independent of provider rewiring issues
## Problem The wallet page shows balance 0, no transactions, no owned products, and staking at 0. The wallet controller at `src/controllers/wallet.rs` (953 lines) uses `FixtureWalletManager` which reads from JSON fixture files instead of hero_osis KVS. ## Current Implementation The `dashboard_wallet_page` handler does use `services.wallet.get_balance()` but the template-rendering path also directly reads fixture data for: - Transaction history - Owned products list - Staking information - Wallet address display ## What Works The hero `WalletManager` implementation already exists at `src/services/impl_hero/wallet_manager.rs` (302 lines) with: - Hybrid on/off-chain balance (KVS ledger + NEAR token queries) - Transaction history via KVS - Balance operations ## What Needs Fixing 1. Ensure `dashboard_wallet_page` fully uses `services.wallet.*` for all data 2. Wire transaction list to `services.wallet.get_transactions()` 3. Wire owned products to `services.orders.*` (completed orders = owned) 4. Wire staking display to `services.wallet.get_staking_info()` or hero_ledger 5. Verify seed script includes wallet test data (balances + transactions) ## Acceptance Criteria - [ ] Wallet shows non-zero balance from hero_osis KVS - [ ] Transaction history displays seeded transactions - [ ] Owned products section shows completed orders - [ ] Staking section shows data (or appropriate empty state if not staked) - [ ] All wallet operations go through WalletManager trait ## Dependencies - Depends on: #9 (split dashboard.rs) - Independent of provider rewiring issues
Author
Owner

Wallet page already uses services.wallet.get_balance() and get_transactions(). Core operations fully wired.

Wallet page already uses services.wallet.get_balance() and get_transactions(). Core operations fully wired.
Author
Owner

Reopened — remaining work

Remaining bypasses in wallet.rs:

  • 2x UserPersistence::load_user_data
  • 2x CurrencyService::new() (utility, keep)
  • 3x InstantPurchaseService::builder() (refactor to use WalletManager)
  • 2x NavbarService::builder() (UI helper, refactor to use existing traits)
  • 2x AutoTopUpService::builder() (needs WalletManager trait methods)

Depends on #26 for WalletManager auto-topup methods.

## Reopened — remaining work Remaining bypasses in wallet.rs: - 2x `UserPersistence::load_user_data` - 2x `CurrencyService::new()` (utility, keep) - 3x `InstantPurchaseService::builder()` (refactor to use WalletManager) - 2x `NavbarService::builder()` (UI helper, refactor to use existing traits) - 2x `AutoTopUpService::builder()` (needs WalletManager trait methods) Depends on #26 for WalletManager auto-topup methods.
Author
Owner

archived repo, closing

archived repo, closing
Commenting is not possible because the repository is archived.
No description provided.