mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-11-13 09:04:09 +01: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
@@ -19,7 +19,6 @@ import 'package:cake_wallet/new-ui/widgets/swap_page/swap_address_selection_moda
|
||||
import 'package:cake_wallet/new-ui/widgets/swap_page/swap_confirm_sheet.dart';
|
||||
import 'package:cake_wallet/new-ui/widgets/swap_page/swap_limit_popup.dart';
|
||||
import 'package:cake_wallet/new-ui/widgets/swap_page/swap_options_page.dart';
|
||||
import 'package:cake_wallet/new-ui/widgets/swap_page/swap_provider_initial_preference_modal.dart';
|
||||
import 'package:cake_wallet/src/screens/exchange/widgets/currency_picker.dart';
|
||||
import 'package:cake_wallet/src/screens/exchange/widgets/present_provider_picker.dart';
|
||||
import 'package:cake_wallet/src/screens/send/widgets/extract_address_from_parsed.dart';
|
||||
@@ -45,7 +44,6 @@ import 'package:cw_core/wallet_type.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
import 'package:modal_bottom_sheet/modal_bottom_sheet.dart';
|
||||
|
||||
@@ -98,20 +96,20 @@ class _NewSwapPageState extends State<NewSwapPage> {
|
||||
}
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (!widget.exchangeViewModel.decentralizedExchangesPromptDismissed) {
|
||||
showMaterialModalBottomSheet(
|
||||
context: context,
|
||||
backgroundColor: Colors.transparent,
|
||||
isDismissible: false,
|
||||
builder: (context) {
|
||||
return SwapProviderInitialPreferenceModal();
|
||||
}).then((val) {
|
||||
widget.exchangeViewModel.dismissDecentralizedExchangesPrompt();
|
||||
if (val is bool && val == true && !widget.exchangeViewModel.forceDecentralizedExchanges) {
|
||||
widget.exchangeViewModel.toggleForceDecentralizedExchanges();
|
||||
}
|
||||
});
|
||||
}
|
||||
// if (!widget.exchangeViewModel.decentralizedExchangesPromptDismissed) {
|
||||
// showMaterialModalBottomSheet(
|
||||
// context: context,
|
||||
// backgroundColor: Colors.transparent,
|
||||
// isDismissible: false,
|
||||
// builder: (context) {
|
||||
// return SwapProviderInitialPreferenceModal();
|
||||
// }).then((val) {
|
||||
// widget.exchangeViewModel.dismissDecentralizedExchangesPrompt();
|
||||
// if (val is bool && val == true && !widget.exchangeViewModel.forceDecentralizedExchanges) {
|
||||
// widget.exchangeViewModel.toggleForceDecentralizedExchanges();
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
final depositAddressController = depositKey.currentState!.addressController;
|
||||
final depositAmountController = depositKey.currentState!.amountController;
|
||||
@@ -1182,13 +1180,14 @@ class SwapAmountBoxState extends State<SwapAmountBox> {
|
||||
});
|
||||
if (res != null && res is SwapAddressSelectionResult) {
|
||||
if (widget.isReceiverCard) {
|
||||
widget.exchangeViewModel.selectedAddressBookWallet = res.walletInfo;
|
||||
widget.exchangeViewModel.receiveAddress = res.address!;
|
||||
if (res.walletName != null) {
|
||||
if (res.walletInfo?.name != null) {
|
||||
if (res.accountName != null) {
|
||||
widget.exchangeViewModel.receiveAddressDisplayName =
|
||||
"${res.walletName} → ${res.accountName}";
|
||||
"${res.walletInfo!.name} → ${res.accountName}";
|
||||
} else {
|
||||
widget.exchangeViewModel.receiveAddressDisplayName = res.walletName!;
|
||||
widget.exchangeViewModel.receiveAddressDisplayName = res.walletInfo!.name;
|
||||
}
|
||||
}
|
||||
} else if (res.address == null || res.address!.isEmpty) {
|
||||
@@ -1196,7 +1195,7 @@ class SwapAmountBoxState extends State<SwapAmountBox> {
|
||||
askForRefundAddress();
|
||||
} else {
|
||||
widget.exchangeViewModel.isSendFromExternal = false;
|
||||
switchToDepositWallet(res.walletName!);
|
||||
switchToDepositWallet(res.walletInfo!.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
import 'package:cake_wallet/src/widgets/cake_image_widget.dart';
|
||||
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
|
||||
class AssetsTopBar extends StatelessWidget {
|
||||
const AssetsTopBar({
|
||||
@@ -98,5 +97,6 @@ class AssetsTopBar extends StatelessWidget {
|
||||
if (tabs[selectedTab] == S.current.history) {
|
||||
return S.current.filters;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,23 +70,25 @@ class HistoryTradeTile extends StatelessWidget {
|
||||
}
|
||||
|
||||
String _getIconPath(CryptoCurrency currency) {
|
||||
if (currency.iconPath != null) {
|
||||
return currency.iconPath!;
|
||||
}
|
||||
|
||||
if (currency.name.isNotEmpty) {
|
||||
final currencyFromName = CryptoCurrency.fromString(currency.name);
|
||||
if (currencyFromName.iconPath != null) {
|
||||
return currencyFromName.iconPath!;
|
||||
try { // temporarily until we migrate from hive to sqlite and store the full currency object
|
||||
if (currency.iconPath != null) {
|
||||
return currency.iconPath!;
|
||||
}
|
||||
}
|
||||
|
||||
if (currency.title.isNotEmpty) {
|
||||
final currencyFromTitle = CryptoCurrency.fromString(currency.title);
|
||||
if (currencyFromTitle.iconPath != null) {
|
||||
return currencyFromTitle.iconPath!;
|
||||
if (currency.name.isNotEmpty) {
|
||||
final currencyFromName = CryptoCurrency.fromString(currency.name);
|
||||
if (currencyFromName.iconPath != null) {
|
||||
return currencyFromName.iconPath!;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (currency.title.isNotEmpty) {
|
||||
final currencyFromTitle = CryptoCurrency.fromString(currency.title);
|
||||
if (currencyFromTitle.iconPath != null) {
|
||||
return currencyFromTitle.iconPath!;
|
||||
}
|
||||
}
|
||||
} catch (_) {}
|
||||
|
||||
//TODO approporiate fallback
|
||||
return "";
|
||||
|
||||
@@ -6,16 +6,16 @@ import 'package:cake_wallet/src/widgets/new_list_row/new_simple_checkbox.dart';
|
||||
import 'package:cake_wallet/view_model/exchange/exchange_view_model.dart';
|
||||
import 'package:cw_core/currency_for_wallet_type.dart';
|
||||
import 'package:cw_core/wallet_info.dart';
|
||||
import 'package:cw_core/wallet_type.dart' show WalletType;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:modal_bottom_sheet/modal_bottom_sheet.dart';
|
||||
|
||||
class SwapAddressSelectionResult {
|
||||
String? address;
|
||||
String? walletName;
|
||||
WalletInfo? walletInfo;
|
||||
String? accountName;
|
||||
|
||||
SwapAddressSelectionResult({this.address, this.walletName, this.accountName});
|
||||
SwapAddressSelectionResult({this.address, this.walletInfo, this.accountName});
|
||||
}
|
||||
|
||||
class SwapAddressSelectionModal extends StatefulWidget {
|
||||
@@ -52,8 +52,8 @@ class _SwapAddressSelectionModalState extends State<SwapAddressSelectionModal> {
|
||||
? await widget.exchangeViewModel.receiveWallets
|
||||
: await widget.exchangeViewModel.depositWallets;
|
||||
for (final item in items) {
|
||||
if (item.type.toString() == "WalletType.monero") {
|
||||
accounts[item.id] = await widget.exchangeViewModel.addressesForWallet(item);
|
||||
if (item.type == WalletType.monero) {
|
||||
accounts[item.id] = await widget.exchangeViewModel.addressesForAccountsWallet(item);
|
||||
}
|
||||
}
|
||||
setState(() {
|
||||
@@ -107,10 +107,10 @@ class _SwapAddressSelectionModalState extends State<SwapAddressSelectionModal> {
|
||||
|
||||
final String currencyIconPath = walletTypeToCryptoCurrency(item.type).iconPath ?? "";
|
||||
|
||||
final bool hasAccounts =
|
||||
item.type.toString() == "WalletType.monero" && widget.isSelectingReceiver;
|
||||
final bool hasAccounts =
|
||||
item.type == WalletType.monero && widget.isSelectingReceiver;
|
||||
|
||||
List<WalletInfoAddressInfo>? accounts =
|
||||
List<WalletInfoAddressInfo>? accounts =
|
||||
hasAccounts ? this.accounts[item.id] : null;
|
||||
|
||||
return Padding(
|
||||
@@ -123,7 +123,7 @@ class _SwapAddressSelectionModalState extends State<SwapAddressSelectionModal> {
|
||||
onAddressChosen: (address, accountName) {
|
||||
Navigator.of(context).pop(SwapAddressSelectionResult(
|
||||
address: address,
|
||||
walletName: item.name,
|
||||
walletInfo: item,
|
||||
accountName: accountName));
|
||||
},
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user