Uniform GUI denominations (#2534)

This commit is contained in:
benthecarman 2021-01-20 08:00:16 -06:00 committed by GitHub
parent 811e96bb4f
commit 962887dd0c
5 changed files with 16 additions and 10 deletions

View File

@ -4,10 +4,10 @@ import org.bitcoins.cli.Config
import org.bitcoins.core.config._
import org.bitcoins.crypto.DoubleSha256DigestBE
import org.bitcoins.gui.settings.Themes
import scalafx.beans.property.{DoubleProperty, StringProperty}
import scalafx.beans.property.{LongProperty, StringProperty}
object GlobalData {
val currentBalance: DoubleProperty = DoubleProperty(0)
val currentBalance: LongProperty = LongProperty(0)
var network: BitcoinNetwork = _

View File

@ -75,7 +75,7 @@ object WalletGUI extends JFXApp {
wrapText = true
text <== StringProperty(
"Your current balance is: ") + GlobalData.currentBalance + StringProperty(
s"\n\n${(0 until 60).map(_ => "-").mkString("")}\n\n") + GlobalData.log
s" sats\n\n${(0 until 60).map(_ => "-").mkString}\n\n") + GlobalData.log
}
private val model = new WalletGUIModel()

View File

@ -2,7 +2,7 @@ package org.bitcoins.gui
import org.bitcoins.cli.CliCommand.{GetBalance, GetNewAddress, SendToAddress}
import org.bitcoins.cli.ConsoleCli
import org.bitcoins.core.currency.Bitcoins
import org.bitcoins.core.currency.{Bitcoins, Satoshis}
import org.bitcoins.core.protocol.BitcoinAddress
import org.bitcoins.gui.dialog.{GetNewAddressDialog, SendDialog}
import scalafx.beans.property.{ObjectProperty, StringProperty}
@ -66,9 +66,11 @@ class WalletGUIModel() {
taskRunner.run(
caption = s"Send $amount to $address",
op = {
val sats = Satoshis(amount.toLong)
ConsoleCli.exec(
SendToAddress(BitcoinAddress.fromString(address),
Bitcoins(BigDecimal(amount)),
Bitcoins(sats),
satoshisPerVirtualByte = None,
noBroadcast = false),
GlobalData.consoleCliConfig
@ -87,10 +89,10 @@ class WalletGUIModel() {
}
private def updateBalance(): Unit = {
ConsoleCli.exec(GetBalance(isSats = false),
ConsoleCli.exec(GetBalance(isSats = true),
GlobalData.consoleCliConfig) match {
case Success(commandReturn) =>
GlobalData.currentBalance.value = commandReturn.split(' ').head.toDouble
GlobalData.currentBalance.value = commandReturn.split(' ').head.toLong
case Failure(err) =>
err.printStackTrace()
val _ = new Alert(AlertType.Error) {

View File

@ -20,7 +20,9 @@ object SendDialog {
dialog.dialogPane().stylesheets = GlobalData.currentStyleSheets
val addressTF = new TextField()
val amountTF = new TextField()
val amountTF = new TextField() {
promptText = "(sats)"
}
dialog.dialogPane().content = new GridPane {
hgap = 10
@ -35,7 +37,7 @@ object SendDialog {
}
addRow("Address", addressTF)
addRow("Amount (in BTC)", amountTF)
addRow("Amount", amountTF)
}
// Enable/Disable OK button depending on whether all data was entered.

View File

@ -67,7 +67,9 @@ class DLCPane(glassPane: VBox) {
private val model =
new DLCPaneModel(resultTextArea, demoOracleArea)
model.setUp()
// This is commented out because it will cause the GUI startup to fail on master
// It should be uncommented when on the adaptor-dlc branch
//model.setUp()
private val enumContractButton = new Button {
text = "Enum Contract"