From 0f96e381e66a7dd263afb35e38a9dee14ffda01c Mon Sep 17 00:00:00 2001 From: Matthew Fosse Date: Tue, 5 Mar 2024 07:55:43 -0800 Subject: [PATCH] review fixes --- cw_core/lib/crypto_currency.dart | 5 +---- lib/di.dart | 8 +++++--- .../widgets/anonpay_currency_input_field.dart | 17 +++++++++-------- .../receive/widgets/lightning_input_form.dart | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/cw_core/lib/crypto_currency.dart b/cw_core/lib/crypto_currency.dart index a2216a0c7..119d4733f 100644 --- a/cw_core/lib/crypto_currency.dart +++ b/cw_core/lib/crypto_currency.dart @@ -187,7 +187,7 @@ class CryptoCurrency extends EnumerableItem with Serializable implemen static const scrt = CryptoCurrency(title: 'SCRT', fullName: 'Secret Network', raw: 59, name: 'scrt', iconPath: 'assets/images/scrt_icon.png', decimals: 6); static const uni = CryptoCurrency(title: 'UNI', tag: 'ETH', fullName: 'Uniswap', raw: 60, name: 'uni', iconPath: 'assets/images/uni_icon.png', decimals: 18); static const stx = CryptoCurrency(title: 'STX', fullName: 'Stacks', raw: 61, name: 'stx', iconPath: 'assets/images/stx_icon.png', decimals: 8); - static const btcln = CryptoCurrency(title: 'sats', tag: 'LN', fullName: 'Bitcoin Lightning Network', raw: 62, name: 'btcln', iconPath: 'assets/images/lightning_logo.png', decimals: 8); + static const btcln = CryptoCurrency(title: 'sats', tag: 'LN', fullName: 'Bitcoin Lightning Network', raw: 62, name: 'sats', iconPath: 'assets/images/lightning_logo.png', decimals: 8); static const shib = CryptoCurrency(title: 'SHIB', tag: 'ETH', fullName: 'Shiba Inu', raw: 63, name: 'shib', iconPath: 'assets/images/shib_icon.png', decimals: 18); static const aave = CryptoCurrency(title: 'AAVE', tag: 'ETH', fullName: 'Aave', raw: 64, name: 'aave', iconPath: 'assets/images/aave_icon.png', decimals: 18); static const arb = CryptoCurrency(title: 'ARB', fullName: 'Arbitrum', raw: 65, name: 'arb', iconPath: 'assets/images/arb_icon.png', decimals: 18); @@ -217,9 +217,6 @@ class CryptoCurrency extends EnumerableItem with Serializable implemen static const kaspa = CryptoCurrency(title: 'KAS', fullName: 'Kaspa', raw: 89, name: 'kas', iconPath: 'assets/images/kaspa_icon.png', decimals: 8); static const digibyte = CryptoCurrency(title: 'DGB', fullName: 'DigiByte', raw: 90, name: 'dgb', iconPath: 'assets/images/digibyte.png', decimals: 8); static const usdtSol = CryptoCurrency(title: 'USDT', tag: 'SOL', fullName: 'USDT Tether', raw: 90, name: 'usdtsol', iconPath: 'assets/images/usdt_icon.png', decimals: 6); - static const satoshis = CryptoCurrency(title: 'sats', fullName: 'Satoshis', raw: 91, name: 'sats', iconPath: 'assets/images/lightning_logo.png', decimals: 0); - - static final Map _rawCurrencyMap = [...all, ...havenCurrencies].fold>({}, (acc, item) { diff --git a/lib/di.dart b/lib/di.dart index 4d4de1ebd..a7c72de08 100644 --- a/lib/di.dart +++ b/lib/di.dart @@ -1205,13 +1205,15 @@ Future setup({ getIt.registerFactory(() => NFTViewModel(appStore, getIt.get())); getIt.registerFactory(() => TorPage(getIt.get())); + + getIt.registerFactory(() => LightningViewModel()); getIt.registerFactoryParam, void>((args, _) { final pageOption = args.first as ReceivePageOption; return LightningInvoicePageViewModel( getIt.get(), getIt.get().wallet!, getIt.get(), - LightningViewModel(), + getIt.get(), pageOption, ); }); @@ -1221,7 +1223,7 @@ Future setup({ final pageOption = args.last as ReceivePageOption; return LightningReceiveOnchainPage( addressListViewModel: getIt.get(), - lightningViewModel: LightningViewModel(), + lightningViewModel: getIt.get(), receiveOptionViewModel: getIt.get(param1: pageOption)); }); @@ -1229,7 +1231,7 @@ Future setup({ final pageOption = args.last as ReceivePageOption; return LightningInvoicePage( lightningInvoicePageViewModel: getIt.get(param1: args), - lightningViewModel: LightningViewModel(), + lightningViewModel: getIt.get(), receiveOptionViewModel: getIt.get(param1: pageOption)); }); diff --git a/lib/src/screens/receive/widgets/anonpay_currency_input_field.dart b/lib/src/screens/receive/widgets/anonpay_currency_input_field.dart index f12156ed7..9bc894a9d 100644 --- a/lib/src/screens/receive/widgets/anonpay_currency_input_field.dart +++ b/lib/src/screens/receive/widgets/anonpay_currency_input_field.dart @@ -7,14 +7,15 @@ import 'package:flutter/services.dart'; import 'package:cake_wallet/themes/extensions/send_page_theme.dart'; class AnonpayCurrencyInputField extends StatelessWidget { - const AnonpayCurrencyInputField( - {super.key, - this.onTapPicker, - required this.selectedCurrency, - required this.focusNode, - required this.controller, - required this.minAmount, - required this.maxAmount}); + const AnonpayCurrencyInputField({ + super.key, + this.onTapPicker, + required this.selectedCurrency, + required this.focusNode, + required this.controller, + required this.minAmount, + required this.maxAmount, + }); final Function()? onTapPicker; final Currency selectedCurrency; final FocusNode focusNode; diff --git a/lib/src/screens/receive/widgets/lightning_input_form.dart b/lib/src/screens/receive/widgets/lightning_input_form.dart index 124053558..7efdd8bc5 100644 --- a/lib/src/screens/receive/widgets/lightning_input_form.dart +++ b/lib/src/screens/receive/widgets/lightning_input_form.dart @@ -46,7 +46,7 @@ class LightningInvoiceForm extends StatelessWidget { focusNode: depositAmountFocus, maxAmount: '', minAmount: (lightningInvoicePageViewModel.minimum != null) ? satsToLightningString(lightningInvoicePageViewModel.minimum!.round()) : '...', - selectedCurrency: CryptoCurrency.satoshis, + selectedCurrency: CryptoCurrency.btcln, ); }), SizedBox(