{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
module Cardano.CLI.EraBased.Script.Vote.Type
( CliVoteScriptRequirements (..)
, PlutusRefScriptCliArgs (..)
, PlutusScriptCliArgs (..)
, VoteScriptWitness (..)
, createSimpleOrPlutusScriptFromCliArgs
, createPlutusReferenceScriptFromCliArgs
)
where
import Cardano.Api
import Cardano.CLI.Type.Common (ScriptDataOrFile)
newtype VoteScriptWitness era
= VoteScriptWitness {forall era. VoteScriptWitness era -> ScriptWitness WitCtxStake era
vswScriptWitness :: ScriptWitness WitCtxStake era}
deriving Int -> VoteScriptWitness era -> ShowS
[VoteScriptWitness era] -> ShowS
VoteScriptWitness era -> String
(Int -> VoteScriptWitness era -> ShowS)
-> (VoteScriptWitness era -> String)
-> ([VoteScriptWitness era] -> ShowS)
-> Show (VoteScriptWitness era)
forall era. Int -> VoteScriptWitness era -> ShowS
forall era. [VoteScriptWitness era] -> ShowS
forall era. VoteScriptWitness era -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall era. Int -> VoteScriptWitness era -> ShowS
showsPrec :: Int -> VoteScriptWitness era -> ShowS
$cshow :: forall era. VoteScriptWitness era -> String
show :: VoteScriptWitness era -> String
$cshowList :: forall era. [VoteScriptWitness era] -> ShowS
showList :: [VoteScriptWitness era] -> ShowS
Show
data CliVoteScriptRequirements
= OnDiskPlutusScript PlutusScriptCliArgs
| OnDiskSimpleScript (File ScriptInAnyLang In)
| OnDiskPlutusRefScript PlutusRefScriptCliArgs
deriving Int -> CliVoteScriptRequirements -> ShowS
[CliVoteScriptRequirements] -> ShowS
CliVoteScriptRequirements -> String
(Int -> CliVoteScriptRequirements -> ShowS)
-> (CliVoteScriptRequirements -> String)
-> ([CliVoteScriptRequirements] -> ShowS)
-> Show CliVoteScriptRequirements
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CliVoteScriptRequirements -> ShowS
showsPrec :: Int -> CliVoteScriptRequirements -> ShowS
$cshow :: CliVoteScriptRequirements -> String
show :: CliVoteScriptRequirements -> String
$cshowList :: [CliVoteScriptRequirements] -> ShowS
showList :: [CliVoteScriptRequirements] -> ShowS
Show
data PlutusScriptCliArgs
= OnDiskPlutusScriptCliArgs
(File ScriptInAnyLang In)
ScriptDataOrFile
ExecutionUnits
deriving Int -> PlutusScriptCliArgs -> ShowS
[PlutusScriptCliArgs] -> ShowS
PlutusScriptCliArgs -> String
(Int -> PlutusScriptCliArgs -> ShowS)
-> (PlutusScriptCliArgs -> String)
-> ([PlutusScriptCliArgs] -> ShowS)
-> Show PlutusScriptCliArgs
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PlutusScriptCliArgs -> ShowS
showsPrec :: Int -> PlutusScriptCliArgs -> ShowS
$cshow :: PlutusScriptCliArgs -> String
show :: PlutusScriptCliArgs -> String
$cshowList :: [PlutusScriptCliArgs] -> ShowS
showList :: [PlutusScriptCliArgs] -> ShowS
Show
createSimpleOrPlutusScriptFromCliArgs
:: File ScriptInAnyLang In
-> Maybe (ScriptDataOrFile, ExecutionUnits)
-> CliVoteScriptRequirements
createSimpleOrPlutusScriptFromCliArgs :: File ScriptInAnyLang 'In
-> Maybe (ScriptDataOrFile, ExecutionUnits)
-> CliVoteScriptRequirements
createSimpleOrPlutusScriptFromCliArgs File ScriptInAnyLang 'In
scriptFp (Just (ScriptDataOrFile
redeemer, ExecutionUnits
execUnits)) =
PlutusScriptCliArgs -> CliVoteScriptRequirements
OnDiskPlutusScript (PlutusScriptCliArgs -> CliVoteScriptRequirements)
-> PlutusScriptCliArgs -> CliVoteScriptRequirements
forall a b. (a -> b) -> a -> b
$ File ScriptInAnyLang 'In
-> ScriptDataOrFile -> ExecutionUnits -> PlutusScriptCliArgs
OnDiskPlutusScriptCliArgs File ScriptInAnyLang 'In
scriptFp ScriptDataOrFile
redeemer ExecutionUnits
execUnits
createSimpleOrPlutusScriptFromCliArgs File ScriptInAnyLang 'In
scriptFp Maybe (ScriptDataOrFile, ExecutionUnits)
Nothing =
File ScriptInAnyLang 'In -> CliVoteScriptRequirements
OnDiskSimpleScript File ScriptInAnyLang 'In
scriptFp
data PlutusRefScriptCliArgs
= PlutusRefScriptCliArgs
TxIn
AnyPlutusScriptVersion
ScriptDataOrFile
ExecutionUnits
deriving Int -> PlutusRefScriptCliArgs -> ShowS
[PlutusRefScriptCliArgs] -> ShowS
PlutusRefScriptCliArgs -> String
(Int -> PlutusRefScriptCliArgs -> ShowS)
-> (PlutusRefScriptCliArgs -> String)
-> ([PlutusRefScriptCliArgs] -> ShowS)
-> Show PlutusRefScriptCliArgs
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PlutusRefScriptCliArgs -> ShowS
showsPrec :: Int -> PlutusRefScriptCliArgs -> ShowS
$cshow :: PlutusRefScriptCliArgs -> String
show :: PlutusRefScriptCliArgs -> String
$cshowList :: [PlutusRefScriptCliArgs] -> ShowS
showList :: [PlutusRefScriptCliArgs] -> ShowS
Show
createPlutusReferenceScriptFromCliArgs
:: TxIn
-> AnyPlutusScriptVersion
-> ScriptDataOrFile
-> ExecutionUnits
-> CliVoteScriptRequirements
createPlutusReferenceScriptFromCliArgs :: TxIn
-> AnyPlutusScriptVersion
-> ScriptDataOrFile
-> ExecutionUnits
-> CliVoteScriptRequirements
createPlutusReferenceScriptFromCliArgs TxIn
txIn AnyPlutusScriptVersion
version ScriptDataOrFile
redeemer ExecutionUnits
execUnits =
PlutusRefScriptCliArgs -> CliVoteScriptRequirements
OnDiskPlutusRefScript (PlutusRefScriptCliArgs -> CliVoteScriptRequirements)
-> PlutusRefScriptCliArgs -> CliVoteScriptRequirements
forall a b. (a -> b) -> a -> b
$ TxIn
-> AnyPlutusScriptVersion
-> ScriptDataOrFile
-> ExecutionUnits
-> PlutusRefScriptCliArgs
PlutusRefScriptCliArgs TxIn
txIn AnyPlutusScriptVersion
version ScriptDataOrFile
redeemer ExecutionUnits
execUnits