/* * This file is part of Stack Wallet. * * Copyright (c) 2023 Cypher Stack * All Rights Reserved. * The code is distributed under GPLv3 license, see LICENSE file for details. * Generated by Cypher Stack on 2023-05-26 * */ import 'package:decimal/decimal.dart'; import 'package:stackwallet/models/exchange/response_objects/estimate.dart'; import 'package:stackwallet/models/exchange/response_objects/range.dart'; import 'package:stackwallet/models/exchange/response_objects/trade.dart'; import 'package:stackwallet/models/isar/exchange_cache/currency.dart'; import 'package:stackwallet/models/isar/exchange_cache/pair.dart'; import 'package:stackwallet/services/exchange/change_now/change_now_exchange.dart'; import 'package:stackwallet/services/exchange/exchange_response.dart'; import 'package:stackwallet/services/exchange/majestic_bank/majestic_bank_exchange.dart'; import 'package:stackwallet/services/exchange/simpleswap/simpleswap_exchange.dart'; import 'package:stackwallet/services/exchange/trocador/trocador_exchange.dart'; abstract class Exchange { static Exchange get defaultExchange => ChangeNowExchange.instance; static Exchange fromName(String name) { switch (name) { case ChangeNowExchange.exchangeName: return ChangeNowExchange.instance; case SimpleSwapExchange.exchangeName: return SimpleSwapExchange.instance; case MajesticBankExchange.exchangeName: return MajesticBankExchange.instance; case TrocadorExchange.exchangeName: return TrocadorExchange.instance; default: final split = name.split(" "); if (split.length >= 2) { // silly way to check for 'Trocador ($providerName)' return fromName(split.first); } throw ArgumentError("Unknown exchange name"); } } String get name; Future>> getAllCurrencies(bool fixedRate); Future>> getPairedCurrencies( String forCurrency, bool fixedRate, ); Future>> getPairsFor( String currency, bool fixedRate, ); Future>> getAllPairs(bool fixedRate); Future> getTrade(String tradeId); Future> updateTrade(Trade trade); Future>> getTrades(); Future> getRange( String from, String to, bool fixedRate, ); Future>> getEstimates( String from, String to, Decimal amount, bool fixedRate, bool reversed, ); Future> createTrade({ required String from, required String to, required bool fixedRate, required Decimal amount, required String addressTo, String? extraId, required String addressRefund, required String refundExtraId, Estimate? estimate, required bool reversed, }); // Flag to indicate that the exchange supports Tor. bool get supportsTor => false; }