content: import 'package:flutter_riverpod/flutter_riverpod.dart';
  import 'package:Satsails/models/balance_model.dart';
  import 'package:Satsails/providers/currency_conversions_provider.dart';
  import 'package:hive/hive.dart';
  
  final balanceNotifierProvider = StateNotifierProvider<BalanceNotifier, WalletBalance>((ref) {
    return BalanceNotifier(ref);
  });
  
  final balanceFutureProvider = FutureProvider<WalletBalance>((ref) async {
    final hiveBox = await Hive.openBox<WalletBalance>('balanceBox');
  
    final balance = hiveBox.get('balance');
  
    return balance ?? WalletBalance.empty();
  });
  
  final balanceChangeProvider = StateProvider<BalanceChange?>((ref) => null);
  
  final totalBalanceInFiatProvider = StateProvider.family.autoDispose<String, String>((ref, currency)  {
    final balanceModel = ref.watch(balanceNotifierProvider);
    final conversions = ref.watch(currencyNotifierProvider);
  
    return balanceModel.totalBalanceInCurrency(currency, conversions).toStringAsFixed(2);
  });
  
  final totalBalanceInDenominationProvider = StateProvider.family.autoDispose<String, String>((ref, denomination){
    final balanceModel = ref.watch(balanceNotifierProvider);
    final conversions = ref.watch(currencyNotifierProvider);
    return balanceModel.totalBalanceInDenominationFormatted(denomination, conversions);
  });
  
  final currentBitcoinPriceInCurrencyProvider = StateProvider.family.autoDispose<double, CurrencyParams>((ref, params) {
    final balanceModel = ref.watch(balanceNotifierProvider);
    return balanceModel.currentBitcoinPriceInCurrency(params, ref.watch(currencyNotifierProvider));
  });
  
  final btcBalanceInFormatProvider = StateProvider.family.autoDispose<String, String>((ref, denomination) {
    final balance = ref.watch(balanceNotifierProvider);
    return balance.btcBalanceInDenominationFormatted(denomination);
  });
  
  final liquidBalanceInFormatProvider = StateProvider.family.autoDispose<String, String>((ref, denomination) {
    final balance = ref.watch(balanceNotifierProvider);
    return balance.liquidBalanceInDenominationFormatted(denomination);
  });
  
  final lightningBalanceInFormatProvider = StateProvider.family.autoDispose<String, String>((ref, denomination) {
    final balance = ref.watch(balanceNotifierProvider);
    return balance.lightningBalanceInDenominationFormatted(denomination);
  });