Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

concurrent xmr/wow wallets & coin control #999

Merged
merged 6 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crypto_plugins/flutter_libmonero
Submodule flutter_libmonero updated 52 files
+1 −1 cw_core/lib/account.dart
+12 −0 cw_core/lib/sub_address.dart
+6 −0 cw_core/lib/sub_address_info_meta_data.dart
+12 −12 cw_core/lib/subaddress.dart
+32 −0 cw_core/lib/utxo.dart
+20 −9 cw_core/lib/wallet_base.dart
+1 −1 cw_core/lib/wallet_service.dart
+94 −86 cw_core/pubspec.lock
+0 −76 cw_monero/lib/api/account_list.dart
+0 −92 cw_monero/lib/api/subaddress_list.dart
+11 −220 cw_monero/lib/api/transaction_history.dart
+588 −216 cw_monero/lib/api/wallet.dart
+319 −292 cw_monero/lib/api/wallet_manager.dart
+9 −7 cw_monero/lib/monero_account_list.dart
+16 −13 cw_monero/lib/monero_subaddress_list.dart
+11 −8 cw_monero/lib/monero_transaction_info.dart
+189 −72 cw_monero/lib/monero_wallet.dart
+11 −6 cw_monero/lib/monero_wallet_addresses.dart
+25 −12 cw_monero/lib/monero_wallet_service.dart
+0 −1,693 cw_monero/lib/mymonero.dart
+5 −4 cw_monero/lib/pending_monero_transaction.dart
+0 −76 cw_wownero/lib/api/account_list.dart
+0 −92 cw_wownero/lib/api/subaddress_list.dart
+11 −223 cw_wownero/lib/api/transaction_history.dart
+619 −239 cw_wownero/lib/api/wallet.dart
+310 −272 cw_wownero/lib/api/wallet_manager.dart
+5 −4 cw_wownero/lib/pending_wownero_transaction.dart
+8 −7 cw_wownero/lib/wownero_account_list.dart
+24 −16 cw_wownero/lib/wownero_subaddress_list.dart
+8 −5 cw_wownero/lib/wownero_transaction_info.dart
+202 −86 cw_wownero/lib/wownero_wallet.dart
+10 −6 cw_wownero/lib/wownero_wallet_addresses.dart
+24 −12 cw_wownero/lib/wownero_wallet_service.dart
+7 −9 example/lib/main.dart
+85 −85 example/pubspec.lock
+2 −5 lib/core/key_service.dart
+31 −25 lib/core/wallet_creation_service.dart
+4 −36 lib/entities/parsed_address.dart
+2 −32 lib/entities/secret_store_key.dart
+38 −22 lib/monero/cw_monero.dart
+24 −39 lib/monero/monero.dart
+0 −11 lib/utils/language_list.dart
+0 −3 lib/utils/list_item.dart
+0 −5 lib/utils/list_section.dart
+0 −165 lib/utils/mobx.dart
+3 −90 lib/view_model/send/output.dart
+0 −230 lib/view_model/send/output.g.dart
+12 −21 lib/wownero/cw_wownero.dart
+4 −17 lib/wownero/wownero.dart
+85 −85 pubspec.lock
+1 −2 pubspec.yaml
+1 −1 scripts/prepare_moneroc.sh
5 changes: 0 additions & 5 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ import 'package:cw_core/wallet_info.dart';
import 'package:cw_core/wallet_type.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_libmonero/monero/monero.dart';
import 'package:flutter_libmonero/wownero/wownero.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:google_fonts/google_fonts.dart';
Expand Down Expand Up @@ -237,9 +235,6 @@ void main(List<String> args) async {
}
}

monero.onStartup();
wownero.onStartup();

// SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,
// overlays: [SystemUiOverlay.bottom]);
unawaited(NotificationApi.init());
Expand Down
15 changes: 15 additions & 0 deletions lib/models/isar/models/blockchain_data/utxo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*
*/

import 'dart:convert';
import 'dart:math';

import 'package:isar/isar.dart';
Expand Down Expand Up @@ -84,6 +85,20 @@ class UTXO {
return confirmations >= minimumConfirms;
}

@ignore
String? get keyImage {
if (otherData == null) {
return null;
}

try {
final map = jsonDecode(otherData!) as Map;
return map["keyImage"] as String;
} catch (_) {
return null;
}
}

