| 1 | import 'package:cake_wallet/buy/buy_amount.dart'; |
| 2 | import 'package:cake_wallet/buy/buy_quote.dart'; |
| 3 | import 'package:cake_wallet/order/order.dart'; |
| 4 | import 'package:cake_wallet/buy/pairs_utils.dart'; |
| 5 | import 'package:cake_wallet/buy/payment_method.dart'; |
| 6 | import 'package:cake_wallet/entities/fiat_currency.dart'; |
| 7 | import 'package:cake_wallet/view_model/hardware_wallet/hardware_wallet_view_model.dart'; |
| 8 | import 'package:cw_core/crypto_currency.dart'; |
| 9 | import 'package:cw_core/wallet_base.dart'; |
| 10 | import 'package:flutter/material.dart'; |
| 11 | |
| 12 | abstract class BuyProvider { |
| 13 | BuyProvider( |
| 14 | {required this.wallet, |
| 15 | required this.isTestEnvironment, |
| 16 | required this.hardwareWalletVM, |
| 17 | required this.supportedCryptoList, |
| 18 | required this.supportedFiatList}); |
| 19 | |
| 20 | final WalletBase wallet; |
| 21 | final bool isTestEnvironment; |
| 22 | final HardwareWalletViewModel? hardwareWalletVM; |
| 23 | final List<TradePair<dynamic, dynamic>> supportedCryptoList; |
| 24 | final List<TradePair<dynamic, dynamic>> supportedFiatList; |
| 25 | |
| 26 | String get title; |
| 27 | |
| 28 | String get providerDescription; |
| 29 | |
| 30 | String get lightIcon; |
| 31 | |
| 32 | String get darkIcon; |
| 33 | |
| 34 | bool get isAggregator; |
| 35 | |
| 36 | @override |
| 37 | String toString() => title; |
| 38 | |
| 39 | Future<void>? launchProvider( |
| 40 | {required BuildContext context, |
| 41 | required Quote quote, |
| 42 | required double amount, |
| 43 | required bool isBuyAction, |
| 44 | required String cryptoCurrencyAddress, |
| 45 | String? countryCode}) => |
| 46 | null; |
| 47 | |
| 48 | Future<String> requestUrl(String amount, String sourceCurrency) => throw UnimplementedError(); |
| 49 | |
| 50 | Future<Order> findOrderById(String id) => throw UnimplementedError(); |
| 51 | |
| 52 | Future<BuyAmount> calculateAmount(String amount, String sourceCurrency) => |
| 53 | throw UnimplementedError(); |
| 54 | |
| 55 | Future<List<PaymentMethod>> getAvailablePaymentTypes( |
| 56 | String fiatCurrency, CryptoCurrency cryptoCurrency, bool isBuyAction) async => |
| 57 | []; |
| 58 | |
| 59 | Future<List<Quote>?> fetchQuote( |
| 60 | {required CryptoCurrency cryptoCurrency, |
| 61 | required FiatCurrency fiatCurrency, |
| 62 | required double amount, |
| 63 | required bool isBuyAction, |
| 64 | required String walletAddress, |
| 65 | PaymentType? paymentType, |
| 66 | String? customPaymentMethodType, |
| 67 | String? countryCode}) async => |
| 68 | null; |
| 69 | } |