From 863ffd9d6fcfd4e48864c2638ab3c320d710122f Mon Sep 17 00:00:00 2001 From: Chris Stewart Date: Sat, 11 May 2024 06:34:06 -0500 Subject: [PATCH] Adjust `OutgoingPaymentStatus.completedAt` to be `RelayTimestamp` type (#5586) * Adjust OutgoingPaymentStatus.completedAt to be RelayTimestamp type * Empty commit to re-run CI --- .../commons/jsonmodels/eclair/EclairModels.scala | 4 ++-- .../org/bitcoins/commons/serializers/JsonReaders.scala | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app-commons/src/main/scala/org/bitcoins/commons/jsonmodels/eclair/EclairModels.scala b/app-commons/src/main/scala/org/bitcoins/commons/jsonmodels/eclair/EclairModels.scala index 48154bcdb9..091634618d 100644 --- a/app-commons/src/main/scala/org/bitcoins/commons/jsonmodels/eclair/EclairModels.scala +++ b/app-commons/src/main/scala/org/bitcoins/commons/jsonmodels/eclair/EclairModels.scala @@ -380,10 +380,10 @@ object OutgoingPaymentStatus { paymentPreimage: PaymentPreimage, feesPaid: MilliSatoshis, route: Seq[Hop], - completedAt: Instant // milliseconds + completedAt: RelayTimestamp ) extends OutgoingPaymentStatus - case class Failed(failures: Seq[PaymentFailure], completedAt: Instant) + case class Failed(failures: Seq[PaymentFailure], completedAt: RelayTimestamp) extends OutgoingPaymentStatus } diff --git a/app-commons/src/main/scala/org/bitcoins/commons/serializers/JsonReaders.scala b/app-commons/src/main/scala/org/bitcoins/commons/serializers/JsonReaders.scala index 8a86bf3799..77443a6284 100644 --- a/app-commons/src/main/scala/org/bitcoins/commons/serializers/JsonReaders.scala +++ b/app-commons/src/main/scala/org/bitcoins/commons/serializers/JsonReaders.scala @@ -1277,8 +1277,8 @@ object JsonReaders { preimage <- (js \ "paymentPreimage").validate[PaymentPreimage] feesPaid <- (js \ "feesPaid").validate[MilliSatoshis] route <- (js \ "route").validate[Seq[Hop]] - completed <- (js \ "completedAt" \ "unix") - .validate[Instant](instantReadsMilliseconds) + completed <- (js \ "completedAt") + .validate[RelayTimestamp] } yield OutgoingPaymentStatus.Succeeded( paymentPreimage = preimage, feesPaid = feesPaid, @@ -1306,6 +1306,9 @@ object JsonReaders { implicit val paymentFailureReads: Reads[PaymentFailure] = Json.reads[PaymentFailure] + implicit val relayTimestampReads: Reads[RelayTimestamp] = + Json.reads[RelayTimestamp] + implicit val paymentFailedReads: Reads[OutgoingPaymentStatus.Failed] = Json.reads[OutgoingPaymentStatus.Failed] @@ -1468,8 +1471,6 @@ object JsonReaders { implicit val sentPaymentReads: Reads[SentPayment] = Json.reads[SentPayment] - implicit val relayTimestampReads: Reads[RelayTimestamp] = - Json.reads[RelayTimestamp] implicit val relayedPaymentReads: Reads[RelayedPayment] = Reads { js => for { amountIn <- (js \ "amountIn").validate[MilliSatoshis]