show fiat fee amount

This commit is contained in:
Craig Raw
2020-08-18 12:54:43 +02:00
parent 198672a06e
commit e93fcf7fbd
4 changed files with 34 additions and 8 deletions
@@ -21,7 +21,7 @@ public class Bip39 implements KeystoreMnemonicImport {
@Override
public String getKeystoreImportDescription() {
return "Import your 12 to 24 word mnemonic and optional passphrase";
return "Import or generate your 12 to 24 word mnemonic and optional passphrase";
}
@Override
@@ -73,6 +73,9 @@ public class SendController extends WalletFormController implements Initializabl
@FXML
private ComboBox<BitcoinUnit> feeAmountUnit;
@FXML
private FiatLabel fiatFeeAmount;
@FXML
private FeeRatesChart feeRatesChart;
@@ -115,6 +118,12 @@ public class SendController extends WalletFormController implements Initializabl
@Override
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
userFeeSet.set(true);
if(newValue.isEmpty()) {
fiatFeeAmount.setText("");
} else {
setFiatFeeAmount(AppController.getFiatCurrencyExchangeRate(), getFeeValueSats());
}
setTargetBlocks(getTargetBlocks());
updateTransaction();
}
@@ -390,6 +399,7 @@ public class SendController extends WalletFormController implements Initializabl
df.setMaximumFractionDigits(8);
fee.setText(df.format(feeAmountUnit.getValue().getValue(feeValue)));
fee.textProperty().addListener(feeListener);
setFiatFeeAmount(AppController.getFiatCurrencyExchangeRate(), feeValue);
}
private Integer getTargetBlocks() {
@@ -468,6 +478,12 @@ public class SendController extends WalletFormController implements Initializabl
}
}
private void setFiatFeeAmount(CurrencyRate currencyRate, Long amount) {
if(amount != null && currencyRate != null && currencyRate.isAvailable()) {
fiatFeeAmount.set(currencyRate, amount);
}
}
private long getRecipientDustThreshold() {
Address address;
try {
@@ -569,5 +585,6 @@ public class SendController extends WalletFormController implements Initializabl
@Subscribe
public void exchangeRatesUpdated(ExchangeRatesUpdatedEvent event) {
setFiatAmount(event.getCurrencyRate(), getRecipientValueSats());
setFiatFeeAmount(event.getCurrencyRate(), getFeeValueSats());
}
}