Skip to content

Commit bdcca3c

Browse files
Merge pull request #1214 from cypherstack/apple-updates
Apple updates, separate wow lib, various bug fixes, some refactoring
2 parents a9fa467 + 6abaa1b commit bdcca3c

File tree

43 files changed

+3991
-1645
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+3991
-1645
lines changed

lib/main.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ import 'wallets/isar/providers/all_wallets_info_provider.dart';
7676
import 'wallets/wallet/wallet_mixin_interfaces/spark_interface.dart';
7777
import 'widgets/crypto_notifications.dart';
7878
import 'wl_gen/interfaces/cs_monero_interface.dart';
79+
import 'wl_gen/interfaces/cs_wownero_interface.dart';
7980
import 'wl_gen/interfaces/lib_xelis_interface.dart';
8081

8182
final openedFromSWBFileStringStateProvider = StateProvider<String?>(
@@ -161,10 +162,12 @@ void main(List<String> args) async {
161162

162163
DB.instance.hive.registerAdapter(lib_monero_compat.WalletTypeAdapter());
163164

164-
if (AppConfig.coins.whereType<Monero>().isNotEmpty ||
165-
AppConfig.coins.whereType<Wownero>().isNotEmpty) {
165+
if (AppConfig.coins.whereType<Monero>().isNotEmpty) {
166166
csMonero.setUseCsMoneroLoggerInternal(kDebugMode);
167167
}
168+
if (AppConfig.coins.whereType<Wownero>().isNotEmpty) {
169+
csWownero.setUseCsWowneroLoggerInternal(kDebugMode);
170+
}
168171

169172
DB.instance.hive.init(
170173
(await StackFileSystem.applicationHiveDirectory()).path,

lib/pages/add_wallet_views/new_wallet_recovery_phrase_warning_view/new_wallet_recovery_phrase_warning_view.dart

Lines changed: 274 additions & 308 deletions
Large diffs are not rendered by default.

lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/restore_options_view.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import '../../../../widgets/textfield_icon_button.dart';
4242
import '../../../../widgets/toggle.dart';
4343
import '../../../../wl_gen/interfaces/cs_monero_interface.dart';
4444
import '../../../../wl_gen/interfaces/cs_salvium_interface.dart';
45+
import '../../../../wl_gen/interfaces/cs_wownero_interface.dart';
4546
import '../../create_or_restore_wallet_view/sub_widgets/coin_image.dart';
4647
import '../restore_view_only_wallet_view.dart';
4748
import '../restore_wallet_view.dart';
@@ -213,10 +214,10 @@ class _RestoreOptionsViewState extends ConsumerState<RestoreOptionsView> {
213214
int height = 0;
214215
if (date != null) {
215216
if (widget.coin is Monero) {
216-
height = csMonero.getHeightByDate(date, csCoin: CsCoin.monero);
217+
height = csMonero.getHeightByDate(date);
217218
}
218219
if (widget.coin is Wownero) {
219-
height = csMonero.getHeightByDate(date, csCoin: CsCoin.wownero);
220+
height = csWownero.getHeightByDate(date);
220221
}
221222
if (widget.coin is Salvium) {
222223
height = csSalvium.getHeightByDate(

lib/pages/add_wallet_views/restore_wallet_view/restore_wallet_view.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ import '../../../widgets/table_view/table_view.dart';
6161
import '../../../widgets/table_view/table_view_cell.dart';
6262
import '../../../widgets/table_view/table_view_row.dart';
6363
import '../../../wl_gen/interfaces/cs_monero_interface.dart';
64+
import '../../../wl_gen/interfaces/cs_wownero_interface.dart';
6465
import '../../../wl_gen/interfaces/lib_xelis_interface.dart';
6566
import '../../home_view/home_view.dart';
6667
import '../add_token_view/edit_wallet_tokens_view.dart';
@@ -189,7 +190,7 @@ class _RestoreWalletViewState extends ConsumerState<RestoreWalletView> {
189190
}
190191
}
191192
if (widget.coin is Wownero) {
192-
final wowneroWordList = csMonero.getWowneroWordList(
193+
final wowneroWordList = csWownero.getWowneroWordList(
193194
"English",
194195
widget.seedWordsLength,
195196
);

lib/pages/add_wallet_views/verify_recovery_phrase_view/verify_recovery_phrase_view.dart

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ import '../../../wallets/wallet/impl/epiccash_wallet.dart';
3737
import '../../../wallets/wallet/impl/monero_wallet.dart';
3838
import '../../../wallets/wallet/impl/wownero_wallet.dart';
3939
import '../../../wallets/wallet/impl/xelis_wallet.dart';
40-
import '../../../wallets/wallet/intermediate/lib_monero_wallet.dart';
41-
import '../../../wallets/wallet/intermediate/lib_salvium_wallet.dart';
40+
import '../../../wallets/wallet/intermediate/cryptonote_wallet.dart';
4241
import '../../../wallets/wallet/wallet.dart';
4342
import '../../../wallets/wallet/wallet_mixin_interfaces/extended_keys_interface.dart';
4443
import '../../../wallets/wallet/wallet_mixin_interfaces/view_only_option_interface.dart';
@@ -48,6 +47,7 @@ import '../../../widgets/desktop/desktop_scaffold.dart';
4847
import '../../../widgets/stack_dialog.dart';
4948
import '../../../wl_gen/interfaces/cs_monero_interface.dart';
5049
import '../../../wl_gen/interfaces/cs_salvium_interface.dart';
50+
import '../../../wl_gen/interfaces/cs_wownero_interface.dart';
5151
import '../../home_view/home_view.dart';
5252
import '../add_token_view/edit_wallet_tokens_view.dart';
5353
import '../new_wallet_options/new_wallet_options_view.dart';
@@ -111,18 +111,15 @@ class _VerifyRecoveryPhraseViewState
111111
final ViewOnlyWalletType viewOnlyWalletType;
112112
if (widget.wallet is ExtendedKeysInterface) {
113113
viewOnlyWalletType = ViewOnlyWalletType.xPub;
114-
} else if (widget.wallet is LibMoneroWallet ||
115-
widget.wallet is LibSalviumWallet) {
114+
} else if (widget.wallet is CryptonoteWallet) {
116115
if (widget.wallet.cryptoCurrency is Monero) {
117116
height = csMonero.getHeightByDate(
118117
DateTime.now().subtract(const Duration(days: 7)),
119-
csCoin: CsCoin.monero,
120118
);
121119
}
122120
if (widget.wallet.cryptoCurrency is Wownero) {
123-
height = csMonero.getHeightByDate(
121+
height = csWownero.getHeightByDate(
124122
DateTime.now().subtract(const Duration(days: 7)),
125-
csCoin: CsCoin.wownero,
126123
);
127124
}
128125
if (widget.wallet.cryptoCurrency is Salvium) {
@@ -175,23 +172,8 @@ class _VerifyRecoveryPhraseViewState
175172
walletId: voInfo.walletId,
176173
xPubs: [xPub],
177174
);
178-
} else if (widget.wallet is LibMoneroWallet) {
179-
final w = widget.wallet as LibMoneroWallet;
180-
181-
final info = await w
182-
.hackToCreateNewViewOnlyWalletDataFromNewlyCreatedWalletThisFunctionShouldNotBeCalledUnlessYouKnowWhatYouAreDoing();
183-
final address = info.$1;
184-
final privateViewKey = info.$2;
185-
186-
await w.exit();
187-
188-
viewOnlyData = CryptonoteViewOnlyWalletData(
189-
walletId: voInfo.walletId,
190-
address: address,
191-
privateViewKey: privateViewKey,
192-
);
193-
} else if (widget.wallet is LibSalviumWallet) {
194-
final w = widget.wallet as LibSalviumWallet;
175+
} else if (widget.wallet is CryptonoteWallet) {
176+
final w = widget.wallet as CryptonoteWallet;
195177

196178
final info = await w
197179
.hackToCreateNewViewOnlyWalletDataFromNewlyCreatedWalletThisFunctionShouldNotBeCalledUnlessYouKnowWhatYouAreDoing();

lib/pages/send_view/send_view.dart

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,13 @@ import '../../utilities/show_loading.dart';
4949
import '../../utilities/text_styles.dart';
5050
import '../../utilities/util.dart';
5151
import '../../wallets/crypto_currency/crypto_currency.dart';
52+
import '../../wallets/crypto_currency/intermediate/cryptonote_currency.dart';
5253
import '../../wallets/crypto_currency/intermediate/nano_currency.dart';
5354
import '../../wallets/isar/providers/wallet_info_provider.dart';
5455
import '../../wallets/models/tx_data.dart';
5556
import '../../wallets/wallet/impl/firo_wallet.dart';
5657
import '../../wallets/wallet/impl/mimblewimblecoin_wallet.dart';
58+
import '../../wallets/wallet/intermediate/cryptonote_wallet.dart';
5759
import '../../wallets/wallet/wallet_mixin_interfaces/coin_control_interface.dart';
5860
import '../../wallets/wallet/wallet_mixin_interfaces/mweb_interface.dart';
5961
import '../../wallets/wallet/wallet_mixin_interfaces/paynym_interface.dart';
@@ -74,7 +76,6 @@ import '../../widgets/rounded_white_container.dart';
7476
import '../../widgets/stack_dialog.dart';
7577
import '../../widgets/stack_text_field.dart';
7678
import '../../widgets/textfield_icon_button.dart';
77-
import '../../wl_gen/interfaces/cs_monero_interface.dart';
7879
import '../address_book_views/address_book_view.dart';
7980
import '../coin_control/coin_control_view.dart';
8081
import 'confirm_transaction_view.dart';
@@ -559,17 +560,17 @@ class _SendViewState extends ConsumerState<SendView> {
559560
}
560561

561562
Amount fee;
562-
if (coin is Monero) {
563+
if (coin is CryptonoteCurrency) {
563564
final int specialMoneroId;
564565
switch (ref.read(feeRateTypeMobileStateProvider.state).state) {
565566
case FeeRateType.fast:
566-
specialMoneroId = csMonero.getTxPriorityHigh();
567+
specialMoneroId = (wallet as CryptonoteWallet).getTxPriorityHigh();
567568
break;
568569
case FeeRateType.average:
569-
specialMoneroId = csMonero.getTxPriorityMedium();
570+
specialMoneroId = (wallet as CryptonoteWallet).getTxPriorityMedium();
570571
break;
571572
case FeeRateType.slow:
572-
specialMoneroId = csMonero.getTxPriorityNormal();
573+
specialMoneroId = (wallet as CryptonoteWallet).getTxPriorityNormal();
573574
break;
574575
default:
575576
throw ArgumentError("custom fee not available for monero");

lib/pages/send_view/sub_widgets/transaction_fee_selection_sheet.dart

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,13 @@ import '../../../utilities/enums/fee_rate_type_enum.dart';
2323
import '../../../utilities/logger.dart';
2424
import '../../../utilities/text_styles.dart';
2525
import '../../../wallets/crypto_currency/crypto_currency.dart';
26+
import '../../../wallets/crypto_currency/intermediate/cryptonote_currency.dart';
2627
import '../../../wallets/isar/providers/eth/current_token_wallet_provider.dart';
2728
import '../../../wallets/isar/providers/wallet_info_provider.dart';
2829
import '../../../wallets/wallet/impl/firo_wallet.dart';
30+
import '../../../wallets/wallet/intermediate/cryptonote_wallet.dart';
2931
import '../../../wallets/wallet/wallet_mixin_interfaces/electrumx_interface.dart';
3032
import '../../../widgets/animated_text.dart';
31-
import '../../../wl_gen/interfaces/cs_monero_interface.dart';
3233

3334
final feeSheetSessionCacheProvider =
3435
ChangeNotifierProvider<FeeSheetSessionCache>((ref) {
@@ -88,10 +89,10 @@ class _TransactionFeeSelectionSheetState
8889
if (widget.isToken == false) {
8990
final wallet = ref.read(pWallets).getWallet(walletId);
9091

91-
if (coin is Monero || coin is Wownero) {
92+
if (coin is CryptonoteCurrency) {
9293
final fee = await wallet.estimateFeeFor(
9394
amount,
94-
BigInt.from(csMonero.getTxPriorityHigh()),
95+
BigInt.from((wallet as CryptonoteWallet).getTxPriorityHigh()),
9596
);
9697
ref.read(feeSheetSessionCacheProvider).fast[amount] = fee;
9798
} else if (coin is Firo) {
@@ -125,10 +126,10 @@ class _TransactionFeeSelectionSheetState
125126
if (ref.read(feeSheetSessionCacheProvider).average[amount] == null) {
126127
if (widget.isToken == false) {
127128
final wallet = ref.read(pWallets).getWallet(walletId);
128-
if (coin is Monero || coin is Wownero) {
129+
if (coin is CryptonoteCurrency) {
129130
final fee = await wallet.estimateFeeFor(
130131
amount,
131-
BigInt.from(csMonero.getTxPriorityMedium()),
132+
BigInt.from((wallet as CryptonoteWallet).getTxPriorityMedium()),
132133
);
133134
ref.read(feeSheetSessionCacheProvider).average[amount] = fee;
134135
} else if (coin is Firo) {
@@ -161,10 +162,10 @@ class _TransactionFeeSelectionSheetState
161162
if (ref.read(feeSheetSessionCacheProvider).slow[amount] == null) {
162163
if (widget.isToken == false) {
163164
final wallet = ref.read(pWallets).getWallet(walletId);
164-
if (coin is Monero || coin is Wownero) {
165+
if (coin is CryptonoteCurrency) {
165166
final fee = await wallet.estimateFeeFor(
166167
amount,
167-
BigInt.from(csMonero.getTxPriorityNormal()),
168+
BigInt.from((wallet as CryptonoteWallet).getTxPriorityNormal()),
168169
);
169170
ref.read(feeSheetSessionCacheProvider).slow[amount] = fee;
170171
} else if (coin is Firo) {

0 commit comments

Comments
 (0)