content: import 'package:Satsails/models/nox_transfer_model.dart';
  import 'package:Satsails/providers/address_provider.dart';
  import 'package:Satsails/providers/user_provider.dart';
  import 'package:flutter_riverpod/flutter_riverpod.dart';
  
  final noxTransferProvider = StateNotifierProvider<NoxTransferNotifier, List<NoxTransfer>>((ref) {
    return NoxTransferNotifier();
  });
  
  
  final selectedNoxTransferIdProvider = StateProvider<int>((ref) => 0);
  
  final singleNoxTransfersDetailsProvider = StateProvider.autoDispose<NoxTransfer>((ref) {
    final purchases = ref.watch(noxTransferProvider.notifier);
    final id = ref.watch(selectedNoxTransferIdProvider);
    final purchase = purchases.getPurchaseById(id);
    return purchase;
  });
  
  
  final getNoxUserPurchasesProvider = FutureProvider.autoDispose<List<NoxTransfer>>((ref) async {
    final auth = ref.read(userProvider).jwt;
    final transactions = await NoxService.getTransfers(auth);
  
    if (transactions.isSuccess && transactions.data != null) {
      ref.read(noxTransferProvider.notifier).mergePurchases(transactions.data!);
      return transactions.data!;
    } else {
      throw transactions.error!;
    }
  });
  
  final createNoxTransferRequestProvider = FutureProvider.autoDispose.family<String, ({String? amountCrypto, String? amountFiat, String type})>((ref, params) async {
    final auth = ref.read(userProvider).jwt;
    final bitcoinAddress = ref.read(addressProvider).bitcoinAddress;
    final result = await NoxService.createTransaction(auth, bitcoinAddress, params.amountCrypto, params.amountFiat, params.type);
    if (result.isSuccess && result.data != null) {
      return result.data!;
    } else {
      throw result.error!;
    }
  });
  
  final minimumNoxDepositsProvider = FutureProvider.autoDispose<MinimumDeposit>((ref) async {
    final auth = ref.read(userProvider).jwt;
    final result = await NoxService.getMinimumDeposit(auth);
  
    if (result.isSuccess && result.data != null) {
      return result.data!;
    } else {
      throw result.error!;
    }
  });
  
  final getNoxTransferDetailsProvider = FutureProvider.autoDispose.family<NoxTransfer, String>((ref, transferId) async {
    final auth = ref.read(userProvider).jwt;
    final result = await NoxService.getTransfer(auth, transferId);
  
    if (result.isSuccess && result.data != null) {
      ref.read(noxTransferProvider.notifier).mergeTransfer(result.data!);
      return result.data!;
    } else {
      throw result.error!;
    }
  });