move bitcoinunit to drongo

This commit is contained in:
Craig Raw 2020-07-09 10:25:49 +02:00
parent e21dbf87ef
commit fc5bff9788
4 changed files with 3 additions and 53 deletions

2
drongo

@ -1 +1 @@
Subproject commit 687e235c94ef181a8de6ee1fb9cf812d6e16c672 Subproject commit 4e7f0611c4bd15ae983bd06feeb80ad69eedb853

View file

@ -1,50 +0,0 @@
package com.sparrowwallet.sparrow;
import com.sparrowwallet.drongo.protocol.Transaction;
public enum BitcoinUnit {
BTC("BTC") {
@Override
public long getSatsValue(double unitValue) {
return (long)(unitValue * Transaction.SATOSHIS_PER_BITCOIN);
}
public double getValue(long satsValue) {
return (double)satsValue / Transaction.SATOSHIS_PER_BITCOIN;
}
},
SATOSHIS("sats") {
@Override
public long getSatsValue(double unitValue) {
return (long)unitValue;
}
public double getValue(long satsValue) {
return (double)satsValue;
}
};
private final String label;
BitcoinUnit(String label) {
this.label = label;
}
public String getLabel() {
return label;
}
public abstract long getSatsValue(double unitValue);
public abstract double getValue(long satsValue);
public double convertFrom(double fromValue, BitcoinUnit fromUnit) {
long satsValue = fromUnit.getSatsValue(fromValue);
return getValue(satsValue);
}
@Override
public String toString() {
return label;
}
}

View file

@ -1,11 +1,11 @@
package com.sparrowwallet.sparrow.wallet; package com.sparrowwallet.sparrow.wallet;
import com.google.common.eventbus.Subscribe; import com.google.common.eventbus.Subscribe;
import com.sparrowwallet.drongo.BitcoinUnit;
import com.sparrowwallet.drongo.address.Address; import com.sparrowwallet.drongo.address.Address;
import com.sparrowwallet.drongo.address.InvalidAddressException; import com.sparrowwallet.drongo.address.InvalidAddressException;
import com.sparrowwallet.drongo.wallet.*; import com.sparrowwallet.drongo.wallet.*;
import com.sparrowwallet.sparrow.AppController; import com.sparrowwallet.sparrow.AppController;
import com.sparrowwallet.sparrow.BitcoinUnit;
import com.sparrowwallet.sparrow.EventManager; import com.sparrowwallet.sparrow.EventManager;
import com.sparrowwallet.sparrow.control.*; import com.sparrowwallet.sparrow.control.*;
import com.sparrowwallet.sparrow.event.FeeRatesUpdatedEvent; import com.sparrowwallet.sparrow.event.FeeRatesUpdatedEvent;

View file

@ -14,11 +14,11 @@
<?import javafx.geometry.Insets?> <?import javafx.geometry.Insets?>
<?import com.sparrowwallet.sparrow.control.CopyableLabel?> <?import com.sparrowwallet.sparrow.control.CopyableLabel?>
<?import javafx.collections.FXCollections?> <?import javafx.collections.FXCollections?>
<?import com.sparrowwallet.sparrow.BitcoinUnit?>
<?import com.sparrowwallet.sparrow.control.FeeRatesChart?> <?import com.sparrowwallet.sparrow.control.FeeRatesChart?>
<?import javafx.scene.chart.CategoryAxis?> <?import javafx.scene.chart.CategoryAxis?>
<?import javafx.scene.chart.NumberAxis?> <?import javafx.scene.chart.NumberAxis?>
<?import com.sparrowwallet.sparrow.control.TransactionDiagram?> <?import com.sparrowwallet.sparrow.control.TransactionDiagram?>
<?import com.sparrowwallet.drongo.BitcoinUnit?>
<BorderPane stylesheets="@send.css, @wallet.css, @../script.css, @../general.css" styleClass="wallet-pane" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.sparrowwallet.sparrow.wallet.SendController"> <BorderPane stylesheets="@send.css, @wallet.css, @../script.css, @../general.css" styleClass="wallet-pane" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.sparrowwallet.sparrow.wallet.SendController">
<center> <center>