comment cleanup

This commit is contained in:
sneurlax 2023-01-16 16:12:53 -06:00
parent d10500ce02
commit 7cc30d1da4

View file

@ -28,120 +28,6 @@ class SimplexAPI {
return Uri.https(authority, path, params);
}
// Future<dynamic> _makeGetRequest(Uri uri) async {
// final client = this.client ?? http.Client();
// int code = -1;
// try {
// final response = await client.get(
// uri,
// );
//
// code = response.statusCode;
//
// final parsed = jsonDecode(response.body);
//
// return parsed;
// } catch (e, s) {
// Logging.instance.log(
// "_makeRequest($uri) HTTP:$code threw: $e\n$s",
// level: LogLevel.Error,
// );
// rethrow;
// }
// }
//
// Future<dynamic> _makePostRequest(
// Uri uri,
// Map<String, dynamic> body,
// ) async {
// final client = this.client ?? http.Client();
// try {
// final response = await client.post(
// uri,
// headers: {'Content-Type': 'application/json'},
// body: jsonEncode(body),
// );
//
// if (response.statusCode == 200) {
// final parsed = jsonDecode(response.body);
// return parsed;
// }
//
// throw Exception("response: ${response.body}");
// } catch (e, s) {
// Logging.instance
// .log("_makeRequest($uri) threw: $e\n$s", level: LogLevel.Error);
// rethrow;
// }
// }
//
// Future<ExchangeResponse<Trade>> createNewExchange({
// required bool isFixedRate,
// required String currencyFrom,
// required String currencyTo,
// required String addressTo,
// required String userRefundAddress,
// required String userRefundExtraId,
// required String amount,
// String? extraIdTo,
// String? apiKey,
// }) async {
// Map<String, dynamic> body = {
// "fixed": isFixedRate,
// "currency_from": currencyFrom,
// "currency_to": currencyTo,
// "addressTo": addressTo,
// "userRefundAddress": userRefundAddress,
// "userRefundExtraId": userRefundExtraId,
// "amount": double.parse(amount),
// "extraIdTo": extraIdTo,
// };
//
// final uri =
// _buildUri("/create_exchange", {"api_key": apiKey ?? kSimplexApiKey});
//
// try {
// final jsonObject = await _makePostRequest(uri, body);
//
// final json = Map<String, dynamic>.from(jsonObject as Map);
// final trade = Trade(
// uuid: const Uuid().v1(),
// tradeId: json["id"] as String,
// rateType: json["type"] as String,
// direction: "direct",
// timestamp: DateTime.parse(json["timestamp"] as String),
// updatedAt: DateTime.parse(json["updated_at"] as String),
// payInCurrency: json["currency_from"] as String,
// payInAmount: json["amount_from"] as String,
// payInAddress: json["address_from"] as String,
// payInNetwork: "",
// payInExtraId: json["extra_id_from"] as String? ?? "",
// payInTxid: json["tx_from"] as String? ?? "",
// payOutCurrency: json["currency_to"] as String,
// payOutAmount: json["amount_to"] as String,
// payOutAddress: json["address_to"] as String,
// payOutNetwork: "",
// payOutExtraId: json["extra_id_to"] as String? ?? "",
// payOutTxid: json["tx_to"] as String? ?? "",
// refundAddress: json["user_refund_address"] as String,
// refundExtraId: json["user_refund_extra_id"] as String,
// status: json["status"] as String,
// exchangeName: SimplexExchange.exchangeName,
// );
// return ExchangeResponse(value: trade, exception: null);
// } catch (e, s) {
// Logging.instance.log("getAvailableCurrencies exception: $e\n$s",
// level: LogLevel.Error);
// return ExchangeResponse(
// exception: ExchangeException(
// e.toString(),
// ExchangeExceptionType.generic,
// ),
// value: null,
// );
// }
// }
Future<BuyResponse<Tuple2<List<Crypto>, List<Fiat>>>> getSupported() async {
// example for quote courtesy of @danrmiller
// curl -H "Content-Type: application/json" -d '{"digital_currency": "BTC", "fiat_currency": "USD", "requested_currency": "USD", "requested_amount": 100}' http://sandbox-api.stackwallet.com/quote