module Morley.Michelson.Runtime.TxData
( TxData (..)
, TxParam(..)
, tdSenderAddressL
, tdParameterL
, tdEntrypointL
, tdAmountL
) where
import Control.Lens (makeLensesWith)
import Fmt (Buildable(..))
import Morley.Michelson.Typed (ParameterScope)
import Morley.Michelson.Typed qualified as T
import Morley.Michelson.Untyped (EpName)
import Morley.Michelson.Untyped qualified as U
import Morley.Tezos.Address
import Morley.Tezos.Core (Mutez)
import Morley.Util.Lens (postfixLFields)
data TxParam where
TxTypedParam :: forall t. ParameterScope t => T.Value t -> TxParam
TxUntypedParam :: U.Value -> TxParam
deriving stock instance Show TxParam
instance Buildable TxParam where
build :: TxParam -> Doc
build = \case
TxTypedParam Value t
val -> Value t -> Doc
forall a. Buildable a => a -> Doc
build Value t
val
TxUntypedParam Value
val -> Value -> Doc
forall a. Buildable a => a -> Doc
build Value
val
data TxData = TxData
{ TxData -> L1Address
tdSenderAddress :: L1Address
, TxData -> TxParam
tdParameter :: TxParam
, TxData -> EpName
tdEntrypoint :: EpName
, TxData -> Mutez
tdAmount :: Mutez
} deriving stock Int -> TxData -> ShowS
[TxData] -> ShowS
TxData -> String
(Int -> TxData -> ShowS)
-> (TxData -> String) -> ([TxData] -> ShowS) -> Show TxData
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TxData -> ShowS
showsPrec :: Int -> TxData -> ShowS
$cshow :: TxData -> String
show :: TxData -> String
$cshowList :: [TxData] -> ShowS
showList :: [TxData] -> ShowS
Show
makeLensesWith postfixLFields ''TxData