mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-03-12 09:32:33 +00:00
Update logic behind import/export keyimages/outputs
This commit is contained in:
parent
2e4c5c4470
commit
b722d2180c
4 changed files with 13 additions and 7 deletions
|
@ -252,6 +252,7 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
|
|||
final err = monero.Wallet_errorString(wptr!);
|
||||
throw Exception("unable to import key images: $err");
|
||||
}
|
||||
monero.Wallet_store(wptr!);
|
||||
return retStatus;
|
||||
}
|
||||
|
||||
|
@ -265,11 +266,12 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
|
|||
return str;
|
||||
}
|
||||
|
||||
bool needExportOutputs(int? amount) {
|
||||
bool needExportOutputs(int amount) {
|
||||
// printV("viewOnlyBalance: ${monero.Wallet_viewOnlyBalance(wptr!, accountIndex: walletAddresses.account!.id)}");
|
||||
// printV(" balance: ${monero.Wallet_balance(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)));
|
||||
accountIndex: walletAddresses.account!.id) < amount);
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
@ -392,7 +392,7 @@ class CWMonero extends Monero {
|
|||
}
|
||||
|
||||
@override
|
||||
bool needExportOutputs(Object wallet, int? amount) {
|
||||
bool needExportOutputs(Object wallet, int amount) {
|
||||
final moneroWallet = wallet as MoneroWallet;
|
||||
return moneroWallet.needExportOutputs(amount);
|
||||
}
|
||||
|
|
|
@ -414,10 +414,14 @@ class SendPage extends BasePage {
|
|||
}
|
||||
|
||||
if (sendViewModel.wallet.type == WalletType.monero) {
|
||||
if (monero!.needExportOutputs(sendViewModel.wallet, null)) {
|
||||
int amount = 0;
|
||||
for (var item in sendViewModel.outputs) {
|
||||
amount += item.formattedCryptoAmount;
|
||||
}
|
||||
if (monero!.needExportOutputs(sendViewModel.wallet, amount)) {
|
||||
await Navigator.of(context).pushNamed(Routes.urqrAnimatedPage, arguments: 'export-outputs');
|
||||
}
|
||||
if (monero!.needExportOutputs(sendViewModel.wallet, null)) {
|
||||
if (monero!.needExportOutputs(sendViewModel.wallet, amount)) {
|
||||
throw Exception("You need to export outputs first");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -387,7 +387,7 @@ abstract class Monero {
|
|||
|
||||
String exportOutputsUR(Object wallet, bool all);
|
||||
|
||||
bool needExportOutputs(Object wallet, int? amount);
|
||||
bool needExportOutputs(Object wallet, int amount);
|
||||
|
||||
bool importKeyImagesUR(Object wallet, String ur);
|
||||
|
||||
|
|
Loading…
Reference in a new issue