Implement updateWalletBalance method in PaymentService and deprecate AuthService method
- Added updateWalletBalance method in PaymentService to handle wallet balance updates from WebSocket notifications, improving wallet management. - Deprecated the existing updateWalletBalance method in AuthService, redirecting calls to the new PaymentService method for better consistency and maintainability. - Updated WalletWebSocketService to utilize PaymentService for balance updates, ensuring accurate wallet state management. These changes enhance the architecture of wallet balance handling and streamline the update process across services.
This commit is contained in:
parent
49e94a894c
commit
f93058add2
3 changed files with 45 additions and 27 deletions
|
|
@ -233,7 +233,7 @@ export class WalletWebSocketService extends BaseService {
|
|||
}
|
||||
|
||||
/**
|
||||
* Update wallet balance in auth service
|
||||
* Update wallet balance via PaymentService
|
||||
*/
|
||||
private updateWalletBalance(balanceSats: number): void {
|
||||
console.log('WalletWebSocketService: Updating balance to', balanceSats, 'sats')
|
||||
|
|
@ -245,9 +245,9 @@ export class WalletWebSocketService extends BaseService {
|
|||
const wallet = this.paymentService?.getPreferredWallet?.()
|
||||
const walletId = wallet?.id
|
||||
|
||||
// Update balance in auth service (source of truth)
|
||||
if (this.authService?.updateWalletBalance) {
|
||||
this.authService.updateWalletBalance(balanceMsat, walletId)
|
||||
// Update balance via PaymentService (which manages wallet state)
|
||||
if (this.paymentService?.updateWalletBalance) {
|
||||
this.paymentService.updateWalletBalance(balanceMsat, walletId)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue