mirror of
https://github.com/ACINQ/eclair.git
synced 2024-11-20 02:27:32 +01:00
Minor API fixes (#929)
Move GetInfoResponse and AuditResponse out of the api package Fix parameter handling for audit() and networkFees()
This commit is contained in:
parent
933913de08
commit
617ccf4d11
@ -5,20 +5,23 @@ import akka.pattern._
|
||||
import akka.util.Timeout
|
||||
import fr.acinq.bitcoin.Crypto.PublicKey
|
||||
import fr.acinq.bitcoin.{ByteVector32, MilliSatoshi, Satoshi}
|
||||
import fr.acinq.eclair.api.{AuditResponse, GetInfoResponse}
|
||||
import fr.acinq.eclair.channel._
|
||||
import fr.acinq.eclair.db.{NetworkFee, Stats}
|
||||
import fr.acinq.eclair.io.Peer.{GetPeerInfo, PeerInfo}
|
||||
import fr.acinq.eclair.io.{NodeURI, Peer}
|
||||
import fr.acinq.eclair.payment.PaymentLifecycle._
|
||||
import fr.acinq.eclair.payment.{PaymentLifecycle, PaymentRequest}
|
||||
import fr.acinq.eclair.payment.{PaymentLifecycle, PaymentReceived, PaymentRelayed, PaymentRequest, PaymentSent}
|
||||
import fr.acinq.eclair.router.{ChannelDesc, RouteRequest, RouteResponse}
|
||||
import fr.acinq.eclair.wire.{ChannelAnnouncement, ChannelUpdate, NodeAnnouncement}
|
||||
import fr.acinq.eclair.wire.{ChannelAnnouncement, ChannelUpdate, NodeAddress, NodeAnnouncement}
|
||||
import scodec.bits.ByteVector
|
||||
|
||||
import scala.concurrent.Future
|
||||
import scala.concurrent.duration._
|
||||
|
||||
case class GetInfoResponse(nodeId: PublicKey, alias: String, chainHash: ByteVector32, blockHeight: Int, publicAddresses: Seq[NodeAddress])
|
||||
|
||||
case class AuditResponse(sent: Seq[PaymentSent], received: Seq[PaymentReceived], relayed: Seq[PaymentRelayed])
|
||||
|
||||
trait Eclair {
|
||||
|
||||
def connect(uri: String): Future[String]
|
||||
@ -148,10 +151,8 @@ class EclairImpl(appKit: Kit) extends Eclair {
|
||||
}
|
||||
|
||||
override def audit(from_opt: Option[Long], to_opt: Option[Long]): Future[AuditResponse] = {
|
||||
val (from, to) = (from_opt, to_opt) match {
|
||||
case (Some(f), Some(t)) => (f, t)
|
||||
case _ => (0L, Long.MaxValue)
|
||||
}
|
||||
val from = from_opt.getOrElse(0L)
|
||||
val to = to_opt.getOrElse(Long.MaxValue)
|
||||
|
||||
Future(AuditResponse(
|
||||
sent = appKit.nodeParams.db.audit.listSent(from, to),
|
||||
@ -161,10 +162,8 @@ class EclairImpl(appKit: Kit) extends Eclair {
|
||||
}
|
||||
|
||||
override def networkFees(from_opt: Option[Long], to_opt: Option[Long]): Future[Seq[NetworkFee]] = {
|
||||
val (from, to) = (from_opt, to_opt) match {
|
||||
case (Some(f), Some(t)) => (f, t)
|
||||
case _ => (0L, Long.MaxValue)
|
||||
}
|
||||
val from = from_opt.getOrElse(0L)
|
||||
val to = to_opt.getOrElse(Long.MaxValue)
|
||||
|
||||
Future(appKit.nodeParams.db.audit.listNetworkFees(from, to))
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ import fr.acinq.eclair.payment.PaymentLifecycle._
|
||||
import fr.acinq.eclair.payment._
|
||||
import fr.acinq.eclair.router.{ChannelDesc, RouteRequest, RouteResponse}
|
||||
import fr.acinq.eclair.wire.{ChannelAnnouncement, ChannelUpdate, NodeAddress, NodeAnnouncement}
|
||||
import fr.acinq.eclair.{Kit, ShortChannelId, feerateByte2Kw}
|
||||
import fr.acinq.eclair.{AuditResponse, GetInfoResponse, Kit, ShortChannelId, feerateByte2Kw}
|
||||
import grizzled.slf4j.Logging
|
||||
import org.json4s.JsonAST.{JBool, JInt, JString}
|
||||
import org.json4s.{JValue, jackson}
|
||||
@ -57,8 +57,6 @@ case class JsonRPCBody(jsonrpc: String = "1.0", id: String = "eclair-node", meth
|
||||
case class Error(code: Int, message: String)
|
||||
case class JsonRPCRes(result: AnyRef, error: Option[Error], id: String)
|
||||
case class Status(node_id: String)
|
||||
case class GetInfoResponse(nodeId: PublicKey, alias: String, chainHash: ByteVector32, blockHeight: Int, publicAddresses: Seq[NodeAddress])
|
||||
case class AuditResponse(sent: Seq[PaymentSent], received: Seq[PaymentReceived], relayed: Seq[PaymentRelayed])
|
||||
trait RPCRejection extends Rejection {
|
||||
def requestId: String
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user