mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-24 12:46:45 +00:00
followup to prev commit to handle button disable
This commit is contained in:
parent
e48e40da0d
commit
d5a26fdf5d
2 changed files with 9 additions and 6 deletions
2
drongo
2
drongo
|
@ -1 +1 @@
|
||||||
Subproject commit 79eb8b002d01be5195bb7fc7eba6bb34bf3366e3
|
Subproject commit b2297a8d0219af70b3e97c83feb1af8aec485d9f
|
|
@ -172,7 +172,7 @@ public class SendController extends WalletFormController implements Initializabl
|
||||||
});
|
});
|
||||||
|
|
||||||
label.textProperty().addListener((observable, oldValue, newValue) -> {
|
label.textProperty().addListener((observable, oldValue, newValue) -> {
|
||||||
createButton.setDisable(walletTransactionProperty.get() == null || newValue == null || newValue.isEmpty());
|
createButton.setDisable(walletTransactionProperty.get() == null || newValue == null || newValue.isEmpty() || isInsufficientFeeRate());
|
||||||
});
|
});
|
||||||
|
|
||||||
amount.setTextFormatter(new CoinTextFormatter());
|
amount.setTextFormatter(new CoinTextFormatter());
|
||||||
|
@ -275,7 +275,7 @@ public class SendController extends WalletFormController implements Initializabl
|
||||||
setFiatAmount(AppController.getFiatCurrencyExchangeRate(), walletTransaction.getRecipientAmount());
|
setFiatAmount(AppController.getFiatCurrencyExchangeRate(), walletTransaction.getRecipientAmount());
|
||||||
}
|
}
|
||||||
|
|
||||||
double feeRate = (double)walletTransaction.getFee() / walletTransaction.getTransaction().getVirtualSize();
|
double feeRate = walletTransaction.getFeeRate();
|
||||||
if(userFeeSet.get()) {
|
if(userFeeSet.get()) {
|
||||||
setTargetBlocks(getTargetBlocks(feeRate));
|
setTargetBlocks(getTargetBlocks(feeRate));
|
||||||
} else {
|
} else {
|
||||||
|
@ -286,7 +286,7 @@ public class SendController extends WalletFormController implements Initializabl
|
||||||
}
|
}
|
||||||
|
|
||||||
transactionDiagram.update(walletTransaction);
|
transactionDiagram.update(walletTransaction);
|
||||||
createButton.setDisable(walletTransaction == null || label.getText().isEmpty());
|
createButton.setDisable(walletTransaction == null || label.getText().isEmpty() || isInsufficientFeeRate());
|
||||||
});
|
});
|
||||||
|
|
||||||
addValidation();
|
addValidation();
|
||||||
|
@ -307,8 +307,7 @@ public class SendController extends WalletFormController implements Initializabl
|
||||||
validationSupport.registerValidator(fee, Validator.combine(
|
validationSupport.registerValidator(fee, Validator.combine(
|
||||||
(Control c, String newValue) -> ValidationResult.fromErrorIf( c, "Insufficient Inputs", userFeeSet.get() && insufficientInputsProperty.get()),
|
(Control c, String newValue) -> ValidationResult.fromErrorIf( c, "Insufficient Inputs", userFeeSet.get() && insufficientInputsProperty.get()),
|
||||||
(Control c, String newValue) -> ValidationResult.fromErrorIf( c, "Insufficient Fee", getFeeValueSats() != null && getFeeValueSats() == 0),
|
(Control c, String newValue) -> ValidationResult.fromErrorIf( c, "Insufficient Fee", getFeeValueSats() != null && getFeeValueSats() == 0),
|
||||||
(Control c, String newValue) -> ValidationResult.fromErrorIf( c, "Insufficient Fee Rate", walletTransactionProperty.get() != null &&
|
(Control c, String newValue) -> ValidationResult.fromErrorIf( c, "Insufficient Fee Rate", isInsufficientFeeRate())
|
||||||
(double)walletTransactionProperty.get().getFee() / walletTransactionProperty.get().getTransaction().getVirtualSize() < AppController.getMinimumRelayFeeRate())
|
|
||||||
));
|
));
|
||||||
|
|
||||||
validationSupport.setValidationDecorator(new StyleClassValidationDecoration());
|
validationSupport.setValidationDecorator(new StyleClassValidationDecoration());
|
||||||
|
@ -460,6 +459,10 @@ public class SendController extends WalletFormController implements Initializabl
|
||||||
return Math.max(minRate, Transaction.DUST_RELAY_TX_FEE);
|
return Math.max(minRate, Transaction.DUST_RELAY_TX_FEE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isInsufficientFeeRate() {
|
||||||
|
return walletTransactionProperty.get() != null && walletTransactionProperty.get().getFeeRate() < AppController.getMinimumRelayFeeRate();
|
||||||
|
}
|
||||||
|
|
||||||
private void setFeeRate(Double feeRateAmt) {
|
private void setFeeRate(Double feeRateAmt) {
|
||||||
feeRate.setText(String.format("%.2f", feeRateAmt) + " sats/vByte");
|
feeRate.setText(String.format("%.2f", feeRateAmt) + " sats/vByte");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue