diff --git a/lib/buy/moonpay/moonpay_provider.dart b/lib/buy/moonpay/moonpay_provider.dart index 52a4f6187..fea8fdabd 100644 --- a/lib/buy/moonpay/moonpay_provider.dart +++ b/lib/buy/moonpay/moonpay_provider.dart @@ -155,7 +155,7 @@ class MoonPayProvider extends BuyProvider { 'baseCurrencyAmount': amount ?? '0', 'currencyCode': currencyCode, 'walletAddress': walletAddress, - 'lockAmount': 'true', + 'lockAmount': 'false', 'showAllCurrencies': 'false', 'showWalletAddressForm': 'false', 'enabledPaymentMethods': @@ -256,44 +256,44 @@ class MoonPayProvider extends BuyProvider { @override Future launchProvider(BuildContext context, bool? isBuyAction) async { - // try { - late final Uri uri; - if (isBuyAction ?? true) { - uri = await requestBuyMoonPayUrl( - currency: wallet.currency, - walletAddress: wallet.walletAddresses.address, - settingsStore: _settingsStore, - ); - } else { - uri = await requestSellMoonPayUrl( - currency: wallet.currency, - refundWalletAddress: wallet.walletAddresses.address, - settingsStore: _settingsStore, - ); - } - - if (await canLaunchUrl(uri)) { - if (DeviceInfo.instance.isMobile) { - Navigator.of(context).pushNamed(Routes.webViewPage, arguments: ['MoonPay', uri]); + try { + late final Uri uri; + if (isBuyAction ?? true) { + uri = await requestBuyMoonPayUrl( + currency: wallet.currency, + walletAddress: wallet.walletAddresses.address, + settingsStore: _settingsStore, + ); } else { - await launchUrl(uri, mode: LaunchMode.externalApplication); + uri = await requestSellMoonPayUrl( + currency: wallet.currency, + refundWalletAddress: wallet.walletAddresses.address, + settingsStore: _settingsStore, + ); } - } else { - throw Exception('Could not launch URL'); + + if (await canLaunchUrl(uri)) { + if (DeviceInfo.instance.isMobile) { + Navigator.of(context).pushNamed(Routes.webViewPage, arguments: ['MoonPay', uri]); + } else { + await launchUrl(uri, mode: LaunchMode.externalApplication); + } + } else { + throw Exception('Could not launch URL'); + } + } catch (e) { + await showDialog( + context: context, + builder: (BuildContext context) { + return AlertWithOneAction( + alertTitle: 'MoonPay', + alertContent: 'The MoonPay service is currently unavailable: $e', + buttonText: S.of(context).ok, + buttonAction: () => Navigator.of(context).pop(), + ); + }, + ); } - // } catch (e) { - // await showDialog( - // context: context, - // builder: (BuildContext context) { - // return AlertWithOneAction( - // alertTitle: 'MoonPay', - // alertContent: 'The MoonPay service is currently unavailable: $e', - // buttonText: S.of(context).ok, - // buttonAction: () => Navigator.of(context).pop(), - // ); - // }, - // ); - // } } String _normalizeCurrency(CryptoCurrency currency) {