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;
final wownero.WalletManager wmPtr = Pointer.fromAddress((() {
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
// than plugging gdb in. Especially on windows/android.
wownero.printStarts = false;

View file

@ -11,7 +11,7 @@ class DoubleSpendException implements Exception {
@override
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 {
@ -28,12 +28,12 @@ class PendingWowneroTransaction with PendingTransaction {
String get txKey => pendingTransactionDescription.txKey;
@override
String get amountFormatted => AmountConverter.amountIntToString(
CryptoCurrency.xmr, pendingTransactionDescription.amount);
String get amountFormatted =>
AmountConverter.amountIntToString(CryptoCurrency.wow, pendingTransactionDescription.amount);
@override
String get feeFormatted => AmountConverter.amountIntToString(
CryptoCurrency.xmr, pendingTransactionDescription.fee);
String get feeFormatted =>
AmountConverter.amountIntToString(CryptoCurrency.wow, pendingTransactionDescription.fee);
@override
Future<void> commit() async {

View file

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

View file

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

View file

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

View file

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

View file

@ -199,6 +199,7 @@ class WalletRestoreFromSeedFormState extends State<WalletRestoreFromSeedForm> {
key: blockchainHeightKey,
onHeightOrDateEntered: widget.onHeightOrDateEntered,
hasDatePicker: widget.type == WalletType.monero || widget.type == WalletType.wownero,
walletType: widget.type,
),
if (widget.displayPassphrase) ...[
const SizedBox(height: 10),
@ -213,7 +214,7 @@ class WalletRestoreFromSeedFormState extends State<WalletRestoreFromSeedForm> {
bool get isPolyseed =>
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(
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/themes/extensions/cake_text_theme.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:intl/intl.dart';
import 'package:cake_wallet/generated/i18n.dart';
@ -18,6 +20,7 @@ class BlockchainHeightWidget extends StatefulWidget {
this.isSilentPaymentsScan = false,
this.toggleSingleScan,
this.doSingleScan = false,
required this.walletType,
}) : super(key: key);
final Function(int)? onHeightChange;
@ -27,6 +30,7 @@ class BlockchainHeightWidget extends StatefulWidget {
final bool isSilentPaymentsScan;
final bool doSingleScan;
final Function()? toggleSingleScan;
final WalletType walletType;
@override
State<StatefulWidget> createState() => BlockchainHeightState();
@ -160,7 +164,13 @@ class BlockchainHeightState extends State<BlockchainHeightWidget> {
if (widget.isSilentPaymentsScan) {
height = bitcoin!.getHeightByDate(date: date);
} 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(() {
dateController.text = DateFormat('yyyy-MM-dd').format(date);

View file

@ -48,13 +48,10 @@ else
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_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_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_libc++_shared.so.xz
[[ ! "x$REMOVE_CACHES" == "x" ]] && rm -rf ${COIN}/contrib/depends/{built,sources}
done
fi

View file

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