bitcoin-s/eclair-rpc/eclair-rpc.sbt
rorp 43b6349758 Eclair RPC 0.4.1 (#1627)
* Eclair RPC 0.4.1

* channelstats

* remove the launch script editing code

* getinfo

* sendonchain, onchainbalance, onchaintransactions

* cleanup

* repond to the comments
2020-07-07 13:22:44 -07:00

55 lines
1.5 KiB
Scala

import java.nio.file._
import scala.util.Properties
name := "bitcoin-s-eclair-rpc"
libraryDependencies ++= Deps.eclairRpc
dependsOn(Projects.bitcoindRpc)
CommonSettings.prodSettings
TaskKeys.downloadEclair := {
val logger = streams.value.log
import scala.sys.process._
val binaryDir = CommonSettings.binariesPath.resolve("eclair")
if (Files.notExists(binaryDir)) {
logger.info(s"Creating directory for Eclair binaires: $binaryDir")
Files.createDirectories(binaryDir)
}
val version = "0.4.1"
val commit = "e5fb281"
logger.debug(s"(Maybe) downloading Eclair binaries for version: $version")
val versionDir = binaryDir resolve version
val location =
s"https://github.com/ACINQ/eclair/releases/download/v$version/eclair-node-$version-$commit-bin.zip"
if (Files.exists(versionDir)) {
logger.debug(
s"Directory $versionDir already exists, skipping download of Eclair $version")
} else {
logger.info(s"Creating directory $version")
Files.createDirectories(versionDir)
val archiveLocation = versionDir resolve s"eclair-node-$version-$commit.zip"
logger.info(
s"Downloading Eclair $version from location: $location, to destination: $archiveLocation")
(url(location) #> archiveLocation.toFile).!!
val extractCommand = s"unzip $archiveLocation -d $versionDir"
logger.info(s"Extracting archive with command: $extractCommand")
extractCommand.!!
logger.info(s"Deleting archive")
Files.delete(archiveLocation)
logger.info(s"Download complete")
}
}