Cw 660 add ledger monero (#1747)

* Fix conflicts with main

* fix for multiple wallets

* Add tron to windows application configuration.

* Add macOS option for description message in configure_cake_wallet.sh

* Include missed monero dll for windows.

* fix conflicts with main

* Disable haven configuration for iOS as default. Add ability to configure cakewallet for iOS with  for configuration script. Remove cw_shared configuration for cw_monero.

* fix: scan fixes, add date, allow sending while scanning

* add missing nano secrets file [skip ci]

* ios library

* don't pull prebuilds android

* Add auto generation of manifest file for android project even for iOS, macOS, Windows.

* feat: sync fixes, sp settings

* feat: fix resyncing

* store crash fix

* make init async so it won't lag
disable print starts

* fix monero_c build issues

* libstdc++

* Fix MacOS saving wallet file issue
Fix Secure Storage issue (somehow)

* update pubspec.lock

* fix build script

* Use dylib as iOS framework. Use custom path for loading of iOS framework for monero.dart. Add script for generate iOS framework for monero wallet.

* fix: date from height logic, status disconnected & chain tip get

* fix: params

* feat: electrum migration if using cake electrum

* fix nodes
update versions

* re-enable tron

* update sp_scanner to work on iOS [skip ci]

* bump monero_c hash

* bump monero_c commit

* bump moneroc version

* bump monero_c commit

* Add ability to build monero wallet lib as universal lib. Update macOS build guide. Change default arch for macOS project to .

* fix: wrong socket for old electrum nodes

* Fix unchecked wallet type call

* get App Dir correctly in default_settings_migration.dart

* handle previous issue with fetching linux documents directory [skip ci]

* backup fix

* fix NTFS issues

* Close the wallet when the wallet gets changed

* fix: double balance

* feat: node domain

* fix: menu name

* bump monero_c commit

* fix: update tip on set scanning

* fix: connection switching back and forth

* feat: check if node is electrs, and supports sp

* chore: fix build

* minor enhancements

* fixes and enhancements

* solve conflicts with main

* Only stop wallet on rename and delete

* fix: status toggle

* minor enhancement

* Monero.com fixes

* bump monero_c commit

* update sp_scanner to include windows and linux

* Update macOS build guide. Change brew dependencies for build unbound locally.

* fix conflicts and update macos build guide

* remove build cache when on gh actions

* update secure storage

* free up even more storage

* free up more storage

* Add initial wownero

* fix conflicts

* fix workflow issue

* build wownero

* ios and windows changes

* macos

* complete wownero flow (app side)

* add keychain group entitlement and update script for RunnerBase on macos

* update secure_storage version to 8.1.0 in configure.dart

* add wownero framework

* update ios builds

* proper path for wownero and monero

* finalizing wownero

* finalizing wownero

* free up even more storage

* revert commenting of build gradle configs

* revert commenting of secrets [skip ci]

* free more storage

* minor fixes

* link android wownero libraries

* bump monero_c commit

* wownero fixes

* rename target

* build_single.sh using clean env

* bump monero_c commit

* minor fix

* Add wownero polyseed

* fix conflicts with main

* fix: wallet seed display
fix: wownero not refreshing

* fix: wallet seed display
fix: wownero not refreshing

* bump monero_c commit

* minor fixes

* fix: incorrectly displaying XMR instead of WOW

* fix: incorrect restore height in wownero

* bump monero_c commit

* Add Inno Setup Script for windows exe installer

* drop libc++_shared.so

* fixes from comments

* Fix CMake for windows

* Merge latest monero dart changes [skip ci]

* bump monero_c commit

* add wownero to build scripts for macos [skip ci]

* add 14 word seed support to wownero

* UI fixes for wownero seed restore

* minor fixes

* reformat code to pass lints

* Add debug ledger code

* Add Litecoin Hardware Wallet Creation

* Add Litecoin Hardware Wallet Creation

* Fix Bitcoin not sending on Ledger

* Fixes to sending LTC using Ledger

* CW-679 Fix merge conflicts

* CW-679 Fix merge conflicts

* CW-679 Minor fixes

* CW-679 Add derivation Path of change address

* Add create Monero Wallet from Ledger

* bug fix to create Monero Wallet from Ledger

* ledger flutter plus refactoring

* ledger flutter plus refactoring

* ledger flutter plus refactoring

* Ups :|

* Ups :| I forgot USB

* Handle BT Off

* Fix Issue with A14 and USB

* Small Ledger Quality of life improvements

* Small Ledger Quality of life improvements

* Small Ledger Quality of life improvements

* Small Ledger Quality of life improvements

* Small Ledger Quality of life improvements

* Small Ledger Quality of life improvements

* Small Ledger Quality of life improvements

* Pls work

* Pls work

* Pls work

* Pls work

* Fix overpopulation

* Fix ble device detection and support for Stax and Flex

* clean up pubspec

* clean up

* MWeb merge fix

* MWeb merge fix

* Migrate to Ledger Flutter Plus

* Add connect device page before loading the wallet (Only monero)

* Add connect device page before loading the wallet (Only monero)

* Fix merge error

* Fix merge error

* Fix merge error && Allow for wallet switching

* Please compile now

* Move monero/ledger.dart from monero_c to cw_monero

* Upgrade ledger_flutter_plus

* Add more popups if action on the device is needed.

* Update monero_c dependency hash

* Yay ledger monero is even more efficient and avoids memory leaks 🥳

* [skip-ci] more code

* Fix Minor Bug

* Fix Minor Bug

* Apply requested changes

* [skip ci] Apply requested changes

* Minor Cleanup

* Welp I'm dumb :/

* Implement requested changes

* Increase ledger refresh speed

* Add Monero Ledger keep connection alive

* Add Monero Ledger keep connection alive

---------

Co-authored-by: OmarHatem <omarh.ismail1@gmail.com>
Co-authored-by: Czarek Nakamoto <cyjan@mrcyjanek.net>
Co-authored-by: m <m@cakewallet.com>
Co-authored-by: Rafael Saes <git@rafael.saes.dev>
Co-authored-by: Matthew Fosse <matt@fosse.co>
This commit is contained in:
Konstantin Ullrich
2024-11-12 05:26:09 +02:00
committed by GitHub
co-authored by OmarHatem Czarek Nakamoto m Rafael Saes Matthew Fosse
parent e148f64508
commit 2c37e427e9
38 changed files with 2912 additions and 249 deletions
@@ -428,7 +428,7 @@ abstract class DashboardViewModelBase with Store {
// to not cause work duplication, this will do the job as well, it will be slightly less precise
// about what happened - but still enough.
// if (keys['privateSpendKey'] == List.generate(64, (index) => "0").join("")) "Private spend key is 0",
if (keys['privateViewKey'] == List.generate(64, (index) => "0").join(""))
if (keys['privateViewKey'] == List.generate(64, (index) => "0").join("") && !wallet.isHardwareWallet)
"private view key is 0",
// if (keys['publicSpendKey'] == List.generate(64, (index) => "0").join("")) "public spend key is 0",
if (keys['publicViewKey'] == List.generate(64, (index) => "0").join(""))
@@ -4,6 +4,7 @@ import 'dart:io';
import 'package:cake_wallet/bitcoin/bitcoin.dart';
import 'package:cake_wallet/ethereum/ethereum.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/monero/monero.dart';
import 'package:cake_wallet/polygon/polygon.dart';
import 'package:cake_wallet/utils/device_info.dart';
import 'package:cake_wallet/wallet_type_utils.dart';
@@ -114,6 +115,8 @@ abstract class LedgerViewModelBase with Store {
void setLedger(WalletBase wallet) {
switch (wallet.type) {
case WalletType.monero:
return monero!.setLedgerConnection(wallet, connection);
case WalletType.bitcoin:
case WalletType.litecoin:
return bitcoin!.setLedgerConnection(wallet, connection);
@@ -1,7 +1,9 @@
import 'package:cake_wallet/bitcoin/bitcoin.dart';
import 'package:cake_wallet/core/generate_wallet_password.dart';
import 'package:cake_wallet/core/wallet_creation_service.dart';
import 'package:cake_wallet/ethereum/ethereum.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/monero/monero.dart';
import 'package:cake_wallet/polygon/polygon.dart';
import 'package:cake_wallet/store/app_store.dart';
import 'package:cake_wallet/view_model/hardware_wallet/ledger_view_model.dart';
@@ -56,8 +58,8 @@ abstract class WalletHardwareRestoreViewModelBase extends WalletCreationVM with
List<HardwareAccountData> accounts;
switch (type) {
case WalletType.bitcoin:
accounts = await bitcoin!
.getHardwareWalletBitcoinAccounts(ledgerViewModel, index: _nextIndex, limit: limit);
accounts = await bitcoin!
.getHardwareWalletBitcoinAccounts(ledgerViewModel, index: _nextIndex, limit: limit);
break;
case WalletType.litecoin:
accounts = await bitcoin!
@@ -104,6 +106,15 @@ abstract class WalletHardwareRestoreViewModelBase extends WalletCreationVM with
case WalletType.polygon:
credentials = polygon!.createPolygonHardwareWalletCredentials(name: name, hwAccountData: selectedAccount!);
break;
case WalletType.monero:
final password = walletPassword ?? generateWalletPassword();
credentials = monero!.createMoneroRestoreWalletFromHardwareCredentials(
name: name,
ledgerConnection: ledgerViewModel.connection,
password: password,
height: _options['height'] as int? ?? 0,
);
default:
throw Exception('Unexpected type: ${type.toString()}');
}
@@ -68,6 +68,10 @@ abstract class WalletListViewModelBase with Store {
WalletType get currentWalletType => _appStore.wallet!.type;
bool requireHardwareWalletConnection(WalletListItem walletItem) =>
_walletLoadingService.requireHardwareWalletConnection(
walletItem.type, walletItem.name);
@action
Future<void> loadWallet(WalletListItem walletItem) async {
// bool switchingToSameWalletType = walletItem.type == _appStore.wallet?.type;
@@ -87,7 +91,8 @@ abstract class WalletListViewModelBase with Store {
singleWalletsList.clear();
wallets.addAll(
_walletInfoSource.values.map((info) => convertWalletInfoToWalletListItem(info)),
_walletInfoSource.values
.map((info) => convertWalletInfoToWalletListItem(info)),
);
//========== Split into shared seed groups and single wallets list
@@ -95,7 +100,8 @@ abstract class WalletListViewModelBase with Store {
for (var group in _walletManager.walletGroups) {
if (group.wallets.length == 1) {
singleWalletsList.add(convertWalletInfoToWalletListItem(group.wallets.first));
singleWalletsList
.add(convertWalletInfoToWalletListItem(group.wallets.first));
} else {
multiWalletGroups.add(group);
}
@@ -148,9 +154,11 @@ abstract class WalletListViewModelBase with Store {
List<WalletInfo> walletInfoSourceCopy = _walletInfoSource.values.toList();
await _walletInfoSource.clear();
if (ascending) {
walletInfoSourceCopy.sort((a, b) => a.type.toString().compareTo(b.type.toString()));
walletInfoSourceCopy
.sort((a, b) => a.type.toString().compareTo(b.type.toString()));
} else {
walletInfoSourceCopy.sort((a, b) => b.type.toString().compareTo(a.type.toString()));
walletInfoSourceCopy
.sort((a, b) => b.type.toString().compareTo(a.type.toString()));
}
await _walletInfoSource.addAll(walletInfoSourceCopy);
updateList();
@@ -213,7 +221,8 @@ abstract class WalletListViewModelBase with Store {
name: info.name,
type: info.type,
key: info.key,
isCurrent: info.name == _appStore.wallet?.name && info.type == _appStore.wallet?.type,
isCurrent: info.name == _appStore.wallet?.name &&
info.type == _appStore.wallet?.type,
isEnabled: availableWalletTypes.contains(info.type),
isTestnet: info.network?.toLowerCase().contains('testnet') ?? false,
);