mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-25 05:06:45 +00:00
show fiat fee amount
This commit is contained in:
parent
198672a06e
commit
e93fcf7fbd
4 changed files with 34 additions and 8 deletions
|
@ -21,7 +21,7 @@ public class Bip39 implements KeystoreMnemonicImport {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getKeystoreImportDescription() {
|
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
|
@Override
|
||||||
|
|
|
@ -73,6 +73,9 @@ public class SendController extends WalletFormController implements Initializabl
|
||||||
@FXML
|
@FXML
|
||||||
private ComboBox<BitcoinUnit> feeAmountUnit;
|
private ComboBox<BitcoinUnit> feeAmountUnit;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private FiatLabel fiatFeeAmount;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private FeeRatesChart feeRatesChart;
|
private FeeRatesChart feeRatesChart;
|
||||||
|
|
||||||
|
@ -115,6 +118,12 @@ public class SendController extends WalletFormController implements Initializabl
|
||||||
@Override
|
@Override
|
||||||
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
|
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
|
||||||
userFeeSet.set(true);
|
userFeeSet.set(true);
|
||||||
|
if(newValue.isEmpty()) {
|
||||||
|
fiatFeeAmount.setText("");
|
||||||
|
} else {
|
||||||
|
setFiatFeeAmount(AppController.getFiatCurrencyExchangeRate(), getFeeValueSats());
|
||||||
|
}
|
||||||
|
|
||||||
setTargetBlocks(getTargetBlocks());
|
setTargetBlocks(getTargetBlocks());
|
||||||
updateTransaction();
|
updateTransaction();
|
||||||
}
|
}
|
||||||
|
@ -390,6 +399,7 @@ public class SendController extends WalletFormController implements Initializabl
|
||||||
df.setMaximumFractionDigits(8);
|
df.setMaximumFractionDigits(8);
|
||||||
fee.setText(df.format(feeAmountUnit.getValue().getValue(feeValue)));
|
fee.setText(df.format(feeAmountUnit.getValue().getValue(feeValue)));
|
||||||
fee.textProperty().addListener(feeListener);
|
fee.textProperty().addListener(feeListener);
|
||||||
|
setFiatFeeAmount(AppController.getFiatCurrencyExchangeRate(), feeValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Integer getTargetBlocks() {
|
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() {
|
private long getRecipientDustThreshold() {
|
||||||
Address address;
|
Address address;
|
||||||
try {
|
try {
|
||||||
|
@ -569,5 +585,6 @@ public class SendController extends WalletFormController implements Initializabl
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void exchangeRatesUpdated(ExchangeRatesUpdatedEvent event) {
|
public void exchangeRatesUpdated(ExchangeRatesUpdatedEvent event) {
|
||||||
setFiatAmount(event.getCurrencyRate(), getRecipientValueSats());
|
setFiatAmount(event.getCurrencyRate(), getRecipientValueSats());
|
||||||
|
setFiatFeeAmount(event.getCurrencyRate(), getFeeValueSats());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,11 +7,18 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.amount-field {
|
.amount-field {
|
||||||
-fx-max-width: 150px;
|
-fx-pref-width: 145px;
|
||||||
|
-fx-min-width: 145px;
|
||||||
|
-fx-max-width: 145px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.amount-unit {
|
||||||
|
-fx-min-width: 70px;
|
||||||
|
-fx-max-width: 70px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#feeRatesChart {
|
#feeRatesChart {
|
||||||
-fx-max-width: 350px;
|
-fx-max-width: 335px;
|
||||||
-fx-max-height: 130px;
|
-fx-max-height: 130px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,8 +29,8 @@
|
||||||
<Insets left="25.0" right="25.0" top="25.0" />
|
<Insets left="25.0" right="25.0" top="25.0" />
|
||||||
</padding>
|
</padding>
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints prefWidth="385" />
|
<ColumnConstraints prefWidth="410" />
|
||||||
<ColumnConstraints prefWidth="225" />
|
<ColumnConstraints prefWidth="200" />
|
||||||
<ColumnConstraints prefWidth="140" />
|
<ColumnConstraints prefWidth="140" />
|
||||||
</columnConstraints>
|
</columnConstraints>
|
||||||
<rowConstraints>
|
<rowConstraints>
|
||||||
|
@ -46,7 +46,7 @@
|
||||||
</Field>
|
</Field>
|
||||||
<Field text="Amount:">
|
<Field text="Amount:">
|
||||||
<TextField fx:id="amount" styleClass="amount-field" />
|
<TextField fx:id="amount" styleClass="amount-field" />
|
||||||
<ComboBox fx:id="amountUnit">
|
<ComboBox fx:id="amountUnit" styleClass="amount-unit">
|
||||||
<items>
|
<items>
|
||||||
<FXCollections fx:factory="observableArrayList">
|
<FXCollections fx:factory="observableArrayList">
|
||||||
<BitcoinUnit fx:constant="BTC" />
|
<BitcoinUnit fx:constant="BTC" />
|
||||||
|
@ -54,7 +54,7 @@
|
||||||
</FXCollections>
|
</FXCollections>
|
||||||
</items>
|
</items>
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
<Region style="-fx-pref-width: 20" />
|
<Label style="-fx-pref-width: 15" />
|
||||||
<FiatLabel fx:id="fiatAmount" />
|
<FiatLabel fx:id="fiatAmount" />
|
||||||
<Region style="-fx-pref-width: 20" />
|
<Region style="-fx-pref-width: 20" />
|
||||||
<Button fx:id="maxButton" text="Max" onAction="#setMaxInput" />
|
<Button fx:id="maxButton" text="Max" onAction="#setMaxInput" />
|
||||||
|
@ -71,7 +71,7 @@
|
||||||
</Field>
|
</Field>
|
||||||
<Field text="Fee:">
|
<Field text="Fee:">
|
||||||
<TextField fx:id="fee" styleClass="amount-field"/>
|
<TextField fx:id="fee" styleClass="amount-field"/>
|
||||||
<ComboBox fx:id="feeAmountUnit">
|
<ComboBox fx:id="feeAmountUnit" styleClass="amount-unit">
|
||||||
<items>
|
<items>
|
||||||
<FXCollections fx:factory="observableArrayList">
|
<FXCollections fx:factory="observableArrayList">
|
||||||
<BitcoinUnit fx:constant="BTC" />
|
<BitcoinUnit fx:constant="BTC" />
|
||||||
|
@ -79,6 +79,8 @@
|
||||||
</FXCollections>
|
</FXCollections>
|
||||||
</items>
|
</items>
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
|
<Label style="-fx-pref-width: 15" />
|
||||||
|
<FiatLabel fx:id="fiatFeeAmount" />
|
||||||
</Field>
|
</Field>
|
||||||
</Fieldset>
|
</Fieldset>
|
||||||
</Form>
|
</Form>
|
||||||
|
|
Loading…
Reference in a new issue