From bc868a7d387ffc5639fde2a2626814dcf6bd6950 Mon Sep 17 00:00:00 2001 From: julian Date: Wed, 24 May 2023 12:08:32 -0600 Subject: [PATCH] fix: merge clean up --- lib/services/coins/ecash/ecash_wallet.dart | 4 ++-- lib/services/coins/firo/firo_wallet.dart | 7 ++++--- lib/themes/coin_icon_provider.dart | 2 ++ lib/themes/coin_image_provider.dart | 5 +++++ lib/utilities/constants.dart | 5 +++-- lib/utilities/enums/coin_enum.dart | 2 +- .../notification_card_test.mocks.dart | 9 +++++++++ test/pages/send_view/send_view_test.mocks.dart | 9 +++++++++ test/services/coins/manager_test.mocks.dart | 8 ++++++++ .../favorite_toggle_test.mocks.dart | 9 +++++++++ .../custom_loading_overlay_test.mocks.dart | 9 +++++++++ .../desktop/desktop_scaffold_test.mocks.dart | 9 +++++++++ .../managed_favorite_test.mocks.dart | 9 +++++++++ .../table_view/table_view_row_test.mocks.dart | 9 +++++++++ test/widget_tests/trade_card_test.mocks.dart | 9 +++++++++ .../transaction_card_test.mocks.dart | 17 +++++++++++++++++ test/widget_tests/wallet_card_test.mocks.dart | 9 +++++++++ .../wallet_info_row_test.mocks.dart | 9 +++++++++ 18 files changed, 132 insertions(+), 8 deletions(-) diff --git a/lib/services/coins/ecash/ecash_wallet.dart b/lib/services/coins/ecash/ecash_wallet.dart index f45c23a73..fca0de581 100644 --- a/lib/services/coins/ecash/ecash_wallet.dart +++ b/lib/services/coins/ecash/ecash_wallet.dart @@ -253,8 +253,8 @@ class ECashWallet extends CoinServiceAPI @override Future get maxFee async { final fee = (await fees).fast as String; - final satsFee = - Decimal.parse(fee) * Decimal.fromInt(Constants.satsPerCoin(coin)); + final satsFee = Decimal.parse(fee) * + Decimal.fromInt(Constants.satsPerCoin(coin).toInt()); return satsFee.floor().toBigInt().toInt(); } diff --git a/lib/services/coins/firo/firo_wallet.dart b/lib/services/coins/firo/firo_wallet.dart index b9cc26f3f..cf78445f7 100644 --- a/lib/services/coins/firo/firo_wallet.dart +++ b/lib/services/coins/firo/firo_wallet.dart @@ -4824,9 +4824,10 @@ class FiroWallet extends CoinServiceAPI ) async { var lelantusEntry = await _getLelantusEntry(); final balance = availablePrivateBalance().decimal; - int spendAmount = (balance * Decimal.fromInt(Constants.satsPerCoin(coin).toInt())) - .toBigInt() - .toInt(); + int spendAmount = + (balance * Decimal.fromInt(Constants.satsPerCoin(coin).toInt())) + .toBigInt() + .toInt(); if (spendAmount == 0 || lelantusEntry.isEmpty) { return LelantusFeeData(0, 0, []).fee; } diff --git a/lib/themes/coin_icon_provider.dart b/lib/themes/coin_icon_provider.dart index 6c17969e6..d0edacda1 100644 --- a/lib/themes/coin_icon_provider.dart +++ b/lib/themes/coin_icon_provider.dart @@ -37,6 +37,8 @@ final coinIconProvider = Provider.family((ref, coin) { return assets.particl; case Coin.ethereum: return assets.ethereum; + default: + return assets.bitcoin; } } else { return (assets as ThemeAssetsV2).coinIcons[coin.mainNetVersion]!; diff --git a/lib/themes/coin_image_provider.dart b/lib/themes/coin_image_provider.dart index 239e1d1cb..0460f1697 100644 --- a/lib/themes/coin_image_provider.dart +++ b/lib/themes/coin_image_provider.dart @@ -41,6 +41,8 @@ final coinImageProvider = Provider.family((ref, coin) { return assets.dogecoinImage; case Coin.ethereum: return assets.ethereumImage; + default: + return assets.bitcoinImage; } } else { return (assets as ThemeAssetsV2).coinImages[coin.mainNetVersion]!; @@ -85,6 +87,9 @@ final coinImageSecondaryProvider = Provider.family((ref, coin) { return assets.dogecoinImageSecondary; case Coin.ethereum: return assets.ethereumImageSecondary; + + default: + return assets.ethereumImageSecondary; } } else { return (assets as ThemeAssetsV2).coinSecondaryImages[coin.mainNetVersion]!; diff --git a/lib/utilities/constants.dart b/lib/utilities/constants.dart index 8eb14a2a8..a8b353c14 100644 --- a/lib/utilities/constants.dart +++ b/lib/utilities/constants.dart @@ -25,11 +25,12 @@ abstract class Constants { // static bool enableBuy = enableExchange; // // true; // true for development, - static const BigInt _satsPerCoinECash = BigInt.from(100); + static final BigInt _satsPerCoinECash = BigInt.from(100); static final BigInt _satsPerCoinEthereum = BigInt.from(1000000000000000000); static final BigInt _satsPerCoinMonero = BigInt.from(1000000000000); static final BigInt _satsPerCoinWownero = BigInt.from(100000000000); - static final BigInt _satsPerCoinNano = BigInt.parse("1000000000000000000000000000000"); + static final BigInt _satsPerCoinNano = + BigInt.parse("1000000000000000000000000000000"); static final BigInt _satsPerCoin = BigInt.from(100000000); static const int _decimalPlaces = 8; static const int _decimalPlacesNano = 6; diff --git a/lib/utilities/enums/coin_enum.dart b/lib/utilities/enums/coin_enum.dart index 0998fb403..8173e3147 100644 --- a/lib/utilities/enums/coin_enum.dart +++ b/lib/utilities/enums/coin_enum.dart @@ -14,10 +14,10 @@ import 'package:stackwallet/services/coins/litecoin/litecoin_wallet.dart' import 'package:stackwallet/services/coins/monero/monero_wallet.dart' as xmr; import 'package:stackwallet/services/coins/namecoin/namecoin_wallet.dart' as nmc; +import 'package:stackwallet/services/coins/nano/nano_wallet.dart' as nano; import 'package:stackwallet/services/coins/particl/particl_wallet.dart' as particl; import 'package:stackwallet/services/coins/wownero/wownero_wallet.dart' as wow; -import 'package:stackwallet/services/coins/nano/nano_wallet.dart' as nano; import 'package:stackwallet/utilities/constants.dart'; enum Coin { diff --git a/test/notifications/notification_card_test.mocks.dart b/test/notifications/notification_card_test.mocks.dart index 7f60b97c9..bb8b8ae74 100644 --- a/test/notifications/notification_card_test.mocks.dart +++ b/test/notifications/notification_card_test.mocks.dart @@ -83,6 +83,15 @@ class MockThemeService extends _i1.Mock implements _i3.ThemeService { returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override + _i5.Future checkDefaultThemesOnStartup() => (super.noSuchMethod( + Invocation.method( + #checkDefaultThemesOnStartup, + [], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + @override _i5.Future verifyInstalled({required String? themeId}) => (super.noSuchMethod( Invocation.method( diff --git a/test/pages/send_view/send_view_test.mocks.dart b/test/pages/send_view/send_view_test.mocks.dart index 8a33fcb87..2276836ce 100644 --- a/test/pages/send_view/send_view_test.mocks.dart +++ b/test/pages/send_view/send_view_test.mocks.dart @@ -2278,6 +2278,15 @@ class MockThemeService extends _i1.Mock implements _i32.ThemeService { returnValueForMissingStub: _i23.Future.value(), ) as _i23.Future); @override + _i23.Future checkDefaultThemesOnStartup() => (super.noSuchMethod( + Invocation.method( + #checkDefaultThemesOnStartup, + [], + ), + returnValue: _i23.Future.value(), + returnValueForMissingStub: _i23.Future.value(), + ) as _i23.Future); + @override _i23.Future verifyInstalled({required String? themeId}) => (super.noSuchMethod( Invocation.method( diff --git a/test/services/coins/manager_test.mocks.dart b/test/services/coins/manager_test.mocks.dart index 8a607f14f..821da6efc 100644 --- a/test/services/coins/manager_test.mocks.dart +++ b/test/services/coins/manager_test.mocks.dart @@ -1086,6 +1086,14 @@ class MockFiroWallet extends _i1.Mock implements _i10.FiroWallet { returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override + int firoGetMintIndex() => (super.noSuchMethod( + Invocation.method( + #firoGetMintIndex, + [], + ), + returnValue: 0, + ) as int); + @override _i11.Future firoUpdateMintIndex(int? mintIndex) => (super.noSuchMethod( Invocation.method( #firoUpdateMintIndex, diff --git a/test/widget_tests/custom_buttons/favorite_toggle_test.mocks.dart b/test/widget_tests/custom_buttons/favorite_toggle_test.mocks.dart index 9bccdcc86..59e02607b 100644 --- a/test/widget_tests/custom_buttons/favorite_toggle_test.mocks.dart +++ b/test/widget_tests/custom_buttons/favorite_toggle_test.mocks.dart @@ -83,6 +83,15 @@ class MockThemeService extends _i1.Mock implements _i3.ThemeService { returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override + _i5.Future checkDefaultThemesOnStartup() => (super.noSuchMethod( + Invocation.method( + #checkDefaultThemesOnStartup, + [], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + @override _i5.Future verifyInstalled({required String? themeId}) => (super.noSuchMethod( Invocation.method( diff --git a/test/widget_tests/custom_loading_overlay_test.mocks.dart b/test/widget_tests/custom_loading_overlay_test.mocks.dart index c2244014e..f192714d8 100644 --- a/test/widget_tests/custom_loading_overlay_test.mocks.dart +++ b/test/widget_tests/custom_loading_overlay_test.mocks.dart @@ -83,6 +83,15 @@ class MockThemeService extends _i1.Mock implements _i3.ThemeService { returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override + _i5.Future checkDefaultThemesOnStartup() => (super.noSuchMethod( + Invocation.method( + #checkDefaultThemesOnStartup, + [], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + @override _i5.Future verifyInstalled({required String? themeId}) => (super.noSuchMethod( Invocation.method( diff --git a/test/widget_tests/desktop/desktop_scaffold_test.mocks.dart b/test/widget_tests/desktop/desktop_scaffold_test.mocks.dart index aa5f1260d..5972c21c2 100644 --- a/test/widget_tests/desktop/desktop_scaffold_test.mocks.dart +++ b/test/widget_tests/desktop/desktop_scaffold_test.mocks.dart @@ -83,6 +83,15 @@ class MockThemeService extends _i1.Mock implements _i3.ThemeService { returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override + _i5.Future checkDefaultThemesOnStartup() => (super.noSuchMethod( + Invocation.method( + #checkDefaultThemesOnStartup, + [], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + @override _i5.Future verifyInstalled({required String? themeId}) => (super.noSuchMethod( Invocation.method( diff --git a/test/widget_tests/managed_favorite_test.mocks.dart b/test/widget_tests/managed_favorite_test.mocks.dart index 1be169e52..5bd694533 100644 --- a/test/widget_tests/managed_favorite_test.mocks.dart +++ b/test/widget_tests/managed_favorite_test.mocks.dart @@ -2008,6 +2008,15 @@ class MockThemeService extends _i1.Mock implements _i30.ThemeService { returnValueForMissingStub: _i23.Future.value(), ) as _i23.Future); @override + _i23.Future checkDefaultThemesOnStartup() => (super.noSuchMethod( + Invocation.method( + #checkDefaultThemesOnStartup, + [], + ), + returnValue: _i23.Future.value(), + returnValueForMissingStub: _i23.Future.value(), + ) as _i23.Future); + @override _i23.Future verifyInstalled({required String? themeId}) => (super.noSuchMethod( Invocation.method( diff --git a/test/widget_tests/table_view/table_view_row_test.mocks.dart b/test/widget_tests/table_view/table_view_row_test.mocks.dart index 62a4e3bd5..d86e3d82d 100644 --- a/test/widget_tests/table_view/table_view_row_test.mocks.dart +++ b/test/widget_tests/table_view/table_view_row_test.mocks.dart @@ -729,6 +729,15 @@ class MockThemeService extends _i1.Mock implements _i25.ThemeService { returnValueForMissingStub: _i22.Future.value(), ) as _i22.Future); @override + _i22.Future checkDefaultThemesOnStartup() => (super.noSuchMethod( + Invocation.method( + #checkDefaultThemesOnStartup, + [], + ), + returnValue: _i22.Future.value(), + returnValueForMissingStub: _i22.Future.value(), + ) as _i22.Future); + @override _i22.Future verifyInstalled({required String? themeId}) => (super.noSuchMethod( Invocation.method( diff --git a/test/widget_tests/trade_card_test.mocks.dart b/test/widget_tests/trade_card_test.mocks.dart index b4092378c..55895389f 100644 --- a/test/widget_tests/trade_card_test.mocks.dart +++ b/test/widget_tests/trade_card_test.mocks.dart @@ -83,6 +83,15 @@ class MockThemeService extends _i1.Mock implements _i3.ThemeService { returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override + _i5.Future checkDefaultThemesOnStartup() => (super.noSuchMethod( + Invocation.method( + #checkDefaultThemesOnStartup, + [], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + @override _i5.Future verifyInstalled({required String? themeId}) => (super.noSuchMethod( Invocation.method( diff --git a/test/widget_tests/transaction_card_test.mocks.dart b/test/widget_tests/transaction_card_test.mocks.dart index 67081a304..93cc0c9a7 100644 --- a/test/widget_tests/transaction_card_test.mocks.dart +++ b/test/widget_tests/transaction_card_test.mocks.dart @@ -2076,6 +2076,14 @@ class MockFiroWallet extends _i1.Mock implements _i22.FiroWallet { returnValueForMissingStub: _i18.Future.value(), ) as _i18.Future); @override + int firoGetMintIndex() => (super.noSuchMethod( + Invocation.method( + #firoGetMintIndex, + [], + ), + returnValue: 0, + ) as int); + @override _i18.Future firoUpdateMintIndex(int? mintIndex) => (super.noSuchMethod( Invocation.method( #firoUpdateMintIndex, @@ -2864,6 +2872,15 @@ class MockThemeService extends _i1.Mock implements _i30.ThemeService { returnValueForMissingStub: _i18.Future.value(), ) as _i18.Future); @override + _i18.Future checkDefaultThemesOnStartup() => (super.noSuchMethod( + Invocation.method( + #checkDefaultThemesOnStartup, + [], + ), + returnValue: _i18.Future.value(), + returnValueForMissingStub: _i18.Future.value(), + ) as _i18.Future); + @override _i18.Future verifyInstalled({required String? themeId}) => (super.noSuchMethod( Invocation.method( diff --git a/test/widget_tests/wallet_card_test.mocks.dart b/test/widget_tests/wallet_card_test.mocks.dart index af1d78fdd..af955c477 100644 --- a/test/widget_tests/wallet_card_test.mocks.dart +++ b/test/widget_tests/wallet_card_test.mocks.dart @@ -1812,6 +1812,15 @@ class MockThemeService extends _i1.Mock implements _i30.ThemeService { returnValueForMissingStub: _i21.Future.value(), ) as _i21.Future); @override + _i21.Future checkDefaultThemesOnStartup() => (super.noSuchMethod( + Invocation.method( + #checkDefaultThemesOnStartup, + [], + ), + returnValue: _i21.Future.value(), + returnValueForMissingStub: _i21.Future.value(), + ) as _i21.Future); + @override _i21.Future verifyInstalled({required String? themeId}) => (super.noSuchMethod( Invocation.method( diff --git a/test/widget_tests/wallet_info_row/wallet_info_row_test.mocks.dart b/test/widget_tests/wallet_info_row/wallet_info_row_test.mocks.dart index 8c8fdc9df..f76a04c74 100644 --- a/test/widget_tests/wallet_info_row/wallet_info_row_test.mocks.dart +++ b/test/widget_tests/wallet_info_row/wallet_info_row_test.mocks.dart @@ -741,6 +741,15 @@ class MockThemeService extends _i1.Mock implements _i26.ThemeService { returnValueForMissingStub: _i23.Future.value(), ) as _i23.Future); @override + _i23.Future checkDefaultThemesOnStartup() => (super.noSuchMethod( + Invocation.method( + #checkDefaultThemesOnStartup, + [], + ), + returnValue: _i23.Future.value(), + returnValueForMissingStub: _i23.Future.value(), + ) as _i23.Future); + @override _i23.Future verifyInstalled({required String? themeId}) => (super.noSuchMethod( Invocation.method(