mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-22 19:49:22 +00:00
minor fixes
This commit is contained in:
parent
0a47cb97c3
commit
361fff9eb8
6 changed files with 73 additions and 116 deletions
|
@ -19,9 +19,6 @@ import 'package:cw_core/wallet_base.dart';
|
||||||
import 'package:cw_core/wallet_info.dart';
|
import 'package:cw_core/wallet_info.dart';
|
||||||
import 'package:cw_core/wownero_amount_format.dart';
|
import 'package:cw_core/wownero_amount_format.dart';
|
||||||
import 'package:cw_core/wownero_balance.dart';
|
import 'package:cw_core/wownero_balance.dart';
|
||||||
import 'package:cw_core/wownero_amount_format.dart';
|
|
||||||
import 'package:cw_core/wownero_balance.dart';
|
|
||||||
import 'package:cw_wownero/api/account_list.dart';
|
|
||||||
import 'package:cw_wownero/api/coins_info.dart';
|
import 'package:cw_wownero/api/coins_info.dart';
|
||||||
import 'package:cw_wownero/api/structs/pending_transaction.dart';
|
import 'package:cw_wownero/api/structs/pending_transaction.dart';
|
||||||
import 'package:cw_wownero/api/transaction_history.dart' as transaction_history;
|
import 'package:cw_wownero/api/transaction_history.dart' as transaction_history;
|
||||||
|
@ -49,11 +46,11 @@ const MIN_RESTORE_HEIGHT = 1000;
|
||||||
|
|
||||||
class WowneroWallet = WowneroWalletBase with _$WowneroWallet;
|
class WowneroWallet = WowneroWalletBase with _$WowneroWallet;
|
||||||
|
|
||||||
abstract class WowneroWalletBase extends WalletBase<WowneroBalance,
|
abstract class WowneroWalletBase
|
||||||
WowneroTransactionHistory, WowneroTransactionInfo> with Store {
|
extends WalletBase<WowneroBalance, WowneroTransactionHistory, WowneroTransactionInfo>
|
||||||
|
with Store {
|
||||||
WowneroWalletBase(
|
WowneroWalletBase(
|
||||||
{required WalletInfo walletInfo,
|
{required WalletInfo walletInfo, required Box<UnspentCoinsInfo> unspentCoinsInfo})
|
||||||
required Box<UnspentCoinsInfo> unspentCoinsInfo})
|
|
||||||
: balance = ObservableMap<CryptoCurrency, WowneroBalance>.of({
|
: balance = ObservableMap<CryptoCurrency, WowneroBalance>.of({
|
||||||
CryptoCurrency.xmr: WowneroBalance(
|
CryptoCurrency.xmr: WowneroBalance(
|
||||||
fullBalance: wownero_wallet.getFullBalance(accountIndex: 0),
|
fullBalance: wownero_wallet.getFullBalance(accountIndex: 0),
|
||||||
|
@ -69,17 +66,13 @@ abstract class WowneroWalletBase extends WalletBase<WowneroBalance,
|
||||||
transactionHistory = WowneroTransactionHistory();
|
transactionHistory = WowneroTransactionHistory();
|
||||||
walletAddresses = WowneroWalletAddresses(walletInfo, transactionHistory);
|
walletAddresses = WowneroWalletAddresses(walletInfo, transactionHistory);
|
||||||
|
|
||||||
_onAccountChangeReaction =
|
_onAccountChangeReaction = reaction((_) => walletAddresses.account, (Account? account) {
|
||||||
reaction((_) => walletAddresses.account, (Account? account) {
|
|
||||||
if (account == null) return;
|
if (account == null) return;
|
||||||
|
|
||||||
balance = ObservableMap<CryptoCurrency,
|
balance = ObservableMap<CryptoCurrency, WowneroBalance>.of(<CryptoCurrency, WowneroBalance>{
|
||||||
WowneroBalance>.of(<CryptoCurrency, WowneroBalance>{
|
|
||||||
currency: WowneroBalance(
|
currency: WowneroBalance(
|
||||||
fullBalance:
|
fullBalance: wownero_wallet.getFullBalance(accountIndex: account.id),
|
||||||
wownero_wallet.getFullBalance(accountIndex: account.id),
|
unlockedBalance: wownero_wallet.getUnlockedBalance(accountIndex: account.id))
|
||||||
unlockedBalance:
|
|
||||||
wownero_wallet.getUnlockedBalance(accountIndex: account.id))
|
|
||||||
});
|
});
|
||||||
_updateSubAddress(isEnabledAutoGenerateSubaddress, account: account);
|
_updateSubAddress(isEnabledAutoGenerateSubaddress, account: account);
|
||||||
_askForUpdateTransactionHistory();
|
_askForUpdateTransactionHistory();
|
||||||
|
@ -134,13 +127,11 @@ abstract class WowneroWalletBase extends WalletBase<WowneroBalance,
|
||||||
|
|
||||||
Future<void> init() async {
|
Future<void> init() async {
|
||||||
await walletAddresses.init();
|
await walletAddresses.init();
|
||||||
balance = ObservableMap<CryptoCurrency, WowneroBalance>.of(<CryptoCurrency,
|
balance = ObservableMap<CryptoCurrency, WowneroBalance>.of(<CryptoCurrency, WowneroBalance>{
|
||||||
WowneroBalance>{
|
|
||||||
currency: WowneroBalance(
|
currency: WowneroBalance(
|
||||||
fullBalance: wownero_wallet.getFullBalance(
|
fullBalance: wownero_wallet.getFullBalance(accountIndex: walletAddresses.account!.id),
|
||||||
accountIndex: walletAddresses.account!.id),
|
unlockedBalance:
|
||||||
unlockedBalance: wownero_wallet.getUnlockedBalance(
|
wownero_wallet.getUnlockedBalance(accountIndex: walletAddresses.account!.id))
|
||||||
accountIndex: walletAddresses.account!.id))
|
|
||||||
});
|
});
|
||||||
_setListeners();
|
_setListeners();
|
||||||
await updateTransactions();
|
await updateTransactions();
|
||||||
|
@ -149,13 +140,12 @@ abstract class WowneroWalletBase extends WalletBase<WowneroBalance,
|
||||||
wownero_wallet.setRecoveringFromSeed(isRecovery: walletInfo.isRecovery);
|
wownero_wallet.setRecoveringFromSeed(isRecovery: walletInfo.isRecovery);
|
||||||
|
|
||||||
if (wownero_wallet.getCurrentHeight() <= 1) {
|
if (wownero_wallet.getCurrentHeight() <= 1) {
|
||||||
wownero_wallet.setRefreshFromBlockHeight(
|
wownero_wallet.setRefreshFromBlockHeight(height: walletInfo.restoreHeight);
|
||||||
height: walletInfo.restoreHeight);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_autoSaveTimer = Timer.periodic(
|
_autoSaveTimer =
|
||||||
Duration(seconds: _autoSaveInterval), (_) async => await save());
|
Timer.periodic(Duration(seconds: _autoSaveInterval), (_) async => await save());
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -227,8 +217,8 @@ abstract class WowneroWalletBase extends WalletBase<WowneroBalance,
|
||||||
final inputs = <String>[];
|
final inputs = <String>[];
|
||||||
final outputs = _credentials.outputs;
|
final outputs = _credentials.outputs;
|
||||||
final hasMultiDestination = outputs.length > 1;
|
final hasMultiDestination = outputs.length > 1;
|
||||||
final unlockedBalance = wownero_wallet.getUnlockedBalance(
|
final unlockedBalance =
|
||||||
accountIndex: walletAddresses.account!.id);
|
wownero_wallet.getUnlockedBalance(accountIndex: walletAddresses.account!.id);
|
||||||
var allInputsAmount = 0;
|
var allInputsAmount = 0;
|
||||||
|
|
||||||
PendingTransactionDescription pendingTransactionDescription;
|
PendingTransactionDescription pendingTransactionDescription;
|
||||||
|
@ -250,17 +240,15 @@ abstract class WowneroWalletBase extends WalletBase<WowneroBalance,
|
||||||
final spendAllCoins = inputs.length == unspentCoins.length;
|
final spendAllCoins = inputs.length == unspentCoins.length;
|
||||||
|
|
||||||
if (hasMultiDestination) {
|
if (hasMultiDestination) {
|
||||||
if (outputs.any(
|
if (outputs.any((item) => item.sendAll || (item.formattedCryptoAmount ?? 0) <= 0)) {
|
||||||
(item) => item.sendAll || (item.formattedCryptoAmount ?? 0) <= 0)) {
|
|
||||||
throw WowneroTransactionCreationException(
|
throw WowneroTransactionCreationException(
|
||||||
'You do not have enough XMR to send this amount.');
|
'You do not have enough XMR to send this amount.');
|
||||||
}
|
}
|
||||||
|
|
||||||
final int totalAmount = outputs.fold(
|
final int totalAmount =
|
||||||
0, (acc, value) => acc + (value.formattedCryptoAmount ?? 0));
|
outputs.fold(0, (acc, value) => acc + (value.formattedCryptoAmount ?? 0));
|
||||||
|
|
||||||
final estimatedFee =
|
final estimatedFee = calculateEstimatedFee(_credentials.priority, totalAmount);
|
||||||
calculateEstimatedFee(_credentials.priority, totalAmount);
|
|
||||||
if (unlockedBalance < totalAmount) {
|
if (unlockedBalance < totalAmount) {
|
||||||
throw WowneroTransactionCreationException(
|
throw WowneroTransactionCreationException(
|
||||||
'You do not have enough XMR to send this amount.');
|
'You do not have enough XMR to send this amount.');
|
||||||
|
@ -271,28 +259,22 @@ abstract class WowneroWalletBase extends WalletBase<WowneroBalance,
|
||||||
}
|
}
|
||||||
|
|
||||||
final wowneroOutputs = outputs.map((output) {
|
final wowneroOutputs = outputs.map((output) {
|
||||||
final outputAddress =
|
final outputAddress = output.isParsedAddress ? output.extractedAddress : output.address;
|
||||||
output.isParsedAddress ? output.extractedAddress : output.address;
|
|
||||||
|
|
||||||
return WowneroOutput(
|
return WowneroOutput(
|
||||||
address: outputAddress!,
|
address: outputAddress!, amount: output.cryptoAmount!.replaceAll(',', '.'));
|
||||||
amount: output.cryptoAmount!.replaceAll(',', '.'));
|
|
||||||
}).toList();
|
}).toList();
|
||||||
|
|
||||||
pendingTransactionDescription =
|
pendingTransactionDescription = await transaction_history.createTransactionMultDest(
|
||||||
await transaction_history.createTransactionMultDest(
|
outputs: wowneroOutputs,
|
||||||
outputs: wowneroOutputs,
|
priorityRaw: _credentials.priority.serialize(),
|
||||||
priorityRaw: _credentials.priority.serialize(),
|
accountIndex: walletAddresses.account!.id,
|
||||||
accountIndex: walletAddresses.account!.id,
|
preferredInputs: inputs);
|
||||||
preferredInputs: inputs);
|
|
||||||
} else {
|
} else {
|
||||||
final output = outputs.first;
|
final output = outputs.first;
|
||||||
final address =
|
final address = output.isParsedAddress ? output.extractedAddress : output.address;
|
||||||
output.isParsedAddress ? output.extractedAddress : output.address;
|
final amount = output.sendAll ? null : output.cryptoAmount!.replaceAll(',', '.');
|
||||||
final amount =
|
final formattedAmount = output.sendAll ? null : output.formattedCryptoAmount;
|
||||||
output.sendAll ? null : output.cryptoAmount!.replaceAll(',', '.');
|
|
||||||
final formattedAmount =
|
|
||||||
output.sendAll ? null : output.formattedCryptoAmount;
|
|
||||||
|
|
||||||
if ((formattedAmount != null && unlockedBalance < formattedAmount) ||
|
if ((formattedAmount != null && unlockedBalance < formattedAmount) ||
|
||||||
(formattedAmount == null && unlockedBalance <= 0)) {
|
(formattedAmount == null && unlockedBalance <= 0)) {
|
||||||
|
@ -302,22 +284,19 @@ abstract class WowneroWalletBase extends WalletBase<WowneroBalance,
|
||||||
'You do not have enough unlocked balance. Unlocked: $formattedBalance. Transaction amount: ${output.cryptoAmount}.');
|
'You do not have enough unlocked balance. Unlocked: $formattedBalance. Transaction amount: ${output.cryptoAmount}.');
|
||||||
}
|
}
|
||||||
|
|
||||||
final estimatedFee =
|
final estimatedFee = calculateEstimatedFee(_credentials.priority, formattedAmount);
|
||||||
calculateEstimatedFee(_credentials.priority, formattedAmount);
|
|
||||||
if (!spendAllCoins &&
|
if (!spendAllCoins &&
|
||||||
((formattedAmount != null &&
|
((formattedAmount != null && allInputsAmount < (formattedAmount + estimatedFee)) ||
|
||||||
allInputsAmount < (formattedAmount + estimatedFee)) ||
|
|
||||||
formattedAmount == null)) {
|
formattedAmount == null)) {
|
||||||
throw WowneroTransactionNoInputsException(inputs.length);
|
throw WowneroTransactionNoInputsException(inputs.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
pendingTransactionDescription =
|
pendingTransactionDescription = await transaction_history.createTransaction(
|
||||||
await transaction_history.createTransaction(
|
address: address!,
|
||||||
address: address!,
|
amount: amount,
|
||||||
amount: amount,
|
priorityRaw: _credentials.priority.serialize(),
|
||||||
priorityRaw: _credentials.priority.serialize(),
|
accountIndex: walletAddresses.account!.id,
|
||||||
accountIndex: walletAddresses.account!.id,
|
preferredInputs: inputs);
|
||||||
preferredInputs: inputs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return PendingWowneroTransaction(pendingTransactionDescription);
|
return PendingWowneroTransaction(pendingTransactionDescription);
|
||||||
|
@ -382,10 +361,8 @@ abstract class WowneroWalletBase extends WalletBase<WowneroBalance,
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
// -- rename the waller folder --
|
// -- rename the waller folder --
|
||||||
final currentWalletDir =
|
final currentWalletDir = Directory(await pathForWalletDir(name: name, type: type));
|
||||||
Directory(await pathForWalletDir(name: name, type: type));
|
final newWalletDirPath = await pathForWalletDir(name: newWalletName, type: type);
|
||||||
final newWalletDirPath =
|
|
||||||
await pathForWalletDir(name: newWalletName, type: type);
|
|
||||||
await currentWalletDir.rename(newWalletDirPath);
|
await currentWalletDir.rename(newWalletDirPath);
|
||||||
|
|
||||||
// -- use new waller folder to rename files with old names still --
|
// -- use new waller folder to rename files with old names still --
|
||||||
|
@ -395,8 +372,7 @@ abstract class WowneroWalletBase extends WalletBase<WowneroBalance,
|
||||||
final currentKeysFile = File('$renamedWalletPath.keys');
|
final currentKeysFile = File('$renamedWalletPath.keys');
|
||||||
final currentAddressListFile = File('$renamedWalletPath.address.txt');
|
final currentAddressListFile = File('$renamedWalletPath.address.txt');
|
||||||
|
|
||||||
final newWalletPath =
|
final newWalletPath = await pathForWallet(name: newWalletName, type: type);
|
||||||
await pathForWallet(name: newWalletName, type: type);
|
|
||||||
|
|
||||||
if (currentCacheFile.existsSync()) {
|
if (currentCacheFile.existsSync()) {
|
||||||
await currentCacheFile.rename(newWalletPath);
|
await currentCacheFile.rename(newWalletPath);
|
||||||
|
@ -416,8 +392,7 @@ abstract class WowneroWalletBase extends WalletBase<WowneroBalance,
|
||||||
final currentKeysFile = File('$currentWalletPath.keys');
|
final currentKeysFile = File('$currentWalletPath.keys');
|
||||||
final currentAddressListFile = File('$currentWalletPath.address.txt');
|
final currentAddressListFile = File('$currentWalletPath.address.txt');
|
||||||
|
|
||||||
final newWalletPath =
|
final newWalletPath = await pathForWallet(name: newWalletName, type: type);
|
||||||
await pathForWallet(name: newWalletName, type: type);
|
|
||||||
|
|
||||||
// Copies current wallet files into new wallet name's dir and files
|
// Copies current wallet files into new wallet name's dir and files
|
||||||
if (currentCacheFile.existsSync()) {
|
if (currentCacheFile.existsSync()) {
|
||||||
|
@ -436,8 +411,7 @@ abstract class WowneroWalletBase extends WalletBase<WowneroBalance,
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> changePassword(String password) async =>
|
Future<void> changePassword(String password) async => wownero_wallet.setPasswordSync(password);
|
||||||
wownero_wallet.setPasswordSync(password);
|
|
||||||
|
|
||||||
Future<int> getNodeHeight() async => wownero_wallet.getNodeHeight();
|
Future<int> getNodeHeight() async => wownero_wallet.getNodeHeight();
|
||||||
|
|
||||||
|
@ -482,8 +456,7 @@ abstract class WowneroWalletBase extends WalletBase<WowneroBalance,
|
||||||
wownero.CoinsInfo_unlocked(coin),
|
wownero.CoinsInfo_unlocked(coin),
|
||||||
);
|
);
|
||||||
if (unspent.hash.isNotEmpty) {
|
if (unspent.hash.isNotEmpty) {
|
||||||
unspent.isChange =
|
unspent.isChange = transaction_history.getTransaction(unspent.hash) == 1;
|
||||||
transaction_history.getTransaction(unspent.hash) == 1;
|
|
||||||
}
|
}
|
||||||
unspentCoins.add(unspent);
|
unspentCoins.add(unspent);
|
||||||
}
|
}
|
||||||
|
@ -545,15 +518,13 @@ abstract class WowneroWalletBase extends WalletBase<WowneroBalance,
|
||||||
Future<void> _refreshUnspentCoinsInfo() async {
|
Future<void> _refreshUnspentCoinsInfo() async {
|
||||||
try {
|
try {
|
||||||
final List<dynamic> keys = <dynamic>[];
|
final List<dynamic> keys = <dynamic>[];
|
||||||
final currentWalletUnspentCoins = unspentCoinsInfo.values.where(
|
final currentWalletUnspentCoins = unspentCoinsInfo.values.where((element) =>
|
||||||
(element) =>
|
element.walletId.contains(id) && element.accountIndex == walletAddresses.account!.id);
|
||||||
element.walletId.contains(id) &&
|
|
||||||
element.accountIndex == walletAddresses.account!.id);
|
|
||||||
|
|
||||||
if (currentWalletUnspentCoins.isNotEmpty) {
|
if (currentWalletUnspentCoins.isNotEmpty) {
|
||||||
currentWalletUnspentCoins.forEach((element) {
|
currentWalletUnspentCoins.forEach((element) {
|
||||||
final existUnspentCoins = unspentCoins
|
final existUnspentCoins =
|
||||||
.where((coin) => element.keyImage!.contains(coin.keyImage!));
|
unspentCoins.where((coin) => element.keyImage!.contains(coin.keyImage!));
|
||||||
|
|
||||||
if (existUnspentCoins.isEmpty) {
|
if (existUnspentCoins.isEmpty) {
|
||||||
keys.add(element.key);
|
keys.add(element.key);
|
||||||
|
@ -570,17 +541,14 @@ abstract class WowneroWalletBase extends WalletBase<WowneroBalance,
|
||||||
}
|
}
|
||||||
|
|
||||||
String getTransactionAddress(int accountIndex, int addressIndex) =>
|
String getTransactionAddress(int accountIndex, int addressIndex) =>
|
||||||
wownero_wallet.getAddress(
|
wownero_wallet.getAddress(accountIndex: accountIndex, addressIndex: addressIndex);
|
||||||
accountIndex: accountIndex, addressIndex: addressIndex);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Map<String, WowneroTransactionInfo>> fetchTransactions() async {
|
Future<Map<String, WowneroTransactionInfo>> fetchTransactions() async {
|
||||||
transaction_history.refreshTransactions();
|
transaction_history.refreshTransactions();
|
||||||
return _getAllTransactionsOfAccount(walletAddresses.account?.id)
|
return _getAllTransactionsOfAccount(walletAddresses.account?.id)
|
||||||
.fold<Map<String, WowneroTransactionInfo>>(
|
.fold<Map<String, WowneroTransactionInfo>>(<String, WowneroTransactionInfo>{},
|
||||||
<String, WowneroTransactionInfo>{},
|
(Map<String, WowneroTransactionInfo> acc, WowneroTransactionInfo tx) {
|
||||||
(Map<String, WowneroTransactionInfo> acc,
|
|
||||||
WowneroTransactionInfo tx) {
|
|
||||||
acc[tx.id] = tx;
|
acc[tx.id] = tx;
|
||||||
return acc;
|
return acc;
|
||||||
});
|
});
|
||||||
|
@ -607,17 +575,14 @@ abstract class WowneroWalletBase extends WalletBase<WowneroBalance,
|
||||||
String getSubaddressLabel(int accountIndex, int addressIndex) =>
|
String getSubaddressLabel(int accountIndex, int addressIndex) =>
|
||||||
wownero_wallet.getSubaddressLabel(accountIndex, addressIndex);
|
wownero_wallet.getSubaddressLabel(accountIndex, addressIndex);
|
||||||
|
|
||||||
List<WowneroTransactionInfo> _getAllTransactionsOfAccount(
|
List<WowneroTransactionInfo> _getAllTransactionsOfAccount(int? accountIndex) =>
|
||||||
int? accountIndex) =>
|
|
||||||
transaction_history
|
transaction_history
|
||||||
.getAllTransactions()
|
.getAllTransactions()
|
||||||
.map(
|
.map(
|
||||||
(row) => WowneroTransactionInfo(
|
(row) => WowneroTransactionInfo(
|
||||||
row.hash,
|
row.hash,
|
||||||
row.blockheight,
|
row.blockheight,
|
||||||
row.isSpend
|
row.isSpend ? TransactionDirection.outgoing : TransactionDirection.incoming,
|
||||||
? TransactionDirection.outgoing
|
|
||||||
: TransactionDirection.incoming,
|
|
||||||
row.timeStamp,
|
row.timeStamp,
|
||||||
row.isPending,
|
row.isPending,
|
||||||
row.amount,
|
row.amount,
|
||||||
|
@ -670,8 +635,7 @@ abstract class WowneroWalletBase extends WalletBase<WowneroBalance,
|
||||||
}
|
}
|
||||||
|
|
||||||
int _getHeightDistance(DateTime date) {
|
int _getHeightDistance(DateTime date) {
|
||||||
final distance =
|
final distance = DateTime.now().millisecondsSinceEpoch - date.millisecondsSinceEpoch;
|
||||||
DateTime.now().millisecondsSinceEpoch - date.millisecondsSinceEpoch;
|
|
||||||
final daysTmp = (distance / 86400).round();
|
final daysTmp = (distance / 86400).round();
|
||||||
final days = daysTmp < 1 ? 1 : daysTmp;
|
final days = daysTmp < 1 ? 1 : daysTmp;
|
||||||
|
|
||||||
|
@ -699,27 +663,22 @@ abstract class WowneroWalletBase extends WalletBase<WowneroBalance,
|
||||||
balance[currency]!.unlockedBalance != unlockedBalance ||
|
balance[currency]!.unlockedBalance != unlockedBalance ||
|
||||||
balance[currency]!.frozenBalance != frozenBalance) {
|
balance[currency]!.frozenBalance != frozenBalance) {
|
||||||
balance[currency] = WowneroBalance(
|
balance[currency] = WowneroBalance(
|
||||||
fullBalance: fullBalance,
|
fullBalance: fullBalance, unlockedBalance: unlockedBalance, frozenBalance: frozenBalance);
|
||||||
unlockedBalance: unlockedBalance,
|
|
||||||
frozenBalance: frozenBalance);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _askForUpdateTransactionHistory() async =>
|
Future<void> _askForUpdateTransactionHistory() async => await updateTransactions();
|
||||||
await updateTransactions();
|
|
||||||
|
|
||||||
int _getFullBalance() =>
|
int _getFullBalance() => wownero_wallet.getFullBalance(accountIndex: walletAddresses.account!.id);
|
||||||
wownero_wallet.getFullBalance(accountIndex: walletAddresses.account!.id);
|
|
||||||
|
|
||||||
int _getUnlockedBalance() => wownero_wallet.getUnlockedBalance(
|
int _getUnlockedBalance() =>
|
||||||
accountIndex: walletAddresses.account!.id);
|
wownero_wallet.getUnlockedBalance(accountIndex: walletAddresses.account!.id);
|
||||||
|
|
||||||
int _getFrozenBalance() {
|
int _getFrozenBalance() {
|
||||||
var frozenBalance = 0;
|
var frozenBalance = 0;
|
||||||
|
|
||||||
for (var coin in unspentCoinsInfo.values.where((element) =>
|
for (var coin in unspentCoinsInfo.values.where((element) =>
|
||||||
element.walletId == id &&
|
element.walletId == id && element.accountIndex == walletAddresses.account!.id)) {
|
||||||
element.accountIndex == walletAddresses.account!.id)) {
|
|
||||||
if (coin.isFrozen) frozenBalance += coin.value;
|
if (coin.isFrozen) frozenBalance += coin.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ The following are the system requirements to build CakeWallet for your Android d
|
||||||
Ubuntu >= 20.04
|
Ubuntu >= 20.04
|
||||||
Android SDK 29 or higher (better to have the latest one 33)
|
Android SDK 29 or higher (better to have the latest one 33)
|
||||||
Android NDK 17c
|
Android NDK 17c
|
||||||
Flutter 3.10.x or earlier
|
Flutter 3.19.x or earlier
|
||||||
```
|
```
|
||||||
|
|
||||||
## Building CakeWallet on Android
|
## Building CakeWallet on Android
|
||||||
|
@ -55,7 +55,7 @@ You may download and install the latest version of Android Studio [here](https:/
|
||||||
|
|
||||||
### 3. Installing Flutter
|
### 3. Installing Flutter
|
||||||
|
|
||||||
Need to install flutter with version `3.7.x`. For this please check section [Install Flutter manually](https://docs.flutter.dev/get-started/install/linux#install-flutter-manually).
|
Need to install flutter with version `3.19.x`. For this please check section [Install Flutter manually](https://docs.flutter.dev/get-started/install/linux#install-flutter-manually).
|
||||||
|
|
||||||
### 4. Verify Installations
|
### 4. Verify Installations
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ Verify that the Android toolchain, Flutter, and Android Studio have been correct
|
||||||
The output of this command will appear like this, indicating successful installations. If there are problems with your installation, they **must** be corrected before proceeding.
|
The output of this command will appear like this, indicating successful installations. If there are problems with your installation, they **must** be corrected before proceeding.
|
||||||
```
|
```
|
||||||
Doctor summary (to see all details, run flutter doctor -v):
|
Doctor summary (to see all details, run flutter doctor -v):
|
||||||
[✓] Flutter (Channel stable, 3.10.x, on Linux, locale en_US.UTF-8)
|
[✓] Flutter (Channel stable, 3.19.x, on Linux, locale en_US.UTF-8)
|
||||||
[✓] Android toolchain - develop for Android devices (Android SDK version 29 or higher)
|
[✓] Android toolchain - develop for Android devices (Android SDK version 29 or higher)
|
||||||
[✓] Android Studio (version 4.0 or higher)
|
[✓] Android Studio (version 4.0 or higher)
|
||||||
```
|
```
|
||||||
|
@ -116,10 +116,6 @@ Build the Monero libraries and their dependencies:
|
||||||
|
|
||||||
`$ ./build_all.sh`
|
`$ ./build_all.sh`
|
||||||
|
|
||||||
Now the dependencies need to be copied into the CakeWallet project with this command:
|
|
||||||
|
|
||||||
`$ ./copy_monero_deps.sh`
|
|
||||||
|
|
||||||
It is now time to change back to the base directory of the CakeWallet source code:
|
It is now time to change back to the base directory of the CakeWallet source code:
|
||||||
|
|
||||||
`$ cd ../../`
|
`$ cd ../../`
|
||||||
|
|
|
@ -7,7 +7,7 @@ The following are the system requirements to build CakeWallet for your iOS devic
|
||||||
```
|
```
|
||||||
macOS >= 14.0
|
macOS >= 14.0
|
||||||
Xcode 15.3
|
Xcode 15.3
|
||||||
Flutter 3.10.x
|
Flutter 3.19.x
|
||||||
```
|
```
|
||||||
|
|
||||||
## Building CakeWallet on iOS
|
## Building CakeWallet on iOS
|
||||||
|
@ -30,7 +30,7 @@ You may download and install the latest version of [Xcode](https://developer.app
|
||||||
|
|
||||||
### 3. Installing Flutter
|
### 3. Installing Flutter
|
||||||
|
|
||||||
Need to install flutter with version `3.10.x`. For this please check section [Install Flutter](https://docs.flutter.dev/get-started/install/macos/mobile-ios?tab=download).
|
Need to install flutter with version `3.19.x`. For this please check section [Install Flutter](https://docs.flutter.dev/get-started/install/macos/mobile-ios?tab=download).
|
||||||
|
|
||||||
### 4. Verify Installations
|
### 4. Verify Installations
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ Verify that the Flutter and Xcode have been correctly installed on your system w
|
||||||
The output of this command will appear like this, indicating successful installations. If there are problems with your installation, they **must** be corrected before proceeding.
|
The output of this command will appear like this, indicating successful installations. If there are problems with your installation, they **must** be corrected before proceeding.
|
||||||
```
|
```
|
||||||
Doctor summary (to see all details, run flutter doctor -v):
|
Doctor summary (to see all details, run flutter doctor -v):
|
||||||
[✓] Flutter (Channel stable, 3.10.x, on macOS 14.x.x)
|
[✓] Flutter (Channel stable, 3.19.x, on macOS 14.x.x)
|
||||||
[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
|
[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -254,8 +254,7 @@ abstract class WalletKeysViewModelBase with Store {
|
||||||
case WalletType.wownero:
|
case WalletType.wownero:
|
||||||
return 'wownero-wallet';
|
return 'wownero-wallet';
|
||||||
default:
|
default:
|
||||||
throw Exception(
|
throw Exception('Unexpected wallet type: ${_appStore.wallet!.type.toString()}');
|
||||||
'Unexpected wallet type: ${_appStore.wallet!.toString()}');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ abstract class WalletNewVMBase extends WalletCreationVM with Store {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool get hasSeedType => type == WalletType.monero;
|
bool get hasSeedType => type == WalletType.monero || type == WalletType.wownero;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
WalletCredentials getCredentials(dynamic _options) {
|
WalletCredentials getCredentials(dynamic _options) {
|
||||||
|
|
|
@ -10,7 +10,10 @@ case $APP_ANDROID_TYPE in
|
||||||
CONFIG_ARGS="--monero"
|
CONFIG_ARGS="--monero"
|
||||||
;;
|
;;
|
||||||
$CAKEWALLET)
|
$CAKEWALLET)
|
||||||
CONFIG_ARGS="--monero --bitcoin --ethereum --polygon --nano --bitcoinCash --solana --tron --wownero" #TODO: fix and add back --haven
|
CONFIG_ARGS="--monero --bitcoin --ethereum --polygon --nano --bitcoinCash --solana --tron --wownero"
|
||||||
|
if [ "$CW_WITH_HAVEN" = true ];then
|
||||||
|
CONFIG_ARGS="$CONFIG_ARGS --haven"
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
$HAVEN)
|
$HAVEN)
|
||||||
CONFIG_ARGS="--haven"
|
CONFIG_ARGS="--haven"
|
||||||
|
|
Loading…
Reference in a new issue