Merge remote-tracking branch 'origin/wownero' into wownero

This commit is contained in:
OmarHatem 2024-06-28 15:09:09 +03:00
commit 2285540f76
13 changed files with 27 additions and 22 deletions

View file

@ -1 +0,0 @@
../../../../../../scripts/monero_c/release/monero/aarch64-linux-android_libc++_shared.so

View file

@ -1 +0,0 @@
../../../../../../scripts/monero_c/release/monero/arm-linux-androideabi_libc++_shared.so

View file

@ -1 +0,0 @@
../../../../../../scripts/monero_c/release/monero/x86_64-linux-android_libc++_shared.so

View file

@ -12,7 +12,7 @@ import 'package:monero/wownero.dart' as wownero;
wownero.WalletManager? _wmPtr; wownero.WalletManager? _wmPtr;
final wownero.WalletManager wmPtr = Pointer.fromAddress((() { final wownero.WalletManager wmPtr = Pointer.fromAddress((() {
try { try {
// Problems with the wallet? Crashes? Lags? this will print all calls to xmr // Problems with the wallet? Crashes? Lags? this will print all calls to wow
// codebase, so it will be easier to debug what happens. At least easier // codebase, so it will be easier to debug what happens. At least easier
// than plugging gdb in. Especially on windows/android. // than plugging gdb in. Especially on windows/android.
wownero.printStarts = false; wownero.printStarts = false;

View file

@ -11,7 +11,7 @@ class DoubleSpendException implements Exception {
@override @override
String toString() => String toString() =>
'This transaction cannot be committed. This can be due to many reasons including the wallet not being synced, there is not enough XMR in your available balance, or previous transactions are not yet fully processed.'; 'This transaction cannot be committed. This can be due to many reasons including the wallet not being synced, there is not enough WOW in your available balance, or previous transactions are not yet fully processed.';
} }
class PendingWowneroTransaction with PendingTransaction { class PendingWowneroTransaction with PendingTransaction {
@ -28,12 +28,12 @@ class PendingWowneroTransaction with PendingTransaction {
String get txKey => pendingTransactionDescription.txKey; String get txKey => pendingTransactionDescription.txKey;
@override @override
String get amountFormatted => AmountConverter.amountIntToString( String get amountFormatted =>
CryptoCurrency.xmr, pendingTransactionDescription.amount); AmountConverter.amountIntToString(CryptoCurrency.wow, pendingTransactionDescription.amount);
@override @override
String get feeFormatted => AmountConverter.amountIntToString( String get feeFormatted =>
CryptoCurrency.xmr, pendingTransactionDescription.fee); AmountConverter.amountIntToString(CryptoCurrency.wow, pendingTransactionDescription.fee);
@override @override
Future<void> commit() async { Future<void> commit() async {

View file

@ -67,8 +67,7 @@ class WowneroTransactionInfo extends TransactionInfo {
String? _fiatAmount; String? _fiatAmount;
@override @override
String amountFormatted() => String amountFormatted() => '${formatAmount(wowneroAmountToString(amount: amount))} WOW';
'${formatAmount(wowneroAmountToString(amount: amount))} XMR';
@override @override
String fiatAmount() => _fiatAmount ?? ''; String fiatAmount() => _fiatAmount ?? '';
@ -77,6 +76,5 @@ class WowneroTransactionInfo extends TransactionInfo {
void changeFiatAmount(String amount) => _fiatAmount = formatAmount(amount); void changeFiatAmount(String amount) => _fiatAmount = formatAmount(amount);
@override @override
String feeFormatted() => String feeFormatted() => '${formatAmount(wowneroAmountToString(amount: fee))} WOW';
'${formatAmount(wowneroAmountToString(amount: fee))} XMR';
} }

View file

@ -52,7 +52,7 @@ abstract class WowneroWalletBase
WowneroWalletBase( WowneroWalletBase(
{required WalletInfo walletInfo, required Box<UnspentCoinsInfo> unspentCoinsInfo}) {required WalletInfo walletInfo, required Box<UnspentCoinsInfo> unspentCoinsInfo})
: balance = ObservableMap<CryptoCurrency, WowneroBalance>.of({ : balance = ObservableMap<CryptoCurrency, WowneroBalance>.of({
CryptoCurrency.xmr: WowneroBalance( CryptoCurrency.wow: WowneroBalance(
fullBalance: wownero_wallet.getFullBalance(accountIndex: 0), fullBalance: wownero_wallet.getFullBalance(accountIndex: 0),
unlockedBalance: wownero_wallet.getFullBalance(accountIndex: 0)) unlockedBalance: wownero_wallet.getFullBalance(accountIndex: 0))
}), }),
@ -242,7 +242,7 @@ abstract class WowneroWalletBase
if (hasMultiDestination) { if (hasMultiDestination) {
if (outputs.any((item) => item.sendAll || (item.formattedCryptoAmount ?? 0) <= 0)) { if (outputs.any((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 WOW to send this amount.');
} }
final int totalAmount = final int totalAmount =
@ -251,7 +251,7 @@ abstract class WowneroWalletBase
final estimatedFee = calculateEstimatedFee(_credentials.priority, totalAmount); final estimatedFee = 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 WOW to send this amount.');
} }
if (!spendAllCoins && (allInputsAmount < totalAmount + estimatedFee)) { if (!spendAllCoins && (allInputsAmount < totalAmount + estimatedFee)) {

View file

@ -33,6 +33,7 @@ class RescanPage extends BasePage {
doSingleScan: _rescanViewModel.doSingleScan, doSingleScan: _rescanViewModel.doSingleScan,
toggleSingleScan: () => toggleSingleScan: () =>
_rescanViewModel.doSingleScan = !_rescanViewModel.doSingleScan, _rescanViewModel.doSingleScan = !_rescanViewModel.doSingleScan,
walletType: _rescanViewModel.wallet.type,
)), )),
Observer( Observer(
builder: (_) => LoadingPrimaryButton( builder: (_) => LoadingPrimaryButton(

View file

@ -171,6 +171,7 @@ class WalletRestoreFromKeysFromState extends State<WalletRestoreFromKeysFrom> {
hasDatePicker: widget.walletRestoreViewModel.type != WalletType.haven, hasDatePicker: widget.walletRestoreViewModel.type != WalletType.haven,
onHeightChange: (_) => null, onHeightChange: (_) => null,
onHeightOrDateEntered: widget.onHeightOrDateEntered, onHeightOrDateEntered: widget.onHeightOrDateEntered,
walletType: widget.walletRestoreViewModel.type,
), ),
], ],
); );

View file

@ -199,6 +199,7 @@ class WalletRestoreFromSeedFormState extends State<WalletRestoreFromSeedForm> {
key: blockchainHeightKey, key: blockchainHeightKey,
onHeightOrDateEntered: widget.onHeightOrDateEntered, onHeightOrDateEntered: widget.onHeightOrDateEntered,
hasDatePicker: widget.type == WalletType.monero || widget.type == WalletType.wownero, hasDatePicker: widget.type == WalletType.monero || widget.type == WalletType.wownero,
walletType: widget.type,
), ),
if (widget.displayPassphrase) ...[ if (widget.displayPassphrase) ...[
const SizedBox(height: 10), const SizedBox(height: 10),
@ -213,7 +214,7 @@ class WalletRestoreFromSeedFormState extends State<WalletRestoreFromSeedForm> {
bool get isPolyseed => bool get isPolyseed =>
widget.seedTypeViewModel.moneroSeedType == SeedType.polyseed && widget.seedTypeViewModel.moneroSeedType == SeedType.polyseed &&
(widget.type == WalletType.monero || widget.type == WalletType.wownero); (widget.type == WalletType.monero || widget.type == WalletType.wownero);
Widget get expandIcon => Container( Widget get expandIcon => Container(
padding: EdgeInsets.all(18), padding: EdgeInsets.all(18),

View file

@ -2,6 +2,8 @@ import 'package:cake_wallet/bitcoin/bitcoin.dart';
import 'package:cake_wallet/src/widgets/standard_switch.dart'; import 'package:cake_wallet/src/widgets/standard_switch.dart';
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart'; import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
import 'package:cake_wallet/utils/date_picker.dart'; import 'package:cake_wallet/utils/date_picker.dart';
import 'package:cake_wallet/wownero/wownero.dart';
import 'package:cw_core/wallet_type.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/generated/i18n.dart';
@ -18,6 +20,7 @@ class BlockchainHeightWidget extends StatefulWidget {
this.isSilentPaymentsScan = false, this.isSilentPaymentsScan = false,
this.toggleSingleScan, this.toggleSingleScan,
this.doSingleScan = false, this.doSingleScan = false,
required this.walletType,
}) : super(key: key); }) : super(key: key);
final Function(int)? onHeightChange; final Function(int)? onHeightChange;
@ -27,6 +30,7 @@ class BlockchainHeightWidget extends StatefulWidget {
final bool isSilentPaymentsScan; final bool isSilentPaymentsScan;
final bool doSingleScan; final bool doSingleScan;
final Function()? toggleSingleScan; final Function()? toggleSingleScan;
final WalletType walletType;
@override @override
State<StatefulWidget> createState() => BlockchainHeightState(); State<StatefulWidget> createState() => BlockchainHeightState();
@ -160,7 +164,13 @@ class BlockchainHeightState extends State<BlockchainHeightWidget> {
if (widget.isSilentPaymentsScan) { if (widget.isSilentPaymentsScan) {
height = bitcoin!.getHeightByDate(date: date); height = bitcoin!.getHeightByDate(date: date);
} else { } else {
height = monero!.getHeightByDate(date: date); if (widget.walletType == WalletType.monero) {
height = monero!.getHeightByDate(date: date);
} else {
assert(widget.walletType == WalletType.wownero,
"unknown currency in BlockchainHeightWidget");
height = wownero!.getHeightByDate(date: date);
}
} }
setState(() { setState(() {
dateController.text = DateFormat('yyyy-MM-dd').format(date); dateController.text = DateFormat('yyyy-MM-dd').format(date);

View file

@ -48,13 +48,10 @@ else
popd popd
unxz -f ../monero_c/release/${COIN}/x86_64-linux-android_libwallet2_api_c.so.xz unxz -f ../monero_c/release/${COIN}/x86_64-linux-android_libwallet2_api_c.so.xz
unxz -f ../monero_c/release/${COIN}/x86_64-linux-android_libc++_shared.so.xz
unxz -f ../monero_c/release/${COIN}/armv7a-linux-androideabi_libwallet2_api_c.so.xz unxz -f ../monero_c/release/${COIN}/armv7a-linux-androideabi_libwallet2_api_c.so.xz
unxz -f ../monero_c/release/${COIN}/armv7a-linux-androideabi_libc++_shared.so.xz
unxz -f ../monero_c/release/${COIN}/aarch64-linux-android_libwallet2_api_c.so.xz unxz -f ../monero_c/release/${COIN}/aarch64-linux-android_libwallet2_api_c.so.xz
unxz -f ../monero_c/release/${COIN}/aarch64-linux-android_libc++_shared.so.xz
[[ ! "x$REMOVE_CACHES" == "x" ]] && rm -rf ${COIN}/contrib/depends/{built,sources} [[ ! "x$REMOVE_CACHES" == "x" ]] && rm -rf ${COIN}/contrib/depends/{built,sources}
done done
fi fi

View file

@ -8,7 +8,7 @@ if [[ ! -d "monero_c" ]];
then then
git clone https://github.com/mrcyjanek/monero_c --branch rewrite-wip git clone https://github.com/mrcyjanek/monero_c --branch rewrite-wip
cd monero_c cd monero_c
git checkout 4f4cde82f799b191576f619a7653fe5f6f366758 git checkout 0b1520b6c24c87440f35a4c17f64044d5edcf647
git reset --hard git reset --hard
git submodule update --init --force --recursive git submodule update --init --force --recursive
./apply_patches.sh monero ./apply_patches.sh monero