mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-22 06:28:39 +02:00
v6.0.2 Release candidate (#3080)
* v6.0.2 Release candidate * v6.0.2 Release candidate * move btc ln up in the currency picker * disable bsc for swapsxyz * minor [skip ci] * hide dex/rate selection on swap screen * temp fix for evm tokens swaps icons until hive migration is done * minor [skip ci] * disable force dex providers for existing users and let them pick it from settings preference * Show bitcoin address types in swap picker (#3096) * Show bitcoin address types in swap picker * remove wrong conversion to bolt11 [skip ci] * feat: add Lightning invoice resolution and address normalization * automatically select contact wallet address based on the selected swap currency (whether it's bitcoin or lightning) * minor [skip ci] * default to bolt11 invoice for lightning swaps --------- Co-authored-by: Konstantin Ullrich <konstantinullrich12@gmail.com> --------- Co-authored-by: Konstantin Ullrich <konstantinullrich12@gmail.com>
This commit is contained in:
co-authored by
Konstantin Ullrich
parent
82982ae5af
commit
db00a0214a
@@ -1,6 +1,7 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:cake_wallet/.secrets.g.dart' as secrets;
|
||||
import 'package:cake_wallet/core/lightning_invoice_service.dart';
|
||||
import 'package:cake_wallet/exchange/exchange_provider_description.dart';
|
||||
import 'package:cake_wallet/exchange/limits.dart';
|
||||
import 'package:cake_wallet/exchange/provider/exchange_provider.dart';
|
||||
@@ -196,8 +197,8 @@ class ExolixExchangeProvider extends ExchangeProvider {
|
||||
'coinTo': _normalizeCurrency(_overrideToCryptoCurrency(request.toCurrency, request.toAddress)),
|
||||
'networkFrom': _networkFor(request.fromCurrency),
|
||||
'networkTo': _networkFor(request.toCurrency),
|
||||
'withdrawalAddress': _normalizeAddress(request.toAddress),
|
||||
'refundAddress': _normalizeAddress(request.refundAddress),
|
||||
'withdrawalAddress': await _normalizeAddress(request.toAddress),
|
||||
'refundAddress': await _normalizeAddress(request.refundAddress),
|
||||
'rateType': _getRateType(isFixedRateMode),
|
||||
'apiToken': apiKey,
|
||||
};
|
||||
@@ -213,7 +214,6 @@ class ExolixExchangeProvider extends ExchangeProvider {
|
||||
headers: headers,
|
||||
body: json.encode(body),
|
||||
);
|
||||
|
||||
|
||||
if (response.statusCode == 400) {
|
||||
final responseJSON = json.decode(response.body) as Map<String, dynamic>;
|
||||
@@ -446,8 +446,17 @@ class ExolixExchangeProvider extends ExchangeProvider {
|
||||
}
|
||||
}
|
||||
|
||||
String _normalizeAddress(String address) =>
|
||||
address.startsWith('bitcoincash:') ? address.replaceFirst('bitcoincash:', '') : address;
|
||||
Future<String> _normalizeAddress(String address) async {
|
||||
if (address.startsWith('bitcoincash:'))
|
||||
return address.replaceFirst('bitcoincash:', '');
|
||||
|
||||
// Lightning addresses
|
||||
if(address.contains("@"))
|
||||
return await getBolt11FromLightingAddress(address) ?? address;
|
||||
|
||||
return address;
|
||||
}
|
||||
|
||||
|
||||
static double? _toDouble(dynamic value) {
|
||||
if (value is int) {
|
||||
|
||||
@@ -8,7 +8,6 @@ import 'package:cake_wallet/exchange/trade.dart';
|
||||
import 'package:cake_wallet/exchange/trade_not_created_exception.dart';
|
||||
import 'package:cake_wallet/exchange/trade_request.dart';
|
||||
import 'package:cake_wallet/exchange/trade_state.dart';
|
||||
import 'package:cake_wallet/exchange/utils/currency_pairs_utils.dart';
|
||||
import 'package:cw_core/amount_converter.dart';
|
||||
import 'package:cw_core/utils/print_verbose.dart';
|
||||
import 'package:cw_core/utils/proxy_wrapper.dart';
|
||||
@@ -20,7 +19,7 @@ class SwapsXyzExchangeProvider extends ExchangeProvider {
|
||||
static final List<CryptoCurrency> _notSupportedAsSourceToken = [
|
||||
CryptoCurrency.sol,
|
||||
...CryptoCurrency.all.where(
|
||||
(c) => (c.tag ?? '').toUpperCase() == 'SOL',
|
||||
(c) => (c.tag ?? '').toUpperCase() == 'SOL' || c.tag == CryptoCurrency.bnb.tag,
|
||||
),
|
||||
];
|
||||
|
||||
@@ -209,7 +208,7 @@ class SwapsXyzExchangeProvider extends ExchangeProvider {
|
||||
required bool isReceiveAmount}) async {
|
||||
try {
|
||||
|
||||
if(_notSupportedAsSourceToken.contains(from)) {
|
||||
if(_notSupportedAsSourceToken.contains(from) || _notSupportedAsSourceToken.contains(to)) {
|
||||
printV(
|
||||
'fetchRate: source token ${from.title} is not supported as source token');
|
||||
return 0.0;
|
||||
|
||||
@@ -7,7 +7,6 @@ import 'package:cake_wallet/exchange/provider/exchange_provider.dart';
|
||||
import 'package:cake_wallet/exchange/trade.dart';
|
||||
import 'package:cake_wallet/exchange/trade_request.dart';
|
||||
import 'package:cake_wallet/exchange/trade_state.dart';
|
||||
import 'package:cake_wallet/exchange/utils/currency_pairs_utils.dart';
|
||||
import 'package:cake_wallet/wallet_type_utils.dart';
|
||||
import 'package:cw_core/utils/proxy_wrapper.dart';
|
||||
import 'package:cw_core/crypto_currency.dart';
|
||||
|
||||
Reference in New Issue
Block a user