mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-22 11:39:22 +00:00
automatically export outputs
This commit is contained in:
parent
ae80fb3b55
commit
9a45915b0c
5 changed files with 31 additions and 2 deletions
|
@ -126,8 +126,10 @@ Future<bool> setupNodeSync(
|
||||||
|
|
||||||
if (status != 0) {
|
if (status != 0) {
|
||||||
final error = monero.Wallet_errorString(wptr!);
|
final error = monero.Wallet_errorString(wptr!);
|
||||||
printV("error: $error");
|
if (error != "no tx keys found for this txid") {
|
||||||
throw SetupWalletException(message: error);
|
printV("error: $error");
|
||||||
|
throw SetupWalletException(message: error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (kDebugMode) {
|
if (kDebugMode) {
|
||||||
|
|
|
@ -265,6 +265,15 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool needExportOutputs(int? amount) {
|
||||||
|
print("monero.Wallet_hasUnknownKeyImages(wptr!): ${monero.Wallet_hasUnknownKeyImages(wptr!)}");
|
||||||
|
print("monero.Wallet_viewOnlyBalance(wptr!, accountIndex: walletAddresses.account!.id): ${monero.Wallet_viewOnlyBalance(wptr!, accountIndex: walletAddresses.account!.id)}");
|
||||||
|
return monero.Wallet_hasUnknownKeyImages(wptr!) ||
|
||||||
|
(monero.Wallet_viewOnlyBalance(wptr!,
|
||||||
|
accountIndex: walletAddresses.account!.id) <
|
||||||
|
(amount ?? monero.Wallet_balance(wptr!, accountIndex: walletAddresses.account!.id)));
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<PendingTransaction> createTransaction(Object credentials) async {
|
Future<PendingTransaction> createTransaction(Object credentials) async {
|
||||||
final _credentials = credentials as MoneroTransactionCreationCredentials;
|
final _credentials = credentials as MoneroTransactionCreationCredentials;
|
||||||
|
|
|
@ -391,6 +391,12 @@ class CWMonero extends Monero {
|
||||||
return moneroWallet.exportOutputsUR(all);
|
return moneroWallet.exportOutputsUR(all);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool needExportOutputs(Object wallet, int? amount) {
|
||||||
|
final moneroWallet = wallet as MoneroWallet;
|
||||||
|
return moneroWallet.needExportOutputs(amount);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void monerocCheck() {
|
void monerocCheck() {
|
||||||
checkIfMoneroCIsFine();
|
checkIfMoneroCIsFine();
|
||||||
|
|
|
@ -4,6 +4,7 @@ import 'package:cake_wallet/entities/contact_record.dart';
|
||||||
import 'package:cake_wallet/core/execution_state.dart';
|
import 'package:cake_wallet/core/execution_state.dart';
|
||||||
import 'package:cake_wallet/entities/fiat_currency.dart';
|
import 'package:cake_wallet/entities/fiat_currency.dart';
|
||||||
import 'package:cake_wallet/entities/template.dart';
|
import 'package:cake_wallet/entities/template.dart';
|
||||||
|
import 'package:cake_wallet/monero/monero.dart';
|
||||||
import 'package:cake_wallet/reactions/wallet_connect.dart';
|
import 'package:cake_wallet/reactions/wallet_connect.dart';
|
||||||
import 'package:cake_wallet/generated/i18n.dart';
|
import 'package:cake_wallet/generated/i18n.dart';
|
||||||
import 'package:cake_wallet/routes.dart';
|
import 'package:cake_wallet/routes.dart';
|
||||||
|
@ -412,6 +413,15 @@ class SendPage extends BasePage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sendViewModel.wallet.type == WalletType.monero) {
|
||||||
|
if (monero!.needExportOutputs(sendViewModel.wallet, null)) {
|
||||||
|
await Navigator.of(context).pushNamed(Routes.urqrAnimatedPage, arguments: 'export-outputs');
|
||||||
|
}
|
||||||
|
if (monero!.needExportOutputs(sendViewModel.wallet, null)) {
|
||||||
|
throw Exception("You need to export outputs first");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
final check = sendViewModel.shouldDisplayTotp();
|
final check = sendViewModel.shouldDisplayTotp();
|
||||||
authService.authenticateAction(
|
authService.authenticateAction(
|
||||||
context,
|
context,
|
||||||
|
|
|
@ -387,6 +387,8 @@ abstract class Monero {
|
||||||
|
|
||||||
String exportOutputsUR(Object wallet, bool all);
|
String exportOutputsUR(Object wallet, bool all);
|
||||||
|
|
||||||
|
bool needExportOutputs(Object wallet);
|
||||||
|
|
||||||
bool importKeyImagesUR(Object wallet, String ur);
|
bool importKeyImagesUR(Object wallet, String ur);
|
||||||
|
|
||||||
WalletCredentials createMoneroRestoreWalletFromKeysCredentials({
|
WalletCredentials createMoneroRestoreWalletFromKeysCredentials({
|
||||||
|
|
Loading…
Reference in a new issue