Update DLC Table with scheduler (#3204)

This commit is contained in:
benthecarman 2021-05-31 09:27:37 -07:00 committed by GitHub
parent bf02e89faa
commit d3f827a127
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 5 deletions

View file

@ -54,8 +54,8 @@ abstract class WalletGUI {
" sats")
}
private lazy val model = new WalletGUIModel()
private lazy val dlcPane = new DLCPane(glassPane)
private lazy val model = new WalletGUIModel(dlcPane.model)
private lazy val balanceBox = new VBox {
spacing = 10

View file

@ -7,6 +7,7 @@ import org.bitcoins.core.currency.{Bitcoins, Satoshis}
import org.bitcoins.core.protocol.BitcoinAddress
import org.bitcoins.core.wallet.fee.FeeUnit
import org.bitcoins.gui.dialog._
import org.bitcoins.gui.dlc.DLCPaneModel
import org.bitcoins.gui.util.GUIUtil
import scalafx.application.Platform
import scalafx.beans.property._
@ -18,7 +19,7 @@ import scala.concurrent.duration.DurationInt
import scala.concurrent.{Await, Promise}
import scala.util.{Failure, Success, Try}
class WalletGUIModel()(implicit system: ActorSystem) {
class WalletGUIModel(dlcModel: DLCPaneModel)(implicit system: ActorSystem) {
var taskRunner: TaskRunner = _
import system.dispatcher
@ -33,6 +34,7 @@ class WalletGUIModel()(implicit system: ActorSystem) {
Platform.runLater {
updateBalance()
updateWalletInfo()
dlcModel.updateDLCs()
}
}
}

View file

@ -2,7 +2,7 @@ package org.bitcoins.gui.dlc
import grizzled.slf4j.Logging
import org.bitcoins.cli.CliCommand._
import org.bitcoins.cli.{CliCommand, Config, ConsoleCli}
import org.bitcoins.cli.{CliCommand, ConsoleCli}
import org.bitcoins.commons.serializers.Picklers._
import org.bitcoins.core.protocol.dlc.models._
import org.bitcoins.crypto._
@ -29,7 +29,7 @@ class DLCPaneModel(resultArea: TextArea) extends Logging {
ObjectProperty[Window](null.asInstanceOf[Window])
def getDLCs: Vector[DLCStatus] = {
ConsoleCli.exec(GetDLCs, Config.empty) match {
ConsoleCli.exec(GetDLCs, GlobalData.consoleCliConfig) match {
case Failure(exception) => throw exception
case Success(dlcsStr) =>
ujson.read(dlcsStr).arr.map(read[DLCStatus](_)).toVector
@ -42,7 +42,7 @@ class DLCPaneModel(resultArea: TextArea) extends Logging {
}
def updateDLC(dlcId: Sha256Digest): Unit = {
ConsoleCli.exec(GetDLC(dlcId), Config.empty) match {
ConsoleCli.exec(GetDLC(dlcId), GlobalData.consoleCliConfig) match {
case Failure(exception) => throw exception
case Success(dlcStatus) =>
dlcs += read[DLCStatus](ujson.read(dlcStatus))