mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-16 17:27:39 +00:00
WIP simpleswap and generic exchange
This commit is contained in:
parent
43fa958813
commit
6126588e60
20 changed files with 1177 additions and 230 deletions
|
@ -1,7 +1,7 @@
|
|||
import 'package:decimal/decimal.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:stackwallet/models/exchange/change_now/currency.dart';
|
||||
import 'package:stackwallet/models/exchange/response_objects/currency.dart';
|
||||
import 'package:stackwallet/services/change_now/change_now.dart';
|
||||
import 'package:stackwallet/utilities/logger.dart';
|
||||
|
||||
|
|
|
@ -5,12 +5,18 @@ class Currency {
|
|||
/// Currency name
|
||||
final String name;
|
||||
|
||||
/// Currency network
|
||||
final String network;
|
||||
|
||||
/// Currency logo url
|
||||
final String image;
|
||||
|
||||
/// Indicates if a currency has an Extra ID
|
||||
final bool hasExternalId;
|
||||
|
||||
/// external id if it exists
|
||||
final String? externalId;
|
||||
|
||||
/// Indicates if a currency is a fiat currency (EUR, USD)
|
||||
final bool isFiat;
|
||||
|
||||
|
@ -30,8 +36,10 @@ class Currency {
|
|||
Currency({
|
||||
required this.ticker,
|
||||
required this.name,
|
||||
required this.network,
|
||||
required this.image,
|
||||
required this.hasExternalId,
|
||||
this.externalId,
|
||||
required this.isFiat,
|
||||
required this.featured,
|
||||
required this.isStable,
|
||||
|
@ -44,8 +52,10 @@ class Currency {
|
|||
return Currency(
|
||||
ticker: json["ticker"] as String,
|
||||
name: json["name"] as String,
|
||||
network: json["network"] as String,
|
||||
image: json["image"] as String,
|
||||
hasExternalId: json["hasExternalId"] as bool,
|
||||
externalId: json["externalId"] as String?,
|
||||
isFiat: json["isFiat"] as bool,
|
||||
featured: json["featured"] as bool,
|
||||
isStable: json["isStable"] as bool,
|
||||
|
@ -61,8 +71,10 @@ class Currency {
|
|||
final map = {
|
||||
"ticker": ticker,
|
||||
"name": name,
|
||||
"network": network,
|
||||
"image": image,
|
||||
"hasExternalId": hasExternalId,
|
||||
"externalId": externalId,
|
||||
"isFiat": isFiat,
|
||||
"featured": featured,
|
||||
"isStable": isStable,
|
||||
|
@ -79,8 +91,10 @@ class Currency {
|
|||
Currency copyWith({
|
||||
String? ticker,
|
||||
String? name,
|
||||
String? network,
|
||||
String? image,
|
||||
bool? hasExternalId,
|
||||
String? externalId,
|
||||
bool? isFiat,
|
||||
bool? featured,
|
||||
bool? isStable,
|
||||
|
@ -90,8 +104,10 @@ class Currency {
|
|||
return Currency(
|
||||
ticker: ticker ?? this.ticker,
|
||||
name: name ?? this.name,
|
||||
network: network ?? this.network,
|
||||
image: image ?? this.image,
|
||||
hasExternalId: hasExternalId ?? this.hasExternalId,
|
||||
externalId: externalId ?? this.externalId,
|
||||
isFiat: isFiat ?? this.isFiat,
|
||||
featured: featured ?? this.featured,
|
||||
isStable: isStable ?? this.isStable,
|
35
lib/models/exchange/response_objects/pair.dart
Normal file
35
lib/models/exchange/response_objects/pair.dart
Normal file
|
@ -0,0 +1,35 @@
|
|||
class Pair {
|
||||
final String from;
|
||||
final String fromNetwork;
|
||||
|
||||
final String to;
|
||||
final String toNetwork;
|
||||
|
||||
final bool fixedRate;
|
||||
final bool floatingRate;
|
||||
|
||||
Pair({
|
||||
required this.from,
|
||||
required this.fromNetwork,
|
||||
required this.to,
|
||||
required this.toNetwork,
|
||||
required this.fixedRate,
|
||||
required this.floatingRate,
|
||||
});
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
"from": from,
|
||||
"fromNetwork": fromNetwork,
|
||||
"to": to,
|
||||
"toNetwork": toNetwork,
|
||||
"fixedRate": fixedRate,
|
||||
"floatingRate": floatingRate,
|
||||
};
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return "Pair: ${toJson()}";
|
||||
}
|
||||
}
|
32
lib/models/exchange/response_objects/range.dart
Normal file
32
lib/models/exchange/response_objects/range.dart
Normal file
|
@ -0,0 +1,32 @@
|
|||
import 'package:decimal/decimal.dart';
|
||||
|
||||
class Range {
|
||||
final Decimal? min;
|
||||
final Decimal? max;
|
||||
|
||||
Range({this.min, this.max});
|
||||
|
||||
Range copyWith({
|
||||
Decimal? min,
|
||||
Decimal? max,
|
||||
}) {
|
||||
return Range(
|
||||
min: min ?? this.min,
|
||||
max: max ?? this.max,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
final map = {
|
||||
"min": min?.toString(),
|
||||
"max": max?.toString(),
|
||||
};
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return "Range: ${toMap()}";
|
||||
}
|
||||
}
|
141
lib/models/exchange/response_objects/trade.dart
Normal file
141
lib/models/exchange/response_objects/trade.dart
Normal file
|
@ -0,0 +1,141 @@
|
|||
import 'package:hive/hive.dart';
|
||||
|
||||
@HiveType(typeId: Trade.typeId)
|
||||
class Trade {
|
||||
static const typeId = 22;
|
||||
|
||||
@HiveField(0)
|
||||
final String uuid;
|
||||
|
||||
@HiveField(1)
|
||||
final String tradeId;
|
||||
|
||||
@HiveField(2)
|
||||
final String rateType;
|
||||
|
||||
@HiveField(3)
|
||||
final String direction;
|
||||
|
||||
@HiveField(4)
|
||||
final DateTime timestamp;
|
||||
|
||||
@HiveField(5)
|
||||
final DateTime updatedAt;
|
||||
|
||||
@HiveField(6)
|
||||
final String from;
|
||||
|
||||
@HiveField(7)
|
||||
final String fromAmount;
|
||||
|
||||
@HiveField(8)
|
||||
final String fromAddress;
|
||||
|
||||
@HiveField(9)
|
||||
final String fromNetwork;
|
||||
|
||||
@HiveField(10)
|
||||
final String fromExtraId;
|
||||
|
||||
@HiveField(11)
|
||||
final String fromTxid;
|
||||
|
||||
@HiveField(12)
|
||||
final String to;
|
||||
|
||||
@HiveField(13)
|
||||
final String toAmount;
|
||||
|
||||
@HiveField(14)
|
||||
final String toAddress;
|
||||
|
||||
@HiveField(15)
|
||||
final String toNetwork;
|
||||
|
||||
@HiveField(16)
|
||||
final String toExtraId;
|
||||
|
||||
@HiveField(17)
|
||||
final String toTxid;
|
||||
|
||||
@HiveField(18)
|
||||
final String refundAddress;
|
||||
|
||||
@HiveField(19)
|
||||
final String refundExtraId;
|
||||
|
||||
@HiveField(20)
|
||||
final String status;
|
||||
|
||||
const Trade({
|
||||
required this.uuid,
|
||||
required this.tradeId,
|
||||
required this.rateType,
|
||||
required this.direction,
|
||||
required this.timestamp,
|
||||
required this.updatedAt,
|
||||
required this.from,
|
||||
required this.fromAmount,
|
||||
required this.fromAddress,
|
||||
required this.fromNetwork,
|
||||
required this.fromExtraId,
|
||||
required this.fromTxid,
|
||||
required this.to,
|
||||
required this.toAmount,
|
||||
required this.toAddress,
|
||||
required this.toNetwork,
|
||||
required this.toExtraId,
|
||||
required this.toTxid,
|
||||
required this.refundAddress,
|
||||
required this.refundExtraId,
|
||||
required this.status,
|
||||
});
|
||||
|
||||
Trade copyWith({
|
||||
String? uuid,
|
||||
String? tradeId,
|
||||
String? rateType,
|
||||
String? direction,
|
||||
DateTime? timestamp,
|
||||
DateTime? updatedAt,
|
||||
String? from,
|
||||
String? fromAmount,
|
||||
String? fromAddress,
|
||||
String? fromNetwork,
|
||||
String? fromExtraId,
|
||||
String? fromTxid,
|
||||
String? to,
|
||||
String? toAmount,
|
||||
String? toAddress,
|
||||
String? toNetwork,
|
||||
String? toExtraId,
|
||||
String? toTxid,
|
||||
String? refundAddress,
|
||||
String? refundExtraId,
|
||||
String? status,
|
||||
}) {
|
||||
return Trade(
|
||||
uuid: uuid ?? this.uuid,
|
||||
tradeId: tradeId ?? this.tradeId,
|
||||
rateType: rateType ?? this.rateType,
|
||||
direction: direction ?? this.direction,
|
||||
timestamp: timestamp ?? this.timestamp,
|
||||
updatedAt: updatedAt ?? this.updatedAt,
|
||||
from: from ?? this.from,
|
||||
fromAmount: fromAmount ?? this.fromAmount,
|
||||
fromAddress: fromAddress ?? this.fromAddress,
|
||||
fromNetwork: fromNetwork ?? this.fromNetwork,
|
||||
fromExtraId: fromExtraId ?? this.fromExtraId,
|
||||
fromTxid: fromTxid ?? this.fromTxid,
|
||||
to: to ?? this.to,
|
||||
toAmount: toAmount ?? this.toAmount,
|
||||
toAddress: toAddress ?? this.toAddress,
|
||||
toNetwork: toNetwork ?? this.toNetwork,
|
||||
toExtraId: toExtraId ?? this.toExtraId,
|
||||
toTxid: toTxid ?? this.toTxid,
|
||||
refundAddress: refundAddress ?? this.refundAddress,
|
||||
refundExtraId: refundExtraId ?? this.refundExtraId,
|
||||
status: status ?? this.status,
|
||||
);
|
||||
}
|
||||
}
|
99
lib/models/exchange/simpleswap/sp_currency.dart
Normal file
99
lib/models/exchange/simpleswap/sp_currency.dart
Normal file
|
@ -0,0 +1,99 @@
|
|||
import 'package:stackwallet/utilities/logger.dart';
|
||||
|
||||
class SPCurrency {
|
||||
/// currency name
|
||||
final String name;
|
||||
|
||||
/// currency symbol
|
||||
final String symbol;
|
||||
|
||||
/// currency network
|
||||
final String network;
|
||||
|
||||
/// has this currency extra id parameter
|
||||
final bool hasExtraId;
|
||||
|
||||
/// name of extra id (if exists)
|
||||
final String? extraId;
|
||||
|
||||
/// relative url for currency icon svg
|
||||
final String image;
|
||||
|
||||
/// informational messages about the currency they are changing
|
||||
final List<dynamic> warningsFrom;
|
||||
|
||||
/// informational messages about the currency for which they are exchanged
|
||||
final List<dynamic> warningsTo;
|
||||
|
||||
SPCurrency({
|
||||
required this.name,
|
||||
required this.symbol,
|
||||
required this.network,
|
||||
required this.hasExtraId,
|
||||
required this.extraId,
|
||||
required this.image,
|
||||
required this.warningsFrom,
|
||||
required this.warningsTo,
|
||||
});
|
||||
|
||||
factory SPCurrency.fromJson(Map<String, dynamic> json) {
|
||||
try {
|
||||
return SPCurrency(
|
||||
name: json["name"] as String,
|
||||
symbol: json["symbol"] as String,
|
||||
network: json["network"] as String? ?? "",
|
||||
hasExtraId: json["has_extra_id"] as bool,
|
||||
extraId: json["extra_id"] as String?,
|
||||
image: json["image"] as String,
|
||||
warningsFrom: json["warnings_from"] as List<dynamic>,
|
||||
warningsTo: json["warnings_to"] as List<dynamic>,
|
||||
);
|
||||
} catch (e, s) {
|
||||
Logging.instance.log("SPCurrency.fromJson failed to parse: $e\n$s",
|
||||
level: LogLevel.Error);
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final map = {
|
||||
"name": name,
|
||||
"symbol": symbol,
|
||||
"network": network,
|
||||
"has_extra_id": hasExtraId,
|
||||
"extra_id": extraId,
|
||||
"image": image,
|
||||
"warnings_from": warningsFrom,
|
||||
"warnings_to": warningsTo,
|
||||
};
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
SPCurrency copyWith({
|
||||
String? name,
|
||||
String? symbol,
|
||||
String? network,
|
||||
bool? hasExtraId,
|
||||
String? extraId,
|
||||
String? image,
|
||||
List<dynamic>? warningsFrom,
|
||||
List<dynamic>? warningsTo,
|
||||
}) {
|
||||
return SPCurrency(
|
||||
name: name ?? this.name,
|
||||
symbol: symbol ?? this.symbol,
|
||||
network: network ?? this.network,
|
||||
hasExtraId: hasExtraId ?? this.hasExtraId,
|
||||
extraId: extraId ?? this.extraId,
|
||||
image: image ?? this.image,
|
||||
warningsFrom: warningsFrom ?? this.warningsFrom,
|
||||
warningsTo: warningsTo ?? this.warningsTo,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return "SPCurrency: ${toJson()}";
|
||||
}
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:stackwallet/models/exchange/change_now/currency.dart';
|
||||
import 'package:stackwallet/models/exchange/change_now/fixed_rate_market.dart';
|
||||
import 'package:stackwallet/models/exchange/response_objects/currency.dart';
|
||||
import 'package:stackwallet/utilities/assets.dart';
|
||||
import 'package:stackwallet/utilities/constants.dart';
|
||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:stackwallet/models/exchange/change_now/currency.dart';
|
||||
import 'package:stackwallet/models/exchange/response_objects/currency.dart';
|
||||
import 'package:stackwallet/utilities/assets.dart';
|
||||
import 'package:stackwallet/utilities/constants.dart';
|
||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||
|
|
|
@ -8,9 +8,9 @@ import 'package:flutter_svg/flutter_svg.dart';
|
|||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:stackwallet/models/exchange/change_now/available_floating_rate_pair.dart';
|
||||
import 'package:stackwallet/models/exchange/change_now/cn_exchange_estimate.dart';
|
||||
import 'package:stackwallet/models/exchange/change_now/currency.dart';
|
||||
import 'package:stackwallet/models/exchange/change_now/fixed_rate_market.dart';
|
||||
import 'package:stackwallet/models/exchange/incomplete_exchange.dart';
|
||||
import 'package:stackwallet/models/exchange/response_objects/currency.dart';
|
||||
import 'package:stackwallet/notifications/show_flush_bar.dart';
|
||||
import 'package:stackwallet/pages/exchange_view/exchange_coin_selection/fixed_rate_pair_coin_selection_view.dart';
|
||||
import 'package:stackwallet/pages/exchange_view/exchange_coin_selection/floating_rate_currency_selection_view.dart';
|
||||
|
|
|
@ -7,9 +7,9 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:stackwallet/models/exchange/change_now/available_floating_rate_pair.dart';
|
||||
import 'package:stackwallet/models/exchange/change_now/cn_exchange_estimate.dart';
|
||||
import 'package:stackwallet/models/exchange/change_now/currency.dart';
|
||||
import 'package:stackwallet/models/exchange/change_now/fixed_rate_market.dart';
|
||||
import 'package:stackwallet/models/exchange/incomplete_exchange.dart';
|
||||
import 'package:stackwallet/models/exchange/response_objects/currency.dart';
|
||||
import 'package:stackwallet/notifications/show_flush_bar.dart';
|
||||
import 'package:stackwallet/pages/exchange_view/exchange_coin_selection/fixed_rate_pair_coin_selection_view.dart';
|
||||
import 'package:stackwallet/pages/exchange_view/exchange_coin_selection/floating_rate_currency_selection_view.dart';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:stackwallet/models/exchange/change_now/currency.dart';
|
||||
import 'package:stackwallet/models/exchange/response_objects/currency.dart';
|
||||
|
||||
final availableChangeNowCurrenciesStateProvider =
|
||||
StateProvider<List<Currency>>((ref) => <Currency>[]);
|
||||
|
|
|
@ -7,11 +7,11 @@ import 'package:stackwallet/external_api_keys.dart';
|
|||
import 'package:stackwallet/models/exchange/change_now/available_floating_rate_pair.dart';
|
||||
import 'package:stackwallet/models/exchange/change_now/change_now_response.dart';
|
||||
import 'package:stackwallet/models/exchange/change_now/cn_exchange_estimate.dart';
|
||||
import 'package:stackwallet/models/exchange/change_now/currency.dart';
|
||||
import 'package:stackwallet/models/exchange/change_now/estimated_exchange_amount.dart';
|
||||
import 'package:stackwallet/models/exchange/change_now/exchange_transaction.dart';
|
||||
import 'package:stackwallet/models/exchange/change_now/exchange_transaction_status.dart';
|
||||
import 'package:stackwallet/models/exchange/change_now/fixed_rate_market.dart';
|
||||
import 'package:stackwallet/models/exchange/response_objects/currency.dart';
|
||||
import 'package:stackwallet/utilities/logger.dart';
|
||||
|
||||
class ChangeNow {
|
||||
|
|
46
lib/services/exchange/exchange.dart
Normal file
46
lib/services/exchange/exchange.dart
Normal file
|
@ -0,0 +1,46 @@
|
|||
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 {
|
||||
//
|
||||
|
||||
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);
|
||||
|
||||
Future<ExchangeResponse<List<Trade>>> getTrades();
|
||||
|
||||
Future<ExchangeResponse<Range>> getMinMaxExchangeAmounts(
|
||||
String from,
|
||||
String to,
|
||||
bool fixedRate,
|
||||
);
|
||||
|
||||
Future<ExchangeResponse<Decimal>> getEstimate(
|
||||
String from,
|
||||
String to,
|
||||
Decimal amount,
|
||||
bool fixedRate,
|
||||
);
|
||||
|
||||
Future<ExchangeResponse<Trade>> createTrade({
|
||||
required String from,
|
||||
required String to,
|
||||
required bool fixedRate,
|
||||
required Decimal amount,
|
||||
required String addressTo,
|
||||
required String addressRefund,
|
||||
required String refundExtraId,
|
||||
});
|
||||
}
|
24
lib/services/exchange/exchange_response.dart
Normal file
24
lib/services/exchange/exchange_response.dart
Normal file
|
@ -0,0 +1,24 @@
|
|||
enum ExchangeExceptionType { generic, serializeResponseError }
|
||||
|
||||
class ExchangeException implements Exception {
|
||||
String errorMessage;
|
||||
ExchangeExceptionType type;
|
||||
ExchangeException(this.errorMessage, this.type);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return errorMessage;
|
||||
}
|
||||
}
|
||||
|
||||
class ExchangeResponse<T> {
|
||||
late final T? value;
|
||||
late final ExchangeException? exception;
|
||||
|
||||
ExchangeResponse({this.value, this.exception});
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return "{error: $exception, value: $value}";
|
||||
}
|
||||
}
|
423
lib/services/exchange/simpleswap/simpleswap_api.dart
Normal file
423
lib/services/exchange/simpleswap/simpleswap_api.dart
Normal file
|
@ -0,0 +1,423 @@
|
|||
import 'dart:convert';
|
||||
|
||||
import 'package:decimal/decimal.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:stackwallet/external_api_keys.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/models/exchange/simpleswap/sp_currency.dart';
|
||||
import 'package:stackwallet/services/exchange/exchange_response.dart';
|
||||
import 'package:stackwallet/utilities/logger.dart';
|
||||
import 'package:tuple/tuple.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
|
||||
class SimpleSwapAPI {
|
||||
static const String scheme = "https";
|
||||
static const String authority = "api.simpleswap.io";
|
||||
|
||||
SimpleSwapAPI._();
|
||||
static final SimpleSwapAPI _instance = SimpleSwapAPI._();
|
||||
static SimpleSwapAPI get instance => _instance;
|
||||
|
||||
/// set this to override using standard http client. Useful for testing
|
||||
http.Client? client;
|
||||
|
||||
Uri _buildUri(String path, Map<String, String>? params) {
|
||||
return Uri.https(authority, path, params);
|
||||
}
|
||||
|
||||
Future<dynamic> _makeGetRequest(Uri uri) async {
|
||||
final client = this.client ?? http.Client();
|
||||
try {
|
||||
final response = await client.get(
|
||||
uri,
|
||||
);
|
||||
|
||||
final parsed = jsonDecode(response.body);
|
||||
|
||||
return parsed;
|
||||
} catch (e, s) {
|
||||
Logging.instance
|
||||
.log("_makeRequest($uri) 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, String> body = {
|
||||
"fixed": isFixedRate.toString(),
|
||||
"currency_from": currencyFrom,
|
||||
"currency_to": currencyTo,
|
||||
"addressTo": addressTo,
|
||||
"userRefundAddress": userRefundAddress,
|
||||
"userRefundExtraId": userRefundExtraId,
|
||||
"amount": amount,
|
||||
};
|
||||
|
||||
final uri =
|
||||
_buildUri("/create_exchange", {"api_key": apiKey ?? kSimpleSwapApiKey});
|
||||
|
||||
try {
|
||||
final jsonObject = await _makePostRequest(uri, body);
|
||||
print("================================");
|
||||
print(jsonObject);
|
||||
print("================================");
|
||||
|
||||
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),
|
||||
from: json["currency_from"] as String,
|
||||
fromAmount: json["amount_from"] as String,
|
||||
fromAddress: json["address_from"] as String,
|
||||
fromNetwork: "",
|
||||
fromExtraId: json["extra_id_from"] as String,
|
||||
fromTxid: json["tx_from"] as String,
|
||||
to: json["currency_to"] as String,
|
||||
toAmount: json["amount_to"] as String,
|
||||
toAddress: json["address_to"] as String,
|
||||
toNetwork: "",
|
||||
toExtraId: json["extra_id_to"] as String,
|
||||
toTxid: 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,
|
||||
);
|
||||
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<ExchangeResponse<List<SPCurrency>>> getAllCurrencies({
|
||||
String? apiKey,
|
||||
required bool fixedRate,
|
||||
}) async {
|
||||
final uri = _buildUri(
|
||||
"/get_all_currencies", {"api_key": apiKey ?? kSimpleSwapApiKey});
|
||||
|
||||
try {
|
||||
final jsonArray = await _makeGetRequest(uri);
|
||||
|
||||
return await compute(_parseAvailableCurrenciesJson, jsonArray as List);
|
||||
} catch (e, s) {
|
||||
Logging.instance.log("getAvailableCurrencies exception: $e\n$s",
|
||||
level: LogLevel.Error);
|
||||
return ExchangeResponse(
|
||||
exception: ExchangeException(
|
||||
e.toString(),
|
||||
ExchangeExceptionType.generic,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
ExchangeResponse<List<SPCurrency>> _parseAvailableCurrenciesJson(
|
||||
List<dynamic> jsonArray) {
|
||||
try {
|
||||
List<SPCurrency> currencies = [];
|
||||
|
||||
for (final json in jsonArray) {
|
||||
try {
|
||||
currencies
|
||||
.add(SPCurrency.fromJson(Map<String, dynamic>.from(json as Map)));
|
||||
} catch (_) {
|
||||
return ExchangeResponse(
|
||||
exception: ExchangeException("Failed to serialize $json",
|
||||
ExchangeExceptionType.serializeResponseError));
|
||||
}
|
||||
}
|
||||
|
||||
return ExchangeResponse(value: currencies);
|
||||
} catch (e, s) {
|
||||
Logging.instance.log("_parseAvailableCurrenciesJson exception: $e\n$s",
|
||||
level: LogLevel.Error);
|
||||
return ExchangeResponse(
|
||||
exception: ExchangeException(
|
||||
e.toString(),
|
||||
ExchangeExceptionType.generic,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Future<ExchangeResponse<SPCurrency>> getCurrency({
|
||||
required String symbol,
|
||||
String? apiKey,
|
||||
}) async {
|
||||
final uri = _buildUri(
|
||||
"/get_currency",
|
||||
{
|
||||
"api_key": apiKey ?? kSimpleSwapApiKey,
|
||||
"symbol": symbol,
|
||||
},
|
||||
);
|
||||
|
||||
try {
|
||||
final jsonObject = await _makeGetRequest(uri);
|
||||
|
||||
return ExchangeResponse(
|
||||
value: SPCurrency.fromJson(
|
||||
Map<String, dynamic>.from(jsonObject as Map)));
|
||||
} catch (e, s) {
|
||||
Logging.instance
|
||||
.log("getCurrency exception: $e\n$s", level: LogLevel.Error);
|
||||
return ExchangeResponse(
|
||||
exception: ExchangeException(
|
||||
e.toString(),
|
||||
ExchangeExceptionType.generic,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// returns a map where the key currency symbol is a valid pair with any of
|
||||
/// the symbols in its value list
|
||||
Future<ExchangeResponse<List<Pair>>> getAllPairs({
|
||||
required bool isFixedRate,
|
||||
String? apiKey,
|
||||
}) async {
|
||||
final uri = _buildUri(
|
||||
"/get_all_pairs",
|
||||
{
|
||||
"api_key": apiKey ?? kSimpleSwapApiKey,
|
||||
"fixed": isFixedRate.toString(),
|
||||
},
|
||||
);
|
||||
|
||||
try {
|
||||
final jsonObject = await _makeGetRequest(uri);
|
||||
final result = await compute(
|
||||
_parseAvailablePairsJson,
|
||||
Tuple2(jsonObject as Map, isFixedRate),
|
||||
);
|
||||
return result;
|
||||
} catch (e, s) {
|
||||
Logging.instance
|
||||
.log("getAllPairs exception: $e\n$s", level: LogLevel.Error);
|
||||
return ExchangeResponse(
|
||||
exception: ExchangeException(
|
||||
e.toString(),
|
||||
ExchangeExceptionType.generic,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
ExchangeResponse<List<Pair>> _parseAvailablePairsJson(
|
||||
Tuple2<Map<dynamic, dynamic>, bool> args,
|
||||
) {
|
||||
try {
|
||||
List<Pair> pairs = [];
|
||||
|
||||
for (final entry in args.item1.entries) {
|
||||
try {
|
||||
final from = entry.key as String;
|
||||
for (final to in entry.value as List) {
|
||||
pairs.add(
|
||||
Pair(
|
||||
from: from,
|
||||
fromNetwork: "",
|
||||
to: to as String,
|
||||
toNetwork: "",
|
||||
fixedRate: args.item2,
|
||||
floatingRate: !args.item2,
|
||||
),
|
||||
);
|
||||
}
|
||||
} catch (_) {
|
||||
return ExchangeResponse(
|
||||
exception: ExchangeException("Failed to serialize $json",
|
||||
ExchangeExceptionType.serializeResponseError));
|
||||
}
|
||||
}
|
||||
|
||||
return ExchangeResponse(value: pairs);
|
||||
} catch (e, s) {
|
||||
Logging.instance.log("_parseAvailableCurrenciesJson exception: $e\n$s",
|
||||
level: LogLevel.Error);
|
||||
return ExchangeResponse(
|
||||
exception: ExchangeException(
|
||||
e.toString(),
|
||||
ExchangeExceptionType.generic,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// returns the estimated amount as a string
|
||||
Future<ExchangeResponse<String>> getEstimated({
|
||||
required bool isFixedRate,
|
||||
required String currencyFrom,
|
||||
required String currencyTo,
|
||||
required String amount,
|
||||
String? apiKey,
|
||||
}) async {
|
||||
final uri = _buildUri(
|
||||
"/get_estimated",
|
||||
{
|
||||
"api_key": apiKey ?? kSimpleSwapApiKey,
|
||||
"fixed": isFixedRate.toString(),
|
||||
"currency_from": currencyFrom,
|
||||
"currency_to": currencyTo,
|
||||
"amount": amount,
|
||||
},
|
||||
);
|
||||
|
||||
try {
|
||||
final jsonObject = await _makeGetRequest(uri);
|
||||
|
||||
return ExchangeResponse(value: jsonObject as String);
|
||||
} catch (e, s) {
|
||||
Logging.instance
|
||||
.log("getEstimated exception: $e\n$s", level: LogLevel.Error);
|
||||
return ExchangeResponse(
|
||||
exception: ExchangeException(
|
||||
e.toString(),
|
||||
ExchangeExceptionType.generic,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// returns the exchange for the given id
|
||||
Future<ExchangeResponse<Trade>> getExchange({
|
||||
required String exchangeId,
|
||||
String? apiKey,
|
||||
}) async {
|
||||
final uri = _buildUri(
|
||||
"/get_exchange",
|
||||
{
|
||||
"api_key": apiKey ?? kSimpleSwapApiKey,
|
||||
"id": exchangeId,
|
||||
},
|
||||
);
|
||||
|
||||
try {
|
||||
final jsonObject = await _makeGetRequest(uri);
|
||||
|
||||
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),
|
||||
from: json["currency_from"] as String,
|
||||
fromAmount: json["amount_from"] as String,
|
||||
fromAddress: json["address_from"] as String,
|
||||
fromNetwork: "",
|
||||
fromExtraId: json["extra_id_from"] as String,
|
||||
fromTxid: json["tx_from"] as String,
|
||||
to: json["currency_to"] as String,
|
||||
toAmount: json["amount_to"] as String,
|
||||
toAddress: json["address_to"] as String,
|
||||
toNetwork: "",
|
||||
toExtraId: json["extra_id_to"] as String,
|
||||
toTxid: 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,
|
||||
);
|
||||
|
||||
return ExchangeResponse(value: trade);
|
||||
} catch (e, s) {
|
||||
Logging.instance
|
||||
.log("getExchange exception: $e\n$s", level: LogLevel.Error);
|
||||
return ExchangeResponse(
|
||||
exception: ExchangeException(
|
||||
e.toString(),
|
||||
ExchangeExceptionType.generic,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// returns the minimal exchange amount
|
||||
Future<ExchangeResponse<Range>> getRange({
|
||||
required bool isFixedRate,
|
||||
required String currencyFrom,
|
||||
required String currencyTo,
|
||||
String? apiKey,
|
||||
}) async {
|
||||
final uri = _buildUri(
|
||||
"/get_ranges",
|
||||
{
|
||||
"api_key": apiKey ?? kSimpleSwapApiKey,
|
||||
"fixed": isFixedRate.toString(),
|
||||
"currency_from": currencyFrom,
|
||||
"currency_to": currencyTo,
|
||||
},
|
||||
);
|
||||
|
||||
try {
|
||||
final jsonObject = await _makeGetRequest(uri);
|
||||
|
||||
final json = Map<String, dynamic>.from(jsonObject as Map);
|
||||
return ExchangeResponse(
|
||||
value: Range(
|
||||
max: Decimal.tryParse(json["max"] as String? ?? ""),
|
||||
min: Decimal.tryParse(json["min"] as String? ?? ""),
|
||||
),
|
||||
);
|
||||
} catch (e, s) {
|
||||
Logging.instance.log("getRange exception: $e\n$s", level: LogLevel.Error);
|
||||
return ExchangeResponse(
|
||||
exception: ExchangeException(
|
||||
e.toString(),
|
||||
ExchangeExceptionType.generic,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
122
lib/services/exchange/simpleswap/simpleswap_exchange.dart
Normal file
122
lib/services/exchange/simpleswap/simpleswap_exchange.dart
Normal file
|
@ -0,0 +1,122 @@
|
|||
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.dart';
|
||||
import 'package:stackwallet/services/exchange/exchange_response.dart';
|
||||
import 'package:stackwallet/services/exchange/simpleswap/simpleswap_api.dart';
|
||||
|
||||
class SimpleSwapExchange extends Exchange {
|
||||
@override
|
||||
Future<ExchangeResponse<Trade>> createTrade({
|
||||
required String from,
|
||||
required String to,
|
||||
required bool fixedRate,
|
||||
required Decimal amount,
|
||||
required String addressTo,
|
||||
required String addressRefund,
|
||||
required String refundExtraId,
|
||||
}) async {
|
||||
return await SimpleSwapAPI.instance.createNewExchange(
|
||||
isFixedRate: fixedRate,
|
||||
currencyFrom: from,
|
||||
currencyTo: to,
|
||||
addressTo: addressTo,
|
||||
userRefundAddress: addressRefund,
|
||||
userRefundExtraId: refundExtraId,
|
||||
amount: amount.toString(),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<ExchangeResponse<List<Currency>>> getAllCurrencies(
|
||||
bool fixedRate,
|
||||
) async {
|
||||
final response =
|
||||
await SimpleSwapAPI.instance.getAllCurrencies(fixedRate: fixedRate);
|
||||
if (response.value != null) {
|
||||
final List<Currency> currencies = response.value!
|
||||
.map((e) => Currency(
|
||||
ticker: e.symbol,
|
||||
name: e.name,
|
||||
network: e.network,
|
||||
image: e.image,
|
||||
hasExternalId: e.hasExtraId,
|
||||
externalId: e.extraId,
|
||||
isFiat: false,
|
||||
featured: false,
|
||||
isStable: false,
|
||||
supportsFixedRate: fixedRate,
|
||||
))
|
||||
.toList();
|
||||
return ExchangeResponse<List<Currency>>(
|
||||
value: currencies,
|
||||
exception: response.exception,
|
||||
);
|
||||
}
|
||||
|
||||
return ExchangeResponse<List<Currency>>(
|
||||
value: null,
|
||||
exception: response.exception,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<ExchangeResponse<List<Pair>>> getAllPairs(bool fixedRate) async {
|
||||
return await SimpleSwapAPI.instance.getAllPairs(isFixedRate: fixedRate);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<ExchangeResponse<Decimal>> getEstimate(
|
||||
String from,
|
||||
String to,
|
||||
Decimal amount,
|
||||
bool fixedRate,
|
||||
) async {
|
||||
final response = await SimpleSwapAPI.instance.getEstimated(
|
||||
isFixedRate: fixedRate,
|
||||
currencyFrom: from,
|
||||
currencyTo: to,
|
||||
amount: amount.toString(),
|
||||
);
|
||||
|
||||
return ExchangeResponse(
|
||||
value: Decimal.tryParse(response.value ?? ""),
|
||||
exception: response.exception,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<ExchangeResponse<Range>> getMinMaxExchangeAmounts(
|
||||
String from,
|
||||
String to,
|
||||
bool fixedRate,
|
||||
) async {
|
||||
return await SimpleSwapAPI.instance.getRange(
|
||||
isFixedRate: fixedRate,
|
||||
currencyFrom: from,
|
||||
currencyTo: to,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<ExchangeResponse<List<Pair>>> getPairsFor(
|
||||
String currency,
|
||||
bool fixedRate,
|
||||
) async {
|
||||
// return await SimpleSwapAPI.instance.ge
|
||||
throw UnimplementedError();
|
||||
}
|
||||
|
||||
@override
|
||||
Future<ExchangeResponse<Trade>> getTrade(String tradeId) async {
|
||||
return await SimpleSwapAPI.instance.getExchange(exchangeId: tradeId);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<ExchangeResponse<List<Trade>>> getTrades() async {
|
||||
// TODO: implement getTrades
|
||||
throw UnimplementedError();
|
||||
}
|
||||
}
|
|
@ -3,9 +3,9 @@ import 'package:flutter_test/flutter_test.dart';
|
|||
import 'package:mockito/annotations.dart';
|
||||
import 'package:mockito/mockito.dart';
|
||||
import 'package:stackwallet/models/exchange/change_now/change_now_response.dart';
|
||||
import 'package:stackwallet/models/exchange/change_now/currency.dart';
|
||||
import 'package:stackwallet/models/exchange/change_now/estimated_exchange_amount.dart';
|
||||
import 'package:stackwallet/models/exchange/estimated_rate_exchange_form_state.dart';
|
||||
import 'package:stackwallet/models/exchange/response_objects/currency.dart';
|
||||
import 'package:stackwallet/services/change_now/change_now.dart';
|
||||
|
||||
import 'estimated_rate_exchange_form_state_test.mocks.dart';
|
||||
|
@ -21,6 +21,7 @@ void main() {
|
|||
featured: false,
|
||||
isStable: true,
|
||||
supportsFixedRate: true,
|
||||
network: '',
|
||||
);
|
||||
final currencyB = Currency(
|
||||
ticker: "xmr",
|
||||
|
@ -31,6 +32,7 @@ void main() {
|
|||
featured: false,
|
||||
isStable: true,
|
||||
supportsFixedRate: true,
|
||||
network: '',
|
||||
);
|
||||
final currencyC = Currency(
|
||||
ticker: "firo",
|
||||
|
@ -41,6 +43,7 @@ void main() {
|
|||
featured: false,
|
||||
isStable: true,
|
||||
supportsFixedRate: true,
|
||||
network: '',
|
||||
);
|
||||
|
||||
test("EstimatedRateExchangeFormState constructor", () async {
|
||||
|
|
|
@ -13,7 +13,6 @@ import 'package:stackwallet/models/exchange/change_now/change_now_response.dart'
|
|||
as _i2;
|
||||
import 'package:stackwallet/models/exchange/change_now/cn_exchange_estimate.dart'
|
||||
as _i9;
|
||||
import 'package:stackwallet/models/exchange/change_now/currency.dart' as _i6;
|
||||
import 'package:stackwallet/models/exchange/change_now/estimated_exchange_amount.dart'
|
||||
as _i8;
|
||||
import 'package:stackwallet/models/exchange/change_now/exchange_transaction.dart'
|
||||
|
@ -22,6 +21,8 @@ import 'package:stackwallet/models/exchange/change_now/exchange_transaction_stat
|
|||
as _i12;
|
||||
import 'package:stackwallet/models/exchange/change_now/fixed_rate_market.dart'
|
||||
as _i10;
|
||||
import 'package:stackwallet/models/exchange/response_objects/currency.dart'
|
||||
as _i6;
|
||||
import 'package:stackwallet/services/change_now/change_now.dart' as _i3;
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
|
|
|
@ -14,7 +14,6 @@ import 'package:stackwallet/models/exchange/change_now/change_now_response.dart'
|
|||
as _i2;
|
||||
import 'package:stackwallet/models/exchange/change_now/cn_exchange_estimate.dart'
|
||||
as _i17;
|
||||
import 'package:stackwallet/models/exchange/change_now/currency.dart' as _i14;
|
||||
import 'package:stackwallet/models/exchange/change_now/estimated_exchange_amount.dart'
|
||||
as _i16;
|
||||
import 'package:stackwallet/models/exchange/change_now/exchange_transaction.dart'
|
||||
|
@ -23,6 +22,8 @@ import 'package:stackwallet/models/exchange/change_now/exchange_transaction_stat
|
|||
as _i19;
|
||||
import 'package:stackwallet/models/exchange/change_now/fixed_rate_market.dart'
|
||||
as _i18;
|
||||
import 'package:stackwallet/models/exchange/response_objects/currency.dart'
|
||||
as _i14;
|
||||
import 'package:stackwallet/pages/exchange_view/sub_widgets/exchange_rate_sheet.dart'
|
||||
as _i5;
|
||||
import 'package:stackwallet/services/change_now/change_now.dart' as _i12;
|
||||
|
|
|
@ -2,18 +2,18 @@
|
|||
// in stackwallet/test/services/coins/bitcoincash/bitcoincash_wallet_test.dart.
|
||||
// Do not manually edit this file.
|
||||
|
||||
import 'dart:async' as _i7;
|
||||
import 'dart:async' as _i6;
|
||||
|
||||
import 'package:decimal/decimal.dart' as _i4;
|
||||
import 'package:http/http.dart' as _i3;
|
||||
import 'package:decimal/decimal.dart' as _i2;
|
||||
import 'package:http/http.dart' as _i4;
|
||||
import 'package:mockito/mockito.dart' as _i1;
|
||||
import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart' as _i5;
|
||||
import 'package:stackwallet/electrumx_rpc/electrumx.dart' as _i6;
|
||||
import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart' as _i7;
|
||||
import 'package:stackwallet/electrumx_rpc/electrumx.dart' as _i5;
|
||||
import 'package:stackwallet/services/price.dart' as _i9;
|
||||
import 'package:stackwallet/services/transaction_notification_tracker.dart'
|
||||
as _i11;
|
||||
import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i8;
|
||||
import 'package:stackwallet/utilities/prefs.dart' as _i2;
|
||||
import 'package:stackwallet/utilities/prefs.dart' as _i3;
|
||||
import 'package:tuple/tuple.dart' as _i10;
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
|
@ -26,16 +26,208 @@ import 'package:tuple/tuple.dart' as _i10;
|
|||
// ignore_for_file: unnecessary_parenthesis
|
||||
// ignore_for_file: camel_case_types
|
||||
|
||||
class _FakePrefs_0 extends _i1.Fake implements _i2.Prefs {}
|
||||
class _FakeDecimal_0 extends _i1.Fake implements _i2.Decimal {}
|
||||
|
||||
class _FakeClient_1 extends _i1.Fake implements _i3.Client {}
|
||||
class _FakePrefs_1 extends _i1.Fake implements _i3.Prefs {}
|
||||
|
||||
class _FakeDecimal_2 extends _i1.Fake implements _i4.Decimal {}
|
||||
class _FakeClient_2 extends _i1.Fake implements _i4.Client {}
|
||||
|
||||
/// A class which mocks [ElectrumX].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockElectrumX extends _i1.Mock implements _i5.ElectrumX {
|
||||
MockElectrumX() {
|
||||
_i1.throwOnMissingStub(this);
|
||||
}
|
||||
|
||||
@override
|
||||
set failovers(List<_i5.ElectrumXNode>? _failovers) =>
|
||||
super.noSuchMethod(Invocation.setter(#failovers, _failovers),
|
||||
returnValueForMissingStub: null);
|
||||
@override
|
||||
int get currentFailoverIndex =>
|
||||
(super.noSuchMethod(Invocation.getter(#currentFailoverIndex),
|
||||
returnValue: 0) as int);
|
||||
@override
|
||||
set currentFailoverIndex(int? _currentFailoverIndex) => super.noSuchMethod(
|
||||
Invocation.setter(#currentFailoverIndex, _currentFailoverIndex),
|
||||
returnValueForMissingStub: null);
|
||||
@override
|
||||
String get host =>
|
||||
(super.noSuchMethod(Invocation.getter(#host), returnValue: '') as String);
|
||||
@override
|
||||
int get port =>
|
||||
(super.noSuchMethod(Invocation.getter(#port), returnValue: 0) as int);
|
||||
@override
|
||||
bool get useSSL =>
|
||||
(super.noSuchMethod(Invocation.getter(#useSSL), returnValue: false)
|
||||
as bool);
|
||||
@override
|
||||
_i6.Future<dynamic> request(
|
||||
{String? command,
|
||||
List<dynamic>? args = const [],
|
||||
Duration? connectionTimeout = const Duration(seconds: 60),
|
||||
String? requestID,
|
||||
int? retries = 2}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#request, [], {
|
||||
#command: command,
|
||||
#args: args,
|
||||
#connectionTimeout: connectionTimeout,
|
||||
#requestID: requestID,
|
||||
#retries: retries
|
||||
}),
|
||||
returnValue: Future<dynamic>.value()) as _i6.Future<dynamic>);
|
||||
@override
|
||||
_i6.Future<List<Map<String, dynamic>>> batchRequest(
|
||||
{String? command,
|
||||
Map<String, List<dynamic>>? args,
|
||||
Duration? connectionTimeout = const Duration(seconds: 60),
|
||||
int? retries = 2}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#batchRequest, [], {
|
||||
#command: command,
|
||||
#args: args,
|
||||
#connectionTimeout: connectionTimeout,
|
||||
#retries: retries
|
||||
}),
|
||||
returnValue: Future<List<Map<String, dynamic>>>.value(
|
||||
<Map<String, dynamic>>[]))
|
||||
as _i6.Future<List<Map<String, dynamic>>>);
|
||||
@override
|
||||
_i6.Future<bool> ping({String? requestID, int? retryCount = 1}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#ping, [], {#requestID: requestID, #retryCount: retryCount}),
|
||||
returnValue: Future<bool>.value(false)) as _i6.Future<bool>);
|
||||
@override
|
||||
_i6.Future<Map<String, dynamic>> getBlockHeadTip({String? requestID}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#getBlockHeadTip, [], {#requestID: requestID}),
|
||||
returnValue:
|
||||
Future<Map<String, dynamic>>.value(<String, dynamic>{}))
|
||||
as _i6.Future<Map<String, dynamic>>);
|
||||
@override
|
||||
_i6.Future<Map<String, dynamic>> getServerFeatures({String? requestID}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#getServerFeatures, [], {#requestID: requestID}),
|
||||
returnValue:
|
||||
Future<Map<String, dynamic>>.value(<String, dynamic>{})) as _i6
|
||||
.Future<Map<String, dynamic>>);
|
||||
@override
|
||||
_i6.Future<String> broadcastTransaction({String? rawTx, String? requestID}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#broadcastTransaction, [],
|
||||
{#rawTx: rawTx, #requestID: requestID}),
|
||||
returnValue: Future<String>.value('')) as _i6.Future<String>);
|
||||
@override
|
||||
_i6.Future<Map<String, dynamic>> getBalance(
|
||||
{String? scripthash, String? requestID}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#getBalance, [],
|
||||
{#scripthash: scripthash, #requestID: requestID}),
|
||||
returnValue:
|
||||
Future<Map<String, dynamic>>.value(<String, dynamic>{}))
|
||||
as _i6.Future<Map<String, dynamic>>);
|
||||
@override
|
||||
_i6.Future<List<Map<String, dynamic>>> getHistory(
|
||||
{String? scripthash, String? requestID}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#getHistory, [],
|
||||
{#scripthash: scripthash, #requestID: requestID}),
|
||||
returnValue: Future<List<Map<String, dynamic>>>.value(
|
||||
<Map<String, dynamic>>[]))
|
||||
as _i6.Future<List<Map<String, dynamic>>>);
|
||||
@override
|
||||
_i6.Future<Map<String, List<Map<String, dynamic>>>> getBatchHistory(
|
||||
{Map<String, List<dynamic>>? args}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#getBatchHistory, [], {#args: args}),
|
||||
returnValue: Future<Map<String, List<Map<String, dynamic>>>>.value(
|
||||
<String, List<Map<String, dynamic>>>{})) as _i6
|
||||
.Future<Map<String, List<Map<String, dynamic>>>>);
|
||||
@override
|
||||
_i6.Future<List<Map<String, dynamic>>> getUTXOs(
|
||||
{String? scripthash, String? requestID}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getUTXOs, [], {#scripthash: scripthash, #requestID: requestID}),
|
||||
returnValue: Future<List<Map<String, dynamic>>>.value(
|
||||
<Map<String, dynamic>>[])) as _i6
|
||||
.Future<List<Map<String, dynamic>>>);
|
||||
@override
|
||||
_i6.Future<Map<String, List<Map<String, dynamic>>>> getBatchUTXOs(
|
||||
{Map<String, List<dynamic>>? args}) =>
|
||||
(super.noSuchMethod(Invocation.method(#getBatchUTXOs, [], {#args: args}),
|
||||
returnValue: Future<Map<String, List<Map<String, dynamic>>>>.value(
|
||||
<String, List<Map<String, dynamic>>>{})) as _i6
|
||||
.Future<Map<String, List<Map<String, dynamic>>>>);
|
||||
@override
|
||||
_i6.Future<Map<String, dynamic>> getTransaction(
|
||||
{String? txHash, bool? verbose = true, String? requestID}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#getTransaction, [],
|
||||
{#txHash: txHash, #verbose: verbose, #requestID: requestID}),
|
||||
returnValue:
|
||||
Future<Map<String, dynamic>>.value(<String, dynamic>{}))
|
||||
as _i6.Future<Map<String, dynamic>>);
|
||||
@override
|
||||
_i6.Future<Map<String, dynamic>> getAnonymitySet(
|
||||
{String? groupId = r'1',
|
||||
String? blockhash = r'',
|
||||
String? requestID}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#getAnonymitySet, [], {
|
||||
#groupId: groupId,
|
||||
#blockhash: blockhash,
|
||||
#requestID: requestID
|
||||
}),
|
||||
returnValue:
|
||||
Future<Map<String, dynamic>>.value(<String, dynamic>{}))
|
||||
as _i6.Future<Map<String, dynamic>>);
|
||||
@override
|
||||
_i6.Future<dynamic> getMintData({dynamic mints, String? requestID}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getMintData, [], {#mints: mints, #requestID: requestID}),
|
||||
returnValue: Future<dynamic>.value()) as _i6.Future<dynamic>);
|
||||
@override
|
||||
_i6.Future<Map<String, dynamic>> getUsedCoinSerials(
|
||||
{String? requestID, int? startNumber}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#getUsedCoinSerials, [],
|
||||
{#requestID: requestID, #startNumber: startNumber}),
|
||||
returnValue:
|
||||
Future<Map<String, dynamic>>.value(<String, dynamic>{}))
|
||||
as _i6.Future<Map<String, dynamic>>);
|
||||
@override
|
||||
_i6.Future<int> getLatestCoinId({String? requestID}) => (super.noSuchMethod(
|
||||
Invocation.method(#getLatestCoinId, [], {#requestID: requestID}),
|
||||
returnValue: Future<int>.value(0)) as _i6.Future<int>);
|
||||
@override
|
||||
_i6.Future<Map<String, dynamic>> getFeeRate({String? requestID}) => (super
|
||||
.noSuchMethod(Invocation.method(#getFeeRate, [], {#requestID: requestID}),
|
||||
returnValue:
|
||||
Future<Map<String, dynamic>>.value(<String, dynamic>{})) as _i6
|
||||
.Future<Map<String, dynamic>>);
|
||||
@override
|
||||
_i6.Future<_i2.Decimal> estimateFee({String? requestID, int? blocks}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#estimateFee, [], {#requestID: requestID, #blocks: blocks}),
|
||||
returnValue: Future<_i2.Decimal>.value(_FakeDecimal_0()))
|
||||
as _i6.Future<_i2.Decimal>);
|
||||
@override
|
||||
_i6.Future<_i2.Decimal> relayFee({String? requestID}) => (super.noSuchMethod(
|
||||
Invocation.method(#relayFee, [], {#requestID: requestID}),
|
||||
returnValue: Future<_i2.Decimal>.value(_FakeDecimal_0()))
|
||||
as _i6.Future<_i2.Decimal>);
|
||||
}
|
||||
|
||||
/// A class which mocks [CachedElectrumX].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockCachedElectrumX extends _i1.Mock implements _i5.CachedElectrumX {
|
||||
class MockCachedElectrumX extends _i1.Mock implements _i7.CachedElectrumX {
|
||||
MockCachedElectrumX() {
|
||||
_i1.throwOnMissingStub(this);
|
||||
}
|
||||
|
@ -52,44 +244,44 @@ class MockCachedElectrumX extends _i1.Mock implements _i5.CachedElectrumX {
|
|||
(super.noSuchMethod(Invocation.getter(#useSSL), returnValue: false)
|
||||
as bool);
|
||||
@override
|
||||
_i2.Prefs get prefs => (super.noSuchMethod(Invocation.getter(#prefs),
|
||||
returnValue: _FakePrefs_0()) as _i2.Prefs);
|
||||
_i3.Prefs get prefs => (super.noSuchMethod(Invocation.getter(#prefs),
|
||||
returnValue: _FakePrefs_1()) as _i3.Prefs);
|
||||
@override
|
||||
List<_i6.ElectrumXNode> get failovers =>
|
||||
List<_i5.ElectrumXNode> get failovers =>
|
||||
(super.noSuchMethod(Invocation.getter(#failovers),
|
||||
returnValue: <_i6.ElectrumXNode>[]) as List<_i6.ElectrumXNode>);
|
||||
returnValue: <_i5.ElectrumXNode>[]) as List<_i5.ElectrumXNode>);
|
||||
@override
|
||||
_i7.Future<Map<String, dynamic>> getAnonymitySet(
|
||||
_i6.Future<Map<String, dynamic>> getAnonymitySet(
|
||||
{String? groupId, String? blockhash = r'', _i8.Coin? coin}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#getAnonymitySet, [],
|
||||
{#groupId: groupId, #blockhash: blockhash, #coin: coin}),
|
||||
returnValue:
|
||||
Future<Map<String, dynamic>>.value(<String, dynamic>{}))
|
||||
as _i7.Future<Map<String, dynamic>>);
|
||||
as _i6.Future<Map<String, dynamic>>);
|
||||
@override
|
||||
_i7.Future<Map<String, dynamic>> getTransaction(
|
||||
_i6.Future<Map<String, dynamic>> getTransaction(
|
||||
{String? txHash, _i8.Coin? coin, bool? verbose = true}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#getTransaction, [],
|
||||
{#txHash: txHash, #coin: coin, #verbose: verbose}),
|
||||
returnValue:
|
||||
Future<Map<String, dynamic>>.value(<String, dynamic>{}))
|
||||
as _i7.Future<Map<String, dynamic>>);
|
||||
as _i6.Future<Map<String, dynamic>>);
|
||||
@override
|
||||
_i7.Future<List<dynamic>> getUsedCoinSerials(
|
||||
_i6.Future<List<dynamic>> getUsedCoinSerials(
|
||||
{_i8.Coin? coin, int? startNumber = 0}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#getUsedCoinSerials, [],
|
||||
{#coin: coin, #startNumber: startNumber}),
|
||||
returnValue: Future<List<dynamic>>.value(<dynamic>[]))
|
||||
as _i7.Future<List<dynamic>>);
|
||||
as _i6.Future<List<dynamic>>);
|
||||
@override
|
||||
_i7.Future<void> clearSharedTransactionCache({_i8.Coin? coin}) =>
|
||||
_i6.Future<void> clearSharedTransactionCache({_i8.Coin? coin}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#clearSharedTransactionCache, [], {#coin: coin}),
|
||||
returnValue: Future<void>.value(),
|
||||
returnValueForMissingStub: Future<void>.value()) as _i7.Future<void>);
|
||||
returnValueForMissingStub: Future<void>.value()) as _i6.Future<void>);
|
||||
}
|
||||
|
||||
/// A class which mocks [PriceAPI].
|
||||
|
@ -101,21 +293,21 @@ class MockPriceAPI extends _i1.Mock implements _i9.PriceAPI {
|
|||
}
|
||||
|
||||
@override
|
||||
_i3.Client get client => (super.noSuchMethod(Invocation.getter(#client),
|
||||
returnValue: _FakeClient_1()) as _i3.Client);
|
||||
_i4.Client get client => (super.noSuchMethod(Invocation.getter(#client),
|
||||
returnValue: _FakeClient_2()) as _i4.Client);
|
||||
@override
|
||||
void resetLastCalledToForceNextCallToUpdateCache() => super.noSuchMethod(
|
||||
Invocation.method(#resetLastCalledToForceNextCallToUpdateCache, []),
|
||||
returnValueForMissingStub: null);
|
||||
@override
|
||||
_i7.Future<Map<_i8.Coin, _i10.Tuple2<_i4.Decimal, double>>>
|
||||
_i6.Future<Map<_i8.Coin, _i10.Tuple2<_i2.Decimal, double>>>
|
||||
getPricesAnd24hChange({String? baseCurrency}) => (super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getPricesAnd24hChange, [], {#baseCurrency: baseCurrency}),
|
||||
returnValue:
|
||||
Future<Map<_i8.Coin, _i10.Tuple2<_i4.Decimal, double>>>.value(
|
||||
<_i8.Coin, _i10.Tuple2<_i4.Decimal, double>>{}))
|
||||
as _i7.Future<Map<_i8.Coin, _i10.Tuple2<_i4.Decimal, double>>>);
|
||||
Future<Map<_i8.Coin, _i10.Tuple2<_i2.Decimal, double>>>.value(
|
||||
<_i8.Coin, _i10.Tuple2<_i2.Decimal, double>>{}))
|
||||
as _i6.Future<Map<_i8.Coin, _i10.Tuple2<_i2.Decimal, double>>>);
|
||||
}
|
||||
|
||||
/// A class which mocks [TransactionNotificationTracker].
|
||||
|
@ -144,205 +336,17 @@ class MockTransactionNotificationTracker extends _i1.Mock
|
|||
(super.noSuchMethod(Invocation.method(#wasNotifiedPending, [txid]),
|
||||
returnValue: false) as bool);
|
||||
@override
|
||||
_i7.Future<void> addNotifiedPending(String? txid) =>
|
||||
_i6.Future<void> addNotifiedPending(String? txid) =>
|
||||
(super.noSuchMethod(Invocation.method(#addNotifiedPending, [txid]),
|
||||
returnValue: Future<void>.value(),
|
||||
returnValueForMissingStub: Future<void>.value()) as _i7.Future<void>);
|
||||
returnValueForMissingStub: Future<void>.value()) as _i6.Future<void>);
|
||||
@override
|
||||
bool wasNotifiedConfirmed(String? txid) =>
|
||||
(super.noSuchMethod(Invocation.method(#wasNotifiedConfirmed, [txid]),
|
||||
returnValue: false) as bool);
|
||||
@override
|
||||
_i7.Future<void> addNotifiedConfirmed(String? txid) =>
|
||||
_i6.Future<void> addNotifiedConfirmed(String? txid) =>
|
||||
(super.noSuchMethod(Invocation.method(#addNotifiedConfirmed, [txid]),
|
||||
returnValue: Future<void>.value(),
|
||||
returnValueForMissingStub: Future<void>.value()) as _i7.Future<void>);
|
||||
}
|
||||
|
||||
/// A class which mocks [ElectrumX].
|
||||
///
|
||||
/// See the documentation for Mockito's code generation for more information.
|
||||
class MockElectrumX extends _i1.Mock implements _i6.ElectrumX {
|
||||
@override
|
||||
set failovers(List<_i6.ElectrumXNode>? _failovers) =>
|
||||
super.noSuchMethod(Invocation.setter(#failovers, _failovers),
|
||||
returnValueForMissingStub: null);
|
||||
@override
|
||||
int get currentFailoverIndex =>
|
||||
(super.noSuchMethod(Invocation.getter(#currentFailoverIndex),
|
||||
returnValue: 0) as int);
|
||||
@override
|
||||
set currentFailoverIndex(int? _currentFailoverIndex) => super.noSuchMethod(
|
||||
Invocation.setter(#currentFailoverIndex, _currentFailoverIndex),
|
||||
returnValueForMissingStub: null);
|
||||
@override
|
||||
String get host =>
|
||||
(super.noSuchMethod(Invocation.getter(#host), returnValue: '') as String);
|
||||
@override
|
||||
int get port =>
|
||||
(super.noSuchMethod(Invocation.getter(#port), returnValue: 0) as int);
|
||||
@override
|
||||
bool get useSSL =>
|
||||
(super.noSuchMethod(Invocation.getter(#useSSL), returnValue: false)
|
||||
as bool);
|
||||
@override
|
||||
_i7.Future<dynamic> request(
|
||||
{String? command,
|
||||
List<dynamic>? args = const [],
|
||||
Duration? connectionTimeout = const Duration(seconds: 60),
|
||||
String? requestID,
|
||||
int? retries = 2}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#request, [], {
|
||||
#command: command,
|
||||
#args: args,
|
||||
#connectionTimeout: connectionTimeout,
|
||||
#requestID: requestID,
|
||||
#retries: retries
|
||||
}),
|
||||
returnValue: Future<dynamic>.value()) as _i7.Future<dynamic>);
|
||||
@override
|
||||
_i7.Future<List<Map<String, dynamic>>> batchRequest(
|
||||
{String? command,
|
||||
Map<String, List<dynamic>>? args,
|
||||
Duration? connectionTimeout = const Duration(seconds: 60),
|
||||
int? retries = 2}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#batchRequest, [], {
|
||||
#command: command,
|
||||
#args: args,
|
||||
#connectionTimeout: connectionTimeout,
|
||||
#retries: retries
|
||||
}),
|
||||
returnValue: Future<List<Map<String, dynamic>>>.value(
|
||||
<Map<String, dynamic>>[]))
|
||||
as _i7.Future<List<Map<String, dynamic>>>);
|
||||
@override
|
||||
_i7.Future<bool> ping({String? requestID, int? retryCount = 1}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#ping, [], {#requestID: requestID, #retryCount: retryCount}),
|
||||
returnValue: Future<bool>.value(false)) as _i7.Future<bool>);
|
||||
@override
|
||||
_i7.Future<Map<String, dynamic>> getBlockHeadTip({String? requestID}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#getBlockHeadTip, [], {#requestID: requestID}),
|
||||
returnValue:
|
||||
Future<Map<String, dynamic>>.value(<String, dynamic>{}))
|
||||
as _i7.Future<Map<String, dynamic>>);
|
||||
@override
|
||||
_i7.Future<Map<String, dynamic>> getServerFeatures({String? requestID}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#getServerFeatures, [], {#requestID: requestID}),
|
||||
returnValue:
|
||||
Future<Map<String, dynamic>>.value(<String, dynamic>{})) as _i7
|
||||
.Future<Map<String, dynamic>>);
|
||||
@override
|
||||
_i7.Future<String> broadcastTransaction({String? rawTx, String? requestID}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#broadcastTransaction, [],
|
||||
{#rawTx: rawTx, #requestID: requestID}),
|
||||
returnValue: Future<String>.value('')) as _i7.Future<String>);
|
||||
@override
|
||||
_i7.Future<Map<String, dynamic>> getBalance(
|
||||
{String? scripthash, String? requestID}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#getBalance, [],
|
||||
{#scripthash: scripthash, #requestID: requestID}),
|
||||
returnValue:
|
||||
Future<Map<String, dynamic>>.value(<String, dynamic>{}))
|
||||
as _i7.Future<Map<String, dynamic>>);
|
||||
@override
|
||||
_i7.Future<List<Map<String, dynamic>>> getHistory(
|
||||
{String? scripthash, String? requestID}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#getHistory, [],
|
||||
{#scripthash: scripthash, #requestID: requestID}),
|
||||
returnValue: Future<List<Map<String, dynamic>>>.value(
|
||||
<Map<String, dynamic>>[]))
|
||||
as _i7.Future<List<Map<String, dynamic>>>);
|
||||
@override
|
||||
_i7.Future<Map<String, List<Map<String, dynamic>>>> getBatchHistory(
|
||||
{Map<String, List<dynamic>>? args}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#getBatchHistory, [], {#args: args}),
|
||||
returnValue: Future<Map<String, List<Map<String, dynamic>>>>.value(
|
||||
<String, List<Map<String, dynamic>>>{})) as _i7
|
||||
.Future<Map<String, List<Map<String, dynamic>>>>);
|
||||
@override
|
||||
_i7.Future<List<Map<String, dynamic>>> getUTXOs(
|
||||
{String? scripthash, String? requestID}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getUTXOs, [], {#scripthash: scripthash, #requestID: requestID}),
|
||||
returnValue: Future<List<Map<String, dynamic>>>.value(
|
||||
<Map<String, dynamic>>[])) as _i7
|
||||
.Future<List<Map<String, dynamic>>>);
|
||||
@override
|
||||
_i7.Future<Map<String, List<Map<String, dynamic>>>> getBatchUTXOs(
|
||||
{Map<String, List<dynamic>>? args}) =>
|
||||
(super.noSuchMethod(Invocation.method(#getBatchUTXOs, [], {#args: args}),
|
||||
returnValue: Future<Map<String, List<Map<String, dynamic>>>>.value(
|
||||
<String, List<Map<String, dynamic>>>{})) as _i7
|
||||
.Future<Map<String, List<Map<String, dynamic>>>>);
|
||||
@override
|
||||
_i7.Future<Map<String, dynamic>> getTransaction(
|
||||
{String? txHash, bool? verbose = true, String? requestID}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#getTransaction, [],
|
||||
{#txHash: txHash, #verbose: verbose, #requestID: requestID}),
|
||||
returnValue:
|
||||
Future<Map<String, dynamic>>.value(<String, dynamic>{}))
|
||||
as _i7.Future<Map<String, dynamic>>);
|
||||
@override
|
||||
_i7.Future<Map<String, dynamic>> getAnonymitySet(
|
||||
{String? groupId = r'1',
|
||||
String? blockhash = r'',
|
||||
String? requestID}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#getAnonymitySet, [], {
|
||||
#groupId: groupId,
|
||||
#blockhash: blockhash,
|
||||
#requestID: requestID
|
||||
}),
|
||||
returnValue:
|
||||
Future<Map<String, dynamic>>.value(<String, dynamic>{}))
|
||||
as _i7.Future<Map<String, dynamic>>);
|
||||
@override
|
||||
_i7.Future<dynamic> getMintData({dynamic mints, String? requestID}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#getMintData, [], {#mints: mints, #requestID: requestID}),
|
||||
returnValue: Future<dynamic>.value()) as _i7.Future<dynamic>);
|
||||
@override
|
||||
_i7.Future<Map<String, dynamic>> getUsedCoinSerials(
|
||||
{String? requestID, int? startNumber}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#getUsedCoinSerials, [],
|
||||
{#requestID: requestID, #startNumber: startNumber}),
|
||||
returnValue:
|
||||
Future<Map<String, dynamic>>.value(<String, dynamic>{}))
|
||||
as _i7.Future<Map<String, dynamic>>);
|
||||
@override
|
||||
_i7.Future<int> getLatestCoinId({String? requestID}) => (super.noSuchMethod(
|
||||
Invocation.method(#getLatestCoinId, [], {#requestID: requestID}),
|
||||
returnValue: Future<int>.value(0)) as _i7.Future<int>);
|
||||
@override
|
||||
_i7.Future<Map<String, dynamic>> getFeeRate({String? requestID}) => (super
|
||||
.noSuchMethod(Invocation.method(#getFeeRate, [], {#requestID: requestID}),
|
||||
returnValue:
|
||||
Future<Map<String, dynamic>>.value(<String, dynamic>{})) as _i7
|
||||
.Future<Map<String, dynamic>>);
|
||||
@override
|
||||
_i7.Future<_i4.Decimal> estimateFee({String? requestID, int? blocks}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(
|
||||
#estimateFee, [], {#requestID: requestID, #blocks: blocks}),
|
||||
returnValue: Future<_i4.Decimal>.value(_FakeDecimal_2()))
|
||||
as _i7.Future<_i4.Decimal>);
|
||||
@override
|
||||
_i7.Future<_i4.Decimal> relayFee({String? requestID}) => (super.noSuchMethod(
|
||||
Invocation.method(#relayFee, [], {#requestID: requestID}),
|
||||
returnValue: Future<_i4.Decimal>.value(_FakeDecimal_2()))
|
||||
as _i7.Future<_i4.Decimal>);
|
||||
returnValueForMissingStub: Future<void>.value()) as _i6.Future<void>);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue