complete wownero flow (app side)

This commit is contained in:
OmarHatem 2024-06-09 01:39:42 +02:00
parent 2f2e7ed1af
commit fed6004348
27 changed files with 232 additions and 161 deletions

Binary file not shown.

After

(image error) Size: 49 KiB

Binary file not shown.

After

(image error) Size: 49 KiB

View file

@ -0,0 +1,12 @@
-
uri: node3.monerodevs.org:34568
is_default: true
useSSL: false
-
uri: node2.monerodevs.org:34568
is_default: false
useSSL: false
-
uri: node.monerodevs.org:34568
is_default: false
useSSL: false

View file

@ -78,17 +78,17 @@ class WowneroWalletService extends WalletService<
try {
final path = await pathForWallet(name: credentials.name, type: getType());
if (credentials.isPolyseed) {
final polyseed = Polyseed.create();
final lang = PolyseedLang.getByEnglishName(credentials.language);
final heightOverride =
getWowneroHeightByDate(date: DateTime.now().subtract(Duration(days: 2)));
return _restoreFromPolyseed(
path, credentials.password!, polyseed, credentials.walletInfo!, lang,
overrideHeight: heightOverride);
}
// if (credentials.isPolyseed) {
// final polyseed = Polyseed.create();
// final lang = PolyseedLang.getByEnglishName(credentials.language);
//
// final heightOverride =
// getWowneroHeightByDate(date: DateTime.now().subtract(Duration(days: 2)));
//
// return _restoreFromPolyseed(
// path, credentials.password!, polyseed, credentials.walletInfo!, lang,
// overrideHeight: heightOverride);
// }
await wownero_wallet_manager.createWallet(
path: path, password: credentials.password!, language: credentials.language);
@ -256,9 +256,9 @@ class WowneroWalletService extends WalletService<
Future<WowneroWallet> restoreFromSeed(WowneroRestoreWalletFromSeedCredentials credentials,
{bool? isTestnet}) async {
// Restore from Polyseed
if (Polyseed.isValidSeed(credentials.mnemonic)) {
return restoreFromPolyseed(credentials);
}
// if (Polyseed.isValidSeed(credentials.mnemonic)) {
// return restoreFromPolyseed(credentials);
// }
try {
final path = await pathForWallet(name: credentials.name, type: getType());
@ -279,47 +279,48 @@ class WowneroWalletService extends WalletService<
}
}
Future<WowneroWallet> restoreFromPolyseed(
WowneroRestoreWalletFromSeedCredentials credentials) async {
try {
final path = await pathForWallet(name: credentials.name, type: getType());
final polyseedCoin = PolyseedCoin.POLYSEED_WOWNERO;
final lang = PolyseedLang.getByPhrase(credentials.mnemonic);
final polyseed = Polyseed.decode(credentials.mnemonic, lang, polyseedCoin);
return _restoreFromPolyseed(
path, credentials.password!, polyseed, credentials.walletInfo!, lang);
} catch (e) {
// TODO: Implement Exception for wallet list service.
print('WowneroWalletsManager Error: $e');
rethrow;
}
}
Future<WowneroWallet> _restoreFromPolyseed(
String path, String password, Polyseed polyseed, WalletInfo walletInfo, PolyseedLang lang,
{PolyseedCoin coin = PolyseedCoin.POLYSEED_WOWNERO, int? overrideHeight}) async {
final height = overrideHeight ??
getWowneroHeightByDate(date: DateTime.fromMillisecondsSinceEpoch(polyseed.birthday * 1000));
final spendKey = polyseed.generateKey(coin, 32).toHexString();
final seed = polyseed.encode(lang, coin);
walletInfo.isRecovery = true;
walletInfo.restoreHeight = height;
await wownero_wallet_manager.restoreFromSpendKey(
path: path,
password: password,
seed: seed,
language: lang.nameEnglish,
restoreHeight: height,
spendKey: spendKey);
final wallet = WowneroWallet(walletInfo: walletInfo, unspentCoinsInfo: unspentCoinsInfoSource);
await wallet.init();
return wallet;
}
// TODO: enable when polyseed package supports wownero
// Future<WowneroWallet> restoreFromPolyseed(
// WowneroRestoreWalletFromSeedCredentials credentials) async {
// try {
// final path = await pathForWallet(name: credentials.name, type: getType());
// final polyseedCoin = PolyseedCoin.POLYSEED_WOWNERO;
// final lang = PolyseedLang.getByPhrase(credentials.mnemonic);
// final polyseed = Polyseed.decode(credentials.mnemonic, lang, polyseedCoin);
//
// return _restoreFromPolyseed(
// path, credentials.password!, polyseed, credentials.walletInfo!, lang);
// } catch (e) {
// // TODO: Implement Exception for wallet list service.
// print('WowneroWalletsManager Error: $e');
// rethrow;
// }
// }
//
// Future<WowneroWallet> _restoreFromPolyseed(
// String path, String password, Polyseed polyseed, WalletInfo walletInfo, PolyseedLang lang,
// {PolyseedCoin coin = PolyseedCoin.POLYSEED_WOWNERO, int? overrideHeight}) async {
// final height = overrideHeight ??
// getWowneroHeightByDate(date: DateTime.fromMillisecondsSinceEpoch(polyseed.birthday * 1000));
// final spendKey = polyseed.generateKey(coin, 32).toHexString();
// final seed = polyseed.encode(lang, coin);
//
// walletInfo.isRecovery = true;
// walletInfo.restoreHeight = height;
//
// await wownero_wallet_manager.restoreFromSpendKey(
// path: path,
// password: password,
// seed: seed,
// language: lang.nameEnglish,
// restoreHeight: height,
// spendKey: spendKey);
//
// final wallet = WowneroWallet(walletInfo: walletInfo, unspentCoinsInfo: unspentCoinsInfoSource);
// await wallet.init();
//
// return wallet;
// }
Future<void> repairOldAndroidWallet(String name) async {
try {

View file

@ -8,59 +8,6 @@ PODS:
- Flutter
- ReachabilitySwift
- CryptoSwift (1.8.1)
- cw_haven (0.0.1):
- cw_haven/Boost (= 0.0.1)
- cw_haven/Haven (= 0.0.1)
- cw_haven/OpenSSL (= 0.0.1)
- cw_haven/Sodium (= 0.0.1)
- cw_shared_external
- Flutter
- cw_haven/Boost (0.0.1):
- cw_shared_external
- Flutter
- cw_haven/Haven (0.0.1):
- cw_shared_external
- Flutter
- cw_haven/OpenSSL (0.0.1):
- cw_shared_external
- Flutter
- cw_haven/Sodium (0.0.1):
- cw_shared_external
- Flutter
- cw_monero (0.0.2):
- cw_monero/Boost (= 0.0.2)
- cw_monero/Monero (= 0.0.2)
- cw_monero/OpenSSL (= 0.0.2)
- cw_monero/Sodium (= 0.0.2)
- cw_monero/Unbound (= 0.0.2)
- cw_shared_external
- Flutter
- cw_monero/Boost (0.0.2):
- cw_shared_external
- Flutter
- cw_monero/Monero (0.0.2):
- cw_shared_external
- Flutter
- cw_monero/OpenSSL (0.0.2):
- cw_shared_external
- Flutter
- cw_monero/Sodium (0.0.2):
- cw_shared_external
- Flutter
- cw_monero/Unbound (0.0.2):
- cw_shared_external
- Flutter
- cw_shared_external (0.0.1):
- cw_shared_external/Boost (= 0.0.1)
- cw_shared_external/OpenSSL (= 0.0.1)
- cw_shared_external/Sodium (= 0.0.1)
- Flutter
- cw_shared_external/Boost (0.0.1):
- Flutter
- cw_shared_external/OpenSSL (0.0.1):
- Flutter
- cw_shared_external/Sodium (0.0.1):
- Flutter
- device_display_brightness (0.0.1):
- Flutter
- device_info_plus (0.0.1):
@ -168,9 +115,6 @@ DEPENDENCIES:
- barcode_scan2 (from `.symlinks/plugins/barcode_scan2/ios`)
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`)
- CryptoSwift
- cw_haven (from `.symlinks/plugins/cw_haven/ios`)
- cw_monero (from `.symlinks/plugins/cw_monero/ios`)
- cw_shared_external (from `.symlinks/plugins/cw_shared_external/ios`)
- device_display_brightness (from `.symlinks/plugins/device_display_brightness/ios`)
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
- devicelocale (from `.symlinks/plugins/devicelocale/ios`)
@ -218,12 +162,6 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/barcode_scan2/ios"
connectivity_plus:
:path: ".symlinks/plugins/connectivity_plus/ios"
cw_haven:
:path: ".symlinks/plugins/cw_haven/ios"
cw_monero:
:path: ".symlinks/plugins/cw_monero/ios"
cw_shared_external:
:path: ".symlinks/plugins/cw_shared_external/ios"
device_display_brightness:
:path: ".symlinks/plugins/device_display_brightness/ios"
device_info_plus:
@ -278,9 +216,6 @@ SPEC CHECKSUMS:
BigInt: f668a80089607f521586bbe29513d708491ef2f7
connectivity_plus: bf0076dd84a130856aa636df1c71ccaff908fa1d
CryptoSwift: b9c701d6f5011df23794dbf7f2e480a77835d83d
cw_haven: b3e54e1fbe7b8e6fda57a93206bc38f8e89b898a
cw_monero: 4cf3b96f2da8e95e2ef7d6703dd4d2c509127b7d
cw_shared_external: 2972d872b8917603478117c9957dfca611845a92
device_display_brightness: 1510e72c567a1f6ce6ffe393dcd9afd1426034f7
device_info_plus: c6fb39579d0f423935b0c9ce7ee2f44b71b9fce6
devicelocale: b22617f40038496deffba44747101255cee005b0

View file

@ -6,6 +6,7 @@ import 'package:cake_wallet/entities/mnemonic_item.dart';
import 'package:cake_wallet/polygon/polygon.dart';
import 'package:cake_wallet/solana/solana.dart';
import 'package:cake_wallet/tron/tron.dart';
import 'package:cake_wallet/wownero/wownero.dart';
import 'package:cw_core/wallet_type.dart';
import 'package:cake_wallet/monero/monero.dart';
import 'package:cake_wallet/nano/nano.dart';
@ -43,7 +44,9 @@ class SeedValidator extends Validator<MnemonicItem> {
return solana!.getSolanaWordList(language);
case WalletType.tron:
return tron!.getTronWordList(language);
default:
case WalletType.wownero:
return wownero!.getWowneroWordList(language);
case WalletType.none:
return [];
}
}

View file

@ -215,6 +215,7 @@ import 'package:cake_wallet/view_model/wallet_list/wallet_list_view_model.dart';
import 'package:cake_wallet/view_model/wallet_new_vm.dart';
import 'package:cake_wallet/view_model/wallet_restore_view_model.dart';
import 'package:cake_wallet/view_model/wallet_seed_view_model.dart';
import 'package:cake_wallet/wownero/wownero.dart';
import 'package:cw_core/crypto_currency.dart';
import 'package:cw_core/receive_page_option.dart';
import 'package:cw_core/wallet_info.dart';
@ -900,6 +901,7 @@ Future<void> setup({
return bitcoinCash!
.createBitcoinCashWalletService(_walletInfoSource, _unspentCoinsInfoSource);
case WalletType.nano:
case WalletType.banano:
return nano!.createNanoWalletService(_walletInfoSource);
case WalletType.polygon:
return polygon!.createPolygonWalletService(_walletInfoSource);
@ -907,7 +909,9 @@ Future<void> setup({
return solana!.createSolanaWalletService(_walletInfoSource);
case WalletType.tron:
return tron!.createTronWalletService(_walletInfoSource);
default:
case WalletType.wownero:
return wownero!.createWowneroWalletService(_walletInfoSource, _unspentCoinsInfoSource);
case WalletType.none:
throw Exception('Unexpected token: ${param1.toString()} for generating of WalletService');
}
});

View file

@ -39,6 +39,7 @@ const nanoDefaultPowNodeUri = 'rpc.nano.to';
const solanaDefaultNodeUri = 'rpc.ankr.com';
const tronDefaultNodeUri = 'tron-rpc.publicnode.com:443';
const newCakeWalletBitcoinUri = 'btc-electrum.cakewallet.com:50002';
const wowneroDefaultNodeUri = 'node3.monerodevs.org:34568';
Future<void> defaultSettingsMigration(
{required int version,
@ -487,6 +488,11 @@ Node? getTronDefaultNode({required Box<Node> nodes}) {
nodes.values.firstWhereOrNull((node) => node.type == WalletType.tron);
}
Node? getWowneroDefaultNode({required Box<Node> nodes}) {
return nodes.values.firstWhereOrNull((Node node) => node.uriRaw == wowneroDefaultNodeUri) ??
nodes.values.firstWhereOrNull((node) => node.type == WalletType.wownero);
}
Future<void> insecureStorageMigration({
required SharedPreferences sharedPreferences,
required SecureStorage secureStorage,
@ -841,6 +847,7 @@ Future<void> checkCurrentNodes(
sharedPreferences.getInt(PreferencesKey.currentBitcoinCashNodeIdKey);
final currentSolanaNodeId = sharedPreferences.getInt(PreferencesKey.currentSolanaNodeIdKey);
final currentTronNodeId = sharedPreferences.getInt(PreferencesKey.currentTronNodeIdKey);
final currentWowneroNodeId = sharedPreferences.getInt(PreferencesKey.currentWowneroNodeIdKey);
final currentMoneroNode =
nodeSource.values.firstWhereOrNull((node) => node.key == currentMoneroNodeId);
final currentBitcoinElectrumServer =
@ -863,6 +870,8 @@ Future<void> checkCurrentNodes(
nodeSource.values.firstWhereOrNull((node) => node.key == currentSolanaNodeId);
final currentTronNodeServer =
nodeSource.values.firstWhereOrNull((node) => node.key == currentTronNodeId);
final currentWowneroNodeServer =
nodeSource.values.firstWhereOrNull((node) => node.key == currentWowneroNodeId);
if (currentMoneroNode == null) {
final newCakeWalletNode = Node(uri: newCakeWalletMoneroUri, type: WalletType.monero);
await nodeSource.add(newCakeWalletNode);
@ -940,6 +949,12 @@ Future<void> checkCurrentNodes(
await nodeSource.add(node);
await sharedPreferences.setInt(PreferencesKey.currentTronNodeIdKey, node.key as int);
}
if (currentWowneroNodeServer == null) {
final node = Node(uri: wowneroDefaultNodeUri, type: WalletType.wownero);
await nodeSource.add(node);
await sharedPreferences.setInt(PreferencesKey.currentWowneroNodeIdKey, node.key as int);
}
}
Future<void> resetBitcoinElectrumServer(

View file

@ -15,6 +15,7 @@ class PreferencesKey {
static const currentBitcoinCashNodeIdKey = 'current_node_id_bch';
static const currentSolanaNodeIdKey = 'current_node_id_sol';
static const currentTronNodeIdKey = 'current_node_id_trx';
static const currentWowneroNodeIdKey = 'current_node_id_wow';
static const currentTransactionPriorityKeyLegacy = 'current_fee_priority';
static const currentBalanceDisplayModeKey = 'current_balance_display_mode';
static const shouldSaveRecipientAddressKey = 'save_recipient_address';

View file

@ -40,6 +40,7 @@ class _DesktopWalletSelectionDropDownState extends State<DesktopWalletSelectionD
final bananoIcon = Image.asset('assets/images/nano_icon.png', height: 24, width: 24);
final solanaIcon = Image.asset('assets/images/sol_icon.png', height: 24, width: 24);
final tronIcon = Image.asset('assets/images/trx_icon.png', height: 24, width: 24);
final wowneroIcon = Image.asset('assets/images/wownero_icon.png', height: 24, width: 24);
final nonWalletTypeIcon = Image.asset('assets/images/close.png', height: 24, width: 24);
Image _newWalletImage(BuildContext context) => Image.asset(

View file

@ -36,7 +36,8 @@ class MenuWidgetState extends State<MenuWidget> {
this.bitcoinCashIcon = Image.asset('assets/images/bch_icon.png'),
this.polygonIcon = Image.asset('assets/images/matic_icon.png'),
this.solanaIcon = Image.asset('assets/images/sol_icon.png'),
this.tronIcon = Image.asset('assets/images/trx_icon.png');
this.tronIcon = Image.asset('assets/images/trx_icon.png'),
this.wowneroIcon = Image.asset('assets/images/wownero_icon.png');
final largeScreen = 731;
@ -60,6 +61,7 @@ class MenuWidgetState extends State<MenuWidget> {
Image polygonIcon;
Image solanaIcon;
Image tronIcon;
Image wowneroIcon;
@override
void initState() {
@ -236,6 +238,8 @@ class MenuWidgetState extends State<MenuWidget> {
return solanaIcon;
case WalletType.tron:
return tronIcon;
case WalletType.wownero:
return wowneroIcon;
default:
throw Exception('No icon for ${type.toString()}');
}

View file

@ -106,6 +106,7 @@ class WalletListBodyState extends State<WalletListBody> {
final polygonIcon = Image.asset('assets/images/matic_icon.png', height: 24, width: 24);
final solanaIcon = Image.asset('assets/images/sol_icon.png', height: 24, width: 24);
final tronIcon = Image.asset('assets/images/trx_icon.png', height: 24, width: 24);
final wowneroIcon = Image.asset('assets/images/wownero_icon.png', height: 24, width: 24);
final scrollController = ScrollController();
final double tileHeight = 60;
Flushbar<void>? _progressBar;
@ -319,6 +320,7 @@ class WalletListBodyState extends State<WalletListBody> {
case WalletType.bitcoinCash:
return bitcoinCashIcon;
case WalletType.nano:
case WalletType.banano:
return nanoIcon;
case WalletType.polygon:
return polygonIcon;
@ -326,7 +328,9 @@ class WalletListBodyState extends State<WalletListBody> {
return solanaIcon;
case WalletType.tron:
return tronIcon;
default:
case WalletType.wownero:
return wowneroIcon;
case WalletType.none:
return nonWalletTypeIcon;
}
}

View file

@ -249,6 +249,7 @@ abstract class SettingsStoreBase with Store {
final String? key;
switch (change.key) {
case WalletType.monero:
case WalletType.wownero:
key = PreferencesKey.moneroTransactionPriority;
break;
case WalletType.bitcoin:
@ -902,6 +903,7 @@ abstract class SettingsStoreBase with Store {
final nanoPowNodeId = sharedPreferences.getInt(PreferencesKey.currentNanoPowNodeIdKey);
final solanaNodeId = sharedPreferences.getInt(PreferencesKey.currentSolanaNodeIdKey);
final tronNodeId = sharedPreferences.getInt(PreferencesKey.currentTronNodeIdKey);
final wowneroNodeId = sharedPreferences.getInt(PreferencesKey.currentWowneroNodeIdKey);
final moneroNode = nodeSource.get(nodeId);
final bitcoinElectrumServer = nodeSource.get(bitcoinElectrumServerId);
final litecoinElectrumServer = nodeSource.get(litecoinElectrumServerId);
@ -913,6 +915,7 @@ abstract class SettingsStoreBase with Store {
final nanoPowNode = powNodeSource.get(nanoPowNodeId);
final solanaNode = nodeSource.get(solanaNodeId);
final tronNode = nodeSource.get(tronNodeId);
final wowneroNode = nodeSource.get(wowneroNodeId);
final packageInfo = await PackageInfo.fromPlatform();
final deviceName = await _getDeviceName() ?? '';
final shouldShowYatPopup = sharedPreferences.getBool(PreferencesKey.shouldShowYatPopup) ?? true;
@ -979,6 +982,10 @@ abstract class SettingsStoreBase with Store {
nodes[WalletType.tron] = tronNode;
}
if (wowneroNode != null) {
nodes[WalletType.wownero] = wowneroNode;
}
final savedSyncMode = SyncMode.all.firstWhere((element) {
return element.type.index == (sharedPreferences.getInt(PreferencesKey.syncModeKey) ?? 0);
});
@ -1282,6 +1289,7 @@ abstract class SettingsStoreBase with Store {
final nanoNodeId = sharedPreferences.getInt(PreferencesKey.currentNanoNodeIdKey);
final solanaNodeId = sharedPreferences.getInt(PreferencesKey.currentSolanaNodeIdKey);
final tronNodeId = sharedPreferences.getInt(PreferencesKey.currentTronNodeIdKey);
final wowneroNodeId = sharedPreferences.getInt(PreferencesKey.currentWowneroNodeIdKey);
final moneroNode = nodeSource.get(nodeId);
final bitcoinElectrumServer = nodeSource.get(bitcoinElectrumServerId);
final litecoinElectrumServer = nodeSource.get(litecoinElectrumServerId);
@ -1292,6 +1300,7 @@ abstract class SettingsStoreBase with Store {
final nanoNode = nodeSource.get(nanoNodeId);
final solanaNode = nodeSource.get(solanaNodeId);
final tronNode = nodeSource.get(tronNodeId);
final wowneroNode = nodeSource.get(wowneroNodeId);
if (moneroNode != null) {
nodes[WalletType.monero] = moneroNode;
}
@ -1332,6 +1341,10 @@ abstract class SettingsStoreBase with Store {
nodes[WalletType.tron] = tronNode;
}
if (wowneroNode != null) {
nodes[WalletType.wownero] = wowneroNode;
}
// MIGRATED:
useTOTP2FA = await SecureKey.getBool(
@ -1465,6 +1478,9 @@ abstract class SettingsStoreBase with Store {
case WalletType.tron:
await _sharedPreferences.setInt(PreferencesKey.currentTronNodeIdKey, node.key as int);
break;
case WalletType.wownero:
await _sharedPreferences.setInt(PreferencesKey.currentWowneroNodeIdKey, node.key as int);
break;
default:
break;
}

View file

@ -7,6 +7,7 @@ import 'package:cake_wallet/polygon/polygon.dart';
import 'package:cake_wallet/reactions/wallet_connect.dart';
import 'package:cake_wallet/solana/solana.dart';
import 'package:cake_wallet/tron/tron.dart';
import 'package:cake_wallet/wownero/wownero.dart';
import 'package:cw_core/crypto_currency.dart';
import 'package:cw_core/transaction_direction.dart';
import 'package:cw_core/transaction_info.dart';
@ -108,6 +109,11 @@ class TransactionListItem extends ActionListItem with Keyable {
cryptoAmount: monero!.formatterMoneroAmountToDouble(amount: transaction.amount),
price: price);
break;
case WalletType.wownero:
amount = calculateFiatAmountRaw(
cryptoAmount: wownero!.formatterWowneroAmountToDouble(amount: transaction.amount),
price: price);
break;
case WalletType.bitcoin:
case WalletType.litecoin:
case WalletType.bitcoinCash:

View file

@ -287,6 +287,7 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with
bool get isLowFee {
switch (wallet.type) {
case WalletType.monero:
case WalletType.wownero:
case WalletType.haven:
return transactionPriority == monero!.getMoneroTransactionPrioritySlow();
case WalletType.bitcoin:
@ -670,6 +671,10 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with
depositCurrency = CryptoCurrency.nano;
receiveCurrency = CryptoCurrency.xmr;
break;
case WalletType.banano:
depositCurrency = CryptoCurrency.banano;
receiveCurrency = CryptoCurrency.xmr;
break;
case WalletType.polygon:
depositCurrency = CryptoCurrency.maticpoly;
receiveCurrency = CryptoCurrency.xmr;
@ -682,7 +687,11 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with
depositCurrency = CryptoCurrency.trx;
receiveCurrency = CryptoCurrency.xmr;
break;
default:
case WalletType.wownero:
depositCurrency = CryptoCurrency.wow;
receiveCurrency = CryptoCurrency.xmr;
break;
case WalletType.none:
break;
}
}
@ -755,6 +764,7 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with
switch (wallet.type) {
case WalletType.monero:
case WalletType.haven:
case WalletType.wownero:
_settingsStore.priority[wallet.type] = monero!.getMoneroTransactionPriorityAutomatic();
break;
case WalletType.bitcoin:

View file

@ -85,6 +85,9 @@ abstract class NodeListViewModelBase with Store {
case WalletType.tron:
node = getTronDefaultNode(nodes: _nodeSource)!;
break;
case WalletType.wownero:
node = getWowneroDefaultNode(nodes: _nodeSource)!;
break;
default:
throw Exception('Unexpected wallet type: ${_appStore.wallet!.type}');
}

View file

@ -7,6 +7,7 @@ import 'package:cake_wallet/solana/solana.dart';
import 'package:cake_wallet/tron/tron.dart';
import 'package:cake_wallet/view_model/restore/restore_mode.dart';
import 'package:cake_wallet/view_model/restore/restore_wallet.dart';
import 'package:cake_wallet/wownero/wownero.dart';
import 'package:hive/hive.dart';
import 'package:mobx/mobx.dart';
import 'package:cake_wallet/monero/monero.dart';
@ -137,6 +138,13 @@ abstract class WalletRestorationFromQRVMBase extends WalletCreationVM with Store
case WalletType.tron:
return tron!.createTronRestoreWalletFromSeedCredentials(
name: name, mnemonic: restoreWallet.mnemonicSeed ?? '', password: password);
case WalletType.wownero:
return wownero!.createWowneroRestoreWalletFromSeedCredentials(
name: name,
height: restoreWallet.height ?? 0,
mnemonic: restoreWallet.mnemonicSeed ?? '',
password: password,
);
default:
throw Exception('Unexpected type: ${type.toString()}');
}

View file

@ -9,6 +9,7 @@ import 'package:cake_wallet/reactions/wallet_connect.dart';
import 'package:cake_wallet/solana/solana.dart';
import 'package:cake_wallet/src/screens/send/widgets/extract_address_from_parsed.dart';
import 'package:cake_wallet/tron/tron.dart';
import 'package:cake_wallet/wownero/wownero.dart';
import 'package:cw_core/crypto_currency.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
@ -100,6 +101,9 @@ abstract class OutputBase with Store {
case WalletType.polygon:
_amount = polygon!.formatterPolygonParseAmount(_cryptoAmount);
break;
case WalletType.wownero:
_amount = wownero!.formatterWowneroParseAmount(amount: _cryptoAmount);
break;
default:
break;
}
@ -287,6 +291,9 @@ abstract class OutputBase with Store {
case WalletType.tron:
maximumFractionDigits = 12;
break;
case WalletType.wownero:
maximumFractionDigits = 11;
break;
default:
break;
}

View file

@ -16,6 +16,7 @@ import 'package:cake_wallet/tron/tron.dart';
import 'package:cake_wallet/view_model/contact_list/contact_list_view_model.dart';
import 'package:cake_wallet/view_model/dashboard/balance_view_model.dart';
import 'package:cake_wallet/view_model/hardware_wallet/ledger_view_model.dart';
import 'package:cake_wallet/wownero/wownero.dart';
import 'package:cw_core/exceptions.dart';
import 'package:cw_core/transaction_priority.dart';
import 'package:cake_wallet/view_model/send/output.dart';
@ -478,6 +479,10 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
return monero!
.createMoneroTransactionCreationCredentials(outputs: outputs, priority: priority!);
case WalletType.wownero:
return wownero!
.createWowneroTransactionCreationCredentials(outputs: outputs, priority: priority!);
case WalletType.haven:
return haven!.createHavenTransactionCreationCredentials(
outputs: outputs, priority: priority!, assetType: selectedCryptoCurrency.title);

View file

@ -75,6 +75,9 @@ abstract class TransactionDetailsViewModelBase with Store {
case WalletType.tron:
_addTronListItems(tx, dateFormat);
break;
case WalletType.wownero:
// _addWowneroListItems(tx, dateFormat);
break;
default:
break;
}

View file

@ -85,7 +85,9 @@ abstract class WalletCreationVMBase with Store {
getIt.get<BackgroundTasks>().registerSyncTask();
_appStore.authenticationStore.allowed();
state = ExecutedSuccessfullyState();
} catch (e) {
} catch (e, s) {
print("@@@@@@@@");
print(s);
state = FailureState(e.toString());
}
}

View file

@ -1,6 +1,7 @@
import 'package:cake_wallet/bitcoin/bitcoin.dart';
import 'package:cake_wallet/reactions/wallet_connect.dart';
import 'package:cake_wallet/store/app_store.dart';
import 'package:cake_wallet/wownero/wownero.dart';
import 'package:cw_core/transaction_direction.dart';
import 'package:cw_core/transaction_info.dart';
import 'package:cw_core/wallet_type.dart';
@ -33,7 +34,9 @@ abstract class WalletKeysViewModelBase with Store {
_populateItems();
});
if (_appStore.wallet!.type == WalletType.monero || _appStore.wallet!.type == WalletType.haven) {
if (_appStore.wallet!.type == WalletType.monero ||
_appStore.wallet!.type == WalletType.haven ||
_appStore.wallet!.type == WalletType.wownero) {
final accountTransactions = _getWalletTransactions(_appStore.wallet!);
if (accountTransactions.isNotEmpty) {
final incomingAccountTransactions =
@ -101,6 +104,22 @@ abstract class WalletKeysViewModelBase with Store {
]);
}
if (_appStore.wallet!.type == WalletType.wownero) {
final keys = wownero!.getKeys(_appStore.wallet!);
items.addAll([
if (keys['publicSpendKey'] != null)
StandartListItem(title: S.current.spend_key_public, value: keys['publicSpendKey']!),
if (keys['privateSpendKey'] != null)
StandartListItem(title: S.current.spend_key_private, value: keys['privateSpendKey']!),
if (keys['publicViewKey'] != null)
StandartListItem(title: S.current.view_key_public, value: keys['publicViewKey']!),
if (keys['privateViewKey'] != null)
StandartListItem(title: S.current.view_key_private, value: keys['privateViewKey']!),
StandartListItem(title: S.current.wallet_seed, value: _appStore.wallet!.seed!),
]);
}
if (_appStore.wallet!.type == WalletType.bitcoin ||
_appStore.wallet!.type == WalletType.litecoin ||
_appStore.wallet!.type == WalletType.bitcoinCash) {

View file

@ -2,6 +2,7 @@ import 'package:cake_wallet/ethereum/ethereum.dart';
import 'package:cake_wallet/bitcoin_cash/bitcoin_cash.dart';
import 'package:cake_wallet/solana/solana.dart';
import 'package:cake_wallet/tron/tron.dart';
import 'package:cake_wallet/wownero/wownero.dart';
import 'package:hive/hive.dart';
import 'package:mobx/mobx.dart';
import 'package:cake_wallet/monero/monero.dart';
@ -35,7 +36,8 @@ abstract class WalletNewVMBase extends WalletCreationVM with Store {
@observable
String selectedMnemonicLanguage;
bool get hasLanguageSelector => type == WalletType.monero || type == WalletType.haven;
bool get hasLanguageSelector =>
type == WalletType.monero || type == WalletType.haven || type == WalletType.wownero;
int get seedPhraseWordsLength {
switch (type) {
@ -76,6 +78,7 @@ abstract class WalletNewVMBase extends WalletCreationVM with Store {
case WalletType.bitcoinCash:
return bitcoinCash!.createBitcoinCashNewWalletCredentials(name: name);
case WalletType.nano:
case WalletType.banano:
return nano!.createNanoNewWalletCredentials(name: name);
case WalletType.polygon:
return polygon!.createPolygonNewWalletCredentials(name: name);
@ -83,7 +86,10 @@ abstract class WalletNewVMBase extends WalletCreationVM with Store {
return solana!.createSolanaNewWalletCredentials(name: name);
case WalletType.tron:
return tron!.createTronNewWalletCredentials(name: name);
default:
case WalletType.wownero:
return wownero!.createWowneroNewWalletCredentials(
name: name, language: options!.first as String, isPolyseed: options.last as bool);
case WalletType.none:
throw Exception('Unexpected type: ${type.toString()}');
}
}

View file

@ -2,7 +2,7 @@ import 'package:cake_wallet/bitcoin/bitcoin.dart';
import 'package:cake_wallet/di.dart';
import 'package:cake_wallet/nano/nano.dart';
import 'package:cake_wallet/ethereum/ethereum.dart';
import 'package:cw_core/nano_account_info_response.dart';
import 'package:cake_wallet/wownero/wownero.dart';
import 'package:cake_wallet/bitcoin_cash/bitcoin_cash.dart';
import 'package:cake_wallet/polygon/polygon.dart';
import 'package:cake_wallet/solana/solana.dart';
@ -136,6 +136,13 @@ abstract class WalletRestoreViewModelBase extends WalletCreationVM with Store {
mnemonic: seed,
password: password,
);
case WalletType.wownero:
return wownero!.createWowneroRestoreWalletFromSeedCredentials(
name: name,
mnemonic: seed,
password: password,
height: height,
);
default:
break;
}
@ -200,6 +207,16 @@ abstract class WalletRestoreViewModelBase extends WalletCreationVM with Store {
password: password,
privateKey: options['private_key'] as String,
);
case WalletType.wownero:
return wownero!.createWowneroRestoreWalletFromKeysCredentials(
name: name,
height: height,
spendKey: spendKey!,
viewKey: viewKey!,
address: address!,
password: password,
language: 'English',
);
default:
break;
}

View file

@ -1,13 +1,13 @@
#cd cw_core; flutter pub get; flutter packages pub run build_runner build --delete-conflicting-outputs; cd ..
#cd cw_evm; flutter pub get; flutter packages pub run build_runner build --delete-conflicting-outputs; cd ..
#cd cw_monero; flutter pub get; flutter packages pub run build_runner build --delete-conflicting-outputs; cd ..
#cd cw_bitcoin; flutter pub get; flutter packages pub run build_runner build --delete-conflicting-outputs; cd ..
#cd cw_haven; flutter pub get; flutter packages pub run build_runner build --delete-conflicting-outputs; cd ..
#cd cw_nano; flutter pub get; flutter packages pub run build_runner build --delete-conflicting-outputs; cd ..
#cd cw_bitcoin_cash; flutter pub get; flutter packages pub run build_runner build --delete-conflicting-outputs; cd ..
#cd cw_solana; flutter pub get; flutter packages pub run build_runner build --delete-conflicting-outputs; cd ..
#cd cw_tron; flutter pub get; flutter packages pub run build_runner build --delete-conflicting-outputs; cd ..
cd cw_core; flutter pub get; flutter packages pub run build_runner build --delete-conflicting-outputs; cd ..
cd cw_evm; flutter pub get; flutter packages pub run build_runner build --delete-conflicting-outputs; cd ..
cd cw_monero; flutter pub get; flutter packages pub run build_runner build --delete-conflicting-outputs; cd ..
cd cw_bitcoin; flutter pub get; flutter packages pub run build_runner build --delete-conflicting-outputs; cd ..
cd cw_haven; flutter pub get; flutter packages pub run build_runner build --delete-conflicting-outputs; cd ..
cd cw_nano; flutter pub get; flutter packages pub run build_runner build --delete-conflicting-outputs; cd ..
cd cw_bitcoin_cash; flutter pub get; flutter packages pub run build_runner build --delete-conflicting-outputs; cd ..
cd cw_solana; flutter pub get; flutter packages pub run build_runner build --delete-conflicting-outputs; cd ..
cd cw_tron; flutter pub get; flutter packages pub run build_runner build --delete-conflicting-outputs; cd ..
cd cw_wownero; flutter pub get; flutter packages pub run build_runner build --delete-conflicting-outputs; cd ..
#cd cw_polygon; flutter pub get; cd ..
#cd cw_ethereum; flutter pub get; cd ..
#flutter packages pub run build_runner build --delete-conflicting-outputs
cd cw_polygon; flutter pub get; cd ..
cd cw_ethereum; flutter pub get; cd ..
flutter packages pub run build_runner build --delete-conflicting-outputs

View file

@ -165,6 +165,7 @@ flutter:
- assets/polygon_node_list.yml
- assets/solana_node_list.yml
- assets/tron_node_list.yml
- assets/wownero_node_list.yml
- assets/text/
- assets/faq/
- assets/animation/

View file

@ -16,24 +16,12 @@ NPROC="-j$(sysctl -n hw.logicalcpu)"
../prepare_moneroc.sh
# NOTE: -j1 is intentional. Otherwise you will run into weird behaviour on macos
if [[ ! "x$USE_DOCKER" == "x" ]];
then
for COIN in monero wownero;
do
pushd ../monero_c
echo "unsupported!"
exit 1
popd
done
else
for COIN in monero;
do
pushd ../monero_c
./build_single.sh ${COIN} host-apple-ios $NPROC
popd
done
fi
for COIN in monero wownero;
do
pushd ../monero_c
./build_single.sh ${COIN} host-apple-ios $NPROC
popd
done
unxz -f ../monero_c/release/monero/host-apple-ios_libwallet2_api_c.dylib.xz
# unxz -f ../monero_c/release/wownero/host-apple-ios_libwallet2_api_c.dylib.xz
unxz -f ../monero_c/release/wownero/host-apple-ios_libwallet2_api_c.dylib.xz