Refactor wallet balance handling and integrate PaymentService for centralized management

- Replaced direct wallet balance computation in Navbar and WalletPage with a centralized totalBalance property from PaymentService, improving code maintainability.
- Updated CreateProductDialog, CreateStoreDialog, and MerchantStore components to utilize PaymentService for retrieving wallet admin and invoice keys, enhancing consistency across the application.
- These changes streamline wallet management and improve the overall architecture of the wallet module.
This commit is contained in:
padreug 2025-09-17 20:23:46 +02:00
parent c064b0b40d
commit e5db949aae
6 changed files with 69 additions and 21 deletions

View file

@ -59,6 +59,15 @@ export class PaymentService extends BaseService {
return this.authService?.user?.value?.wallets || []
}
/**
* Get total balance across all user wallets in millisatoshis
*/
get totalBalance(): number {
return this.userWallets.reduce((total: number, wallet: any) => {
return total + (wallet.balance_msat || 0)
}, 0)
}
/**
* Check if user has any wallet with balance
*/