UTXO copyWith({
Id? id,
String? walletId,
Expand Down
18 changes: 17 additions & 1 deletion lib/pages/add_wallet_views/add_wallet_view/add_wallet_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class _AddWalletViewState extends ConsumerState<AddWalletView> {
...AppConfig.coins.where((e) => e.network == CryptoCurrencyNetwork.main),
];
final List<AddWalletListEntity> coinEntities = [];
final List<AddWalletListEntity> coinTestnetEntities = [];
final List<EthTokenEntity> tokenEntities = [];

final bool isDesktop = Util.isDesktop;
Expand Down Expand Up @@ -139,7 +140,7 @@ class _AddWalletViewState extends ConsumerState<AddWalletView> {
coinEntities.addAll(_coins.map((e) => CoinEntity(e)));

if (ref.read(prefsChangeNotifierProvider).showTestNetCoins) {
coinEntities.addAll(_coinsTestnet.map((e) => CoinEntity(e)));
coinTestnetEntities.addAll(_coinsTestnet.map((e) => CoinEntity(e)));
}

if (AppConfig.coins.whereType<Ethereum>().isNotEmpty) {
Expand Down Expand Up @@ -286,6 +287,14 @@ class _AddWalletViewState extends ConsumerState<AddWalletView> {
initialState: ExpandableState.expanded,
animationDurationMultiplier: 0.5,
),
if (coinTestnetEntities.isNotEmpty)
ExpandingSubListItem(
title: "Testnet",
entities:
filter(_searchTerm, coinTestnetEntities),
initialState: ExpandableState.expanded,
animationDurationMultiplier: 0.5,
),
if (tokenEntities.isNotEmpty)
ExpandingSubListItem(
title: "Tokens",
Expand Down Expand Up @@ -419,6 +428,13 @@ class _AddWalletViewState extends ConsumerState<AddWalletView> {
entities: filter(_searchTerm, coinEntities),
initialState: ExpandableState.expanded,
),
if (coinTestnetEntities.isNotEmpty)
ExpandingSubListItem(
title: "Testnet",
entities:
filter(_searchTerm, coinTestnetEntities),
initialState: ExpandableState.expanded,
),
if (tokenEntities.isNotEmpty)
ExpandingSubListItem(
title: "Tokens",
Expand Down
3 changes: 2 additions & 1 deletion lib/pages/coin_control/utxo_details_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:isar/isar.dart';

import '../../db/isar/main_db.dart';
import '../../models/isar/models/isar_models.dart';
import '../wallet_view/transaction_views/transaction_details_view.dart';
import '../../providers/global/wallets_provider.dart';
import '../../themes/stack_colors.dart';
import '../../utilities/amount/amount.dart';
Expand All @@ -33,6 +33,7 @@ import '../../widgets/desktop/desktop_dialog_close_button.dart';
import '../../widgets/desktop/secondary_button.dart';
import '../../widgets/icon_widgets/utxo_status_icon.dart';
import '../../widgets/rounded_container.dart';
import '../wallet_view/transaction_views/transaction_details_view.dart';

class UtxoDetailsView extends ConsumerStatefulWidget {
const UtxoDetailsView({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,20 @@
*
*/

import 'package:flutter/foundation.dart';

import '../../../../utilities/logger.dart';

class UpdatedInBackgroundEvent {
String message;
String walletId;

UpdatedInBackgroundEvent(this.message, this.walletId) {
Logging.instance.log(
"UpdatedInBackgroundEvent fired with message: $message",
level: LogLevel.Info,
);
if (kDebugMode) {
Logging.instance.log(
"UpdatedInBackgroundEvent fired with message: $message",
level: LogLevel.Info,
);
}
}
}
4 changes: 2 additions & 2 deletions lib/wallets/crypto_currency/coins/wownero.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:cw_wownero/api/wallet.dart' as wownero_wallet;
import 'package:monero/wownero.dart' as wownero;

import '../../../models/node_model.dart';
import '../../../utilities/default_nodes.dart';
Expand Down Expand Up @@ -48,7 +48,7 @@ class Wownero extends CryptonoteCurrency {

@override
bool validateAddress(String address) {
return wownero_wallet.addressValid(address);
return wownero.Wallet_addressValid(address, 0);
}

@override
Expand Down
Loading
Loading