Skip to content

Commit

Permalink
Addition of ToJSON/FromJSON instances for BlockNo
Browse files Browse the repository at this point in the history
  • Loading branch information
lehins committed Mar 16, 2023
1 parent dd15fa6 commit d305388
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions cardano-slotting/CHANGELOG.md
Expand Up @@ -2,6 +2,7 @@

## 0.1.1.0

* Addition of `ToJSON`/`FromJSON` instances for `BlockNo`
* Addition of `ToJSON`/`FromJSON` instances for `SystemStart`
* Addition of `ToCBOR`/`FromCBOR` instances for `RelativeTime` and `SlotLength`

Expand Down
3 changes: 2 additions & 1 deletion cardano-slotting/src/Cardano/Slotting/Block.hs
Expand Up @@ -10,6 +10,7 @@ where
import Cardano.Binary (FromCBOR (..), ToCBOR (..))
import Codec.Serialise (Serialise (..))
import Control.DeepSeq (NFData)
import Data.Aeson (ToJSON, FromJSON)
import Data.Word (Word64)
import GHC.Generics (Generic)
import NoThunks.Class (NoThunks)
Expand All @@ -21,7 +22,7 @@ import Quiet (Quiet (..))
newtype BlockNo = BlockNo {unBlockNo :: Word64}
deriving stock (Eq, Ord, Generic)
deriving Show via Quiet BlockNo
deriving newtype (Enum, Bounded, Num, Serialise, NoThunks, NFData)
deriving newtype (Enum, Bounded, Num, Serialise, NoThunks, NFData, ToJSON, FromJSON)

instance ToCBOR BlockNo where
toCBOR = encode
Expand Down

0 comments on commit d305388

Please sign in to comment.