module Blockfrost.Types.Cardano.Scripts
( Script (..)
, ScriptType (..)
, ScriptRedeemer (..)
, ScriptDatum (..)
, ScriptDatumCBOR (..)
, InlineDatum (..)
, ScriptJSON (..)
, ScriptCBOR (..)
) where
import Data.Aeson (Value, object, (.=), FromJSON (..), ToJSON (..))
import Data.Text (Text)
import Deriving.Aeson
import Servant.Docs (ToSample (..), samples, singleSample)
import Blockfrost.Types.Shared
data ScriptType = PlutusV1 | PlutusV2 | Timelock
deriving stock (Int -> ScriptType -> ShowS
[ScriptType] -> ShowS
ScriptType -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ScriptType] -> ShowS
$cshowList :: [ScriptType] -> ShowS
show :: ScriptType -> String
$cshow :: ScriptType -> String
showsPrec :: Int -> ScriptType -> ShowS
$cshowsPrec :: Int -> ScriptType -> ShowS
Show, ScriptType -> ScriptType -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ScriptType -> ScriptType -> Bool
$c/= :: ScriptType -> ScriptType -> Bool
== :: ScriptType -> ScriptType -> Bool
$c== :: ScriptType -> ScriptType -> Bool
Eq, Eq ScriptType
ScriptType -> ScriptType -> Bool
ScriptType -> ScriptType -> Ordering
ScriptType -> ScriptType -> ScriptType
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: ScriptType -> ScriptType -> ScriptType
$cmin :: ScriptType -> ScriptType -> ScriptType
max :: ScriptType -> ScriptType -> ScriptType
$cmax :: ScriptType -> ScriptType -> ScriptType
>= :: ScriptType -> ScriptType -> Bool
$c>= :: ScriptType -> ScriptType -> Bool
> :: ScriptType -> ScriptType -> Bool
$c> :: ScriptType -> ScriptType -> Bool
<= :: ScriptType -> ScriptType -> Bool
$c<= :: ScriptType -> ScriptType -> Bool
< :: ScriptType -> ScriptType -> Bool
$c< :: ScriptType -> ScriptType -> Bool
compare :: ScriptType -> ScriptType -> Ordering
$ccompare :: ScriptType -> ScriptType -> Ordering
Ord, forall x. Rep ScriptType x -> ScriptType
forall x. ScriptType -> Rep ScriptType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ScriptType x -> ScriptType
$cfrom :: forall x. ScriptType -> Rep ScriptType x
Generic)
deriving (Value -> Parser [ScriptType]
Value -> Parser ScriptType
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [ScriptType]
$cparseJSONList :: Value -> Parser [ScriptType]
parseJSON :: Value -> Parser ScriptType
$cparseJSON :: Value -> Parser ScriptType
FromJSON, [ScriptType] -> Encoding
[ScriptType] -> Value
ScriptType -> Encoding
ScriptType -> Value
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [ScriptType] -> Encoding
$ctoEncodingList :: [ScriptType] -> Encoding
toJSONList :: [ScriptType] -> Value
$ctoJSONList :: [ScriptType] -> Value
toEncoding :: ScriptType -> Encoding
$ctoEncoding :: ScriptType -> Encoding
toJSON :: ScriptType -> Value
$ctoJSON :: ScriptType -> Value
ToJSON)
via CustomJSON '[ConstructorTagModifier '[ToLower]] ScriptType
instance ToSample ScriptType where
toSamples :: Proxy ScriptType -> [(Text, ScriptType)]
toSamples = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ forall a. [a] -> [(Text, a)]
samples [ ScriptType
PlutusV1, ScriptType
PlutusV2, ScriptType
Timelock ]
data Script = Script
{ Script -> ScriptHash
_scriptScriptHash :: ScriptHash
, Script -> ScriptType
_scriptType :: ScriptType
, Script -> Maybe Integer
_scriptSerialisedSize :: Maybe Integer
}
deriving stock (Int -> Script -> ShowS
[Script] -> ShowS
Script -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Script] -> ShowS
$cshowList :: [Script] -> ShowS
show :: Script -> String
$cshow :: Script -> String
showsPrec :: Int -> Script -> ShowS
$cshowsPrec :: Int -> Script -> ShowS
Show, Script -> Script -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Script -> Script -> Bool
$c/= :: Script -> Script -> Bool
== :: Script -> Script -> Bool
$c== :: Script -> Script -> Bool
Eq, forall x. Rep Script x -> Script
forall x. Script -> Rep Script x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Script x -> Script
$cfrom :: forall x. Script -> Rep Script x
Generic)
deriving (Value -> Parser [Script]
Value -> Parser Script
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [Script]
$cparseJSONList :: Value -> Parser [Script]
parseJSON :: Value -> Parser Script
$cparseJSON :: Value -> Parser Script
FromJSON, [Script] -> Encoding
[Script] -> Value
Script -> Encoding
Script -> Value
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [Script] -> Encoding
$ctoEncodingList :: [Script] -> Encoding
toJSONList :: [Script] -> Value
$ctoJSONList :: [Script] -> Value
toEncoding :: Script -> Encoding
$ctoEncoding :: Script -> Encoding
toJSON :: Script -> Value
$ctoJSON :: Script -> Value
ToJSON)
via CustomJSON '[FieldLabelModifier '[StripPrefix "_script", CamelToSnake]] Script
instance ToSample Script where
toSamples :: Proxy Script -> [(Text, Script)]
toSamples = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ forall a. a -> [(Text, a)]
singleSample
Script
{ _scriptScriptHash :: ScriptHash
_scriptScriptHash = ScriptHash
"67f33146617a5e61936081db3b2117cbf59bd2123748f58ac9678656"
, _scriptType :: ScriptType
_scriptType = ScriptType
PlutusV1
, _scriptSerialisedSize :: Maybe Integer
_scriptSerialisedSize = forall a. a -> Maybe a
Just Integer
3119
}
data ScriptRedeemer = ScriptRedeemer
{ ScriptRedeemer -> TxHash
_scriptRedeemerTxHash :: TxHash
, ScriptRedeemer -> Integer
_scriptRedeemerTxIndex :: Integer
, ScriptRedeemer -> ValidationPurpose
_scriptRedeemerPurpose :: ValidationPurpose
, ScriptRedeemer -> DatumHash
_scriptRedeemerRedeemerDataHash :: DatumHash
, ScriptRedeemer -> DatumHash
_scriptRedeemerDatumHash :: DatumHash
, ScriptRedeemer -> Quantity
_scriptRedeemerUnitMem :: Quantity
, ScriptRedeemer -> Quantity
_scriptRedeemerUnitSteps :: Quantity
, ScriptRedeemer -> Lovelaces
_scriptRedeemerFee :: Lovelaces
}
deriving stock (Int -> ScriptRedeemer -> ShowS
[ScriptRedeemer] -> ShowS
ScriptRedeemer -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ScriptRedeemer] -> ShowS
$cshowList :: [ScriptRedeemer] -> ShowS
show :: ScriptRedeemer -> String
$cshow :: ScriptRedeemer -> String
showsPrec :: Int -> ScriptRedeemer -> ShowS
$cshowsPrec :: Int -> ScriptRedeemer -> ShowS
Show, ScriptRedeemer -> ScriptRedeemer -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ScriptRedeemer -> ScriptRedeemer -> Bool
$c/= :: ScriptRedeemer -> ScriptRedeemer -> Bool
== :: ScriptRedeemer -> ScriptRedeemer -> Bool
$c== :: ScriptRedeemer -> ScriptRedeemer -> Bool
Eq, forall x. Rep ScriptRedeemer x -> ScriptRedeemer
forall x. ScriptRedeemer -> Rep ScriptRedeemer x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ScriptRedeemer x -> ScriptRedeemer
$cfrom :: forall x. ScriptRedeemer -> Rep ScriptRedeemer x
Generic)
deriving (Value -> Parser [ScriptRedeemer]
Value -> Parser ScriptRedeemer
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [ScriptRedeemer]
$cparseJSONList :: Value -> Parser [ScriptRedeemer]
parseJSON :: Value -> Parser ScriptRedeemer
$cparseJSON :: Value -> Parser ScriptRedeemer
FromJSON, [ScriptRedeemer] -> Encoding
[ScriptRedeemer] -> Value
ScriptRedeemer -> Encoding
ScriptRedeemer -> Value
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [ScriptRedeemer] -> Encoding
$ctoEncodingList :: [ScriptRedeemer] -> Encoding
toJSONList :: [ScriptRedeemer] -> Value
$ctoJSONList :: [ScriptRedeemer] -> Value
toEncoding :: ScriptRedeemer -> Encoding
$ctoEncoding :: ScriptRedeemer -> Encoding
toJSON :: ScriptRedeemer -> Value
$ctoJSON :: ScriptRedeemer -> Value
ToJSON)
via CustomJSON '[FieldLabelModifier '[StripPrefix "_scriptRedeemer", CamelToSnake]] ScriptRedeemer
instance ToSample ScriptRedeemer where
toSamples :: Proxy ScriptRedeemer -> [(Text, ScriptRedeemer)]
toSamples = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ forall a. a -> [(Text, a)]
singleSample
ScriptRedeemer
{ _scriptRedeemerTxHash :: TxHash
_scriptRedeemerTxHash = TxHash
"1a0570af966fb355a7160e4f82d5a80b8681b7955f5d44bec0dce628516157f0"
, _scriptRedeemerTxIndex :: Integer
_scriptRedeemerTxIndex = Integer
0
, _scriptRedeemerPurpose :: ValidationPurpose
_scriptRedeemerPurpose = ValidationPurpose
Spend
, _scriptRedeemerRedeemerDataHash :: DatumHash
_scriptRedeemerRedeemerDataHash = DatumHash
"923918e403bf43c34b4ef6b48eb2ee04babed17320d8d1b9ff9ad086e86f44ec"
, _scriptRedeemerDatumHash :: DatumHash
_scriptRedeemerDatumHash = DatumHash
"923918e403bf43c34b4ef6b48eb2ee04babed17320d8d1b9ff9ad086e86f44ec"
, _scriptRedeemerUnitMem :: Quantity
_scriptRedeemerUnitMem = Quantity
1700
, _scriptRedeemerUnitSteps :: Quantity
_scriptRedeemerUnitSteps = Quantity
476468
, _scriptRedeemerFee :: Lovelaces
_scriptRedeemerFee = Discrete' "ADA" '(1000000, 1)
172033
}
newtype ScriptDatum = ScriptDatum { ScriptDatum -> Value
_scriptDatumJsonValue :: Value }
deriving stock (Int -> ScriptDatum -> ShowS
[ScriptDatum] -> ShowS
ScriptDatum -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ScriptDatum] -> ShowS
$cshowList :: [ScriptDatum] -> ShowS
show :: ScriptDatum -> String
$cshow :: ScriptDatum -> String
showsPrec :: Int -> ScriptDatum -> ShowS
$cshowsPrec :: Int -> ScriptDatum -> ShowS
Show, ScriptDatum -> ScriptDatum -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ScriptDatum -> ScriptDatum -> Bool
$c/= :: ScriptDatum -> ScriptDatum -> Bool
== :: ScriptDatum -> ScriptDatum -> Bool
$c== :: ScriptDatum -> ScriptDatum -> Bool
Eq, forall x. Rep ScriptDatum x -> ScriptDatum
forall x. ScriptDatum -> Rep ScriptDatum x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ScriptDatum x -> ScriptDatum
$cfrom :: forall x. ScriptDatum -> Rep ScriptDatum x
Generic)
deriving (Value -> Parser [ScriptDatum]
Value -> Parser ScriptDatum
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [ScriptDatum]
$cparseJSONList :: Value -> Parser [ScriptDatum]
parseJSON :: Value -> Parser ScriptDatum
$cparseJSON :: Value -> Parser ScriptDatum
FromJSON, [ScriptDatum] -> Encoding
[ScriptDatum] -> Value
ScriptDatum -> Encoding
ScriptDatum -> Value
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [ScriptDatum] -> Encoding
$ctoEncodingList :: [ScriptDatum] -> Encoding
toJSONList :: [ScriptDatum] -> Value
$ctoJSONList :: [ScriptDatum] -> Value
toEncoding :: ScriptDatum -> Encoding
$ctoEncoding :: ScriptDatum -> Encoding
toJSON :: ScriptDatum -> Value
$ctoJSON :: ScriptDatum -> Value
ToJSON)
via CustomJSON '[FieldLabelModifier '[StripPrefix "_scriptDatum", CamelToSnake]] ScriptDatum
instance ToSample ScriptDatum where
toSamples :: Proxy ScriptDatum -> [(Text, ScriptDatum)]
toSamples =
forall (f :: * -> *) a. Applicative f => a -> f a
pure
forall a b. (a -> b) -> a -> b
$ forall a. a -> [(Text, a)]
singleSample
forall a b. (a -> b) -> a -> b
$ Value -> ScriptDatum
ScriptDatum
forall a b. (a -> b) -> a -> b
$ [Pair] -> Value
object [ Key
"int" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= (Int
42 :: Int) ]
newtype ScriptDatumCBOR = ScriptDatumCBOR { ScriptDatumCBOR -> Text
_scriptDatumCborCbor :: Text }
deriving stock (Int -> ScriptDatumCBOR -> ShowS
[ScriptDatumCBOR] -> ShowS
ScriptDatumCBOR -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ScriptDatumCBOR] -> ShowS
$cshowList :: [ScriptDatumCBOR] -> ShowS
show :: ScriptDatumCBOR -> String
$cshow :: ScriptDatumCBOR -> String
showsPrec :: Int -> ScriptDatumCBOR -> ShowS
$cshowsPrec :: Int -> ScriptDatumCBOR -> ShowS
Show, ScriptDatumCBOR -> ScriptDatumCBOR -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ScriptDatumCBOR -> ScriptDatumCBOR -> Bool
$c/= :: ScriptDatumCBOR -> ScriptDatumCBOR -> Bool
== :: ScriptDatumCBOR -> ScriptDatumCBOR -> Bool
$c== :: ScriptDatumCBOR -> ScriptDatumCBOR -> Bool
Eq, forall x. Rep ScriptDatumCBOR x -> ScriptDatumCBOR
forall x. ScriptDatumCBOR -> Rep ScriptDatumCBOR x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ScriptDatumCBOR x -> ScriptDatumCBOR
$cfrom :: forall x. ScriptDatumCBOR -> Rep ScriptDatumCBOR x
Generic)
deriving (Value -> Parser [ScriptDatumCBOR]
Value -> Parser ScriptDatumCBOR
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [ScriptDatumCBOR]
$cparseJSONList :: Value -> Parser [ScriptDatumCBOR]
parseJSON :: Value -> Parser ScriptDatumCBOR
$cparseJSON :: Value -> Parser ScriptDatumCBOR
FromJSON, [ScriptDatumCBOR] -> Encoding
[ScriptDatumCBOR] -> Value
ScriptDatumCBOR -> Encoding
ScriptDatumCBOR -> Value
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [ScriptDatumCBOR] -> Encoding
$ctoEncodingList :: [ScriptDatumCBOR] -> Encoding
toJSONList :: [ScriptDatumCBOR] -> Value
$ctoJSONList :: [ScriptDatumCBOR] -> Value
toEncoding :: ScriptDatumCBOR -> Encoding
$ctoEncoding :: ScriptDatumCBOR -> Encoding
toJSON :: ScriptDatumCBOR -> Value
$ctoJSON :: ScriptDatumCBOR -> Value
ToJSON)
via CustomJSON '[FieldLabelModifier '[StripPrefix "_scriptDatumCbor", CamelToSnake]] ScriptDatumCBOR
instance ToSample ScriptDatumCBOR where
toSamples :: Proxy ScriptDatumCBOR -> [(Text, ScriptDatumCBOR)]
toSamples =
forall (f :: * -> *) a. Applicative f => a -> f a
pure
forall a b. (a -> b) -> a -> b
$ forall a. a -> [(Text, a)]
singleSample
forall a b. (a -> b) -> a -> b
$ Text -> ScriptDatumCBOR
ScriptDatumCBOR Text
"19a6aa"
newtype InlineDatum = InlineDatum { InlineDatum -> ScriptDatumCBOR
unInlineDatum :: ScriptDatumCBOR }
deriving stock (Int -> InlineDatum -> ShowS
[InlineDatum] -> ShowS
InlineDatum -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InlineDatum] -> ShowS
$cshowList :: [InlineDatum] -> ShowS
show :: InlineDatum -> String
$cshow :: InlineDatum -> String
showsPrec :: Int -> InlineDatum -> ShowS
$cshowsPrec :: Int -> InlineDatum -> ShowS
Show, InlineDatum -> InlineDatum -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InlineDatum -> InlineDatum -> Bool
$c/= :: InlineDatum -> InlineDatum -> Bool
== :: InlineDatum -> InlineDatum -> Bool
$c== :: InlineDatum -> InlineDatum -> Bool
Eq, forall x. Rep InlineDatum x -> InlineDatum
forall x. InlineDatum -> Rep InlineDatum x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InlineDatum x -> InlineDatum
$cfrom :: forall x. InlineDatum -> Rep InlineDatum x
Generic)
instance ToJSON InlineDatum where
toJSON :: InlineDatum -> Value
toJSON = forall a. ToJSON a => a -> Value
toJSON forall b c a. (b -> c) -> (a -> b) -> a -> c
. ScriptDatumCBOR -> Text
_scriptDatumCborCbor forall b c a. (b -> c) -> (a -> b) -> a -> c
. InlineDatum -> ScriptDatumCBOR
unInlineDatum
toEncoding :: InlineDatum -> Encoding
toEncoding = forall a. ToJSON a => a -> Encoding
toEncoding forall b c a. (b -> c) -> (a -> b) -> a -> c
. ScriptDatumCBOR -> Text
_scriptDatumCborCbor forall b c a. (b -> c) -> (a -> b) -> a -> c
. InlineDatum -> ScriptDatumCBOR
unInlineDatum
instance FromJSON InlineDatum where
parseJSON :: Value -> Parser InlineDatum
parseJSON = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (ScriptDatumCBOR -> InlineDatum
InlineDatum forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> ScriptDatumCBOR
ScriptDatumCBOR) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. FromJSON a => Value -> Parser a
parseJSON
instance ToSample InlineDatum where
toSamples :: Proxy InlineDatum -> [(Text, InlineDatum)]
toSamples =
forall (f :: * -> *) a. Applicative f => a -> f a
pure
forall a b. (a -> b) -> a -> b
$ forall a. a -> [(Text, a)]
singleSample
forall a b. (a -> b) -> a -> b
$ ScriptDatumCBOR -> InlineDatum
InlineDatum
forall a b. (a -> b) -> a -> b
$ Text -> ScriptDatumCBOR
ScriptDatumCBOR Text
"19a6aa"
newtype ScriptJSON = ScriptJSON { ScriptJSON -> Maybe Value
_scriptJsonJson :: Maybe Value }
deriving stock (Int -> ScriptJSON -> ShowS
[ScriptJSON] -> ShowS
ScriptJSON -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ScriptJSON] -> ShowS
$cshowList :: [ScriptJSON] -> ShowS
show :: ScriptJSON -> String
$cshow :: ScriptJSON -> String
showsPrec :: Int -> ScriptJSON -> ShowS
$cshowsPrec :: Int -> ScriptJSON -> ShowS
Show, ScriptJSON -> ScriptJSON -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ScriptJSON -> ScriptJSON -> Bool
$c/= :: ScriptJSON -> ScriptJSON -> Bool
== :: ScriptJSON -> ScriptJSON -> Bool
$c== :: ScriptJSON -> ScriptJSON -> Bool
Eq, forall x. Rep ScriptJSON x -> ScriptJSON
forall x. ScriptJSON -> Rep ScriptJSON x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ScriptJSON x -> ScriptJSON
$cfrom :: forall x. ScriptJSON -> Rep ScriptJSON x
Generic)
deriving (Value -> Parser [ScriptJSON]
Value -> Parser ScriptJSON
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [ScriptJSON]
$cparseJSONList :: Value -> Parser [ScriptJSON]
parseJSON :: Value -> Parser ScriptJSON
$cparseJSON :: Value -> Parser ScriptJSON
FromJSON, [ScriptJSON] -> Encoding
[ScriptJSON] -> Value
ScriptJSON -> Encoding
ScriptJSON -> Value
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [ScriptJSON] -> Encoding
$ctoEncodingList :: [ScriptJSON] -> Encoding
toJSONList :: [ScriptJSON] -> Value
$ctoJSONList :: [ScriptJSON] -> Value
toEncoding :: ScriptJSON -> Encoding
$ctoEncoding :: ScriptJSON -> Encoding
toJSON :: ScriptJSON -> Value
$ctoJSON :: ScriptJSON -> Value
ToJSON)
via CustomJSON '[FieldLabelModifier '[StripPrefix "_scriptJson", CamelToSnake]] ScriptJSON
instance ToSample ScriptJSON where
toSamples :: Proxy ScriptJSON -> [(Text, ScriptJSON)]
toSamples =
forall (f :: * -> *) a. Applicative f => a -> f a
pure
forall a b. (a -> b) -> a -> b
$ forall a. a -> [(Text, a)]
singleSample
forall a b. (a -> b) -> a -> b
$ Maybe Value -> ScriptJSON
ScriptJSON
forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *) a. Applicative f => a -> f a
pure
forall a b. (a -> b) -> a -> b
$ [Pair] -> Value
object [ Key
"type" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= (String
"sig" :: String)
, Key
"keyHash" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
.= (String
"8ed9e675aaf99868736c372d5eac9f5b3deae4568f0cde6a7d9e1422" :: String)]
newtype ScriptCBOR = ScriptCBOR { ScriptCBOR -> Maybe Text
_scriptCborCbor :: Maybe Text }
deriving stock (Int -> ScriptCBOR -> ShowS
[ScriptCBOR] -> ShowS
ScriptCBOR -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ScriptCBOR] -> ShowS
$cshowList :: [ScriptCBOR] -> ShowS
show :: ScriptCBOR -> String
$cshow :: ScriptCBOR -> String
showsPrec :: Int -> ScriptCBOR -> ShowS
$cshowsPrec :: Int -> ScriptCBOR -> ShowS
Show, ScriptCBOR -> ScriptCBOR -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ScriptCBOR -> ScriptCBOR -> Bool
$c/= :: ScriptCBOR -> ScriptCBOR -> Bool
== :: ScriptCBOR -> ScriptCBOR -> Bool
$c== :: ScriptCBOR -> ScriptCBOR -> Bool
Eq, forall x. Rep ScriptCBOR x -> ScriptCBOR
forall x. ScriptCBOR -> Rep ScriptCBOR x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ScriptCBOR x -> ScriptCBOR
$cfrom :: forall x. ScriptCBOR -> Rep ScriptCBOR x
Generic)
deriving (Value -> Parser [ScriptCBOR]
Value -> Parser ScriptCBOR
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [ScriptCBOR]
$cparseJSONList :: Value -> Parser [ScriptCBOR]
parseJSON :: Value -> Parser ScriptCBOR
$cparseJSON :: Value -> Parser ScriptCBOR
FromJSON, [ScriptCBOR] -> Encoding
[ScriptCBOR] -> Value
ScriptCBOR -> Encoding
ScriptCBOR -> Value
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [ScriptCBOR] -> Encoding
$ctoEncodingList :: [ScriptCBOR] -> Encoding
toJSONList :: [ScriptCBOR] -> Value
$ctoJSONList :: [ScriptCBOR] -> Value
toEncoding :: ScriptCBOR -> Encoding
$ctoEncoding :: ScriptCBOR -> Encoding
toJSON :: ScriptCBOR -> Value
$ctoJSON :: ScriptCBOR -> Value
ToJSON)
via CustomJSON '[FieldLabelModifier '[StripPrefix "_scriptCbor", CamelToSnake]] ScriptCBOR
instance ToSample ScriptCBOR where
toSamples :: Proxy ScriptCBOR -> [(Text, ScriptCBOR)]
toSamples =
forall (f :: * -> *) a. Applicative f => a -> f a
pure
forall a b. (a -> b) -> a -> b
$ forall a. a -> [(Text, a)]
singleSample
forall a b. (a -> b) -> a -> b
$ Maybe Text -> ScriptCBOR
ScriptCBOR
forall a b. (a -> b) -> a -> b
$ forall (f :: * -> *) a. Applicative f => a -> f a
pure Text
"4e4d01000033222220051200120011"