2020-09-21 11:50:26 +00:00
|
|
|
import 'package:cake_wallet/exchange/exchange_pair.dart';
|
2023-10-25 20:58:25 +00:00
|
|
|
import 'package:cake_wallet/exchange/exchange_provider_description.dart';
|
2020-09-21 11:50:26 +00:00
|
|
|
import 'package:cake_wallet/exchange/limits.dart';
|
|
|
|
import 'package:cake_wallet/exchange/trade.dart';
|
2023-10-25 20:58:25 +00:00
|
|
|
import 'package:cake_wallet/exchange/trade_request.dart';
|
|
|
|
import 'package:cw_core/crypto_currency.dart';
|
2020-01-04 19:31:52 +00:00
|
|
|
|
|
|
|
abstract class ExchangeProvider {
|
2022-10-12 17:09:57 +00:00
|
|
|
ExchangeProvider({required this.pairList});
|
2023-10-25 20:58:25 +00:00
|
|
|
|
2020-01-04 19:31:52 +00:00
|
|
|
String get title;
|
2023-10-25 20:58:25 +00:00
|
|
|
|
2020-01-04 19:31:52 +00:00
|
|
|
List<ExchangePair> pairList;
|
2023-10-25 20:58:25 +00:00
|
|
|
|
2022-10-12 17:09:57 +00:00
|
|
|
ExchangeProviderDescription get description;
|
2023-10-25 20:58:25 +00:00
|
|
|
|
2020-11-10 14:58:40 +00:00
|
|
|
bool get isAvailable;
|
2023-10-25 20:58:25 +00:00
|
|
|
|
2022-09-01 14:12:38 +00:00
|
|
|
bool get isEnabled;
|
2023-10-25 20:58:25 +00:00
|
|
|
|
2022-12-06 17:23:46 +00:00
|
|
|
bool get supportsFixedRate;
|
2023-10-25 20:58:25 +00:00
|
|
|
|
2023-03-01 21:44:15 +00:00
|
|
|
bool get supportsOnionAddress => false;
|
2020-01-04 19:31:52 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
String toString() => title;
|
|
|
|
|
2021-02-18 19:08:52 +00:00
|
|
|
Future<Limits> fetchLimits(
|
2023-10-25 20:58:25 +00:00
|
|
|
{required CryptoCurrency from, required CryptoCurrency to, required bool isFixedRateMode});
|
|
|
|
|
|
|
|
Future<Trade> createTrade({required TradeRequest request, required bool isFixedRateMode});
|
|
|
|
|
|
|
|
Future<Trade> findTradeById({required String id});
|
|
|
|
|
|
|
|
Future<double> fetchRate(
|
2022-10-12 17:09:57 +00:00
|
|
|
{required CryptoCurrency from,
|
|
|
|
required CryptoCurrency to,
|
2023-10-25 20:58:25 +00:00
|
|
|
required double amount,
|
|
|
|
required bool isFixedRateMode,
|
|
|
|
required bool isReceiveAmount});
|
|
|
|
|
2020-11-10 14:58:40 +00:00
|
|
|
Future<bool> checkIsAvailable();
|
2020-01-04 19:31:52 +00:00
|
|
|
}
|