2021-04-12 18:22:22 +00:00
|
|
|
import 'package:cake_wallet/buy/buy_amount.dart';
|
2024-11-09 19:00:56 +00:00
|
|
|
import 'package:cake_wallet/buy/buy_quote.dart';
|
2021-04-12 18:22:22 +00:00
|
|
|
import 'package:cake_wallet/buy/order.dart';
|
2024-11-09 19:00:56 +00:00
|
|
|
import 'package:cake_wallet/buy/payment_method.dart';
|
|
|
|
import 'package:cake_wallet/entities/fiat_currency.dart';
|
2024-05-05 01:44:50 +00:00
|
|
|
import 'package:cake_wallet/view_model/hardware_wallet/ledger_view_model.dart';
|
2024-11-09 19:00:56 +00:00
|
|
|
import 'package:cw_core/crypto_currency.dart';
|
2021-12-24 12:37:24 +00:00
|
|
|
import 'package:cw_core/wallet_base.dart';
|
2023-12-28 19:20:59 +00:00
|
|
|
import 'package:flutter/material.dart';
|
2021-04-12 18:22:22 +00:00
|
|
|
|
|
|
|
abstract class BuyProvider {
|
2023-12-28 19:20:59 +00:00
|
|
|
BuyProvider({
|
|
|
|
required this.wallet,
|
|
|
|
required this.isTestEnvironment,
|
2024-05-05 01:44:50 +00:00
|
|
|
required this.ledgerVM,
|
2023-12-28 19:20:59 +00:00
|
|
|
});
|
2021-04-12 18:22:22 +00:00
|
|
|
|
|
|
|
final WalletBase wallet;
|
|
|
|
final bool isTestEnvironment;
|
2024-05-05 01:44:50 +00:00
|
|
|
final LedgerViewModel? ledgerVM;
|
2021-04-12 18:22:22 +00:00
|
|
|
|
|
|
|
String get title;
|
|
|
|
|
2024-01-01 13:05:37 +00:00
|
|
|
String get providerDescription;
|
2023-12-28 19:20:59 +00:00
|
|
|
|
|
|
|
String get lightIcon;
|
|
|
|
|
|
|
|
String get darkIcon;
|
2021-04-12 18:22:22 +00:00
|
|
|
|
2024-11-09 19:00:56 +00:00
|
|
|
bool get isAggregator;
|
|
|
|
|
2021-04-12 18:22:22 +00:00
|
|
|
@override
|
|
|
|
String toString() => title;
|
|
|
|
|
2024-11-09 19:00:56 +00: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 19:20:59 +00:00
|
|
|
|
|
|
|
Future<String> requestUrl(String amount, String sourceCurrency) => throw UnimplementedError();
|
|
|
|
|
|
|
|
Future<Order> findOrderById(String id) => throw UnimplementedError();
|
|
|
|
|
2024-11-09 19:00:56 +00:00
|
|
|
Future<BuyAmount> calculateAmount(String amount, String sourceCurrency) =>
|
|
|
|
throw UnimplementedError();
|
|
|
|
|
|
|
|
Future<List<PaymentMethod>> getAvailablePaymentTypes(
|
|
|
|
String fiatCurrency, String cryptoCurrency, bool isBuyAction) async =>
|
|
|
|
[];
|
|
|
|
|
|
|
|
Future<List<Quote>?> fetchQuote(
|
|
|
|
{required CryptoCurrency cryptoCurrency,
|
|
|
|
required FiatCurrency fiatCurrency,
|
|
|
|
required double amount,
|
|
|
|
required bool isBuyAction,
|
|
|
|
required String walletAddress,
|
|
|
|
PaymentType? paymentType,
|
|
|
|
String? countryCode}) async =>
|
|
|
|
null;
|
2023-12-28 19:20:59 +00:00
|
|
|
}
|