stack_wallet/lib/services/exchange/exchange.dart

51 lines
1.4 KiB
Dart
Raw Normal View History

2022-10-02 19:37:11 +00:00
import 'package:decimal/decimal.dart';
import 'package:stackwallet/models/exchange/response_objects/currency.dart';
import 'package:stackwallet/models/exchange/response_objects/pair.dart';
import 'package:stackwallet/models/exchange/response_objects/range.dart';
import 'package:stackwallet/models/exchange/response_objects/trade.dart';
import 'package:stackwallet/services/exchange/exchange_response.dart';
abstract class Exchange {
String get name;
2022-10-02 19:37:11 +00:00
Future<ExchangeResponse<List<Currency>>> getAllCurrencies(bool fixedRate);
Future<ExchangeResponse<List<Pair>>> getPairsFor(
String currency,
bool fixedRate,
);
Future<ExchangeResponse<List<Pair>>> getAllPairs(bool fixedRate);
Future<ExchangeResponse<Trade>> getTrade(String tradeId);
2022-10-02 21:48:43 +00:00
Future<ExchangeResponse<Trade>> updateTrade(Trade trade);
2022-10-02 19:37:11 +00:00
Future<ExchangeResponse<List<Trade>>> getTrades();
2022-10-02 21:48:43 +00:00
Future<ExchangeResponse<Range>> getRange(
2022-10-02 19:37:11 +00:00
String from,
String to,
bool fixedRate,
);
Future<ExchangeResponse<Decimal>> getEstimate(
String from,
String to,
Decimal amount,
bool fixedRate,
2022-10-02 21:48:43 +00:00
bool reversed,
2022-10-02 19:37:11 +00:00
);
Future<ExchangeResponse<Trade>> createTrade({
required String from,
required String to,
required bool fixedRate,
required Decimal amount,
required String addressTo,
String? extraId,
2022-10-02 19:37:11 +00:00
required String addressRefund,
required String refundExtraId,
String? rateId,
2022-10-02 19:37:11 +00:00
});
}