@@ -63,9 +63,18 @@ object CardanoApiCodec {
6363 private [cardano] implicit val decodeDelegationStatus : Decoder [DelegationStatus ] = Decoder .decodeString.map(DelegationStatus .withName)
6464 private [cardano] implicit val encodeDelegationStatus : Encoder [DelegationStatus ] = (a : DelegationStatus ) => Json .fromString(a.toString)
6565
66- private [cardano] implicit val decodeTxMetadataOut : Decoder [TxMetadataOut ] = Decoder .decodeJson.map(TxMetadataOut )
66+ private [cardano] implicit val decodeTxMetadataOut : Decoder [TxMetadataOut ] = Decoder .decodeJson.map(TxMetadataOut .apply )
6767 private [cardano] implicit val decodeKeyMetadata : KeyDecoder [MetadataKey ] = (key : String ) => Some (MetadataValueStr (key))
6868
69+ private [cardano] implicit val encodeDelegationNext : Encoder [DelegationNext ] = dropNulls(deriveConfiguredEncoder)
70+ private [cardano] implicit val encodeDelegationActive : Encoder [DelegationActive ] = dropNulls(deriveConfiguredEncoder)
71+ private [cardano] implicit val encodeNetworkTip : Encoder [NetworkTip ] = dropNulls(deriveConfiguredEncoder)
72+ private [cardano] implicit val encodeNodeTip : Encoder [NodeTip ] = dropNulls(deriveConfiguredEncoder)
73+ private [cardano] implicit val encodeSyncStatus : Encoder [SyncStatus ] = dropNulls(deriveConfiguredEncoder)
74+ private [cardano] implicit val encodeCreateTransactionResponse : Encoder [CreateTransactionResponse ] = dropNulls(deriveConfiguredEncoder)
75+ private [cardano] implicit val encodeWallet : Encoder [Wallet ] = dropNulls(deriveConfiguredEncoder)
76+ private [cardano] implicit val encodeBlock : Encoder [Block ] = dropNulls(deriveConfiguredEncoder)
77+
6978 sealed trait MetadataValue
7079
7180 sealed trait MetadataKey extends MetadataValue
@@ -130,7 +139,7 @@ object CardanoApiCodec {
130139
131140 }
132141
133- case class SyncStatus (status : SyncState , progress : Option [QuantityUnit ])
142+ final case class SyncStatus (status : SyncState , progress : Option [QuantityUnit ])
134143
135144 object SyncState extends Enumeration {
136145 type SyncState = Value
@@ -145,17 +154,17 @@ object CardanoApiCodec {
145154 val delegating : DelegationStatus = Value (" delegating" )
146155 val notDelegating : DelegationStatus = Value (" not_delegating" )
147156 }
148- final case class DelegationActive (status : DelegationStatus , target : Option [String ])
149- @ ConfiguredJsonCodec final case class DelegationNext (status : DelegationStatus , changesAt : Option [NextEpoch ])
150- final case class Delegation (active : DelegationActive , next : List [DelegationNext ])
157+ @ ConfiguredJsonCodec (decodeOnly = true ) final case class DelegationActive (status : DelegationStatus , target : Option [String ])
158+ @ ConfiguredJsonCodec (decodeOnly = true ) final case class DelegationNext (status : DelegationStatus , changesAt : Option [NextEpoch ])
159+ @ ConfiguredJsonCodec final case class Delegation (active : DelegationActive , next : List [DelegationNext ])
151160
152- @ ConfiguredJsonCodec case class NetworkTip (
161+ @ ConfiguredJsonCodec (decodeOnly = true ) final case class NetworkTip (
153162 epochNumber : Long ,
154163 slotNumber : Long ,
155164 height : Option [QuantityUnit ],
156165 absoluteSlotNumber : Option [Long ])
157166
158- @ ConfiguredJsonCodec case class NodeTip (height : QuantityUnit , slotNumber : Long , epochNumber : Long , absoluteSlotNumber : Option [Long ])
167+ @ ConfiguredJsonCodec (decodeOnly = true ) final case class NodeTip (height : QuantityUnit , slotNumber : Long , epochNumber : Long , absoluteSlotNumber : Option [Long ])
159168
160169 case class WalletAddressId (id : String , state : Option [AddressFilter ])
161170
@@ -211,7 +220,7 @@ object CardanoApiCodec {
211220 nextEpoch : NextEpoch
212221 )
213222
214- @ ConfiguredJsonCodec
223+ @ ConfiguredJsonCodec (decodeOnly = true )
215224 case class CreateRestore (
216225 name : String ,
217226 passphrase : String ,
@@ -283,7 +292,7 @@ object CardanoApiCodec {
283292 outputs : Seq [OutAddress ]
284293 )
285294
286- @ ConfiguredJsonCodec
295+ @ ConfiguredJsonCodec (decodeOnly = true )
287296 case class Block (
288297 slotNumber : Int ,
289298 epochNumber : Int ,
@@ -304,7 +313,7 @@ object CardanoApiCodec {
304313 estimatedMax : QuantityUnit
305314 )
306315
307- @ ConfiguredJsonCodec
316+ @ ConfiguredJsonCodec (decodeOnly = true )
308317 case class CreateTransactionResponse (
309318 id : String ,
310319 amount : QuantityUnit ,
@@ -322,7 +331,7 @@ object CardanoApiCodec {
322331 @ ConfiguredJsonCodec
323332 final case class Passphrase (lastUpdatedAt : ZonedDateTime )
324333
325- @ ConfiguredJsonCodec
334+ @ ConfiguredJsonCodec (decodeOnly = true )
326335 case class Wallet (
327336 id : String ,
328337 addressPoolGap : Int ,
0 commit comments