2021-04-12 21:22:22 +03:00
|
|
|
import 'package:cake_wallet/buy/buy_amount.dart';
|
2024-11-09 21:00:56 +02:00
|
|
|
import 'package:cake_wallet/buy/buy_quote.dart';
|
2021-04-12 21:22:22 +03:00
|
|
|
import 'package:cake_wallet/buy/order.dart';
|
2025-03-29 07:46:16 +02:00
|
|
|
import 'package:cake_wallet/buy/pairs_utils.dart';
|
2024-11-09 21:00:56 +02:00
|
|
|
import 'package:cake_wallet/buy/payment_method.dart';
|
|
|
|
import 'package:cake_wallet/entities/fiat_currency.dart';
|
2024-05-04 20:44:50 -05:00
|
|
|
import 'package:cake_wallet/view_model/hardware_wallet/ledger_view_model.dart';
|
2024-11-09 21:00:56 +02:00
|
|
|
import 'package:cw_core/crypto_currency.dart';
|
2021-12-24 14:37:24 +02:00
|
|
|
import 'package:cw_core/wallet_base.dart';
|
2023-12-28 21:20:59 +02:00
|
|
|
import 'package:flutter/material.dart';
|
2021-04-12 21:22:22 +03:00
|
|
|
|
|
|
|
abstract class BuyProvider {
|
2023-12-28 21:20:59 +02:00
|
|
|
BuyProvider({
|
|
|
|
required this.wallet,
|
|
|
|
required this.isTestEnvironment,
|
2024-05-04 20:44:50 -05:00
|
|
|
required this.ledgerVM,
|
2025-03-29 07:46:16 +02:00
|
|
|
required this.supportedCryptoList,
|
|
|
|
required this.supportedFiatList
|
2023-12-28 21:20:59 +02:00
|
|
|
});
|
2021-04-12 21:22:22 +03:00
|
|
|
|
|
|
|
final WalletBase wallet;
|
|
|
|
final bool isTestEnvironment;
|
2024-05-04 20:44:50 -05:00
|
|
|
final LedgerViewModel? ledgerVM;
|
2025-03-29 07:46:16 +02:00
|
|
|
final List<TradePair<dynamic, dynamic>> supportedCryptoList;
|
|
|
|
final List<TradePair<dynamic, dynamic>> supportedFiatList;
|
2021-04-12 21:22:22 +03:00
|
|
|
|
|
|
|
String get title;
|
|
|
|
|
2024-01-01 15:05:37 +02:00
|
|
|
String get providerDescription;
|
2023-12-28 21:20:59 +02:00
|
|
|
|
|
|
|
String get lightIcon;
|
|
|
|
|
|
|
|
String get darkIcon;
|
2021-04-12 21:22:22 +03:00
|
|
|
|
2024-11-09 21:00:56 +02:00
|
|
|
bool get isAggregator;
|
|
|
|
|
2021-04-12 21:22:22 +03:00
|
|
|
@override
|
|
|
|
String toString() => title;
|
|
|
|
|
2024-11-09 21:00:56 +02:00
|
|
|
Future<void>? launchProvider(
|
|
|
|
{required BuildContext context,
|
|
|
|
required Quote quote,
|
|
|
|
required double amount,
|
|
|
|
required bool isBuyAction,
|
|
|
|
required String cryptoCurrencyAddress,
|
|
|
|
String? countryCode}) =>
|
|
|
|
null;
|
2023-12-28 21:20:59 +02:00
|
|
|
|
|
|
|
Future<String> requestUrl(String amount, String sourceCurrency) => throw UnimplementedError();
|
|
|
|
|
|
|
|
Future<Order> findOrderById(String id) => throw UnimplementedError();
|
|
|
|
|
2024-11-09 21:00:56 +02:00
|
|
|
Future<BuyAmount> calculateAmount(String amount, String sourceCurrency) =>
|
|
|
|
throw UnimplementedError();
|
|
|
|
|
|
|
|
Future<List<PaymentMethod>> getAvailablePaymentTypes(
|
2025-03-06 19:39:41 +02:00
|
|
|
String fiatCurrency, CryptoCurrency cryptoCurrency, bool isBuyAction) async =>
|
2024-11-09 21:00:56 +02:00
|
|
|
[];
|
|
|
|
|
|
|
|
Future<List<Quote>?> fetchQuote(
|
|
|
|
{required CryptoCurrency cryptoCurrency,
|
|
|
|
required FiatCurrency fiatCurrency,
|
|
|
|
required double amount,
|
|
|
|
required bool isBuyAction,
|
|
|
|
required String walletAddress,
|
|
|
|
PaymentType? paymentType,
|
2025-05-15 19:48:06 +03:00
|
|
|
String? customPaymentMethodType,
|
2024-11-09 21:00:56 +02:00
|
|
|
String? countryCode}) async =>
|
|
|
|
null;
|
2023-12-28 21:20:59 +02:00
|
|
|
}
|