forked from Public/monero-gui
Add a button to sweep unmixable outputs
This commit is contained in:
40
main.qml
40
main.qml
@@ -157,6 +157,7 @@ ApplicationWindow {
|
||||
middlePanel.checkPaymentClicked.disconnect(handleCheckPayment);
|
||||
}
|
||||
middlePanel.paymentClicked.connect(handlePayment);
|
||||
middlePanel.sweepUnmixableClicked.connect(handleSweepUnmixable);
|
||||
// basicPanel.paymentClicked.connect(handlePayment);
|
||||
middlePanel.checkPaymentClicked.connect(handleCheckPayment);
|
||||
|
||||
@@ -451,6 +452,45 @@ ApplicationWindow {
|
||||
currentWallet.createTransactionAsync(address, paymentId, amountxmr, mixinCount, priority);
|
||||
}
|
||||
|
||||
function handleSweepUnmixable() {
|
||||
console.log("Creating transaction: ")
|
||||
|
||||
transaction = currentWallet.createSweepUnmixableTransaction();
|
||||
if (transaction.status !== PendingTransaction.Status_Ok) {
|
||||
console.error("Can't create transaction: ", transaction.errorString);
|
||||
informationPopup.title = qsTr("Error") + translationManager.emptyString;
|
||||
informationPopup.text = qsTr("Can't create transaction: ") + transaction.errorString
|
||||
informationPopup.icon = StandardIcon.Critical
|
||||
informationPopup.onCloseCallback = null
|
||||
informationPopup.open();
|
||||
// deleting transaction object, we don't want memleaks
|
||||
currentWallet.disposeTransaction(transaction);
|
||||
|
||||
} else if (transaction.txCount == 0) {
|
||||
informationPopup.title = qsTr("No unmixable outputs to sweep") + translationManager.emptyString
|
||||
informationPopup.text = qsTr("No unmixable outputs to sweep") + translationManager.emptyString
|
||||
informationPopup.icon = StandardIcon.Information
|
||||
informationPopup.onCloseCallback = null
|
||||
informationPopup.open()
|
||||
// deleting transaction object, we don't want memleaks
|
||||
currentWallet.disposeTransaction(transaction);
|
||||
} else {
|
||||
console.log("Transaction created, amount: " + walletManager.displayAmount(transaction.amount)
|
||||
+ ", fee: " + walletManager.displayAmount(transaction.fee));
|
||||
|
||||
// here we show confirmation popup;
|
||||
|
||||
transactionConfirmationPopup.title = qsTr("Confirmation") + translationManager.emptyString
|
||||
transactionConfirmationPopup.text = qsTr("Please confirm transaction:\n")
|
||||
+ qsTr("\n\nAmount: ") + walletManager.displayAmount(transaction.amount)
|
||||
+ qsTr("\nFee: ") + walletManager.displayAmount(transaction.fee)
|
||||
+ translationManager.emptyString
|
||||
transactionConfirmationPopup.icon = StandardIcon.Question
|
||||
transactionConfirmationPopup.open()
|
||||
// committing transaction
|
||||
}
|
||||
}
|
||||
|
||||
// called after user confirms transaction
|
||||
function handleTransactionConfirmed() {
|
||||
// grab transaction.txid before commit, since it clears it.
|
||||
|
||||
Reference in New Issue
Block a user