export 8 decimal places when exporting a csv in btc units

This commit is contained in:
Craig Raw 2022-12-15 16:37:33 +02:00
parent 8ba0a9f360
commit ce44cfe877
3 changed files with 6 additions and 2 deletions

View file

@ -82,6 +82,10 @@ public enum UnitFormat {
return getBtcFormat().format(amount.doubleValue() / Transaction.SATOSHIS_PER_BITCOIN); return getBtcFormat().format(amount.doubleValue() / Transaction.SATOSHIS_PER_BITCOIN);
} }
public String tableFormatBtcValue(Long amount) {
return getTableBtcFormat().format(amount.doubleValue() / Transaction.SATOSHIS_PER_BITCOIN);
}
public String formatSatsValue(Long amount) { public String formatSatsValue(Long amount) {
return getSatsFormat().format(amount); return getSatsFormat().format(amount);
} }

View file

@ -142,7 +142,7 @@ public class TransactionsController extends WalletFormController implements Init
private String getCoinValue(Long value) { private String getCoinValue(Long value) {
UnitFormat format = Config.get().getUnitFormat() == null ? UnitFormat.DOT : Config.get().getUnitFormat(); UnitFormat format = Config.get().getUnitFormat() == null ? UnitFormat.DOT : Config.get().getUnitFormat();
return BitcoinUnit.BTC.equals(transactionsTable.getBitcoinUnit()) ? format.formatBtcValue(value) : String.format(Locale.ENGLISH, "%d", value); return BitcoinUnit.BTC.equals(transactionsTable.getBitcoinUnit()) ? format.tableFormatBtcValue(value) : String.format(Locale.ENGLISH, "%d", value);
} }
private void logMessage(String logMessage) { private void logMessage(String logMessage) {

View file

@ -491,7 +491,7 @@ public class UtxosController extends WalletFormController implements Initializab
private String getCoinValue(Long value) { private String getCoinValue(Long value) {
UnitFormat format = Config.get().getUnitFormat() == null ? UnitFormat.DOT : Config.get().getUnitFormat(); UnitFormat format = Config.get().getUnitFormat() == null ? UnitFormat.DOT : Config.get().getUnitFormat();
return BitcoinUnit.BTC.equals(utxosTable.getBitcoinUnit()) ? format.formatBtcValue(value) : String.format(Locale.ENGLISH, "%d", value); return BitcoinUnit.BTC.equals(utxosTable.getBitcoinUnit()) ? format.tableFormatBtcValue(value) : String.format(Locale.ENGLISH, "%d", value);
} }
private static Glyph getExternalGlyph() { private static Glyph getExternalGlyph() {