1
1
{-# LANGUAGE AllowAmbiguousTypes #-}
2
+ {-# LANGUAGE DerivingVia #-}
2
3
{-# LANGUAGE DuplicateRecordFields #-}
3
4
4
5
module Hydra.Tx.CollectCom where
@@ -99,6 +100,15 @@ collectComTx networkId scriptRegistry vk headId headParameters (headInput, initi
99
100
100
101
newtype UTxOHash = UTxOHash ByteString
101
102
deriving stock (Eq , Show , Generic )
103
+ deriving (ToJSON , FromJSON ) via (UsingRawBytesHex UTxOHash )
104
+
105
+ instance HasTypeProxy UTxOHash where
106
+ data AsType UTxOHash = AsUTxOHash
107
+ proxyToAsType _ = AsUTxOHash
108
+
109
+ instance SerialiseAsRawBytes UTxOHash where
110
+ serialiseToRawBytes (UTxOHash bytes) = bytes
111
+ deserialiseFromRawBytes _ = Right . UTxOHash
102
112
103
113
instance Arbitrary UTxOHash where
104
114
arbitrary = UTxOHash . BS. pack <$> vectorOf 32 arbitrary
@@ -108,6 +118,11 @@ data CollectComObservation = CollectComObservation
108
118
, utxoHash :: UTxOHash
109
119
}
110
120
deriving stock (Show , Eq , Generic )
121
+ deriving anyclass (ToJSON , FromJSON )
122
+
123
+ instance Arbitrary CollectComObservation where
124
+ arbitrary = genericArbitrary
125
+ shrink = genericShrink
111
126
112
127
-- | Identify a collectCom tx by lookup up the input spending the Head output
113
128
-- and decoding its redeemer.
0 commit comments