diff --git a/marlowe-dashboard-client/generated/Auth.purs b/marlowe-dashboard-client/generated/Auth.purs new file mode 100644 index 0000000000..b3eef2195e --- /dev/null +++ b/marlowe-dashboard-client/generated/Auth.purs @@ -0,0 +1,98 @@ +-- File auto generated by purescript-bridge! -- +module Auth where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Bounded.Generic (genericBottom, genericTop) +import Data.Enum (class Enum) +import Data.Enum.Generic (genericPred, genericSucc) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Type.Proxy (Proxy(Proxy)) + +newtype AuthStatus = AuthStatus { _authStatusAuthRole :: AuthRole } + +derive instance eqAuthStatus :: Eq AuthStatus + +instance showAuthStatus :: Show AuthStatus where + show a = genericShow a + +instance encodeJsonAuthStatus :: EncodeJson AuthStatus where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { _authStatusAuthRole: E.value :: _ AuthRole } + ) + +instance decodeJsonAuthStatus :: DecodeJson AuthStatus where + decodeJson = defer \_ -> D.decode $ + ( AuthStatus <$> D.record "AuthStatus" + { _authStatusAuthRole: D.value :: _ AuthRole } + ) + +derive instance genericAuthStatus :: Generic AuthStatus _ + +derive instance newtypeAuthStatus :: Newtype AuthStatus _ + +-------------------------------------------------------------------------------- + +_AuthStatus :: Iso' AuthStatus { _authStatusAuthRole :: AuthRole } +_AuthStatus = _Newtype + +authStatusAuthRole :: Lens' AuthStatus AuthRole +authStatusAuthRole = _Newtype <<< prop (Proxy :: _ "_authStatusAuthRole") + +-------------------------------------------------------------------------------- + +data AuthRole + = Anonymous + | GithubUser + +derive instance eqAuthRole :: Eq AuthRole + +derive instance ordAuthRole :: Ord AuthRole + +instance showAuthRole :: Show AuthRole where + show a = genericShow a + +instance encodeJsonAuthRole :: EncodeJson AuthRole where + encodeJson = defer \_ -> E.encode E.enum + +instance decodeJsonAuthRole :: DecodeJson AuthRole where + decodeJson = defer \_ -> D.decode D.enum + +derive instance genericAuthRole :: Generic AuthRole _ + +instance enumAuthRole :: Enum AuthRole where + succ = genericSucc + pred = genericPred + +instance boundedAuthRole :: Bounded AuthRole where + bottom = genericBottom + top = genericTop + +-------------------------------------------------------------------------------- + +_Anonymous :: Prism' AuthRole Unit +_Anonymous = prism' (const Anonymous) case _ of + Anonymous -> Just unit + _ -> Nothing + +_GithubUser :: Prism' AuthRole Unit +_GithubUser = prism' (const GithubUser) case _ of + GithubUser -> Just unit + _ -> Nothing \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/Cardano/Wallet/Mock/Types.purs b/marlowe-dashboard-client/generated/Cardano/Wallet/Mock/Types.purs new file mode 100644 index 0000000000..313036a016 --- /dev/null +++ b/marlowe-dashboard-client/generated/Cardano/Wallet/Mock/Types.purs @@ -0,0 +1,59 @@ +-- File auto generated by purescript-bridge! -- +module Cardano.Wallet.Mock.Types where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Plutus.V1.Ledger.Crypto (PubKeyHash) +import Type.Proxy (Proxy(Proxy)) +import Wallet.Emulator.Wallet (Wallet) + +newtype WalletInfo = WalletInfo + { wiWallet :: Wallet + , wiPubKeyHash :: PubKeyHash + } + +instance showWalletInfo :: Show WalletInfo where + show a = genericShow a + +instance encodeJsonWalletInfo :: EncodeJson WalletInfo where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { wiWallet: E.value :: _ Wallet + , wiPubKeyHash: E.value :: _ PubKeyHash + } + ) + +instance decodeJsonWalletInfo :: DecodeJson WalletInfo where + decodeJson = defer \_ -> D.decode $ + ( WalletInfo <$> D.record "WalletInfo" + { wiWallet: D.value :: _ Wallet + , wiPubKeyHash: D.value :: _ PubKeyHash + } + ) + +derive instance genericWalletInfo :: Generic WalletInfo _ + +derive instance newtypeWalletInfo :: Newtype WalletInfo _ + +-------------------------------------------------------------------------------- + +_WalletInfo :: Iso' WalletInfo + { wiWallet :: Wallet, wiPubKeyHash :: PubKeyHash } +_WalletInfo = _Newtype \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/Control/Monad/Freer/Extras/Beam.purs b/marlowe-dashboard-client/generated/Control/Monad/Freer/Extras/Beam.purs new file mode 100644 index 0000000000..06812fb4d5 --- /dev/null +++ b/marlowe-dashboard-client/generated/Control/Monad/Freer/Extras/Beam.purs @@ -0,0 +1,69 @@ +-- File auto generated by purescript-bridge! -- +module Control.Monad.Freer.Extras.Beam where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Type.Proxy (Proxy(Proxy)) + +newtype BeamError = SqlError String + +derive instance eqBeamError :: Eq BeamError + +instance showBeamError :: Show BeamError where + show a = genericShow a + +instance encodeJsonBeamError :: EncodeJson BeamError where + encodeJson = defer \_ -> E.encode $ unwrap >$< E.value + +instance decodeJsonBeamError :: DecodeJson BeamError where + decodeJson = defer \_ -> D.decode $ (SqlError <$> D.value) + +derive instance genericBeamError :: Generic BeamError _ + +derive instance newtypeBeamError :: Newtype BeamError _ + +-------------------------------------------------------------------------------- + +_SqlError :: Iso' BeamError String +_SqlError = _Newtype + +-------------------------------------------------------------------------------- + +newtype BeamLog = SqlLog String + +derive instance eqBeamLog :: Eq BeamLog + +instance showBeamLog :: Show BeamLog where + show a = genericShow a + +instance encodeJsonBeamLog :: EncodeJson BeamLog where + encodeJson = defer \_ -> E.encode $ unwrap >$< E.value + +instance decodeJsonBeamLog :: DecodeJson BeamLog where + decodeJson = defer \_ -> D.decode $ (SqlLog <$> D.value) + +derive instance genericBeamLog :: Generic BeamLog _ + +derive instance newtypeBeamLog :: Newtype BeamLog _ + +-------------------------------------------------------------------------------- + +_SqlLog :: Iso' BeamLog String +_SqlLog = _Newtype \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/Control/Monad/Freer/Extras/Log.purs b/marlowe-dashboard-client/generated/Control/Monad/Freer/Extras/Log.purs new file mode 100644 index 0000000000..620445a7fc --- /dev/null +++ b/marlowe-dashboard-client/generated/Control/Monad/Freer/Extras/Log.purs @@ -0,0 +1,146 @@ +-- File auto generated by purescript-bridge! -- +module Control.Monad.Freer.Extras.Log where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Bounded.Generic (genericBottom, genericTop) +import Data.Enum (class Enum) +import Data.Enum.Generic (genericPred, genericSucc) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Type.Proxy (Proxy(Proxy)) + +newtype LogMessage a = LogMessage + { _logLevel :: LogLevel + , _logMessageContent :: a + } + +derive instance eqLogMessage :: (Eq a) => Eq (LogMessage a) + +instance showLogMessage :: (Show a) => Show (LogMessage a) where + show a = genericShow a + +instance encodeJsonLogMessage :: (EncodeJson a) => EncodeJson (LogMessage a) where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { _logLevel: E.value :: _ LogLevel + , _logMessageContent: E.value :: _ a + } + ) + +instance decodeJsonLogMessage :: (DecodeJson a) => DecodeJson (LogMessage a) where + decodeJson = defer \_ -> D.decode $ + ( LogMessage <$> D.record "LogMessage" + { _logLevel: D.value :: _ LogLevel + , _logMessageContent: D.value :: _ a + } + ) + +derive instance genericLogMessage :: Generic (LogMessage a) _ + +derive instance newtypeLogMessage :: Newtype (LogMessage a) _ + +-------------------------------------------------------------------------------- + +_LogMessage + :: forall a + . Iso' (LogMessage a) { _logLevel :: LogLevel, _logMessageContent :: a } +_LogMessage = _Newtype + +logLevel :: forall a. Lens' (LogMessage a) LogLevel +logLevel = _Newtype <<< prop (Proxy :: _ "_logLevel") + +logMessageContent :: forall a. Lens' (LogMessage a) a +logMessageContent = _Newtype <<< prop (Proxy :: _ "_logMessageContent") + +-------------------------------------------------------------------------------- + +data LogLevel + = Debug + | Info + | Notice + | Warning + | Error + | Critical + | Alert + | Emergency + +derive instance eqLogLevel :: Eq LogLevel + +derive instance ordLogLevel :: Ord LogLevel + +instance showLogLevel :: Show LogLevel where + show a = genericShow a + +instance encodeJsonLogLevel :: EncodeJson LogLevel where + encodeJson = defer \_ -> E.encode E.enum + +instance decodeJsonLogLevel :: DecodeJson LogLevel where + decodeJson = defer \_ -> D.decode D.enum + +derive instance genericLogLevel :: Generic LogLevel _ + +instance enumLogLevel :: Enum LogLevel where + succ = genericSucc + pred = genericPred + +instance boundedLogLevel :: Bounded LogLevel where + bottom = genericBottom + top = genericTop + +-------------------------------------------------------------------------------- + +_Debug :: Prism' LogLevel Unit +_Debug = prism' (const Debug) case _ of + Debug -> Just unit + _ -> Nothing + +_Info :: Prism' LogLevel Unit +_Info = prism' (const Info) case _ of + Info -> Just unit + _ -> Nothing + +_Notice :: Prism' LogLevel Unit +_Notice = prism' (const Notice) case _ of + Notice -> Just unit + _ -> Nothing + +_Warning :: Prism' LogLevel Unit +_Warning = prism' (const Warning) case _ of + Warning -> Just unit + _ -> Nothing + +_Error :: Prism' LogLevel Unit +_Error = prism' (const Error) case _ of + Error -> Just unit + _ -> Nothing + +_Critical :: Prism' LogLevel Unit +_Critical = prism' (const Critical) case _ of + Critical -> Just unit + _ -> Nothing + +_Alert :: Prism' LogLevel Unit +_Alert = prism' (const Alert) case _ of + Alert -> Just unit + _ -> Nothing + +_Emergency :: Prism' LogLevel Unit +_Emergency = prism' (const Emergency) case _ of + Emergency -> Just unit + _ -> Nothing \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/Control/Monad/Freer/Extras/Pagination.purs b/marlowe-dashboard-client/generated/Control/Monad/Freer/Extras/Pagination.purs new file mode 100644 index 0000000000..d73fdfe0f8 --- /dev/null +++ b/marlowe-dashboard-client/generated/Control/Monad/Freer/Extras/Pagination.purs @@ -0,0 +1,135 @@ +-- File auto generated by purescript-bridge! -- +module Control.Monad.Freer.Extras.Pagination where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Type.Proxy (Proxy(Proxy)) + +newtype Page a = Page + { currentPageQuery :: PageQuery a + , nextPageQuery :: Maybe (PageQuery a) + , pageItems :: Array a + } + +derive instance eqPage :: (Eq a) => Eq (Page a) + +instance showPage :: (Show a) => Show (Page a) where + show a = genericShow a + +instance encodeJsonPage :: (EncodeJson a) => EncodeJson (Page a) where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { currentPageQuery: E.value :: _ (PageQuery a) + , nextPageQuery: (E.maybe E.value) :: _ (Maybe (PageQuery a)) + , pageItems: E.value :: _ (Array a) + } + ) + +instance decodeJsonPage :: (DecodeJson a) => DecodeJson (Page a) where + decodeJson = defer \_ -> D.decode $ + ( Page <$> D.record "Page" + { currentPageQuery: D.value :: _ (PageQuery a) + , nextPageQuery: (D.maybe D.value) :: _ (Maybe (PageQuery a)) + , pageItems: D.value :: _ (Array a) + } + ) + +derive instance genericPage :: Generic (Page a) _ + +derive instance newtypePage :: Newtype (Page a) _ + +-------------------------------------------------------------------------------- + +_Page + :: forall a + . Iso' (Page a) + { currentPageQuery :: PageQuery a + , nextPageQuery :: Maybe (PageQuery a) + , pageItems :: Array a + } +_Page = _Newtype + +-------------------------------------------------------------------------------- + +newtype PageQuery a = PageQuery + { pageQuerySize :: PageSize + , pageQueryLastItem :: Maybe a + } + +derive instance eqPageQuery :: (Eq a) => Eq (PageQuery a) + +instance showPageQuery :: (Show a) => Show (PageQuery a) where + show a = genericShow a + +instance encodeJsonPageQuery :: (EncodeJson a) => EncodeJson (PageQuery a) where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { pageQuerySize: E.value :: _ PageSize + , pageQueryLastItem: (E.maybe E.value) :: _ (Maybe a) + } + ) + +instance decodeJsonPageQuery :: (DecodeJson a) => DecodeJson (PageQuery a) where + decodeJson = defer \_ -> D.decode $ + ( PageQuery <$> D.record "PageQuery" + { pageQuerySize: D.value :: _ PageSize + , pageQueryLastItem: (D.maybe D.value) :: _ (Maybe a) + } + ) + +derive instance genericPageQuery :: Generic (PageQuery a) _ + +derive instance newtypePageQuery :: Newtype (PageQuery a) _ + +-------------------------------------------------------------------------------- + +_PageQuery + :: forall a + . Iso' (PageQuery a) + { pageQuerySize :: PageSize, pageQueryLastItem :: Maybe a } +_PageQuery = _Newtype + +-------------------------------------------------------------------------------- + +newtype PageSize = PageSize { getPageSize :: Int } + +derive instance eqPageSize :: Eq PageSize + +instance showPageSize :: Show PageSize where + show a = genericShow a + +instance encodeJsonPageSize :: EncodeJson PageSize where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { getPageSize: E.value :: _ Int } + ) + +instance decodeJsonPageSize :: DecodeJson PageSize where + decodeJson = defer \_ -> D.decode $ + (PageSize <$> D.record "PageSize" { getPageSize: D.value :: _ Int }) + +derive instance genericPageSize :: Generic PageSize _ + +derive instance newtypePageSize :: Newtype PageSize _ + +-------------------------------------------------------------------------------- + +_PageSize :: Iso' PageSize { getPageSize :: Int } +_PageSize = _Newtype \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/Gist.purs b/marlowe-dashboard-client/generated/Gist.purs new file mode 100644 index 0000000000..de61342967 --- /dev/null +++ b/marlowe-dashboard-client/generated/Gist.purs @@ -0,0 +1,340 @@ +-- File auto generated by purescript-bridge! -- +module Gist where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map (Map) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Type.Proxy (Proxy(Proxy)) + +newtype GistId = GistId String + +derive instance eqGistId :: Eq GistId + +derive instance ordGistId :: Ord GistId + +instance showGistId :: Show GistId where + show a = genericShow a + +instance encodeJsonGistId :: EncodeJson GistId where + encodeJson = defer \_ -> E.encode $ unwrap >$< E.value + +instance decodeJsonGistId :: DecodeJson GistId where + decodeJson = defer \_ -> D.decode $ (GistId <$> D.value) + +derive instance genericGistId :: Generic GistId _ + +derive instance newtypeGistId :: Newtype GistId _ + +-------------------------------------------------------------------------------- + +_GistId :: Iso' GistId String +_GistId = _Newtype + +-------------------------------------------------------------------------------- + +newtype Gist = Gist + { _gistId :: GistId + , _gistGitPushUrl :: String + , _gistHtmlUrl :: String + , _gistOwner :: Owner + , _gistFiles :: Map String GistFile + , _gistTruncated :: Boolean + , _gistCreatedAt :: String + , _gistUpdatedAt :: String + , _gistDescription :: String + } + +derive instance eqGist :: Eq Gist + +instance showGist :: Show Gist where + show a = genericShow a + +instance encodeJsonGist :: EncodeJson Gist where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { _gistId: E.value :: _ GistId + , _gistGitPushUrl: E.value :: _ String + , _gistHtmlUrl: E.value :: _ String + , _gistOwner: E.value :: _ Owner + , _gistFiles: (E.dictionary E.value E.value) :: _ (Map String GistFile) + , _gistTruncated: E.value :: _ Boolean + , _gistCreatedAt: E.value :: _ String + , _gistUpdatedAt: E.value :: _ String + , _gistDescription: E.value :: _ String + } + ) + +instance decodeJsonGist :: DecodeJson Gist where + decodeJson = defer \_ -> D.decode $ + ( Gist <$> D.record "Gist" + { _gistId: D.value :: _ GistId + , _gistGitPushUrl: D.value :: _ String + , _gistHtmlUrl: D.value :: _ String + , _gistOwner: D.value :: _ Owner + , _gistFiles: (D.dictionary D.value D.value) :: _ (Map String GistFile) + , _gistTruncated: D.value :: _ Boolean + , _gistCreatedAt: D.value :: _ String + , _gistUpdatedAt: D.value :: _ String + , _gistDescription: D.value :: _ String + } + ) + +derive instance genericGist :: Generic Gist _ + +derive instance newtypeGist :: Newtype Gist _ + +-------------------------------------------------------------------------------- + +_Gist :: Iso' Gist + { _gistId :: GistId + , _gistGitPushUrl :: String + , _gistHtmlUrl :: String + , _gistOwner :: Owner + , _gistFiles :: Map String GistFile + , _gistTruncated :: Boolean + , _gistCreatedAt :: String + , _gistUpdatedAt :: String + , _gistDescription :: String + } +_Gist = _Newtype + +gistId :: Lens' Gist GistId +gistId = _Newtype <<< prop (Proxy :: _ "_gistId") + +gistGitPushUrl :: Lens' Gist String +gistGitPushUrl = _Newtype <<< prop (Proxy :: _ "_gistGitPushUrl") + +gistHtmlUrl :: Lens' Gist String +gistHtmlUrl = _Newtype <<< prop (Proxy :: _ "_gistHtmlUrl") + +gistOwner :: Lens' Gist Owner +gistOwner = _Newtype <<< prop (Proxy :: _ "_gistOwner") + +gistFiles :: Lens' Gist (Map String GistFile) +gistFiles = _Newtype <<< prop (Proxy :: _ "_gistFiles") + +gistTruncated :: Lens' Gist Boolean +gistTruncated = _Newtype <<< prop (Proxy :: _ "_gistTruncated") + +gistCreatedAt :: Lens' Gist String +gistCreatedAt = _Newtype <<< prop (Proxy :: _ "_gistCreatedAt") + +gistUpdatedAt :: Lens' Gist String +gistUpdatedAt = _Newtype <<< prop (Proxy :: _ "_gistUpdatedAt") + +gistDescription :: Lens' Gist String +gistDescription = _Newtype <<< prop (Proxy :: _ "_gistDescription") + +-------------------------------------------------------------------------------- + +newtype GistFile = GistFile + { _gistFileFilename :: String + , _gistFileLanguage :: Maybe String + , _gistFileType :: String + , _gistFileTruncated :: Maybe Boolean + , _gistFileContent :: Maybe String + } + +derive instance eqGistFile :: Eq GistFile + +instance showGistFile :: Show GistFile where + show a = genericShow a + +instance encodeJsonGistFile :: EncodeJson GistFile where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { _gistFileFilename: E.value :: _ String + , _gistFileLanguage: (E.maybe E.value) :: _ (Maybe String) + , _gistFileType: E.value :: _ String + , _gistFileTruncated: (E.maybe E.value) :: _ (Maybe Boolean) + , _gistFileContent: (E.maybe E.value) :: _ (Maybe String) + } + ) + +instance decodeJsonGistFile :: DecodeJson GistFile where + decodeJson = defer \_ -> D.decode $ + ( GistFile <$> D.record "GistFile" + { _gistFileFilename: D.value :: _ String + , _gistFileLanguage: (D.maybe D.value) :: _ (Maybe String) + , _gistFileType: D.value :: _ String + , _gistFileTruncated: (D.maybe D.value) :: _ (Maybe Boolean) + , _gistFileContent: (D.maybe D.value) :: _ (Maybe String) + } + ) + +derive instance genericGistFile :: Generic GistFile _ + +derive instance newtypeGistFile :: Newtype GistFile _ + +-------------------------------------------------------------------------------- + +_GistFile :: Iso' GistFile + { _gistFileFilename :: String + , _gistFileLanguage :: Maybe String + , _gistFileType :: String + , _gistFileTruncated :: Maybe Boolean + , _gistFileContent :: Maybe String + } +_GistFile = _Newtype + +gistFileFilename :: Lens' GistFile String +gistFileFilename = _Newtype <<< prop (Proxy :: _ "_gistFileFilename") + +gistFileLanguage :: Lens' GistFile (Maybe String) +gistFileLanguage = _Newtype <<< prop (Proxy :: _ "_gistFileLanguage") + +gistFileType :: Lens' GistFile String +gistFileType = _Newtype <<< prop (Proxy :: _ "_gistFileType") + +gistFileTruncated :: Lens' GistFile (Maybe Boolean) +gistFileTruncated = _Newtype <<< prop (Proxy :: _ "_gistFileTruncated") + +gistFileContent :: Lens' GistFile (Maybe String) +gistFileContent = _Newtype <<< prop (Proxy :: _ "_gistFileContent") + +-------------------------------------------------------------------------------- + +newtype NewGist = NewGist + { _newGistDescription :: String + , _newGistPublic :: Boolean + , _newGistFiles :: Array NewGistFile + } + +instance encodeJsonNewGist :: EncodeJson NewGist where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { _newGistDescription: E.value :: _ String + , _newGistPublic: E.value :: _ Boolean + , _newGistFiles: E.value :: _ (Array NewGistFile) + } + ) + +instance decodeJsonNewGist :: DecodeJson NewGist where + decodeJson = defer \_ -> D.decode $ + ( NewGist <$> D.record "NewGist" + { _newGistDescription: D.value :: _ String + , _newGistPublic: D.value :: _ Boolean + , _newGistFiles: D.value :: _ (Array NewGistFile) + } + ) + +derive instance genericNewGist :: Generic NewGist _ + +derive instance newtypeNewGist :: Newtype NewGist _ + +-------------------------------------------------------------------------------- + +_NewGist :: Iso' NewGist + { _newGistDescription :: String + , _newGistPublic :: Boolean + , _newGistFiles :: Array NewGistFile + } +_NewGist = _Newtype + +newGistDescription :: Lens' NewGist String +newGistDescription = _Newtype <<< prop (Proxy :: _ "_newGistDescription") + +newGistPublic :: Lens' NewGist Boolean +newGistPublic = _Newtype <<< prop (Proxy :: _ "_newGistPublic") + +newGistFiles :: Lens' NewGist (Array NewGistFile) +newGistFiles = _Newtype <<< prop (Proxy :: _ "_newGistFiles") + +-------------------------------------------------------------------------------- + +newtype NewGistFile = NewGistFile + { _newGistFilename :: String + , _newGistFileContent :: String + } + +instance encodeJsonNewGistFile :: EncodeJson NewGistFile where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { _newGistFilename: E.value :: _ String + , _newGistFileContent: E.value :: _ String + } + ) + +instance decodeJsonNewGistFile :: DecodeJson NewGistFile where + decodeJson = defer \_ -> D.decode $ + ( NewGistFile <$> D.record "NewGistFile" + { _newGistFilename: D.value :: _ String + , _newGistFileContent: D.value :: _ String + } + ) + +derive instance genericNewGistFile :: Generic NewGistFile _ + +derive instance newtypeNewGistFile :: Newtype NewGistFile _ + +-------------------------------------------------------------------------------- + +_NewGistFile :: Iso' NewGistFile + { _newGistFilename :: String, _newGistFileContent :: String } +_NewGistFile = _Newtype + +newGistFilename :: Lens' NewGistFile String +newGistFilename = _Newtype <<< prop (Proxy :: _ "_newGistFilename") + +newGistFileContent :: Lens' NewGistFile String +newGistFileContent = _Newtype <<< prop (Proxy :: _ "_newGistFileContent") + +-------------------------------------------------------------------------------- + +newtype Owner = Owner + { _ownerLogin :: String + , _ownerHtmlUrl :: String + } + +derive instance eqOwner :: Eq Owner + +instance showOwner :: Show Owner where + show a = genericShow a + +instance encodeJsonOwner :: EncodeJson Owner where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { _ownerLogin: E.value :: _ String + , _ownerHtmlUrl: E.value :: _ String + } + ) + +instance decodeJsonOwner :: DecodeJson Owner where + decodeJson = defer \_ -> D.decode $ + ( Owner <$> D.record "Owner" + { _ownerLogin: D.value :: _ String + , _ownerHtmlUrl: D.value :: _ String + } + ) + +derive instance genericOwner :: Generic Owner _ + +derive instance newtypeOwner :: Newtype Owner _ + +-------------------------------------------------------------------------------- + +_Owner :: Iso' Owner { _ownerLogin :: String, _ownerHtmlUrl :: String } +_Owner = _Newtype + +ownerLogin :: Lens' Owner String +ownerLogin = _Newtype <<< prop (Proxy :: _ "_ownerLogin") + +ownerHtmlUrl :: Lens' Owner String +ownerHtmlUrl = _Newtype <<< prop (Proxy :: _ "_ownerHtmlUrl") \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/Ledger/Blockchain.purs b/marlowe-dashboard-client/generated/Ledger/Blockchain.purs new file mode 100644 index 0000000000..7c355ca105 --- /dev/null +++ b/marlowe-dashboard-client/generated/Ledger/Blockchain.purs @@ -0,0 +1,90 @@ +-- File auto generated by purescript-bridge! -- +module Ledger.Blockchain where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Plutus.V1.Ledger.Tx (Tx) +import Type.Proxy (Proxy(Proxy)) + +data OnChainTx + = Invalid Tx + | Valid Tx + +derive instance eqOnChainTx :: Eq OnChainTx + +instance showOnChainTx :: Show OnChainTx where + show a = genericShow a + +instance encodeJsonOnChainTx :: EncodeJson OnChainTx where + encodeJson = defer \_ -> case _ of + Invalid a -> E.encodeTagged "Invalid" a E.value + Valid a -> E.encodeTagged "Valid" a E.value + +instance decodeJsonOnChainTx :: DecodeJson OnChainTx where + decodeJson = defer \_ -> D.decode + $ D.sumType "OnChainTx" + $ Map.fromFoldable + [ "Invalid" /\ D.content (Invalid <$> D.value) + , "Valid" /\ D.content (Valid <$> D.value) + ] + +derive instance genericOnChainTx :: Generic OnChainTx _ + +-------------------------------------------------------------------------------- + +_Invalid :: Prism' OnChainTx Tx +_Invalid = prism' Invalid case _ of + (Invalid a) -> Just a + _ -> Nothing + +_Valid :: Prism' OnChainTx Tx +_Valid = prism' Valid case _ of + (Valid a) -> Just a + _ -> Nothing + +-------------------------------------------------------------------------------- + +newtype BlockId = BlockId { getBlockId :: String } + +derive instance eqBlockId :: Eq BlockId + +derive instance ordBlockId :: Ord BlockId + +instance showBlockId :: Show BlockId where + show a = genericShow a + +instance encodeJsonBlockId :: EncodeJson BlockId where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { getBlockId: E.value :: _ String } + ) + +instance decodeJsonBlockId :: DecodeJson BlockId where + decodeJson = defer \_ -> D.decode $ + (BlockId <$> D.record "BlockId" { getBlockId: D.value :: _ String }) + +derive instance genericBlockId :: Generic BlockId _ + +derive instance newtypeBlockId :: Newtype BlockId _ + +-------------------------------------------------------------------------------- + +_BlockId :: Iso' BlockId { getBlockId :: String } +_BlockId = _Newtype \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/Ledger/CardanoWallet.purs b/marlowe-dashboard-client/generated/Ledger/CardanoWallet.purs new file mode 100644 index 0000000000..7b4114e68f --- /dev/null +++ b/marlowe-dashboard-client/generated/Ledger/CardanoWallet.purs @@ -0,0 +1,52 @@ +-- File auto generated by purescript-bridge! -- +module Ledger.CardanoWallet where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.BigInt.Argonaut (BigInt) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Type.Proxy (Proxy(Proxy)) + +newtype WalletNumber = WalletNumber { getWallet :: BigInt } + +derive instance eqWalletNumber :: Eq WalletNumber + +instance showWalletNumber :: Show WalletNumber where + show a = genericShow a + +instance encodeJsonWalletNumber :: EncodeJson WalletNumber where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { getWallet: E.value :: _ BigInt } + ) + +instance decodeJsonWalletNumber :: DecodeJson WalletNumber where + decodeJson = defer \_ -> D.decode $ + ( WalletNumber <$> D.record "WalletNumber" + { getWallet: D.value :: _ BigInt } + ) + +derive instance genericWalletNumber :: Generic WalletNumber _ + +derive instance newtypeWalletNumber :: Newtype WalletNumber _ + +-------------------------------------------------------------------------------- + +_WalletNumber :: Iso' WalletNumber { getWallet :: BigInt } +_WalletNumber = _Newtype \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/Ledger/Constraints/OffChain.purs b/marlowe-dashboard-client/generated/Ledger/Constraints/OffChain.purs new file mode 100644 index 0000000000..f31d7d4bbb --- /dev/null +++ b/marlowe-dashboard-client/generated/Ledger/Constraints/OffChain.purs @@ -0,0 +1,191 @@ +-- File auto generated by purescript-bridge! -- +module Ledger.Constraints.OffChain where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map (Map) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Ledger.Typed.Tx (ConnectionError) +import Plutus.V1.Ledger.Crypto (PubKey, PubKeyHash) +import Plutus.V1.Ledger.Interval (Interval) +import Plutus.V1.Ledger.Scripts (DatumHash) +import Plutus.V1.Ledger.Time (POSIXTime) +import Plutus.V1.Ledger.Tx (Tx, TxOut, TxOutRef) +import Type.Proxy (Proxy(Proxy)) + +data MkTxError + = TypeCheckFailed ConnectionError + | TxOutRefNotFound TxOutRef + | TxOutRefWrongType TxOutRef + | DatumNotFound DatumHash + | MintingPolicyNotFound String + | ValidatorHashNotFound String + | OwnPubKeyMissing + | TypedValidatorMissing + | DatumWrongHash DatumHash String + | CannotSatisfyAny + +derive instance eqMkTxError :: Eq MkTxError + +instance showMkTxError :: Show MkTxError where + show a = genericShow a + +instance encodeJsonMkTxError :: EncodeJson MkTxError where + encodeJson = defer \_ -> case _ of + TypeCheckFailed a -> E.encodeTagged "TypeCheckFailed" a E.value + TxOutRefNotFound a -> E.encodeTagged "TxOutRefNotFound" a E.value + TxOutRefWrongType a -> E.encodeTagged "TxOutRefWrongType" a E.value + DatumNotFound a -> E.encodeTagged "DatumNotFound" a E.value + MintingPolicyNotFound a -> E.encodeTagged "MintingPolicyNotFound" a E.value + ValidatorHashNotFound a -> E.encodeTagged "ValidatorHashNotFound" a E.value + OwnPubKeyMissing -> encodeJson + { tag: "OwnPubKeyMissing", contents: jsonNull } + TypedValidatorMissing -> encodeJson + { tag: "TypedValidatorMissing", contents: jsonNull } + DatumWrongHash a b -> E.encodeTagged "DatumWrongHash" (a /\ b) + (E.tuple (E.value >/\< E.value)) + CannotSatisfyAny -> encodeJson + { tag: "CannotSatisfyAny", contents: jsonNull } + +instance decodeJsonMkTxError :: DecodeJson MkTxError where + decodeJson = defer \_ -> D.decode + $ D.sumType "MkTxError" + $ Map.fromFoldable + [ "TypeCheckFailed" /\ D.content (TypeCheckFailed <$> D.value) + , "TxOutRefNotFound" /\ D.content (TxOutRefNotFound <$> D.value) + , "TxOutRefWrongType" /\ D.content (TxOutRefWrongType <$> D.value) + , "DatumNotFound" /\ D.content (DatumNotFound <$> D.value) + , "MintingPolicyNotFound" /\ D.content + (MintingPolicyNotFound <$> D.value) + , "ValidatorHashNotFound" /\ D.content + (ValidatorHashNotFound <$> D.value) + , "OwnPubKeyMissing" /\ pure OwnPubKeyMissing + , "TypedValidatorMissing" /\ pure TypedValidatorMissing + , "DatumWrongHash" /\ D.content + (D.tuple $ DatumWrongHash D.value D.value) + , "CannotSatisfyAny" /\ pure CannotSatisfyAny + ] + +derive instance genericMkTxError :: Generic MkTxError _ + +-------------------------------------------------------------------------------- + +_TypeCheckFailed :: Prism' MkTxError ConnectionError +_TypeCheckFailed = prism' TypeCheckFailed case _ of + (TypeCheckFailed a) -> Just a + _ -> Nothing + +_TxOutRefNotFound :: Prism' MkTxError TxOutRef +_TxOutRefNotFound = prism' TxOutRefNotFound case _ of + (TxOutRefNotFound a) -> Just a + _ -> Nothing + +_TxOutRefWrongType :: Prism' MkTxError TxOutRef +_TxOutRefWrongType = prism' TxOutRefWrongType case _ of + (TxOutRefWrongType a) -> Just a + _ -> Nothing + +_DatumNotFound :: Prism' MkTxError DatumHash +_DatumNotFound = prism' DatumNotFound case _ of + (DatumNotFound a) -> Just a + _ -> Nothing + +_MintingPolicyNotFound :: Prism' MkTxError String +_MintingPolicyNotFound = prism' MintingPolicyNotFound case _ of + (MintingPolicyNotFound a) -> Just a + _ -> Nothing + +_ValidatorHashNotFound :: Prism' MkTxError String +_ValidatorHashNotFound = prism' ValidatorHashNotFound case _ of + (ValidatorHashNotFound a) -> Just a + _ -> Nothing + +_OwnPubKeyMissing :: Prism' MkTxError Unit +_OwnPubKeyMissing = prism' (const OwnPubKeyMissing) case _ of + OwnPubKeyMissing -> Just unit + _ -> Nothing + +_TypedValidatorMissing :: Prism' MkTxError Unit +_TypedValidatorMissing = prism' (const TypedValidatorMissing) case _ of + TypedValidatorMissing -> Just unit + _ -> Nothing + +_DatumWrongHash :: Prism' MkTxError { a :: DatumHash, b :: String } +_DatumWrongHash = prism' (\{ a, b } -> (DatumWrongHash a b)) case _ of + (DatumWrongHash a b) -> Just { a, b } + _ -> Nothing + +_CannotSatisfyAny :: Prism' MkTxError Unit +_CannotSatisfyAny = prism' (const CannotSatisfyAny) case _ of + CannotSatisfyAny -> Just unit + _ -> Nothing + +-------------------------------------------------------------------------------- + +newtype UnbalancedTx = UnbalancedTx + { unBalancedTxTx :: Tx + , unBalancedTxRequiredSignatories :: Map PubKeyHash (Maybe PubKey) + , unBalancedTxUtxoIndex :: Map TxOutRef TxOut + , unBalancedTxValidityTimeRange :: Interval POSIXTime + } + +derive instance eqUnbalancedTx :: Eq UnbalancedTx + +instance showUnbalancedTx :: Show UnbalancedTx where + show a = genericShow a + +instance encodeJsonUnbalancedTx :: EncodeJson UnbalancedTx where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { unBalancedTxTx: E.value :: _ Tx + , unBalancedTxRequiredSignatories: + (E.dictionary E.value (E.maybe E.value)) :: _ + (Map PubKeyHash (Maybe PubKey)) + , unBalancedTxUtxoIndex: + (E.dictionary E.value E.value) :: _ (Map TxOutRef TxOut) + , unBalancedTxValidityTimeRange: E.value :: _ (Interval POSIXTime) + } + ) + +instance decodeJsonUnbalancedTx :: DecodeJson UnbalancedTx where + decodeJson = defer \_ -> D.decode $ + ( UnbalancedTx <$> D.record "UnbalancedTx" + { unBalancedTxTx: D.value :: _ Tx + , unBalancedTxRequiredSignatories: + (D.dictionary D.value (D.maybe D.value)) :: _ + (Map PubKeyHash (Maybe PubKey)) + , unBalancedTxUtxoIndex: + (D.dictionary D.value D.value) :: _ (Map TxOutRef TxOut) + , unBalancedTxValidityTimeRange: D.value :: _ (Interval POSIXTime) + } + ) + +derive instance genericUnbalancedTx :: Generic UnbalancedTx _ + +derive instance newtypeUnbalancedTx :: Newtype UnbalancedTx _ + +-------------------------------------------------------------------------------- + +_UnbalancedTx :: Iso' UnbalancedTx + { unBalancedTxTx :: Tx + , unBalancedTxRequiredSignatories :: Map PubKeyHash (Maybe PubKey) + , unBalancedTxUtxoIndex :: Map TxOutRef TxOut + , unBalancedTxValidityTimeRange :: Interval POSIXTime + } +_UnbalancedTx = _Newtype \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/Ledger/Index.purs b/marlowe-dashboard-client/generated/Ledger/Index.purs new file mode 100644 index 0000000000..3a1107d585 --- /dev/null +++ b/marlowe-dashboard-client/generated/Ledger/Index.purs @@ -0,0 +1,349 @@ +-- File auto generated by purescript-bridge! -- +module Ledger.Index where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Bounded.Generic (genericBottom, genericTop) +import Data.Either (Either) +import Data.Enum (class Enum) +import Data.Enum.Generic (genericPred, genericSucc) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map (Map) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.RawJson (RawJson) +import Data.Show.Generic (genericShow) +import Data.Tuple (Tuple) +import Data.Tuple.Nested ((/\)) +import Plutus.V1.Ledger.Crypto (PubKey, PubKeyHash, Signature) +import Plutus.V1.Ledger.Scripts + ( DatumHash + , MintingPolicy + , ScriptError + , Validator + ) +import Plutus.V1.Ledger.Slot (Slot) +import Plutus.V1.Ledger.Tx (RedeemerPtr, Tx, TxIn, TxOut, TxOutRef) +import Plutus.V1.Ledger.Value (Value) +import Type.Proxy (Proxy(Proxy)) + +newtype UtxoIndex = UtxoIndex { getIndex :: Map TxOutRef TxOut } + +derive instance eqUtxoIndex :: Eq UtxoIndex + +instance showUtxoIndex :: Show UtxoIndex where + show a = genericShow a + +instance encodeJsonUtxoIndex :: EncodeJson UtxoIndex where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { getIndex: (E.dictionary E.value E.value) :: _ (Map TxOutRef TxOut) } + ) + +instance decodeJsonUtxoIndex :: DecodeJson UtxoIndex where + decodeJson = defer \_ -> D.decode $ + ( UtxoIndex <$> D.record "UtxoIndex" + { getIndex: (D.dictionary D.value D.value) :: _ (Map TxOutRef TxOut) } + ) + +derive instance genericUtxoIndex :: Generic UtxoIndex _ + +derive instance newtypeUtxoIndex :: Newtype UtxoIndex _ + +-------------------------------------------------------------------------------- + +_UtxoIndex :: Iso' UtxoIndex { getIndex :: Map TxOutRef TxOut } +_UtxoIndex = _Newtype + +-------------------------------------------------------------------------------- + +data ValidationError + = InOutTypeMismatch TxIn TxOut + | TxOutRefNotFound TxOutRef + | InvalidScriptHash Validator String + | InvalidDatumHash String DatumHash + | MissingRedeemer RedeemerPtr + | InvalidSignature PubKey Signature + | ValueNotPreserved Value Value + | NegativeValue Tx + | NonAdaFees Tx + | ScriptFailure ScriptError + | CurrentSlotOutOfRange Slot + | SignatureMissing PubKeyHash + | MintWithoutScript String + | TransactionFeeTooLow Value Value + +derive instance eqValidationError :: Eq ValidationError + +instance showValidationError :: Show ValidationError where + show a = genericShow a + +instance encodeJsonValidationError :: EncodeJson ValidationError where + encodeJson = defer \_ -> case _ of + InOutTypeMismatch a b -> E.encodeTagged "InOutTypeMismatch" (a /\ b) + (E.tuple (E.value >/\< E.value)) + TxOutRefNotFound a -> E.encodeTagged "TxOutRefNotFound" a E.value + InvalidScriptHash a b -> E.encodeTagged "InvalidScriptHash" (a /\ b) + (E.tuple (E.value >/\< E.value)) + InvalidDatumHash a b -> E.encodeTagged "InvalidDatumHash" (a /\ b) + (E.tuple (E.value >/\< E.value)) + MissingRedeemer a -> E.encodeTagged "MissingRedeemer" a E.value + InvalidSignature a b -> E.encodeTagged "InvalidSignature" (a /\ b) + (E.tuple (E.value >/\< E.value)) + ValueNotPreserved a b -> E.encodeTagged "ValueNotPreserved" (a /\ b) + (E.tuple (E.value >/\< E.value)) + NegativeValue a -> E.encodeTagged "NegativeValue" a E.value + NonAdaFees a -> E.encodeTagged "NonAdaFees" a E.value + ScriptFailure a -> E.encodeTagged "ScriptFailure" a E.value + CurrentSlotOutOfRange a -> E.encodeTagged "CurrentSlotOutOfRange" a E.value + SignatureMissing a -> E.encodeTagged "SignatureMissing" a E.value + MintWithoutScript a -> E.encodeTagged "MintWithoutScript" a E.value + TransactionFeeTooLow a b -> E.encodeTagged "TransactionFeeTooLow" (a /\ b) + (E.tuple (E.value >/\< E.value)) + +instance decodeJsonValidationError :: DecodeJson ValidationError where + decodeJson = defer \_ -> D.decode + $ D.sumType "ValidationError" + $ Map.fromFoldable + [ "InOutTypeMismatch" /\ D.content + (D.tuple $ InOutTypeMismatch D.value D.value) + , "TxOutRefNotFound" /\ D.content (TxOutRefNotFound <$> D.value) + , "InvalidScriptHash" /\ D.content + (D.tuple $ InvalidScriptHash D.value D.value) + , "InvalidDatumHash" /\ D.content + (D.tuple $ InvalidDatumHash D.value D.value) + , "MissingRedeemer" /\ D.content (MissingRedeemer <$> D.value) + , "InvalidSignature" /\ D.content + (D.tuple $ InvalidSignature D.value D.value) + , "ValueNotPreserved" /\ D.content + (D.tuple $ ValueNotPreserved D.value D.value) + , "NegativeValue" /\ D.content (NegativeValue <$> D.value) + , "NonAdaFees" /\ D.content (NonAdaFees <$> D.value) + , "ScriptFailure" /\ D.content (ScriptFailure <$> D.value) + , "CurrentSlotOutOfRange" /\ D.content + (CurrentSlotOutOfRange <$> D.value) + , "SignatureMissing" /\ D.content (SignatureMissing <$> D.value) + , "MintWithoutScript" /\ D.content (MintWithoutScript <$> D.value) + , "TransactionFeeTooLow" /\ D.content + (D.tuple $ TransactionFeeTooLow D.value D.value) + ] + +derive instance genericValidationError :: Generic ValidationError _ + +-------------------------------------------------------------------------------- + +_InOutTypeMismatch :: Prism' ValidationError { a :: TxIn, b :: TxOut } +_InOutTypeMismatch = prism' (\{ a, b } -> (InOutTypeMismatch a b)) case _ of + (InOutTypeMismatch a b) -> Just { a, b } + _ -> Nothing + +_TxOutRefNotFound :: Prism' ValidationError TxOutRef +_TxOutRefNotFound = prism' TxOutRefNotFound case _ of + (TxOutRefNotFound a) -> Just a + _ -> Nothing + +_InvalidScriptHash :: Prism' ValidationError { a :: Validator, b :: String } +_InvalidScriptHash = prism' (\{ a, b } -> (InvalidScriptHash a b)) case _ of + (InvalidScriptHash a b) -> Just { a, b } + _ -> Nothing + +_InvalidDatumHash :: Prism' ValidationError { a :: String, b :: DatumHash } +_InvalidDatumHash = prism' (\{ a, b } -> (InvalidDatumHash a b)) case _ of + (InvalidDatumHash a b) -> Just { a, b } + _ -> Nothing + +_MissingRedeemer :: Prism' ValidationError RedeemerPtr +_MissingRedeemer = prism' MissingRedeemer case _ of + (MissingRedeemer a) -> Just a + _ -> Nothing + +_InvalidSignature :: Prism' ValidationError { a :: PubKey, b :: Signature } +_InvalidSignature = prism' (\{ a, b } -> (InvalidSignature a b)) case _ of + (InvalidSignature a b) -> Just { a, b } + _ -> Nothing + +_ValueNotPreserved :: Prism' ValidationError { a :: Value, b :: Value } +_ValueNotPreserved = prism' (\{ a, b } -> (ValueNotPreserved a b)) case _ of + (ValueNotPreserved a b) -> Just { a, b } + _ -> Nothing + +_NegativeValue :: Prism' ValidationError Tx +_NegativeValue = prism' NegativeValue case _ of + (NegativeValue a) -> Just a + _ -> Nothing + +_NonAdaFees :: Prism' ValidationError Tx +_NonAdaFees = prism' NonAdaFees case _ of + (NonAdaFees a) -> Just a + _ -> Nothing + +_ScriptFailure :: Prism' ValidationError ScriptError +_ScriptFailure = prism' ScriptFailure case _ of + (ScriptFailure a) -> Just a + _ -> Nothing + +_CurrentSlotOutOfRange :: Prism' ValidationError Slot +_CurrentSlotOutOfRange = prism' CurrentSlotOutOfRange case _ of + (CurrentSlotOutOfRange a) -> Just a + _ -> Nothing + +_SignatureMissing :: Prism' ValidationError PubKeyHash +_SignatureMissing = prism' SignatureMissing case _ of + (SignatureMissing a) -> Just a + _ -> Nothing + +_MintWithoutScript :: Prism' ValidationError String +_MintWithoutScript = prism' MintWithoutScript case _ of + (MintWithoutScript a) -> Just a + _ -> Nothing + +_TransactionFeeTooLow :: Prism' ValidationError { a :: Value, b :: Value } +_TransactionFeeTooLow = prism' (\{ a, b } -> (TransactionFeeTooLow a b)) + case _ of + (TransactionFeeTooLow a b) -> Just { a, b } + _ -> Nothing + +-------------------------------------------------------------------------------- + +data ValidationPhase + = Phase1 + | Phase2 + +derive instance eqValidationPhase :: Eq ValidationPhase + +derive instance ordValidationPhase :: Ord ValidationPhase + +instance showValidationPhase :: Show ValidationPhase where + show a = genericShow a + +instance encodeJsonValidationPhase :: EncodeJson ValidationPhase where + encodeJson = defer \_ -> E.encode E.enum + +instance decodeJsonValidationPhase :: DecodeJson ValidationPhase where + decodeJson = defer \_ -> D.decode D.enum + +derive instance genericValidationPhase :: Generic ValidationPhase _ + +instance enumValidationPhase :: Enum ValidationPhase where + succ = genericSucc + pred = genericPred + +instance boundedValidationPhase :: Bounded ValidationPhase where + bottom = genericBottom + top = genericTop + +-------------------------------------------------------------------------------- + +_Phase1 :: Prism' ValidationPhase Unit +_Phase1 = prism' (const Phase1) case _ of + Phase1 -> Just unit + _ -> Nothing + +_Phase2 :: Prism' ValidationPhase Unit +_Phase2 = prism' (const Phase2) case _ of + Phase2 -> Just unit + _ -> Nothing + +-------------------------------------------------------------------------------- + +newtype ScriptValidationEvent = ScriptValidationEvent + { sveScript :: String + , sveResult :: Either ScriptError (Tuple RawJson (Array String)) + , sveRedeemer :: String + , sveType :: ScriptType + } + +derive instance eqScriptValidationEvent :: Eq ScriptValidationEvent + +instance showScriptValidationEvent :: Show ScriptValidationEvent where + show a = genericShow a + +instance encodeJsonScriptValidationEvent :: EncodeJson ScriptValidationEvent where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { sveScript: E.value :: _ String + , sveResult: + (E.either E.value (E.tuple (E.value >/\< E.value))) :: _ + (Either ScriptError (Tuple RawJson (Array String))) + , sveRedeemer: E.value :: _ String + , sveType: E.value :: _ ScriptType + } + ) + +instance decodeJsonScriptValidationEvent :: DecodeJson ScriptValidationEvent where + decodeJson = defer \_ -> D.decode $ + ( ScriptValidationEvent <$> D.record "ScriptValidationEvent" + { sveScript: D.value :: _ String + , sveResult: + (D.either D.value (D.tuple (D.value D.value))) :: _ + (Either ScriptError (Tuple RawJson (Array String))) + , sveRedeemer: D.value :: _ String + , sveType: D.value :: _ ScriptType + } + ) + +derive instance genericScriptValidationEvent :: Generic ScriptValidationEvent _ + +derive instance newtypeScriptValidationEvent :: Newtype ScriptValidationEvent _ + +-------------------------------------------------------------------------------- + +_ScriptValidationEvent :: Iso' ScriptValidationEvent + { sveScript :: String + , sveResult :: Either ScriptError (Tuple RawJson (Array String)) + , sveRedeemer :: String + , sveType :: ScriptType + } +_ScriptValidationEvent = _Newtype + +-------------------------------------------------------------------------------- + +data ScriptType + = ValidatorScript Validator String + | MintingPolicyScript MintingPolicy + +derive instance eqScriptType :: Eq ScriptType + +instance showScriptType :: Show ScriptType where + show a = genericShow a + +instance encodeJsonScriptType :: EncodeJson ScriptType where + encodeJson = defer \_ -> case _ of + ValidatorScript a b -> E.encodeTagged "ValidatorScript" (a /\ b) + (E.tuple (E.value >/\< E.value)) + MintingPolicyScript a -> E.encodeTagged "MintingPolicyScript" a E.value + +instance decodeJsonScriptType :: DecodeJson ScriptType where + decodeJson = defer \_ -> D.decode + $ D.sumType "ScriptType" + $ Map.fromFoldable + [ "ValidatorScript" /\ D.content + (D.tuple $ ValidatorScript D.value D.value) + , "MintingPolicyScript" /\ D.content (MintingPolicyScript <$> D.value) + ] + +derive instance genericScriptType :: Generic ScriptType _ + +-------------------------------------------------------------------------------- + +_ValidatorScript :: Prism' ScriptType { a :: Validator, b :: String } +_ValidatorScript = prism' (\{ a, b } -> (ValidatorScript a b)) case _ of + (ValidatorScript a b) -> Just { a, b } + _ -> Nothing + +_MintingPolicyScript :: Prism' ScriptType MintingPolicy +_MintingPolicyScript = prism' MintingPolicyScript case _ of + (MintingPolicyScript a) -> Just a + _ -> Nothing \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/Ledger/TimeSlot.purs b/marlowe-dashboard-client/generated/Ledger/TimeSlot.purs new file mode 100644 index 0000000000..9ee43b4bd4 --- /dev/null +++ b/marlowe-dashboard-client/generated/Ledger/TimeSlot.purs @@ -0,0 +1,101 @@ +-- File auto generated by purescript-bridge! -- +module Ledger.TimeSlot where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.BigInt.Argonaut (BigInt) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple (Tuple) +import Data.Tuple.Nested ((/\)) +import Plutus.V1.Ledger.Slot (Slot) +import Plutus.V1.Ledger.Time (POSIXTime) +import Type.Proxy (Proxy(Proxy)) + +newtype SlotConfig = SlotConfig + { scSlotLength :: BigInt + , scSlotZeroTime :: POSIXTime + } + +derive instance eqSlotConfig :: Eq SlotConfig + +instance showSlotConfig :: Show SlotConfig where + show a = genericShow a + +instance encodeJsonSlotConfig :: EncodeJson SlotConfig where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { scSlotLength: E.value :: _ BigInt + , scSlotZeroTime: E.value :: _ POSIXTime + } + ) + +instance decodeJsonSlotConfig :: DecodeJson SlotConfig where + decodeJson = defer \_ -> D.decode $ + ( SlotConfig <$> D.record "SlotConfig" + { scSlotLength: D.value :: _ BigInt + , scSlotZeroTime: D.value :: _ POSIXTime + } + ) + +derive instance genericSlotConfig :: Generic SlotConfig _ + +derive instance newtypeSlotConfig :: Newtype SlotConfig _ + +-------------------------------------------------------------------------------- + +_SlotConfig :: Iso' SlotConfig + { scSlotLength :: BigInt, scSlotZeroTime :: POSIXTime } +_SlotConfig = _Newtype + +-------------------------------------------------------------------------------- + +newtype SlotConversionError = SlotOutOfRange + { requestedSlot :: Slot + , horizon :: Tuple Slot POSIXTime + } + +derive instance eqSlotConversionError :: Eq SlotConversionError + +instance showSlotConversionError :: Show SlotConversionError where + show a = genericShow a + +instance encodeJsonSlotConversionError :: EncodeJson SlotConversionError where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { requestedSlot: E.value :: _ Slot + , horizon: (E.tuple (E.value >/\< E.value)) :: _ (Tuple Slot POSIXTime) + } + ) + +instance decodeJsonSlotConversionError :: DecodeJson SlotConversionError where + decodeJson = defer \_ -> D.decode $ + ( SlotOutOfRange <$> D.record "SlotOutOfRange" + { requestedSlot: D.value :: _ Slot + , horizon: (D.tuple (D.value D.value)) :: _ (Tuple Slot POSIXTime) + } + ) + +derive instance genericSlotConversionError :: Generic SlotConversionError _ + +derive instance newtypeSlotConversionError :: Newtype SlotConversionError _ + +-------------------------------------------------------------------------------- + +_SlotOutOfRange :: Iso' SlotConversionError + { requestedSlot :: Slot, horizon :: Tuple Slot POSIXTime } +_SlotOutOfRange = _Newtype \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/Ledger/Tx.purs b/marlowe-dashboard-client/generated/Ledger/Tx.purs new file mode 100644 index 0000000000..3c94c37735 --- /dev/null +++ b/marlowe-dashboard-client/generated/Ledger/Tx.purs @@ -0,0 +1,104 @@ +-- File auto generated by purescript-bridge! -- +module Ledger.Tx where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Either (Either) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Plutus.V1.Ledger.Address (Address) +import Plutus.V1.Ledger.Scripts (DatumHash, Validator) +import Plutus.V1.Ledger.Value (Value) +import Type.Proxy (Proxy(Proxy)) + +data ChainIndexTxOut + = PublicKeyChainIndexTxOut + { _ciTxOutAddress :: Address + , _ciTxOutValue :: Value + } + | ScriptChainIndexTxOut + { _ciTxOutAddress :: Address + , _ciTxOutValidator :: Either String Validator + , _ciTxOutDatum :: Either DatumHash String + , _ciTxOutValue :: Value + } + +derive instance eqChainIndexTxOut :: Eq ChainIndexTxOut + +instance showChainIndexTxOut :: Show ChainIndexTxOut where + show a = genericShow a + +instance encodeJsonChainIndexTxOut :: EncodeJson ChainIndexTxOut where + encodeJson = defer \_ -> case _ of + PublicKeyChainIndexTxOut { _ciTxOutAddress, _ciTxOutValue } -> encodeJson + { tag: "PublicKeyChainIndexTxOut" + , _ciTxOutAddress: flip E.encode _ciTxOutAddress E.value + , _ciTxOutValue: flip E.encode _ciTxOutValue E.value + } + ScriptChainIndexTxOut + { _ciTxOutAddress, _ciTxOutValidator, _ciTxOutDatum, _ciTxOutValue } -> + encodeJson + { tag: "ScriptChainIndexTxOut" + , _ciTxOutAddress: flip E.encode _ciTxOutAddress E.value + , _ciTxOutValidator: flip E.encode _ciTxOutValidator + (E.either E.value E.value) + , _ciTxOutDatum: flip E.encode _ciTxOutDatum (E.either E.value E.value) + , _ciTxOutValue: flip E.encode _ciTxOutValue E.value + } + +instance decodeJsonChainIndexTxOut :: DecodeJson ChainIndexTxOut where + decodeJson = defer \_ -> D.decode + $ D.sumType "ChainIndexTxOut" + $ Map.fromFoldable + [ "PublicKeyChainIndexTxOut" /\ + ( PublicKeyChainIndexTxOut <$> D.object "PublicKeyChainIndexTxOut" + { _ciTxOutAddress: D.value :: _ Address + , _ciTxOutValue: D.value :: _ Value + } + ) + , "ScriptChainIndexTxOut" /\ + ( ScriptChainIndexTxOut <$> D.object "ScriptChainIndexTxOut" + { _ciTxOutAddress: D.value :: _ Address + , _ciTxOutValidator: + (D.either D.value D.value) :: _ (Either String Validator) + , _ciTxOutDatum: + (D.either D.value D.value) :: _ (Either DatumHash String) + , _ciTxOutValue: D.value :: _ Value + } + ) + ] + +derive instance genericChainIndexTxOut :: Generic ChainIndexTxOut _ + +-------------------------------------------------------------------------------- + +_PublicKeyChainIndexTxOut :: Prism' ChainIndexTxOut + { _ciTxOutAddress :: Address, _ciTxOutValue :: Value } +_PublicKeyChainIndexTxOut = prism' PublicKeyChainIndexTxOut case _ of + (PublicKeyChainIndexTxOut a) -> Just a + _ -> Nothing + +_ScriptChainIndexTxOut :: Prism' ChainIndexTxOut + { _ciTxOutAddress :: Address + , _ciTxOutValidator :: Either String Validator + , _ciTxOutDatum :: Either DatumHash String + , _ciTxOutValue :: Value + } +_ScriptChainIndexTxOut = prism' ScriptChainIndexTxOut case _ of + (ScriptChainIndexTxOut a) -> Just a + _ -> Nothing \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/Ledger/Tx/CardanoAPI.purs b/marlowe-dashboard-client/generated/Ledger/Tx/CardanoAPI.purs new file mode 100644 index 0000000000..4a878b5cb0 --- /dev/null +++ b/marlowe-dashboard-client/generated/Ledger/Tx/CardanoAPI.purs @@ -0,0 +1,199 @@ +-- File auto generated by purescript-bridge! -- +module Ledger.Tx.CardanoAPI where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Bounded.Generic (genericBottom, genericTop) +import Data.Enum (class Enum) +import Data.Enum.Generic (genericPred, genericSucc) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Plutus.V1.Ledger.Tx (ScriptTag) +import Type.Proxy (Proxy(Proxy)) + +data FromCardanoError = SimpleScriptsNotSupported + +derive instance eqFromCardanoError :: Eq FromCardanoError + +derive instance ordFromCardanoError :: Ord FromCardanoError + +instance showFromCardanoError :: Show FromCardanoError where + show a = genericShow a + +instance encodeJsonFromCardanoError :: EncodeJson FromCardanoError where + encodeJson = defer \_ -> E.encode E.enum + +instance decodeJsonFromCardanoError :: DecodeJson FromCardanoError where + decodeJson = defer \_ -> D.decode D.enum + +derive instance genericFromCardanoError :: Generic FromCardanoError _ + +instance enumFromCardanoError :: Enum FromCardanoError where + succ = genericSucc + pred = genericPred + +instance boundedFromCardanoError :: Bounded FromCardanoError where + bottom = genericBottom + top = genericTop + +-------------------------------------------------------------------------------- + +_SimpleScriptsNotSupported :: Iso' FromCardanoError Unit +_SimpleScriptsNotSupported = iso (const unit) (const SimpleScriptsNotSupported) + +-------------------------------------------------------------------------------- + +data ToCardanoError + = TxBodyError String + | DeserialisationError + | InvalidValidityRange + | ValueNotPureAda + | OutputHasZeroAda + | StakingPointersNotSupported + | SimpleScriptsNotSupportedToCardano + | MissingTxInType + | MissingMintingPolicyRedeemer + | MissingMintingPolicy + | ScriptPurposeNotSupported ScriptTag + | PublicKeyInputsNotSupported + | Tag String ToCardanoError + +derive instance eqToCardanoError :: Eq ToCardanoError + +instance showToCardanoError :: Show ToCardanoError where + show a = genericShow a + +instance encodeJsonToCardanoError :: EncodeJson ToCardanoError where + encodeJson = defer \_ -> case _ of + TxBodyError a -> E.encodeTagged "TxBodyError" a E.value + DeserialisationError -> encodeJson + { tag: "DeserialisationError", contents: jsonNull } + InvalidValidityRange -> encodeJson + { tag: "InvalidValidityRange", contents: jsonNull } + ValueNotPureAda -> encodeJson { tag: "ValueNotPureAda", contents: jsonNull } + OutputHasZeroAda -> encodeJson + { tag: "OutputHasZeroAda", contents: jsonNull } + StakingPointersNotSupported -> encodeJson + { tag: "StakingPointersNotSupported", contents: jsonNull } + SimpleScriptsNotSupportedToCardano -> encodeJson + { tag: "SimpleScriptsNotSupportedToCardano", contents: jsonNull } + MissingTxInType -> encodeJson { tag: "MissingTxInType", contents: jsonNull } + MissingMintingPolicyRedeemer -> encodeJson + { tag: "MissingMintingPolicyRedeemer", contents: jsonNull } + MissingMintingPolicy -> encodeJson + { tag: "MissingMintingPolicy", contents: jsonNull } + ScriptPurposeNotSupported a -> E.encodeTagged "ScriptPurposeNotSupported" a + E.value + PublicKeyInputsNotSupported -> encodeJson + { tag: "PublicKeyInputsNotSupported", contents: jsonNull } + Tag a b -> E.encodeTagged "Tag" (a /\ b) (E.tuple (E.value >/\< E.value)) + +instance decodeJsonToCardanoError :: DecodeJson ToCardanoError where + decodeJson = defer \_ -> D.decode + $ D.sumType "ToCardanoError" + $ Map.fromFoldable + [ "TxBodyError" /\ D.content (TxBodyError <$> D.value) + , "DeserialisationError" /\ pure DeserialisationError + , "InvalidValidityRange" /\ pure InvalidValidityRange + , "ValueNotPureAda" /\ pure ValueNotPureAda + , "OutputHasZeroAda" /\ pure OutputHasZeroAda + , "StakingPointersNotSupported" /\ pure StakingPointersNotSupported + , "SimpleScriptsNotSupportedToCardano" /\ pure + SimpleScriptsNotSupportedToCardano + , "MissingTxInType" /\ pure MissingTxInType + , "MissingMintingPolicyRedeemer" /\ pure MissingMintingPolicyRedeemer + , "MissingMintingPolicy" /\ pure MissingMintingPolicy + , "ScriptPurposeNotSupported" /\ D.content + (ScriptPurposeNotSupported <$> D.value) + , "PublicKeyInputsNotSupported" /\ pure PublicKeyInputsNotSupported + , "Tag" /\ D.content (D.tuple $ Tag D.value D.value) + ] + +derive instance genericToCardanoError :: Generic ToCardanoError _ + +-------------------------------------------------------------------------------- + +_TxBodyError :: Prism' ToCardanoError String +_TxBodyError = prism' TxBodyError case _ of + (TxBodyError a) -> Just a + _ -> Nothing + +_DeserialisationError :: Prism' ToCardanoError Unit +_DeserialisationError = prism' (const DeserialisationError) case _ of + DeserialisationError -> Just unit + _ -> Nothing + +_InvalidValidityRange :: Prism' ToCardanoError Unit +_InvalidValidityRange = prism' (const InvalidValidityRange) case _ of + InvalidValidityRange -> Just unit + _ -> Nothing + +_ValueNotPureAda :: Prism' ToCardanoError Unit +_ValueNotPureAda = prism' (const ValueNotPureAda) case _ of + ValueNotPureAda -> Just unit + _ -> Nothing + +_OutputHasZeroAda :: Prism' ToCardanoError Unit +_OutputHasZeroAda = prism' (const OutputHasZeroAda) case _ of + OutputHasZeroAda -> Just unit + _ -> Nothing + +_StakingPointersNotSupported :: Prism' ToCardanoError Unit +_StakingPointersNotSupported = prism' (const StakingPointersNotSupported) + case _ of + StakingPointersNotSupported -> Just unit + _ -> Nothing + +_SimpleScriptsNotSupportedToCardano :: Prism' ToCardanoError Unit +_SimpleScriptsNotSupportedToCardano = prism' + (const SimpleScriptsNotSupportedToCardano) + case _ of + SimpleScriptsNotSupportedToCardano -> Just unit + _ -> Nothing + +_MissingTxInType :: Prism' ToCardanoError Unit +_MissingTxInType = prism' (const MissingTxInType) case _ of + MissingTxInType -> Just unit + _ -> Nothing + +_MissingMintingPolicyRedeemer :: Prism' ToCardanoError Unit +_MissingMintingPolicyRedeemer = prism' (const MissingMintingPolicyRedeemer) + case _ of + MissingMintingPolicyRedeemer -> Just unit + _ -> Nothing + +_MissingMintingPolicy :: Prism' ToCardanoError Unit +_MissingMintingPolicy = prism' (const MissingMintingPolicy) case _ of + MissingMintingPolicy -> Just unit + _ -> Nothing + +_ScriptPurposeNotSupported :: Prism' ToCardanoError ScriptTag +_ScriptPurposeNotSupported = prism' ScriptPurposeNotSupported case _ of + (ScriptPurposeNotSupported a) -> Just a + _ -> Nothing + +_PublicKeyInputsNotSupported :: Prism' ToCardanoError Unit +_PublicKeyInputsNotSupported = prism' (const PublicKeyInputsNotSupported) + case _ of + PublicKeyInputsNotSupported -> Just unit + _ -> Nothing + +_Tag :: Prism' ToCardanoError { a :: String, b :: ToCardanoError } +_Tag = prism' (\{ a, b } -> (Tag a b)) case _ of + (Tag a b) -> Just { a, b } + _ -> Nothing \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/Ledger/Typed/Tx.purs b/marlowe-dashboard-client/generated/Ledger/Typed/Tx.purs new file mode 100644 index 0000000000..4ddf754035 --- /dev/null +++ b/marlowe-dashboard-client/generated/Ledger/Typed/Tx.purs @@ -0,0 +1,166 @@ +-- File auto generated by purescript-bridge! -- +module Ledger.Typed.Tx where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Bounded.Generic (genericBottom, genericTop) +import Data.Enum (class Enum) +import Data.Enum.Generic (genericPred, genericSucc) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Plutus.V1.Ledger.Address (Address) +import Plutus.V1.Ledger.Scripts (DatumHash) +import Plutus.V1.Ledger.Tx (TxInType, TxOutRef) +import Type.Proxy (Proxy(Proxy)) + +data ConnectionError + = WrongValidatorAddress Address Address + | WrongOutType WrongOutTypeError + | WrongInType TxInType + | MissingInType + | WrongValidatorType String + | WrongRedeemerType String + | WrongDatumType String + | NoDatum TxOutRef DatumHash + | UnknownRef + +derive instance eqConnectionError :: Eq ConnectionError + +instance showConnectionError :: Show ConnectionError where + show a = genericShow a + +instance encodeJsonConnectionError :: EncodeJson ConnectionError where + encodeJson = defer \_ -> case _ of + WrongValidatorAddress a b -> E.encodeTagged "WrongValidatorAddress" (a /\ b) + (E.tuple (E.value >/\< E.value)) + WrongOutType a -> E.encodeTagged "WrongOutType" a E.value + WrongInType a -> E.encodeTagged "WrongInType" a E.value + MissingInType -> encodeJson { tag: "MissingInType", contents: jsonNull } + WrongValidatorType a -> E.encodeTagged "WrongValidatorType" a E.value + WrongRedeemerType a -> E.encodeTagged "WrongRedeemerType" a E.value + WrongDatumType a -> E.encodeTagged "WrongDatumType" a E.value + NoDatum a b -> E.encodeTagged "NoDatum" (a /\ b) + (E.tuple (E.value >/\< E.value)) + UnknownRef -> encodeJson { tag: "UnknownRef", contents: jsonNull } + +instance decodeJsonConnectionError :: DecodeJson ConnectionError where + decodeJson = defer \_ -> D.decode + $ D.sumType "ConnectionError" + $ Map.fromFoldable + [ "WrongValidatorAddress" /\ D.content + (D.tuple $ WrongValidatorAddress D.value D.value) + , "WrongOutType" /\ D.content (WrongOutType <$> D.value) + , "WrongInType" /\ D.content (WrongInType <$> D.value) + , "MissingInType" /\ pure MissingInType + , "WrongValidatorType" /\ D.content (WrongValidatorType <$> D.value) + , "WrongRedeemerType" /\ D.content (WrongRedeemerType <$> D.value) + , "WrongDatumType" /\ D.content (WrongDatumType <$> D.value) + , "NoDatum" /\ D.content (D.tuple $ NoDatum D.value D.value) + , "UnknownRef" /\ pure UnknownRef + ] + +derive instance genericConnectionError :: Generic ConnectionError _ + +-------------------------------------------------------------------------------- + +_WrongValidatorAddress :: Prism' ConnectionError { a :: Address, b :: Address } +_WrongValidatorAddress = prism' (\{ a, b } -> (WrongValidatorAddress a b)) + case _ of + (WrongValidatorAddress a b) -> Just { a, b } + _ -> Nothing + +_WrongOutType :: Prism' ConnectionError WrongOutTypeError +_WrongOutType = prism' WrongOutType case _ of + (WrongOutType a) -> Just a + _ -> Nothing + +_WrongInType :: Prism' ConnectionError TxInType +_WrongInType = prism' WrongInType case _ of + (WrongInType a) -> Just a + _ -> Nothing + +_MissingInType :: Prism' ConnectionError Unit +_MissingInType = prism' (const MissingInType) case _ of + MissingInType -> Just unit + _ -> Nothing + +_WrongValidatorType :: Prism' ConnectionError String +_WrongValidatorType = prism' WrongValidatorType case _ of + (WrongValidatorType a) -> Just a + _ -> Nothing + +_WrongRedeemerType :: Prism' ConnectionError String +_WrongRedeemerType = prism' WrongRedeemerType case _ of + (WrongRedeemerType a) -> Just a + _ -> Nothing + +_WrongDatumType :: Prism' ConnectionError String +_WrongDatumType = prism' WrongDatumType case _ of + (WrongDatumType a) -> Just a + _ -> Nothing + +_NoDatum :: Prism' ConnectionError { a :: TxOutRef, b :: DatumHash } +_NoDatum = prism' (\{ a, b } -> (NoDatum a b)) case _ of + (NoDatum a b) -> Just { a, b } + _ -> Nothing + +_UnknownRef :: Prism' ConnectionError Unit +_UnknownRef = prism' (const UnknownRef) case _ of + UnknownRef -> Just unit + _ -> Nothing + +-------------------------------------------------------------------------------- + +data WrongOutTypeError + = ExpectedScriptGotPubkey + | ExpectedPubkeyGotScript + +derive instance eqWrongOutTypeError :: Eq WrongOutTypeError + +derive instance ordWrongOutTypeError :: Ord WrongOutTypeError + +instance showWrongOutTypeError :: Show WrongOutTypeError where + show a = genericShow a + +instance encodeJsonWrongOutTypeError :: EncodeJson WrongOutTypeError where + encodeJson = defer \_ -> E.encode E.enum + +instance decodeJsonWrongOutTypeError :: DecodeJson WrongOutTypeError where + decodeJson = defer \_ -> D.decode D.enum + +derive instance genericWrongOutTypeError :: Generic WrongOutTypeError _ + +instance enumWrongOutTypeError :: Enum WrongOutTypeError where + succ = genericSucc + pred = genericPred + +instance boundedWrongOutTypeError :: Bounded WrongOutTypeError where + bottom = genericBottom + top = genericTop + +-------------------------------------------------------------------------------- + +_ExpectedScriptGotPubkey :: Prism' WrongOutTypeError Unit +_ExpectedScriptGotPubkey = prism' (const ExpectedScriptGotPubkey) case _ of + ExpectedScriptGotPubkey -> Just unit + _ -> Nothing + +_ExpectedPubkeyGotScript :: Prism' WrongOutTypeError Unit +_ExpectedPubkeyGotScript = prism' (const ExpectedPubkeyGotScript) case _ of + ExpectedPubkeyGotScript -> Just unit + _ -> Nothing \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/Marlowe.js b/marlowe-dashboard-client/generated/Marlowe.js new file mode 100644 index 0000000000..c0dcec34c3 --- /dev/null +++ b/marlowe-dashboard-client/generated/Marlowe.js @@ -0,0 +1,3 @@ +"use strict"; + +exports.encodeURIComponent = encodeURIComponent; diff --git a/marlowe-dashboard-client/generated/Marlowe.purs b/marlowe-dashboard-client/generated/Marlowe.purs new file mode 100644 index 0000000000..28a3bda162 --- /dev/null +++ b/marlowe-dashboard-client/generated/Marlowe.purs @@ -0,0 +1,222 @@ +-- File auto generated by servant-purescript! -- +module Marlowe where + +import Prelude + +import Affjax (defaultRequest, request) +import Affjax.RequestBody (json) as Request +import Affjax.RequestHeader (RequestHeader(..)) +import Affjax.ResponseFormat (json) as Response +import Cardano.Wallet.Mock.Types (WalletInfo) +import Control.Monad.Error.Class (class MonadError, throwError) +import Control.Monad.Reader.Class (class MonadAsk, asks) +import Data.Argonaut.Decode (decodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Array (fromFoldable, null) +import Data.Either (Either(..)) +import Data.HTTP.Method (Method(..)) +import Data.Maybe (Maybe(..)) +import Data.Newtype (unwrap) +import Data.String (joinWith) +import Effect.Aff.Class (class MonadAff, liftAff) +import Marlowe.Run.Webserver.Wallet.CentralizedTestnet.Types + ( RestoreError + , RestorePostData + ) +import Marlowe.Run.Webserver.Wallet.Types (GetTotalFunds) +import Servant.PureScript + ( class ToURLPiece + , AjaxError + , ErrorDescription(..) + , toURLPiece + ) + +foreign import encodeURIComponent :: String -> String + +type SPSettings_ + = + { baseURL :: String + } + +class HasSPSettings a where + spSettings :: a -> SPSettings_ + +getApiVersion + :: forall env m + . HasSPSettings env + => MonadAsk env m + => MonadError AjaxError m + => MonadAff m + => m String +getApiVersion = do + spSettings <- asks spSettings + let baseURL = spSettings.baseURL + let httpMethod = Left GET + let + encodeQueryItem :: forall a. ToURLPiece a => String -> a -> String + encodeQueryItem name val = name <> "=" <> toURLPiece val + let + queryArgs :: Array String + queryArgs = + [] + let + queryString = if null queryArgs then "" else "?" <> (joinWith "&" queryArgs) + let + reqURL = + baseURL + <> "api" + <> "/" + <> "version" + <> queryString + let + reqHeaders = + [ + ] + let + affReq = + defaultRequest + { method = httpMethod + , url = reqURL + , headers = defaultRequest.headers <> reqHeaders + , responseFormat = Response.json + } + let + decoder = + D.value + result <- liftAff $ request affReq + response <- case result of + Left err -> throwError $ + { request: affReq, description: ConnectingError err } + Right r -> pure r + when (unwrap response.status < 200 || unwrap response.status >= 299) + $ throwError + $ { request: affReq, description: UnexpectedHTTPStatus response } + case D.decode decoder response.body of + Left err -> throwError $ { request: affReq, description: DecodingError err } + Right body -> pure body + +getApiWalletByWalletidGettotalfunds + :: forall env m + . HasSPSettings env + => MonadAsk env m + => MonadError AjaxError m + => MonadAff m + => String + -> m GetTotalFunds +getApiWalletByWalletidGettotalfunds wallet_id = do + spSettings <- asks spSettings + let baseURL = spSettings.baseURL + let httpMethod = Left GET + let + encodeQueryItem :: forall a. ToURLPiece a => String -> a -> String + encodeQueryItem name val = name <> "=" <> toURLPiece val + let + queryArgs :: Array String + queryArgs = + [] + let + queryString = if null queryArgs then "" else "?" <> (joinWith "&" queryArgs) + let + reqURL = + baseURL + <> "api" + <> "/" + <> "wallet" + <> "/" + <> encodeURIComponent (toURLPiece wallet_id) + <> "/" + <> "get-total-funds" + <> queryString + let + reqHeaders = + [ + ] + let + affReq = + defaultRequest + { method = httpMethod + , url = reqURL + , headers = defaultRequest.headers <> reqHeaders + , responseFormat = Response.json + } + let + decoder = + D.value + result <- liftAff $ request affReq + response <- case result of + Left err -> throwError $ + { request: affReq, description: ConnectingError err } + Right r -> pure r + when (unwrap response.status < 200 || unwrap response.status >= 299) + $ throwError + $ { request: affReq, description: UnexpectedHTTPStatus response } + case D.decode decoder response.body of + Left err -> throwError $ { request: affReq, description: DecodingError err } + Right body -> pure body + +postApiWalletCentralizedtestnetRestore + :: forall env m + . HasSPSettings env + => MonadAsk env m + => MonadError AjaxError m + => MonadAff m + => RestorePostData + -> m (Either RestoreError WalletInfo) +postApiWalletCentralizedtestnetRestore reqBody = do + spSettings <- asks spSettings + let baseURL = spSettings.baseURL + let httpMethod = Left POST + let + encodeQueryItem :: forall a. ToURLPiece a => String -> a -> String + encodeQueryItem name val = name <> "=" <> toURLPiece val + let + queryArgs :: Array String + queryArgs = + [] + let + queryString = if null queryArgs then "" else "?" <> (joinWith "&" queryArgs) + let + reqURL = + baseURL + <> "api" + <> "/" + <> "wallet" + <> "/" + <> "centralized-testnet" + <> "/" + <> "restore" + <> queryString + let + reqHeaders = + [ + ] + let + affReq = + defaultRequest + { method = httpMethod + , url = reqURL + , headers = defaultRequest.headers <> reqHeaders + , responseFormat = Response.json + , content = Just + $ Request.json + $ flip E.encode reqBody + $ E.value + } + let + decoder = + (D.either D.value D.value) + result <- liftAff $ request affReq + response <- case result of + Left err -> throwError $ + { request: affReq, description: ConnectingError err } + Right r -> pure r + when (unwrap response.status < 200 || unwrap response.status >= 299) + $ throwError + $ { request: affReq, description: UnexpectedHTTPStatus response } + case D.decode decoder response.body of + Left err -> throwError $ { request: affReq, description: DecodingError err } + Right body -> pure body diff --git a/marlowe-dashboard-client/generated/Marlowe/Run/Webserver/Wallet/CentralizedTestnet/Types.purs b/marlowe-dashboard-client/generated/Marlowe/Run/Webserver/Wallet/CentralizedTestnet/Types.purs new file mode 100644 index 0000000000..8c6d7bf680 --- /dev/null +++ b/marlowe-dashboard-client/generated/Marlowe/Run/Webserver/Wallet/CentralizedTestnet/Types.purs @@ -0,0 +1,115 @@ +-- File auto generated by purescript-bridge! -- +module Marlowe.Run.Webserver.Wallet.CentralizedTestnet.Types where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Bounded.Generic (genericBottom, genericTop) +import Data.Enum (class Enum) +import Data.Enum.Generic (genericPred, genericSucc) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Type.Proxy (Proxy(Proxy)) + +data RestoreError + = InvalidMnemonic + | RestoreWalletError + | FetchPubKeyHashError + +derive instance eqRestoreError :: Eq RestoreError + +derive instance ordRestoreError :: Ord RestoreError + +instance showRestoreError :: Show RestoreError where + show a = genericShow a + +instance encodeJsonRestoreError :: EncodeJson RestoreError where + encodeJson = defer \_ -> E.encode E.enum + +instance decodeJsonRestoreError :: DecodeJson RestoreError where + decodeJson = defer \_ -> D.decode D.enum + +derive instance genericRestoreError :: Generic RestoreError _ + +instance enumRestoreError :: Enum RestoreError where + succ = genericSucc + pred = genericPred + +instance boundedRestoreError :: Bounded RestoreError where + bottom = genericBottom + top = genericTop + +-------------------------------------------------------------------------------- + +_InvalidMnemonic :: Prism' RestoreError Unit +_InvalidMnemonic = prism' (const InvalidMnemonic) case _ of + InvalidMnemonic -> Just unit + _ -> Nothing + +_RestoreWalletError :: Prism' RestoreError Unit +_RestoreWalletError = prism' (const RestoreWalletError) case _ of + RestoreWalletError -> Just unit + _ -> Nothing + +_FetchPubKeyHashError :: Prism' RestoreError Unit +_FetchPubKeyHashError = prism' (const FetchPubKeyHashError) case _ of + FetchPubKeyHashError -> Just unit + _ -> Nothing + +-------------------------------------------------------------------------------- + +newtype RestorePostData = RestorePostData + { getMnemonicPhrase :: Array String + , getPassphrase :: String + , getWalletName :: String + } + +derive instance eqRestorePostData :: Eq RestorePostData + +instance showRestorePostData :: Show RestorePostData where + show a = genericShow a + +instance encodeJsonRestorePostData :: EncodeJson RestorePostData where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { getMnemonicPhrase: E.value :: _ (Array String) + , getPassphrase: E.value :: _ String + , getWalletName: E.value :: _ String + } + ) + +instance decodeJsonRestorePostData :: DecodeJson RestorePostData where + decodeJson = defer \_ -> D.decode $ + ( RestorePostData <$> D.record "RestorePostData" + { getMnemonicPhrase: D.value :: _ (Array String) + , getPassphrase: D.value :: _ String + , getWalletName: D.value :: _ String + } + ) + +derive instance genericRestorePostData :: Generic RestorePostData _ + +derive instance newtypeRestorePostData :: Newtype RestorePostData _ + +-------------------------------------------------------------------------------- + +_RestorePostData :: Iso' RestorePostData + { getMnemonicPhrase :: Array String + , getPassphrase :: String + , getWalletName :: String + } +_RestorePostData = _Newtype \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/Marlowe/Run/Webserver/Wallet/Types.purs b/marlowe-dashboard-client/generated/Marlowe/Run/Webserver/Wallet/Types.purs new file mode 100644 index 0000000000..61b2f33a78 --- /dev/null +++ b/marlowe-dashboard-client/generated/Marlowe/Run/Webserver/Wallet/Types.purs @@ -0,0 +1,59 @@ +-- File auto generated by purescript-bridge! -- +module Marlowe.Run.Webserver.Wallet.Types where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Plutus.V1.Ledger.Value (Value) +import Type.Proxy (Proxy(Proxy)) + +newtype GetTotalFunds = GetTotalFunds + { assets :: Value + , sync :: Number + } + +derive instance eqGetTotalFunds :: Eq GetTotalFunds + +instance showGetTotalFunds :: Show GetTotalFunds where + show a = genericShow a + +instance encodeJsonGetTotalFunds :: EncodeJson GetTotalFunds where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { assets: E.value :: _ Value + , sync: E.value :: _ Number + } + ) + +instance decodeJsonGetTotalFunds :: DecodeJson GetTotalFunds where + decodeJson = defer \_ -> D.decode $ + ( GetTotalFunds <$> D.record "GetTotalFunds" + { assets: D.value :: _ Value + , sync: D.value :: _ Number + } + ) + +derive instance genericGetTotalFunds :: Generic GetTotalFunds _ + +derive instance newtypeGetTotalFunds :: Newtype GetTotalFunds _ + +-------------------------------------------------------------------------------- + +_GetTotalFunds :: Iso' GetTotalFunds { assets :: Value, sync :: Number } +_GetTotalFunds = _Newtype \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/Marlowe/Run/Webserver/WebSocket.purs b/marlowe-dashboard-client/generated/Marlowe/Run/Webserver/WebSocket.purs new file mode 100644 index 0000000000..1f974adbfe --- /dev/null +++ b/marlowe-dashboard-client/generated/Marlowe/Run/Webserver/WebSocket.purs @@ -0,0 +1,69 @@ +-- File auto generated by purescript-bridge! -- +module Marlowe.Run.Webserver.WebSocket where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Type.Proxy (Proxy(Proxy)) + +newtype StreamToServer = ServerMsg Boolean + +derive instance eqStreamToServer :: Eq StreamToServer + +instance showStreamToServer :: Show StreamToServer where + show a = genericShow a + +instance encodeJsonStreamToServer :: EncodeJson StreamToServer where + encodeJson = defer \_ -> E.encode $ unwrap >$< E.value + +instance decodeJsonStreamToServer :: DecodeJson StreamToServer where + decodeJson = defer \_ -> D.decode $ (ServerMsg <$> D.value) + +derive instance genericStreamToServer :: Generic StreamToServer _ + +derive instance newtypeStreamToServer :: Newtype StreamToServer _ + +-------------------------------------------------------------------------------- + +_ServerMsg :: Iso' StreamToServer Boolean +_ServerMsg = _Newtype + +-------------------------------------------------------------------------------- + +newtype StreamToClient = ClientMsg Boolean + +derive instance eqStreamToClient :: Eq StreamToClient + +instance showStreamToClient :: Show StreamToClient where + show a = genericShow a + +instance encodeJsonStreamToClient :: EncodeJson StreamToClient where + encodeJson = defer \_ -> E.encode $ unwrap >$< E.value + +instance decodeJsonStreamToClient :: DecodeJson StreamToClient where + decodeJson = defer \_ -> D.decode $ (ClientMsg <$> D.value) + +derive instance genericStreamToClient :: Generic StreamToClient _ + +derive instance newtypeStreamToClient :: Newtype StreamToClient _ + +-------------------------------------------------------------------------------- + +_ClientMsg :: Iso' StreamToClient Boolean +_ClientMsg = _Newtype \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/MarloweContract.purs b/marlowe-dashboard-client/generated/MarloweContract.purs new file mode 100644 index 0000000000..39af34b8fa --- /dev/null +++ b/marlowe-dashboard-client/generated/MarloweContract.purs @@ -0,0 +1,71 @@ +-- File auto generated by purescript-bridge! -- +module MarloweContract where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Bounded.Generic (genericBottom, genericTop) +import Data.Enum (class Enum) +import Data.Enum.Generic (genericPred, genericSucc) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Type.Proxy (Proxy(Proxy)) + +data MarloweContract + = MarloweApp + | WalletCompanion + | MarloweFollower + +derive instance eqMarloweContract :: Eq MarloweContract + +derive instance ordMarloweContract :: Ord MarloweContract + +instance showMarloweContract :: Show MarloweContract where + show a = genericShow a + +instance encodeJsonMarloweContract :: EncodeJson MarloweContract where + encodeJson = defer \_ -> E.encode E.enum + +instance decodeJsonMarloweContract :: DecodeJson MarloweContract where + decodeJson = defer \_ -> D.decode D.enum + +derive instance genericMarloweContract :: Generic MarloweContract _ + +instance enumMarloweContract :: Enum MarloweContract where + succ = genericSucc + pred = genericPred + +instance boundedMarloweContract :: Bounded MarloweContract where + bottom = genericBottom + top = genericTop + +-------------------------------------------------------------------------------- + +_MarloweApp :: Prism' MarloweContract Unit +_MarloweApp = prism' (const MarloweApp) case _ of + MarloweApp -> Just unit + _ -> Nothing + +_WalletCompanion :: Prism' MarloweContract Unit +_WalletCompanion = prism' (const WalletCompanion) case _ of + WalletCompanion -> Just unit + _ -> Nothing + +_MarloweFollower :: Prism' MarloweContract Unit +_MarloweFollower = prism' (const MarloweFollower) case _ of + MarloweFollower -> Just unit + _ -> Nothing \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/Playground/Types.purs b/marlowe-dashboard-client/generated/Playground/Types.purs new file mode 100644 index 0000000000..cb0da7998b --- /dev/null +++ b/marlowe-dashboard-client/generated/Playground/Types.purs @@ -0,0 +1,216 @@ +-- File auto generated by purescript-bridge! -- +module Playground.Types where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.BigInt.Argonaut (BigInt) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.List.Types (NonEmptyList) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Ledger.CardanoWallet (WalletNumber) +import Plutus.V1.Ledger.Slot (Slot) +import Plutus.V1.Ledger.Value (TokenName, Value) +import Type.Proxy (Proxy(Proxy)) +import Wallet.Types (EndpointDescription) + +newtype FunctionSchema a = FunctionSchema + { endpointDescription :: EndpointDescription + , argument :: a + } + +derive instance functorFunctionSchema :: Functor FunctionSchema + +instance showFunctionSchema :: (Show a) => Show (FunctionSchema a) where + show a = genericShow a + +derive instance eqFunctionSchema :: (Eq a) => Eq (FunctionSchema a) + +instance encodeJsonFunctionSchema :: + ( EncodeJson a + ) => + EncodeJson (FunctionSchema a) where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { endpointDescription: E.value :: _ EndpointDescription + , argument: E.value :: _ a + } + ) + +instance decodeJsonFunctionSchema :: + ( DecodeJson a + ) => + DecodeJson (FunctionSchema a) where + decodeJson = defer \_ -> D.decode $ + ( FunctionSchema <$> D.record "FunctionSchema" + { endpointDescription: D.value :: _ EndpointDescription + , argument: D.value :: _ a + } + ) + +derive instance genericFunctionSchema :: Generic (FunctionSchema a) _ + +derive instance newtypeFunctionSchema :: Newtype (FunctionSchema a) _ + +-------------------------------------------------------------------------------- + +_FunctionSchema + :: forall a + . Iso' (FunctionSchema a) + { endpointDescription :: EndpointDescription, argument :: a } +_FunctionSchema = _Newtype + +-------------------------------------------------------------------------------- + +newtype KnownCurrency = KnownCurrency + { hash :: String + , friendlyName :: String + , knownTokens :: NonEmptyList TokenName + } + +instance showKnownCurrency :: Show KnownCurrency where + show a = genericShow a + +derive instance eqKnownCurrency :: Eq KnownCurrency + +instance encodeJsonKnownCurrency :: EncodeJson KnownCurrency where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { hash: E.value :: _ String + , friendlyName: E.value :: _ String + , knownTokens: E.value :: _ (NonEmptyList TokenName) + } + ) + +instance decodeJsonKnownCurrency :: DecodeJson KnownCurrency where + decodeJson = defer \_ -> D.decode $ + ( KnownCurrency <$> D.record "KnownCurrency" + { hash: D.value :: _ String + , friendlyName: D.value :: _ String + , knownTokens: D.value :: _ (NonEmptyList TokenName) + } + ) + +derive instance genericKnownCurrency :: Generic KnownCurrency _ + +derive instance newtypeKnownCurrency :: Newtype KnownCurrency _ + +-------------------------------------------------------------------------------- + +_KnownCurrency :: Iso' KnownCurrency + { hash :: String + , friendlyName :: String + , knownTokens :: NonEmptyList TokenName + } +_KnownCurrency = _Newtype + +-------------------------------------------------------------------------------- + +data ContractCall a + = CallEndpoint + { caller :: WalletNumber + , argumentValues :: FunctionSchema a + } + | AddBlocks { blocks :: BigInt } + | AddBlocksUntil { slot :: Slot } + | PayToWallet + { sender :: WalletNumber + , recipient :: WalletNumber + , amount :: Value + } + +instance showContractCall :: (Show a) => Show (ContractCall a) where + show a = genericShow a + +derive instance eqContractCall :: (Eq a) => Eq (ContractCall a) + +instance encodeJsonContractCall :: (EncodeJson a) => EncodeJson (ContractCall a) where + encodeJson = defer \_ -> case _ of + CallEndpoint { caller, argumentValues } -> encodeJson + { tag: "CallEndpoint" + , caller: flip E.encode caller E.value + , argumentValues: flip E.encode argumentValues E.value + } + AddBlocks { blocks } -> encodeJson + { tag: "AddBlocks" + , blocks: flip E.encode blocks E.value + } + AddBlocksUntil { slot } -> encodeJson + { tag: "AddBlocksUntil" + , slot: flip E.encode slot E.value + } + PayToWallet { sender, recipient, amount } -> encodeJson + { tag: "PayToWallet" + , sender: flip E.encode sender E.value + , recipient: flip E.encode recipient E.value + , amount: flip E.encode amount E.value + } + +instance decodeJsonContractCall :: (DecodeJson a) => DecodeJson (ContractCall a) where + decodeJson = defer \_ -> D.decode + $ D.sumType "ContractCall" + $ Map.fromFoldable + [ "CallEndpoint" /\ + ( CallEndpoint <$> D.object "CallEndpoint" + { caller: D.value :: _ WalletNumber + , argumentValues: D.value :: _ (FunctionSchema a) + } + ) + , "AddBlocks" /\ + (AddBlocks <$> D.object "AddBlocks" { blocks: D.value :: _ BigInt }) + , "AddBlocksUntil" /\ + ( AddBlocksUntil <$> D.object "AddBlocksUntil" + { slot: D.value :: _ Slot } + ) + , "PayToWallet" /\ + ( PayToWallet <$> D.object "PayToWallet" + { sender: D.value :: _ WalletNumber + , recipient: D.value :: _ WalletNumber + , amount: D.value :: _ Value + } + ) + ] + +derive instance genericContractCall :: Generic (ContractCall a) _ + +-------------------------------------------------------------------------------- + +_CallEndpoint + :: forall a + . Prism' (ContractCall a) + { caller :: WalletNumber, argumentValues :: FunctionSchema a } +_CallEndpoint = prism' CallEndpoint case _ of + (CallEndpoint a) -> Just a + _ -> Nothing + +_AddBlocks :: forall a. Prism' (ContractCall a) { blocks :: BigInt } +_AddBlocks = prism' AddBlocks case _ of + (AddBlocks a) -> Just a + _ -> Nothing + +_AddBlocksUntil :: forall a. Prism' (ContractCall a) { slot :: Slot } +_AddBlocksUntil = prism' AddBlocksUntil case _ of + (AddBlocksUntil a) -> Just a + _ -> Nothing + +_PayToWallet + :: forall a + . Prism' (ContractCall a) + { sender :: WalletNumber, recipient :: WalletNumber, amount :: Value } +_PayToWallet = prism' PayToWallet case _ of + (PayToWallet a) -> Just a + _ -> Nothing \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/Plutus/ChainIndex/ChainIndexError.purs b/marlowe-dashboard-client/generated/Plutus/ChainIndex/ChainIndexError.purs new file mode 100644 index 0000000000..ad4e441d41 --- /dev/null +++ b/marlowe-dashboard-client/generated/Plutus/ChainIndex/ChainIndexError.purs @@ -0,0 +1,183 @@ +-- File auto generated by purescript-bridge! -- +module Plutus.ChainIndex.ChainIndexError where + +import Prelude + +import Control.Lazy (defer) +import Control.Monad.Freer.Extras.Beam (BeamError) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Plutus.ChainIndex.Types (Point, Tip) +import Type.Proxy (Proxy(Proxy)) + +data ChainIndexError + = InsertionFailed InsertUtxoFailed + | RollbackFailed RollbackFailed + | ResumeNotSupported + | QueryFailedNoTip + | BeamEffectError BeamError + +derive instance eqChainIndexError :: Eq ChainIndexError + +instance showChainIndexError :: Show ChainIndexError where + show a = genericShow a + +instance encodeJsonChainIndexError :: EncodeJson ChainIndexError where + encodeJson = defer \_ -> case _ of + InsertionFailed a -> E.encodeTagged "InsertionFailed" a E.value + RollbackFailed a -> E.encodeTagged "RollbackFailed" a E.value + ResumeNotSupported -> encodeJson + { tag: "ResumeNotSupported", contents: jsonNull } + QueryFailedNoTip -> encodeJson + { tag: "QueryFailedNoTip", contents: jsonNull } + BeamEffectError a -> E.encodeTagged "BeamEffectError" a E.value + +instance decodeJsonChainIndexError :: DecodeJson ChainIndexError where + decodeJson = defer \_ -> D.decode + $ D.sumType "ChainIndexError" + $ Map.fromFoldable + [ "InsertionFailed" /\ D.content (InsertionFailed <$> D.value) + , "RollbackFailed" /\ D.content (RollbackFailed <$> D.value) + , "ResumeNotSupported" /\ pure ResumeNotSupported + , "QueryFailedNoTip" /\ pure QueryFailedNoTip + , "BeamEffectError" /\ D.content (BeamEffectError <$> D.value) + ] + +derive instance genericChainIndexError :: Generic ChainIndexError _ + +-------------------------------------------------------------------------------- + +_InsertionFailed :: Prism' ChainIndexError InsertUtxoFailed +_InsertionFailed = prism' InsertionFailed case _ of + (InsertionFailed a) -> Just a + _ -> Nothing + +_RollbackFailed :: Prism' ChainIndexError RollbackFailed +_RollbackFailed = prism' RollbackFailed case _ of + (RollbackFailed a) -> Just a + _ -> Nothing + +_ResumeNotSupported :: Prism' ChainIndexError Unit +_ResumeNotSupported = prism' (const ResumeNotSupported) case _ of + ResumeNotSupported -> Just unit + _ -> Nothing + +_QueryFailedNoTip :: Prism' ChainIndexError Unit +_QueryFailedNoTip = prism' (const QueryFailedNoTip) case _ of + QueryFailedNoTip -> Just unit + _ -> Nothing + +_BeamEffectError :: Prism' ChainIndexError BeamError +_BeamEffectError = prism' BeamEffectError case _ of + (BeamEffectError a) -> Just a + _ -> Nothing + +-------------------------------------------------------------------------------- + +data InsertUtxoFailed + = DuplicateBlock Tip + | InsertUtxoNoTip + +derive instance eqInsertUtxoFailed :: Eq InsertUtxoFailed + +instance showInsertUtxoFailed :: Show InsertUtxoFailed where + show a = genericShow a + +instance encodeJsonInsertUtxoFailed :: EncodeJson InsertUtxoFailed where + encodeJson = defer \_ -> case _ of + DuplicateBlock a -> E.encodeTagged "DuplicateBlock" a E.value + InsertUtxoNoTip -> encodeJson { tag: "InsertUtxoNoTip", contents: jsonNull } + +instance decodeJsonInsertUtxoFailed :: DecodeJson InsertUtxoFailed where + decodeJson = defer \_ -> D.decode + $ D.sumType "InsertUtxoFailed" + $ Map.fromFoldable + [ "DuplicateBlock" /\ D.content (DuplicateBlock <$> D.value) + , "InsertUtxoNoTip" /\ pure InsertUtxoNoTip + ] + +derive instance genericInsertUtxoFailed :: Generic InsertUtxoFailed _ + +-------------------------------------------------------------------------------- + +_DuplicateBlock :: Prism' InsertUtxoFailed Tip +_DuplicateBlock = prism' DuplicateBlock case _ of + (DuplicateBlock a) -> Just a + _ -> Nothing + +_InsertUtxoNoTip :: Prism' InsertUtxoFailed Unit +_InsertUtxoNoTip = prism' (const InsertUtxoNoTip) case _ of + InsertUtxoNoTip -> Just unit + _ -> Nothing + +-------------------------------------------------------------------------------- + +data RollbackFailed + = RollbackNoTip + | TipMismatch + { foundTip :: Tip + , targetPoint :: Point + } + | OldPointNotFound Point + +derive instance eqRollbackFailed :: Eq RollbackFailed + +instance showRollbackFailed :: Show RollbackFailed where + show a = genericShow a + +instance encodeJsonRollbackFailed :: EncodeJson RollbackFailed where + encodeJson = defer \_ -> case _ of + RollbackNoTip -> encodeJson { tag: "RollbackNoTip", contents: jsonNull } + TipMismatch { foundTip, targetPoint } -> encodeJson + { tag: "TipMismatch" + , foundTip: flip E.encode foundTip E.value + , targetPoint: flip E.encode targetPoint E.value + } + OldPointNotFound a -> E.encodeTagged "OldPointNotFound" a E.value + +instance decodeJsonRollbackFailed :: DecodeJson RollbackFailed where + decodeJson = defer \_ -> D.decode + $ D.sumType "RollbackFailed" + $ Map.fromFoldable + [ "RollbackNoTip" /\ pure RollbackNoTip + , "TipMismatch" /\ + ( TipMismatch <$> D.object "TipMismatch" + { foundTip: D.value :: _ Tip + , targetPoint: D.value :: _ Point + } + ) + , "OldPointNotFound" /\ D.content (OldPointNotFound <$> D.value) + ] + +derive instance genericRollbackFailed :: Generic RollbackFailed _ + +-------------------------------------------------------------------------------- + +_RollbackNoTip :: Prism' RollbackFailed Unit +_RollbackNoTip = prism' (const RollbackNoTip) case _ of + RollbackNoTip -> Just unit + _ -> Nothing + +_TipMismatch :: Prism' RollbackFailed { foundTip :: Tip, targetPoint :: Point } +_TipMismatch = prism' TipMismatch case _ of + (TipMismatch a) -> Just a + _ -> Nothing + +_OldPointNotFound :: Prism' RollbackFailed Point +_OldPointNotFound = prism' OldPointNotFound case _ of + (OldPointNotFound a) -> Just a + _ -> Nothing \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/Plutus/ChainIndex/ChainIndexLog.purs b/marlowe-dashboard-client/generated/Plutus/ChainIndex/ChainIndexLog.purs new file mode 100644 index 0000000000..b8a2c7072b --- /dev/null +++ b/marlowe-dashboard-client/generated/Plutus/ChainIndex/ChainIndexLog.purs @@ -0,0 +1,167 @@ +-- File auto generated by purescript-bridge! -- +module Plutus.ChainIndex.ChainIndexLog where + +import Prelude + +import Control.Lazy (defer) +import Control.Monad.Freer.Extras.Beam (BeamLog) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Bounded.Generic (genericBottom, genericTop) +import Data.Enum (class Enum) +import Data.Enum.Generic (genericPred, genericSucc) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Ledger.Tx.CardanoAPI (FromCardanoError) +import Plutus.ChainIndex.ChainIndexError (ChainIndexError) +import Plutus.ChainIndex.Types (Tip) +import Plutus.V1.Ledger.Tx (TxOut, TxOutRef) +import Plutus.V1.Ledger.TxId (TxId) +import Type.Proxy (Proxy(Proxy)) + +data ChainIndexLog + = InsertionSuccess Tip InsertUtxoPosition + | ConversionFailed FromCardanoError + | RollbackSuccess Tip + | Err ChainIndexError + | TxNotFound TxId + | TxOutNotFound TxOutRef + | TipIsGenesis + | NoDatumScriptAddr TxOut + | BeamLogItem BeamLog + +derive instance eqChainIndexLog :: Eq ChainIndexLog + +instance showChainIndexLog :: Show ChainIndexLog where + show a = genericShow a + +instance encodeJsonChainIndexLog :: EncodeJson ChainIndexLog where + encodeJson = defer \_ -> case _ of + InsertionSuccess a b -> E.encodeTagged "InsertionSuccess" (a /\ b) + (E.tuple (E.value >/\< E.value)) + ConversionFailed a -> E.encodeTagged "ConversionFailed" a E.value + RollbackSuccess a -> E.encodeTagged "RollbackSuccess" a E.value + Err a -> E.encodeTagged "Err" a E.value + TxNotFound a -> E.encodeTagged "TxNotFound" a E.value + TxOutNotFound a -> E.encodeTagged "TxOutNotFound" a E.value + TipIsGenesis -> encodeJson { tag: "TipIsGenesis", contents: jsonNull } + NoDatumScriptAddr a -> E.encodeTagged "NoDatumScriptAddr" a E.value + BeamLogItem a -> E.encodeTagged "BeamLogItem" a E.value + +instance decodeJsonChainIndexLog :: DecodeJson ChainIndexLog where + decodeJson = defer \_ -> D.decode + $ D.sumType "ChainIndexLog" + $ Map.fromFoldable + [ "InsertionSuccess" /\ D.content + (D.tuple $ InsertionSuccess D.value D.value) + , "ConversionFailed" /\ D.content (ConversionFailed <$> D.value) + , "RollbackSuccess" /\ D.content (RollbackSuccess <$> D.value) + , "Err" /\ D.content (Err <$> D.value) + , "TxNotFound" /\ D.content (TxNotFound <$> D.value) + , "TxOutNotFound" /\ D.content (TxOutNotFound <$> D.value) + , "TipIsGenesis" /\ pure TipIsGenesis + , "NoDatumScriptAddr" /\ D.content (NoDatumScriptAddr <$> D.value) + , "BeamLogItem" /\ D.content (BeamLogItem <$> D.value) + ] + +derive instance genericChainIndexLog :: Generic ChainIndexLog _ + +-------------------------------------------------------------------------------- + +_InsertionSuccess :: Prism' ChainIndexLog { a :: Tip, b :: InsertUtxoPosition } +_InsertionSuccess = prism' (\{ a, b } -> (InsertionSuccess a b)) case _ of + (InsertionSuccess a b) -> Just { a, b } + _ -> Nothing + +_ConversionFailed :: Prism' ChainIndexLog FromCardanoError +_ConversionFailed = prism' ConversionFailed case _ of + (ConversionFailed a) -> Just a + _ -> Nothing + +_RollbackSuccess :: Prism' ChainIndexLog Tip +_RollbackSuccess = prism' RollbackSuccess case _ of + (RollbackSuccess a) -> Just a + _ -> Nothing + +_Err :: Prism' ChainIndexLog ChainIndexError +_Err = prism' Err case _ of + (Err a) -> Just a + _ -> Nothing + +_TxNotFound :: Prism' ChainIndexLog TxId +_TxNotFound = prism' TxNotFound case _ of + (TxNotFound a) -> Just a + _ -> Nothing + +_TxOutNotFound :: Prism' ChainIndexLog TxOutRef +_TxOutNotFound = prism' TxOutNotFound case _ of + (TxOutNotFound a) -> Just a + _ -> Nothing + +_TipIsGenesis :: Prism' ChainIndexLog Unit +_TipIsGenesis = prism' (const TipIsGenesis) case _ of + TipIsGenesis -> Just unit + _ -> Nothing + +_NoDatumScriptAddr :: Prism' ChainIndexLog TxOut +_NoDatumScriptAddr = prism' NoDatumScriptAddr case _ of + (NoDatumScriptAddr a) -> Just a + _ -> Nothing + +_BeamLogItem :: Prism' ChainIndexLog BeamLog +_BeamLogItem = prism' BeamLogItem case _ of + (BeamLogItem a) -> Just a + _ -> Nothing + +-------------------------------------------------------------------------------- + +data InsertUtxoPosition + = InsertAtEnd + | InsertBeforeEnd + +derive instance eqInsertUtxoPosition :: Eq InsertUtxoPosition + +derive instance ordInsertUtxoPosition :: Ord InsertUtxoPosition + +instance showInsertUtxoPosition :: Show InsertUtxoPosition where + show a = genericShow a + +instance encodeJsonInsertUtxoPosition :: EncodeJson InsertUtxoPosition where + encodeJson = defer \_ -> E.encode E.enum + +instance decodeJsonInsertUtxoPosition :: DecodeJson InsertUtxoPosition where + decodeJson = defer \_ -> D.decode D.enum + +derive instance genericInsertUtxoPosition :: Generic InsertUtxoPosition _ + +instance enumInsertUtxoPosition :: Enum InsertUtxoPosition where + succ = genericSucc + pred = genericPred + +instance boundedInsertUtxoPosition :: Bounded InsertUtxoPosition where + bottom = genericBottom + top = genericTop + +-------------------------------------------------------------------------------- + +_InsertAtEnd :: Prism' InsertUtxoPosition Unit +_InsertAtEnd = prism' (const InsertAtEnd) case _ of + InsertAtEnd -> Just unit + _ -> Nothing + +_InsertBeforeEnd :: Prism' InsertUtxoPosition Unit +_InsertBeforeEnd = prism' (const InsertBeforeEnd) case _ of + InsertBeforeEnd -> Just unit + _ -> Nothing \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/Plutus/ChainIndex/Tx.purs b/marlowe-dashboard-client/generated/Plutus/ChainIndex/Tx.purs new file mode 100644 index 0000000000..dad282ad09 --- /dev/null +++ b/marlowe-dashboard-client/generated/Plutus/ChainIndex/Tx.purs @@ -0,0 +1,157 @@ +-- File auto generated by purescript-bridge! -- +module Plutus.ChainIndex.Tx where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map (Map) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.RawJson (RawJson) +import Data.Set (Set) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Plutus.V1.Ledger.Interval (Interval) +import Plutus.V1.Ledger.Scripts (DatumHash) +import Plutus.V1.Ledger.Slot (Slot) +import Plutus.V1.Ledger.Tx (TxIn, TxOut) +import Plutus.V1.Ledger.TxId (TxId) +import Type.Proxy (Proxy(Proxy)) + +newtype ChainIndexTx = ChainIndexTx + { _citxTxId :: TxId + , _citxInputs :: Set TxIn + , _citxOutputs :: ChainIndexTxOutputs + , _citxValidRange :: Interval Slot + , _citxData :: Map DatumHash String + , _citxRedeemers :: Map String String + , _citxScripts :: Map String String + , _citxCardanoTx :: Maybe RawJson + } + +derive instance eqChainIndexTx :: Eq ChainIndexTx + +instance showChainIndexTx :: Show ChainIndexTx where + show a = genericShow a + +instance encodeJsonChainIndexTx :: EncodeJson ChainIndexTx where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { _citxTxId: E.value :: _ TxId + , _citxInputs: E.value :: _ (Set TxIn) + , _citxOutputs: E.value :: _ ChainIndexTxOutputs + , _citxValidRange: E.value :: _ (Interval Slot) + , _citxData: (E.dictionary E.value E.value) :: _ (Map DatumHash String) + , _citxRedeemers: + (E.dictionary E.value E.value) :: _ (Map String String) + , _citxScripts: (E.dictionary E.value E.value) :: _ (Map String String) + , _citxCardanoTx: (E.maybe E.value) :: _ (Maybe RawJson) + } + ) + +instance decodeJsonChainIndexTx :: DecodeJson ChainIndexTx where + decodeJson = defer \_ -> D.decode $ + ( ChainIndexTx <$> D.record "ChainIndexTx" + { _citxTxId: D.value :: _ TxId + , _citxInputs: D.value :: _ (Set TxIn) + , _citxOutputs: D.value :: _ ChainIndexTxOutputs + , _citxValidRange: D.value :: _ (Interval Slot) + , _citxData: (D.dictionary D.value D.value) :: _ (Map DatumHash String) + , _citxRedeemers: + (D.dictionary D.value D.value) :: _ (Map String String) + , _citxScripts: (D.dictionary D.value D.value) :: _ (Map String String) + , _citxCardanoTx: (D.maybe D.value) :: _ (Maybe RawJson) + } + ) + +derive instance genericChainIndexTx :: Generic ChainIndexTx _ + +derive instance newtypeChainIndexTx :: Newtype ChainIndexTx _ + +-------------------------------------------------------------------------------- + +_ChainIndexTx :: Iso' ChainIndexTx + { _citxTxId :: TxId + , _citxInputs :: Set TxIn + , _citxOutputs :: ChainIndexTxOutputs + , _citxValidRange :: Interval Slot + , _citxData :: Map DatumHash String + , _citxRedeemers :: Map String String + , _citxScripts :: Map String String + , _citxCardanoTx :: Maybe RawJson + } +_ChainIndexTx = _Newtype + +citxTxId :: Lens' ChainIndexTx TxId +citxTxId = _Newtype <<< prop (Proxy :: _ "_citxTxId") + +citxInputs :: Lens' ChainIndexTx (Set TxIn) +citxInputs = _Newtype <<< prop (Proxy :: _ "_citxInputs") + +citxOutputs :: Lens' ChainIndexTx ChainIndexTxOutputs +citxOutputs = _Newtype <<< prop (Proxy :: _ "_citxOutputs") + +citxValidRange :: Lens' ChainIndexTx (Interval Slot) +citxValidRange = _Newtype <<< prop (Proxy :: _ "_citxValidRange") + +citxData :: Lens' ChainIndexTx (Map DatumHash String) +citxData = _Newtype <<< prop (Proxy :: _ "_citxData") + +citxRedeemers :: Lens' ChainIndexTx (Map String String) +citxRedeemers = _Newtype <<< prop (Proxy :: _ "_citxRedeemers") + +citxScripts :: Lens' ChainIndexTx (Map String String) +citxScripts = _Newtype <<< prop (Proxy :: _ "_citxScripts") + +citxCardanoTx :: Lens' ChainIndexTx (Maybe RawJson) +citxCardanoTx = _Newtype <<< prop (Proxy :: _ "_citxCardanoTx") + +-------------------------------------------------------------------------------- + +data ChainIndexTxOutputs + = InvalidTx + | ValidTx (Array TxOut) + +derive instance eqChainIndexTxOutputs :: Eq ChainIndexTxOutputs + +instance showChainIndexTxOutputs :: Show ChainIndexTxOutputs where + show a = genericShow a + +instance encodeJsonChainIndexTxOutputs :: EncodeJson ChainIndexTxOutputs where + encodeJson = defer \_ -> case _ of + InvalidTx -> encodeJson { tag: "InvalidTx", contents: jsonNull } + ValidTx a -> E.encodeTagged "ValidTx" a E.value + +instance decodeJsonChainIndexTxOutputs :: DecodeJson ChainIndexTxOutputs where + decodeJson = defer \_ -> D.decode + $ D.sumType "ChainIndexTxOutputs" + $ Map.fromFoldable + [ "InvalidTx" /\ pure InvalidTx + , "ValidTx" /\ D.content (ValidTx <$> D.value) + ] + +derive instance genericChainIndexTxOutputs :: Generic ChainIndexTxOutputs _ + +-------------------------------------------------------------------------------- + +_InvalidTx :: Prism' ChainIndexTxOutputs Unit +_InvalidTx = prism' (const InvalidTx) case _ of + InvalidTx -> Just unit + _ -> Nothing + +_ValidTx :: Prism' ChainIndexTxOutputs (Array TxOut) +_ValidTx = prism' ValidTx case _ of + (ValidTx a) -> Just a + _ -> Nothing \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/Plutus/ChainIndex/Types.purs b/marlowe-dashboard-client/generated/Plutus/ChainIndex/Types.purs new file mode 100644 index 0000000000..85565bb91d --- /dev/null +++ b/marlowe-dashboard-client/generated/Plutus/ChainIndex/Types.purs @@ -0,0 +1,336 @@ +-- File auto generated by purescript-bridge! -- +module Plutus.ChainIndex.Types where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.BigInt.Argonaut (BigInt) +import Data.Bounded.Generic (genericBottom, genericTop) +import Data.Enum (class Enum) +import Data.Enum.Generic (genericPred, genericSucc) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Ledger.Blockchain (BlockId) +import Plutus.V1.Ledger.Slot (Slot) +import Plutus.V1.Ledger.TxId (TxId) +import Type.Proxy (Proxy(Proxy)) + +data Tip + = TipAtGenesis + | Tip + { tipSlot :: Slot + , tipBlockId :: BlockId + , tipBlockNo :: BlockNumber + } + +derive instance eqTip :: Eq Tip + +instance showTip :: Show Tip where + show a = genericShow a + +instance encodeJsonTip :: EncodeJson Tip where + encodeJson = defer \_ -> case _ of + TipAtGenesis -> encodeJson { tag: "TipAtGenesis", contents: jsonNull } + Tip { tipSlot, tipBlockId, tipBlockNo } -> encodeJson + { tag: "Tip" + , tipSlot: flip E.encode tipSlot E.value + , tipBlockId: flip E.encode tipBlockId E.value + , tipBlockNo: flip E.encode tipBlockNo E.value + } + +instance decodeJsonTip :: DecodeJson Tip where + decodeJson = defer \_ -> D.decode + $ D.sumType "Tip" + $ Map.fromFoldable + [ "TipAtGenesis" /\ pure TipAtGenesis + , "Tip" /\ + ( Tip <$> D.object "Tip" + { tipSlot: D.value :: _ Slot + , tipBlockId: D.value :: _ BlockId + , tipBlockNo: D.value :: _ BlockNumber + } + ) + ] + +derive instance genericTip :: Generic Tip _ + +-------------------------------------------------------------------------------- + +_TipAtGenesis :: Prism' Tip Unit +_TipAtGenesis = prism' (const TipAtGenesis) case _ of + TipAtGenesis -> Just unit + _ -> Nothing + +_Tip :: Prism' Tip + { tipSlot :: Slot, tipBlockId :: BlockId, tipBlockNo :: BlockNumber } +_Tip = prism' Tip case _ of + (Tip a) -> Just a + _ -> Nothing + +-------------------------------------------------------------------------------- + +data Point + = PointAtGenesis + | Point + { pointSlot :: Slot + , pointBlockId :: BlockId + } + +derive instance eqPoint :: Eq Point + +instance showPoint :: Show Point where + show a = genericShow a + +instance encodeJsonPoint :: EncodeJson Point where + encodeJson = defer \_ -> case _ of + PointAtGenesis -> encodeJson { tag: "PointAtGenesis", contents: jsonNull } + Point { pointSlot, pointBlockId } -> encodeJson + { tag: "Point" + , pointSlot: flip E.encode pointSlot E.value + , pointBlockId: flip E.encode pointBlockId E.value + } + +instance decodeJsonPoint :: DecodeJson Point where + decodeJson = defer \_ -> D.decode + $ D.sumType "Point" + $ Map.fromFoldable + [ "PointAtGenesis" /\ pure PointAtGenesis + , "Point" /\ + ( Point <$> D.object "Point" + { pointSlot: D.value :: _ Slot + , pointBlockId: D.value :: _ BlockId + } + ) + ] + +derive instance genericPoint :: Generic Point _ + +-------------------------------------------------------------------------------- + +_PointAtGenesis :: Prism' Point Unit +_PointAtGenesis = prism' (const PointAtGenesis) case _ of + PointAtGenesis -> Just unit + _ -> Nothing + +_Point :: Prism' Point { pointSlot :: Slot, pointBlockId :: BlockId } +_Point = prism' Point case _ of + (Point a) -> Just a + _ -> Nothing + +-------------------------------------------------------------------------------- + +data TxValidity + = TxValid + | TxInvalid + | UnknownValidity + +derive instance eqTxValidity :: Eq TxValidity + +derive instance ordTxValidity :: Ord TxValidity + +instance showTxValidity :: Show TxValidity where + show a = genericShow a + +instance encodeJsonTxValidity :: EncodeJson TxValidity where + encodeJson = defer \_ -> E.encode E.enum + +instance decodeJsonTxValidity :: DecodeJson TxValidity where + decodeJson = defer \_ -> D.decode D.enum + +derive instance genericTxValidity :: Generic TxValidity _ + +instance enumTxValidity :: Enum TxValidity where + succ = genericSucc + pred = genericPred + +instance boundedTxValidity :: Bounded TxValidity where + bottom = genericBottom + top = genericTop + +-------------------------------------------------------------------------------- + +_TxValid :: Prism' TxValidity Unit +_TxValid = prism' (const TxValid) case _ of + TxValid -> Just unit + _ -> Nothing + +_TxInvalid :: Prism' TxValidity Unit +_TxInvalid = prism' (const TxInvalid) case _ of + TxInvalid -> Just unit + _ -> Nothing + +_UnknownValidity :: Prism' TxValidity Unit +_UnknownValidity = prism' (const UnknownValidity) case _ of + UnknownValidity -> Just unit + _ -> Nothing + +-------------------------------------------------------------------------------- + +data TxOutState + = Spent TxId + | Unspent + +derive instance eqTxOutState :: Eq TxOutState + +instance showTxOutState :: Show TxOutState where + show a = genericShow a + +instance encodeJsonTxOutState :: EncodeJson TxOutState where + encodeJson = defer \_ -> case _ of + Spent a -> E.encodeTagged "Spent" a E.value + Unspent -> encodeJson { tag: "Unspent", contents: jsonNull } + +instance decodeJsonTxOutState :: DecodeJson TxOutState where + decodeJson = defer \_ -> D.decode + $ D.sumType "TxOutState" + $ Map.fromFoldable + [ "Spent" /\ D.content (Spent <$> D.value) + , "Unspent" /\ pure Unspent + ] + +derive instance genericTxOutState :: Generic TxOutState _ + +-------------------------------------------------------------------------------- + +_Spent :: Prism' TxOutState TxId +_Spent = prism' Spent case _ of + (Spent a) -> Just a + _ -> Nothing + +_Unspent :: Prism' TxOutState Unit +_Unspent = prism' (const Unspent) case _ of + Unspent -> Just unit + _ -> Nothing + +-------------------------------------------------------------------------------- + +data RollbackState a + = Unknown + | TentativelyConfirmed Depth TxValidity a + | Committed TxValidity a + +derive instance eqRollbackState :: (Eq a) => Eq (RollbackState a) + +instance showRollbackState :: (Show a) => Show (RollbackState a) where + show a = genericShow a + +instance encodeJsonRollbackState :: + ( EncodeJson a + ) => + EncodeJson (RollbackState a) where + encodeJson = defer \_ -> case _ of + Unknown -> encodeJson { tag: "Unknown", contents: jsonNull } + TentativelyConfirmed a b c -> E.encodeTagged "TentativelyConfirmed" + (a /\ b /\ c) + (E.tuple (E.value >/\< E.value >/\< E.value)) + Committed a b -> E.encodeTagged "Committed" (a /\ b) + (E.tuple (E.value >/\< E.value)) + +instance decodeJsonRollbackState :: + ( DecodeJson a + ) => + DecodeJson (RollbackState a) where + decodeJson = defer \_ -> D.decode + $ D.sumType "RollbackState" + $ Map.fromFoldable + [ "Unknown" /\ pure Unknown + , "TentativelyConfirmed" /\ D.content + ( D.tuple $ TentativelyConfirmed D.value D.value + D.value + ) + , "Committed" /\ D.content + (D.tuple $ Committed D.value D.value) + ] + +derive instance genericRollbackState :: Generic (RollbackState a) _ + +-------------------------------------------------------------------------------- + +_Unknown :: forall a. Prism' (RollbackState a) Unit +_Unknown = prism' (const Unknown) case _ of + Unknown -> Just unit + _ -> Nothing + +_TentativelyConfirmed + :: forall a. Prism' (RollbackState a) { a :: Depth, b :: TxValidity, c :: a } +_TentativelyConfirmed = prism' (\{ a, b, c } -> (TentativelyConfirmed a b c)) + case _ of + (TentativelyConfirmed a b c) -> Just { a, b, c } + _ -> Nothing + +_Committed :: forall a. Prism' (RollbackState a) { a :: TxValidity, b :: a } +_Committed = prism' (\{ a, b } -> (Committed a b)) case _ of + (Committed a b) -> Just { a, b } + _ -> Nothing + +-------------------------------------------------------------------------------- + +newtype BlockNumber = BlockNumber { unBlockNumber :: BigInt } + +derive instance eqBlockNumber :: Eq BlockNumber + +instance showBlockNumber :: Show BlockNumber where + show a = genericShow a + +instance encodeJsonBlockNumber :: EncodeJson BlockNumber where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { unBlockNumber: E.value :: _ BigInt } + ) + +instance decodeJsonBlockNumber :: DecodeJson BlockNumber where + decodeJson = defer \_ -> D.decode $ + ( BlockNumber <$> D.record "BlockNumber" + { unBlockNumber: D.value :: _ BigInt } + ) + +derive instance genericBlockNumber :: Generic BlockNumber _ + +derive instance newtypeBlockNumber :: Newtype BlockNumber _ + +-------------------------------------------------------------------------------- + +_BlockNumber :: Iso' BlockNumber { unBlockNumber :: BigInt } +_BlockNumber = _Newtype + +-------------------------------------------------------------------------------- + +newtype Depth = Depth { unDepth :: Int } + +derive instance eqDepth :: Eq Depth + +instance showDepth :: Show Depth where + show a = genericShow a + +instance encodeJsonDepth :: EncodeJson Depth where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { unDepth: E.value :: _ Int } + ) + +instance decodeJsonDepth :: DecodeJson Depth where + decodeJson = defer \_ -> D.decode $ + (Depth <$> D.record "Depth" { unDepth: D.value :: _ Int }) + +derive instance genericDepth :: Generic Depth _ + +derive instance newtypeDepth :: Newtype Depth _ + +-------------------------------------------------------------------------------- + +_Depth :: Iso' Depth { unDepth :: Int } +_Depth = _Newtype \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/Plutus/Contract/Checkpoint.purs b/marlowe-dashboard-client/generated/Plutus/Contract/Checkpoint.purs new file mode 100644 index 0000000000..57b3bef016 --- /dev/null +++ b/marlowe-dashboard-client/generated/Plutus/Contract/Checkpoint.purs @@ -0,0 +1,45 @@ +-- File auto generated by purescript-bridge! -- +module Plutus.Contract.Checkpoint where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Type.Proxy (Proxy(Proxy)) + +newtype CheckpointError = JSONDecodeError String + +derive instance eqCheckpointError :: Eq CheckpointError + +instance showCheckpointError :: Show CheckpointError where + show a = genericShow a + +instance encodeJsonCheckpointError :: EncodeJson CheckpointError where + encodeJson = defer \_ -> E.encode $ unwrap >$< E.value + +instance decodeJsonCheckpointError :: DecodeJson CheckpointError where + decodeJson = defer \_ -> D.decode $ (JSONDecodeError <$> D.value) + +derive instance genericCheckpointError :: Generic CheckpointError _ + +derive instance newtypeCheckpointError :: Newtype CheckpointError _ + +-------------------------------------------------------------------------------- + +_JSONDecodeError :: Iso' CheckpointError String +_JSONDecodeError = _Newtype \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/Plutus/Contract/Effects.purs b/marlowe-dashboard-client/generated/Plutus/Contract/Effects.purs new file mode 100644 index 0000000000..cc397082a3 --- /dev/null +++ b/marlowe-dashboard-client/generated/Plutus/Contract/Effects.purs @@ -0,0 +1,744 @@ +-- File auto generated by purescript-bridge! -- +module Plutus.Contract.Effects where + +import Prelude + +import Control.Lazy (defer) +import Control.Monad.Freer.Extras.Pagination (Page, PageQuery) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Either (Either) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.List.Types (NonEmptyList) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.RawJson (RawJson) +import Data.Show.Generic (genericShow) +import Data.Tuple (Tuple) +import Data.Tuple.Nested ((/\)) +import Ledger.Constraints.OffChain (UnbalancedTx) +import Ledger.TimeSlot (SlotConversionError) +import Ledger.Tx (ChainIndexTxOut) +import Plutus.ChainIndex.Tx (ChainIndexTx) +import Plutus.ChainIndex.Types (RollbackState, Tip, TxOutState) +import Plutus.V1.Ledger.Address (Address) +import Plutus.V1.Ledger.Credential (Credential) +import Plutus.V1.Ledger.Crypto (PubKeyHash) +import Plutus.V1.Ledger.Interval (Interval) +import Plutus.V1.Ledger.Scripts + ( DatumHash + , MintingPolicy + , StakeValidator + , Validator + ) +import Plutus.V1.Ledger.Slot (Slot) +import Plutus.V1.Ledger.Time (POSIXTime) +import Plutus.V1.Ledger.Tx (Tx, TxOutRef) +import Plutus.V1.Ledger.TxId (TxId) +import Plutus.V1.Ledger.Value (AssetClass) +import Type.Proxy (Proxy(Proxy)) +import Wallet.Emulator.Error (WalletAPIError) +import Wallet.Types (ContractInstanceId, EndpointDescription, EndpointValue) + +data PABReq + = AwaitSlotReq Slot + | AwaitTimeReq POSIXTime + | AwaitUtxoSpentReq TxOutRef + | AwaitUtxoProducedReq Address + | AwaitTxStatusChangeReq TxId + | AwaitTxOutStatusChangeReq TxOutRef + | CurrentSlotReq + | CurrentTimeReq + | OwnContractInstanceIdReq + | OwnPublicKeyHashReq + | ChainIndexQueryReq ChainIndexQuery + | BalanceTxReq UnbalancedTx + | WriteBalancedTxReq (Either RawJson Tx) + | ExposeEndpointReq ActiveEndpoint + | PosixTimeRangeToContainedSlotRangeReq (Interval POSIXTime) + +derive instance eqPABReq :: Eq PABReq + +instance showPABReq :: Show PABReq where + show a = genericShow a + +instance encodeJsonPABReq :: EncodeJson PABReq where + encodeJson = defer \_ -> case _ of + AwaitSlotReq a -> E.encodeTagged "AwaitSlotReq" a E.value + AwaitTimeReq a -> E.encodeTagged "AwaitTimeReq" a E.value + AwaitUtxoSpentReq a -> E.encodeTagged "AwaitUtxoSpentReq" a E.value + AwaitUtxoProducedReq a -> E.encodeTagged "AwaitUtxoProducedReq" a E.value + AwaitTxStatusChangeReq a -> E.encodeTagged "AwaitTxStatusChangeReq" a + E.value + AwaitTxOutStatusChangeReq a -> E.encodeTagged "AwaitTxOutStatusChangeReq" a + E.value + CurrentSlotReq -> encodeJson { tag: "CurrentSlotReq", contents: jsonNull } + CurrentTimeReq -> encodeJson { tag: "CurrentTimeReq", contents: jsonNull } + OwnContractInstanceIdReq -> encodeJson + { tag: "OwnContractInstanceIdReq", contents: jsonNull } + OwnPublicKeyHashReq -> encodeJson + { tag: "OwnPublicKeyHashReq", contents: jsonNull } + ChainIndexQueryReq a -> E.encodeTagged "ChainIndexQueryReq" a E.value + BalanceTxReq a -> E.encodeTagged "BalanceTxReq" a E.value + WriteBalancedTxReq a -> E.encodeTagged "WriteBalancedTxReq" a + (E.either E.value E.value) + ExposeEndpointReq a -> E.encodeTagged "ExposeEndpointReq" a E.value + PosixTimeRangeToContainedSlotRangeReq a -> E.encodeTagged + "PosixTimeRangeToContainedSlotRangeReq" + a + E.value + +instance decodeJsonPABReq :: DecodeJson PABReq where + decodeJson = defer \_ -> D.decode + $ D.sumType "PABReq" + $ Map.fromFoldable + [ "AwaitSlotReq" /\ D.content (AwaitSlotReq <$> D.value) + , "AwaitTimeReq" /\ D.content (AwaitTimeReq <$> D.value) + , "AwaitUtxoSpentReq" /\ D.content (AwaitUtxoSpentReq <$> D.value) + , "AwaitUtxoProducedReq" /\ D.content (AwaitUtxoProducedReq <$> D.value) + , "AwaitTxStatusChangeReq" /\ D.content + (AwaitTxStatusChangeReq <$> D.value) + , "AwaitTxOutStatusChangeReq" /\ D.content + (AwaitTxOutStatusChangeReq <$> D.value) + , "CurrentSlotReq" /\ pure CurrentSlotReq + , "CurrentTimeReq" /\ pure CurrentTimeReq + , "OwnContractInstanceIdReq" /\ pure OwnContractInstanceIdReq + , "OwnPublicKeyHashReq" /\ pure OwnPublicKeyHashReq + , "ChainIndexQueryReq" /\ D.content (ChainIndexQueryReq <$> D.value) + , "BalanceTxReq" /\ D.content (BalanceTxReq <$> D.value) + , "WriteBalancedTxReq" /\ D.content + (WriteBalancedTxReq <$> (D.either D.value D.value)) + , "ExposeEndpointReq" /\ D.content (ExposeEndpointReq <$> D.value) + , "PosixTimeRangeToContainedSlotRangeReq" /\ D.content + (PosixTimeRangeToContainedSlotRangeReq <$> D.value) + ] + +derive instance genericPABReq :: Generic PABReq _ + +-------------------------------------------------------------------------------- + +_AwaitSlotReq :: Prism' PABReq Slot +_AwaitSlotReq = prism' AwaitSlotReq case _ of + (AwaitSlotReq a) -> Just a + _ -> Nothing + +_AwaitTimeReq :: Prism' PABReq POSIXTime +_AwaitTimeReq = prism' AwaitTimeReq case _ of + (AwaitTimeReq a) -> Just a + _ -> Nothing + +_AwaitUtxoSpentReq :: Prism' PABReq TxOutRef +_AwaitUtxoSpentReq = prism' AwaitUtxoSpentReq case _ of + (AwaitUtxoSpentReq a) -> Just a + _ -> Nothing + +_AwaitUtxoProducedReq :: Prism' PABReq Address +_AwaitUtxoProducedReq = prism' AwaitUtxoProducedReq case _ of + (AwaitUtxoProducedReq a) -> Just a + _ -> Nothing + +_AwaitTxStatusChangeReq :: Prism' PABReq TxId +_AwaitTxStatusChangeReq = prism' AwaitTxStatusChangeReq case _ of + (AwaitTxStatusChangeReq a) -> Just a + _ -> Nothing + +_AwaitTxOutStatusChangeReq :: Prism' PABReq TxOutRef +_AwaitTxOutStatusChangeReq = prism' AwaitTxOutStatusChangeReq case _ of + (AwaitTxOutStatusChangeReq a) -> Just a + _ -> Nothing + +_CurrentSlotReq :: Prism' PABReq Unit +_CurrentSlotReq = prism' (const CurrentSlotReq) case _ of + CurrentSlotReq -> Just unit + _ -> Nothing + +_CurrentTimeReq :: Prism' PABReq Unit +_CurrentTimeReq = prism' (const CurrentTimeReq) case _ of + CurrentTimeReq -> Just unit + _ -> Nothing + +_OwnContractInstanceIdReq :: Prism' PABReq Unit +_OwnContractInstanceIdReq = prism' (const OwnContractInstanceIdReq) case _ of + OwnContractInstanceIdReq -> Just unit + _ -> Nothing + +_OwnPublicKeyHashReq :: Prism' PABReq Unit +_OwnPublicKeyHashReq = prism' (const OwnPublicKeyHashReq) case _ of + OwnPublicKeyHashReq -> Just unit + _ -> Nothing + +_ChainIndexQueryReq :: Prism' PABReq ChainIndexQuery +_ChainIndexQueryReq = prism' ChainIndexQueryReq case _ of + (ChainIndexQueryReq a) -> Just a + _ -> Nothing + +_BalanceTxReq :: Prism' PABReq UnbalancedTx +_BalanceTxReq = prism' BalanceTxReq case _ of + (BalanceTxReq a) -> Just a + _ -> Nothing + +_WriteBalancedTxReq :: Prism' PABReq (Either RawJson Tx) +_WriteBalancedTxReq = prism' WriteBalancedTxReq case _ of + (WriteBalancedTxReq a) -> Just a + _ -> Nothing + +_ExposeEndpointReq :: Prism' PABReq ActiveEndpoint +_ExposeEndpointReq = prism' ExposeEndpointReq case _ of + (ExposeEndpointReq a) -> Just a + _ -> Nothing + +_PosixTimeRangeToContainedSlotRangeReq :: Prism' PABReq (Interval POSIXTime) +_PosixTimeRangeToContainedSlotRangeReq = prism' + PosixTimeRangeToContainedSlotRangeReq + case _ of + (PosixTimeRangeToContainedSlotRangeReq a) -> Just a + _ -> Nothing + +-------------------------------------------------------------------------------- + +data PABResp + = AwaitSlotResp Slot + | AwaitTimeResp POSIXTime + | AwaitUtxoSpentResp ChainIndexTx + | AwaitUtxoProducedResp (NonEmptyList ChainIndexTx) + | AwaitTxStatusChangeResp TxId (RollbackState Unit) + | AwaitTxOutStatusChangeResp TxOutRef (RollbackState TxOutState) + | CurrentSlotResp Slot + | CurrentTimeResp POSIXTime + | OwnContractInstanceIdResp ContractInstanceId + | OwnPublicKeyHashResp PubKeyHash + | ChainIndexQueryResp ChainIndexResponse + | BalanceTxResp BalanceTxResponse + | WriteBalancedTxResp WriteBalancedTxResponse + | ExposeEndpointResp EndpointDescription (EndpointValue RawJson) + | PosixTimeRangeToContainedSlotRangeResp + (Either SlotConversionError (Interval Slot)) + +derive instance eqPABResp :: Eq PABResp + +instance showPABResp :: Show PABResp where + show a = genericShow a + +instance encodeJsonPABResp :: EncodeJson PABResp where + encodeJson = defer \_ -> case _ of + AwaitSlotResp a -> E.encodeTagged "AwaitSlotResp" a E.value + AwaitTimeResp a -> E.encodeTagged "AwaitTimeResp" a E.value + AwaitUtxoSpentResp a -> E.encodeTagged "AwaitUtxoSpentResp" a E.value + AwaitUtxoProducedResp a -> E.encodeTagged "AwaitUtxoProducedResp" a E.value + AwaitTxStatusChangeResp a b -> E.encodeTagged "AwaitTxStatusChangeResp" + (a /\ b) + (E.tuple (E.value >/\< E.value)) + AwaitTxOutStatusChangeResp a b -> E.encodeTagged + "AwaitTxOutStatusChangeResp" + (a /\ b) + (E.tuple (E.value >/\< E.value)) + CurrentSlotResp a -> E.encodeTagged "CurrentSlotResp" a E.value + CurrentTimeResp a -> E.encodeTagged "CurrentTimeResp" a E.value + OwnContractInstanceIdResp a -> E.encodeTagged "OwnContractInstanceIdResp" a + E.value + OwnPublicKeyHashResp a -> E.encodeTagged "OwnPublicKeyHashResp" a E.value + ChainIndexQueryResp a -> E.encodeTagged "ChainIndexQueryResp" a E.value + BalanceTxResp a -> E.encodeTagged "BalanceTxResp" a E.value + WriteBalancedTxResp a -> E.encodeTagged "WriteBalancedTxResp" a E.value + ExposeEndpointResp a b -> E.encodeTagged "ExposeEndpointResp" (a /\ b) + (E.tuple (E.value >/\< E.value)) + PosixTimeRangeToContainedSlotRangeResp a -> E.encodeTagged + "PosixTimeRangeToContainedSlotRangeResp" + a + (E.either E.value E.value) + +instance decodeJsonPABResp :: DecodeJson PABResp where + decodeJson = defer \_ -> D.decode + $ D.sumType "PABResp" + $ Map.fromFoldable + [ "AwaitSlotResp" /\ D.content (AwaitSlotResp <$> D.value) + , "AwaitTimeResp" /\ D.content (AwaitTimeResp <$> D.value) + , "AwaitUtxoSpentResp" /\ D.content (AwaitUtxoSpentResp <$> D.value) + , "AwaitUtxoProducedResp" /\ D.content + (AwaitUtxoProducedResp <$> D.value) + , "AwaitTxStatusChangeResp" /\ D.content + (D.tuple $ AwaitTxStatusChangeResp D.value D.value) + , "AwaitTxOutStatusChangeResp" /\ D.content + (D.tuple $ AwaitTxOutStatusChangeResp D.value D.value) + , "CurrentSlotResp" /\ D.content (CurrentSlotResp <$> D.value) + , "CurrentTimeResp" /\ D.content (CurrentTimeResp <$> D.value) + , "OwnContractInstanceIdResp" /\ D.content + (OwnContractInstanceIdResp <$> D.value) + , "OwnPublicKeyHashResp" /\ D.content (OwnPublicKeyHashResp <$> D.value) + , "ChainIndexQueryResp" /\ D.content (ChainIndexQueryResp <$> D.value) + , "BalanceTxResp" /\ D.content (BalanceTxResp <$> D.value) + , "WriteBalancedTxResp" /\ D.content (WriteBalancedTxResp <$> D.value) + , "ExposeEndpointResp" /\ D.content + (D.tuple $ ExposeEndpointResp D.value D.value) + , "PosixTimeRangeToContainedSlotRangeResp" /\ D.content + ( PosixTimeRangeToContainedSlotRangeResp <$> + (D.either D.value D.value) + ) + ] + +derive instance genericPABResp :: Generic PABResp _ + +-------------------------------------------------------------------------------- + +_AwaitSlotResp :: Prism' PABResp Slot +_AwaitSlotResp = prism' AwaitSlotResp case _ of + (AwaitSlotResp a) -> Just a + _ -> Nothing + +_AwaitTimeResp :: Prism' PABResp POSIXTime +_AwaitTimeResp = prism' AwaitTimeResp case _ of + (AwaitTimeResp a) -> Just a + _ -> Nothing + +_AwaitUtxoSpentResp :: Prism' PABResp ChainIndexTx +_AwaitUtxoSpentResp = prism' AwaitUtxoSpentResp case _ of + (AwaitUtxoSpentResp a) -> Just a + _ -> Nothing + +_AwaitUtxoProducedResp :: Prism' PABResp (NonEmptyList ChainIndexTx) +_AwaitUtxoProducedResp = prism' AwaitUtxoProducedResp case _ of + (AwaitUtxoProducedResp a) -> Just a + _ -> Nothing + +_AwaitTxStatusChangeResp :: Prism' PABResp + { a :: TxId, b :: RollbackState Unit } +_AwaitTxStatusChangeResp = prism' (\{ a, b } -> (AwaitTxStatusChangeResp a b)) + case _ of + (AwaitTxStatusChangeResp a b) -> Just { a, b } + _ -> Nothing + +_AwaitTxOutStatusChangeResp :: Prism' PABResp + { a :: TxOutRef, b :: RollbackState TxOutState } +_AwaitTxOutStatusChangeResp = prism' + (\{ a, b } -> (AwaitTxOutStatusChangeResp a b)) + case _ of + (AwaitTxOutStatusChangeResp a b) -> Just { a, b } + _ -> Nothing + +_CurrentSlotResp :: Prism' PABResp Slot +_CurrentSlotResp = prism' CurrentSlotResp case _ of + (CurrentSlotResp a) -> Just a + _ -> Nothing + +_CurrentTimeResp :: Prism' PABResp POSIXTime +_CurrentTimeResp = prism' CurrentTimeResp case _ of + (CurrentTimeResp a) -> Just a + _ -> Nothing + +_OwnContractInstanceIdResp :: Prism' PABResp ContractInstanceId +_OwnContractInstanceIdResp = prism' OwnContractInstanceIdResp case _ of + (OwnContractInstanceIdResp a) -> Just a + _ -> Nothing + +_OwnPublicKeyHashResp :: Prism' PABResp PubKeyHash +_OwnPublicKeyHashResp = prism' OwnPublicKeyHashResp case _ of + (OwnPublicKeyHashResp a) -> Just a + _ -> Nothing + +_ChainIndexQueryResp :: Prism' PABResp ChainIndexResponse +_ChainIndexQueryResp = prism' ChainIndexQueryResp case _ of + (ChainIndexQueryResp a) -> Just a + _ -> Nothing + +_BalanceTxResp :: Prism' PABResp BalanceTxResponse +_BalanceTxResp = prism' BalanceTxResp case _ of + (BalanceTxResp a) -> Just a + _ -> Nothing + +_WriteBalancedTxResp :: Prism' PABResp WriteBalancedTxResponse +_WriteBalancedTxResp = prism' WriteBalancedTxResp case _ of + (WriteBalancedTxResp a) -> Just a + _ -> Nothing + +_ExposeEndpointResp :: Prism' PABResp + { a :: EndpointDescription, b :: EndpointValue RawJson } +_ExposeEndpointResp = prism' (\{ a, b } -> (ExposeEndpointResp a b)) case _ of + (ExposeEndpointResp a b) -> Just { a, b } + _ -> Nothing + +_PosixTimeRangeToContainedSlotRangeResp :: Prism' PABResp + (Either SlotConversionError (Interval Slot)) +_PosixTimeRangeToContainedSlotRangeResp = prism' + PosixTimeRangeToContainedSlotRangeResp + case _ of + (PosixTimeRangeToContainedSlotRangeResp a) -> Just a + _ -> Nothing + +-------------------------------------------------------------------------------- + +data ChainIndexQuery + = DatumFromHash DatumHash + | ValidatorFromHash String + | MintingPolicyFromHash String + | StakeValidatorFromHash String + | RedeemerFromHash String + | TxOutFromRef TxOutRef + | TxFromTxId TxId + | UtxoSetMembership TxOutRef + | UtxoSetAtAddress (PageQuery TxOutRef) Credential + | UtxoSetWithCurrency (PageQuery TxOutRef) AssetClass + | GetTip + +derive instance eqChainIndexQuery :: Eq ChainIndexQuery + +instance showChainIndexQuery :: Show ChainIndexQuery where + show a = genericShow a + +instance encodeJsonChainIndexQuery :: EncodeJson ChainIndexQuery where + encodeJson = defer \_ -> case _ of + DatumFromHash a -> E.encodeTagged "DatumFromHash" a E.value + ValidatorFromHash a -> E.encodeTagged "ValidatorFromHash" a E.value + MintingPolicyFromHash a -> E.encodeTagged "MintingPolicyFromHash" a E.value + StakeValidatorFromHash a -> E.encodeTagged "StakeValidatorFromHash" a + E.value + RedeemerFromHash a -> E.encodeTagged "RedeemerFromHash" a E.value + TxOutFromRef a -> E.encodeTagged "TxOutFromRef" a E.value + TxFromTxId a -> E.encodeTagged "TxFromTxId" a E.value + UtxoSetMembership a -> E.encodeTagged "UtxoSetMembership" a E.value + UtxoSetAtAddress a b -> E.encodeTagged "UtxoSetAtAddress" (a /\ b) + (E.tuple (E.value >/\< E.value)) + UtxoSetWithCurrency a b -> E.encodeTagged "UtxoSetWithCurrency" (a /\ b) + (E.tuple (E.value >/\< E.value)) + GetTip -> encodeJson { tag: "GetTip", contents: jsonNull } + +instance decodeJsonChainIndexQuery :: DecodeJson ChainIndexQuery where + decodeJson = defer \_ -> D.decode + $ D.sumType "ChainIndexQuery" + $ Map.fromFoldable + [ "DatumFromHash" /\ D.content (DatumFromHash <$> D.value) + , "ValidatorFromHash" /\ D.content (ValidatorFromHash <$> D.value) + , "MintingPolicyFromHash" /\ D.content + (MintingPolicyFromHash <$> D.value) + , "StakeValidatorFromHash" /\ D.content + (StakeValidatorFromHash <$> D.value) + , "RedeemerFromHash" /\ D.content (RedeemerFromHash <$> D.value) + , "TxOutFromRef" /\ D.content (TxOutFromRef <$> D.value) + , "TxFromTxId" /\ D.content (TxFromTxId <$> D.value) + , "UtxoSetMembership" /\ D.content (UtxoSetMembership <$> D.value) + , "UtxoSetAtAddress" /\ D.content + (D.tuple $ UtxoSetAtAddress D.value D.value) + , "UtxoSetWithCurrency" /\ D.content + (D.tuple $ UtxoSetWithCurrency D.value D.value) + , "GetTip" /\ pure GetTip + ] + +derive instance genericChainIndexQuery :: Generic ChainIndexQuery _ + +-------------------------------------------------------------------------------- + +_DatumFromHash :: Prism' ChainIndexQuery DatumHash +_DatumFromHash = prism' DatumFromHash case _ of + (DatumFromHash a) -> Just a + _ -> Nothing + +_ValidatorFromHash :: Prism' ChainIndexQuery String +_ValidatorFromHash = prism' ValidatorFromHash case _ of + (ValidatorFromHash a) -> Just a + _ -> Nothing + +_MintingPolicyFromHash :: Prism' ChainIndexQuery String +_MintingPolicyFromHash = prism' MintingPolicyFromHash case _ of + (MintingPolicyFromHash a) -> Just a + _ -> Nothing + +_StakeValidatorFromHash :: Prism' ChainIndexQuery String +_StakeValidatorFromHash = prism' StakeValidatorFromHash case _ of + (StakeValidatorFromHash a) -> Just a + _ -> Nothing + +_RedeemerFromHash :: Prism' ChainIndexQuery String +_RedeemerFromHash = prism' RedeemerFromHash case _ of + (RedeemerFromHash a) -> Just a + _ -> Nothing + +_TxOutFromRef :: Prism' ChainIndexQuery TxOutRef +_TxOutFromRef = prism' TxOutFromRef case _ of + (TxOutFromRef a) -> Just a + _ -> Nothing + +_TxFromTxId :: Prism' ChainIndexQuery TxId +_TxFromTxId = prism' TxFromTxId case _ of + (TxFromTxId a) -> Just a + _ -> Nothing + +_UtxoSetMembership :: Prism' ChainIndexQuery TxOutRef +_UtxoSetMembership = prism' UtxoSetMembership case _ of + (UtxoSetMembership a) -> Just a + _ -> Nothing + +_UtxoSetAtAddress :: Prism' ChainIndexQuery + { a :: PageQuery TxOutRef, b :: Credential } +_UtxoSetAtAddress = prism' (\{ a, b } -> (UtxoSetAtAddress a b)) case _ of + (UtxoSetAtAddress a b) -> Just { a, b } + _ -> Nothing + +_UtxoSetWithCurrency :: Prism' ChainIndexQuery + { a :: PageQuery TxOutRef, b :: AssetClass } +_UtxoSetWithCurrency = prism' (\{ a, b } -> (UtxoSetWithCurrency a b)) case _ of + (UtxoSetWithCurrency a b) -> Just { a, b } + _ -> Nothing + +_GetTip :: Prism' ChainIndexQuery Unit +_GetTip = prism' (const GetTip) case _ of + GetTip -> Just unit + _ -> Nothing + +-------------------------------------------------------------------------------- + +data ChainIndexResponse + = DatumHashResponse (Maybe String) + | ValidatorHashResponse (Maybe Validator) + | MintingPolicyHashResponse (Maybe MintingPolicy) + | StakeValidatorHashResponse (Maybe StakeValidator) + | TxOutRefResponse (Maybe ChainIndexTxOut) + | RedeemerHashResponse (Maybe String) + | TxIdResponse (Maybe ChainIndexTx) + | UtxoSetMembershipResponse (Tuple Tip Boolean) + | UtxoSetAtResponse (Tuple Tip (Page TxOutRef)) + | UtxoSetWithCurrencyResponse (Tuple Tip (Page TxOutRef)) + | GetTipResponse Tip + +derive instance eqChainIndexResponse :: Eq ChainIndexResponse + +instance showChainIndexResponse :: Show ChainIndexResponse where + show a = genericShow a + +instance encodeJsonChainIndexResponse :: EncodeJson ChainIndexResponse where + encodeJson = defer \_ -> case _ of + DatumHashResponse a -> E.encodeTagged "DatumHashResponse" a + (E.maybe E.value) + ValidatorHashResponse a -> E.encodeTagged "ValidatorHashResponse" a + (E.maybe E.value) + MintingPolicyHashResponse a -> E.encodeTagged "MintingPolicyHashResponse" a + (E.maybe E.value) + StakeValidatorHashResponse a -> E.encodeTagged "StakeValidatorHashResponse" + a + (E.maybe E.value) + TxOutRefResponse a -> E.encodeTagged "TxOutRefResponse" a (E.maybe E.value) + RedeemerHashResponse a -> E.encodeTagged "RedeemerHashResponse" a + (E.maybe E.value) + TxIdResponse a -> E.encodeTagged "TxIdResponse" a (E.maybe E.value) + UtxoSetMembershipResponse a -> E.encodeTagged "UtxoSetMembershipResponse" a + (E.tuple (E.value >/\< E.value)) + UtxoSetAtResponse a -> E.encodeTagged "UtxoSetAtResponse" a + (E.tuple (E.value >/\< E.value)) + UtxoSetWithCurrencyResponse a -> E.encodeTagged + "UtxoSetWithCurrencyResponse" + a + (E.tuple (E.value >/\< E.value)) + GetTipResponse a -> E.encodeTagged "GetTipResponse" a E.value + +instance decodeJsonChainIndexResponse :: DecodeJson ChainIndexResponse where + decodeJson = defer \_ -> D.decode + $ D.sumType "ChainIndexResponse" + $ Map.fromFoldable + [ "DatumHashResponse" /\ D.content + (DatumHashResponse <$> (D.maybe D.value)) + , "ValidatorHashResponse" /\ D.content + (ValidatorHashResponse <$> (D.maybe D.value)) + , "MintingPolicyHashResponse" /\ D.content + (MintingPolicyHashResponse <$> (D.maybe D.value)) + , "StakeValidatorHashResponse" /\ D.content + (StakeValidatorHashResponse <$> (D.maybe D.value)) + , "TxOutRefResponse" /\ D.content + (TxOutRefResponse <$> (D.maybe D.value)) + , "RedeemerHashResponse" /\ D.content + (RedeemerHashResponse <$> (D.maybe D.value)) + , "TxIdResponse" /\ D.content (TxIdResponse <$> (D.maybe D.value)) + , "UtxoSetMembershipResponse" /\ D.content + (UtxoSetMembershipResponse <$> (D.tuple (D.value D.value))) + , "UtxoSetAtResponse" /\ D.content + (UtxoSetAtResponse <$> (D.tuple (D.value D.value))) + , "UtxoSetWithCurrencyResponse" /\ D.content + (UtxoSetWithCurrencyResponse <$> (D.tuple (D.value D.value))) + , "GetTipResponse" /\ D.content (GetTipResponse <$> D.value) + ] + +derive instance genericChainIndexResponse :: Generic ChainIndexResponse _ + +-------------------------------------------------------------------------------- + +_DatumHashResponse :: Prism' ChainIndexResponse (Maybe String) +_DatumHashResponse = prism' DatumHashResponse case _ of + (DatumHashResponse a) -> Just a + _ -> Nothing + +_ValidatorHashResponse :: Prism' ChainIndexResponse (Maybe Validator) +_ValidatorHashResponse = prism' ValidatorHashResponse case _ of + (ValidatorHashResponse a) -> Just a + _ -> Nothing + +_MintingPolicyHashResponse :: Prism' ChainIndexResponse (Maybe MintingPolicy) +_MintingPolicyHashResponse = prism' MintingPolicyHashResponse case _ of + (MintingPolicyHashResponse a) -> Just a + _ -> Nothing + +_StakeValidatorHashResponse :: Prism' ChainIndexResponse (Maybe StakeValidator) +_StakeValidatorHashResponse = prism' StakeValidatorHashResponse case _ of + (StakeValidatorHashResponse a) -> Just a + _ -> Nothing + +_TxOutRefResponse :: Prism' ChainIndexResponse (Maybe ChainIndexTxOut) +_TxOutRefResponse = prism' TxOutRefResponse case _ of + (TxOutRefResponse a) -> Just a + _ -> Nothing + +_RedeemerHashResponse :: Prism' ChainIndexResponse (Maybe String) +_RedeemerHashResponse = prism' RedeemerHashResponse case _ of + (RedeemerHashResponse a) -> Just a + _ -> Nothing + +_TxIdResponse :: Prism' ChainIndexResponse (Maybe ChainIndexTx) +_TxIdResponse = prism' TxIdResponse case _ of + (TxIdResponse a) -> Just a + _ -> Nothing + +_UtxoSetMembershipResponse :: Prism' ChainIndexResponse (Tuple Tip Boolean) +_UtxoSetMembershipResponse = prism' UtxoSetMembershipResponse case _ of + (UtxoSetMembershipResponse a) -> Just a + _ -> Nothing + +_UtxoSetAtResponse :: Prism' ChainIndexResponse (Tuple Tip (Page TxOutRef)) +_UtxoSetAtResponse = prism' UtxoSetAtResponse case _ of + (UtxoSetAtResponse a) -> Just a + _ -> Nothing + +_UtxoSetWithCurrencyResponse :: Prism' ChainIndexResponse + (Tuple Tip (Page TxOutRef)) +_UtxoSetWithCurrencyResponse = prism' UtxoSetWithCurrencyResponse case _ of + (UtxoSetWithCurrencyResponse a) -> Just a + _ -> Nothing + +_GetTipResponse :: Prism' ChainIndexResponse Tip +_GetTipResponse = prism' GetTipResponse case _ of + (GetTipResponse a) -> Just a + _ -> Nothing + +-------------------------------------------------------------------------------- + +data BalanceTxResponse + = BalanceTxFailed WalletAPIError + | BalanceTxSuccess (Either RawJson Tx) + +derive instance eqBalanceTxResponse :: Eq BalanceTxResponse + +instance showBalanceTxResponse :: Show BalanceTxResponse where + show a = genericShow a + +instance encodeJsonBalanceTxResponse :: EncodeJson BalanceTxResponse where + encodeJson = defer \_ -> case _ of + BalanceTxFailed a -> E.encodeTagged "BalanceTxFailed" a E.value + BalanceTxSuccess a -> E.encodeTagged "BalanceTxSuccess" a + (E.either E.value E.value) + +instance decodeJsonBalanceTxResponse :: DecodeJson BalanceTxResponse where + decodeJson = defer \_ -> D.decode + $ D.sumType "BalanceTxResponse" + $ Map.fromFoldable + [ "BalanceTxFailed" /\ D.content (BalanceTxFailed <$> D.value) + , "BalanceTxSuccess" /\ D.content + (BalanceTxSuccess <$> (D.either D.value D.value)) + ] + +derive instance genericBalanceTxResponse :: Generic BalanceTxResponse _ + +-------------------------------------------------------------------------------- + +_BalanceTxFailed :: Prism' BalanceTxResponse WalletAPIError +_BalanceTxFailed = prism' BalanceTxFailed case _ of + (BalanceTxFailed a) -> Just a + _ -> Nothing + +_BalanceTxSuccess :: Prism' BalanceTxResponse (Either RawJson Tx) +_BalanceTxSuccess = prism' BalanceTxSuccess case _ of + (BalanceTxSuccess a) -> Just a + _ -> Nothing + +-------------------------------------------------------------------------------- + +data WriteBalancedTxResponse + = WriteBalancedTxFailed WalletAPIError + | WriteBalancedTxSuccess (Either RawJson Tx) + +derive instance eqWriteBalancedTxResponse :: Eq WriteBalancedTxResponse + +instance showWriteBalancedTxResponse :: Show WriteBalancedTxResponse where + show a = genericShow a + +instance encodeJsonWriteBalancedTxResponse :: EncodeJson WriteBalancedTxResponse where + encodeJson = defer \_ -> case _ of + WriteBalancedTxFailed a -> E.encodeTagged "WriteBalancedTxFailed" a E.value + WriteBalancedTxSuccess a -> E.encodeTagged "WriteBalancedTxSuccess" a + (E.either E.value E.value) + +instance decodeJsonWriteBalancedTxResponse :: DecodeJson WriteBalancedTxResponse where + decodeJson = defer \_ -> D.decode + $ D.sumType "WriteBalancedTxResponse" + $ Map.fromFoldable + [ "WriteBalancedTxFailed" /\ D.content + (WriteBalancedTxFailed <$> D.value) + , "WriteBalancedTxSuccess" /\ D.content + (WriteBalancedTxSuccess <$> (D.either D.value D.value)) + ] + +derive instance genericWriteBalancedTxResponse :: + Generic WriteBalancedTxResponse _ + +-------------------------------------------------------------------------------- + +_WriteBalancedTxFailed :: Prism' WriteBalancedTxResponse WalletAPIError +_WriteBalancedTxFailed = prism' WriteBalancedTxFailed case _ of + (WriteBalancedTxFailed a) -> Just a + _ -> Nothing + +_WriteBalancedTxSuccess :: Prism' WriteBalancedTxResponse (Either RawJson Tx) +_WriteBalancedTxSuccess = prism' WriteBalancedTxSuccess case _ of + (WriteBalancedTxSuccess a) -> Just a + _ -> Nothing + +-------------------------------------------------------------------------------- + +newtype ActiveEndpoint = ActiveEndpoint + { aeDescription :: EndpointDescription + , aeMetadata :: Maybe RawJson + } + +derive instance eqActiveEndpoint :: Eq ActiveEndpoint + +instance showActiveEndpoint :: Show ActiveEndpoint where + show a = genericShow a + +instance encodeJsonActiveEndpoint :: EncodeJson ActiveEndpoint where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { aeDescription: E.value :: _ EndpointDescription + , aeMetadata: (E.maybe E.value) :: _ (Maybe RawJson) + } + ) + +instance decodeJsonActiveEndpoint :: DecodeJson ActiveEndpoint where + decodeJson = defer \_ -> D.decode $ + ( ActiveEndpoint <$> D.record "ActiveEndpoint" + { aeDescription: D.value :: _ EndpointDescription + , aeMetadata: (D.maybe D.value) :: _ (Maybe RawJson) + } + ) + +derive instance genericActiveEndpoint :: Generic ActiveEndpoint _ + +derive instance newtypeActiveEndpoint :: Newtype ActiveEndpoint _ + +-------------------------------------------------------------------------------- + +_ActiveEndpoint :: Iso' ActiveEndpoint + { aeDescription :: EndpointDescription, aeMetadata :: Maybe RawJson } +_ActiveEndpoint = _Newtype \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/Plutus/Contract/Resumable.purs b/marlowe-dashboard-client/generated/Plutus/Contract/Resumable.purs new file mode 100644 index 0000000000..43a2f7cbcc --- /dev/null +++ b/marlowe-dashboard-client/generated/Plutus/Contract/Resumable.purs @@ -0,0 +1,158 @@ +-- File auto generated by purescript-bridge! -- +module Plutus.Contract.Resumable where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Type.Proxy (Proxy(Proxy)) + +newtype Request a = Request + { rqID :: RequestID + , itID :: IterationID + , rqRequest :: a + } + +derive instance eqRequest :: (Eq a) => Eq (Request a) + +instance showRequest :: (Show a) => Show (Request a) where + show a = genericShow a + +instance encodeJsonRequest :: (EncodeJson a) => EncodeJson (Request a) where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { rqID: E.value :: _ RequestID + , itID: E.value :: _ IterationID + , rqRequest: E.value :: _ a + } + ) + +instance decodeJsonRequest :: (DecodeJson a) => DecodeJson (Request a) where + decodeJson = defer \_ -> D.decode $ + ( Request <$> D.record "Request" + { rqID: D.value :: _ RequestID + , itID: D.value :: _ IterationID + , rqRequest: D.value :: _ a + } + ) + +derive instance genericRequest :: Generic (Request a) _ + +derive instance newtypeRequest :: Newtype (Request a) _ + +-------------------------------------------------------------------------------- + +_Request + :: forall a + . Iso' (Request a) { rqID :: RequestID, itID :: IterationID, rqRequest :: a } +_Request = _Newtype + +-------------------------------------------------------------------------------- + +newtype Response a = Response + { rspRqID :: RequestID + , rspItID :: IterationID + , rspResponse :: a + } + +derive instance eqResponse :: (Eq a) => Eq (Response a) + +instance showResponse :: (Show a) => Show (Response a) where + show a = genericShow a + +instance encodeJsonResponse :: (EncodeJson a) => EncodeJson (Response a) where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { rspRqID: E.value :: _ RequestID + , rspItID: E.value :: _ IterationID + , rspResponse: E.value :: _ a + } + ) + +instance decodeJsonResponse :: (DecodeJson a) => DecodeJson (Response a) where + decodeJson = defer \_ -> D.decode $ + ( Response <$> D.record "Response" + { rspRqID: D.value :: _ RequestID + , rspItID: D.value :: _ IterationID + , rspResponse: D.value :: _ a + } + ) + +derive instance genericResponse :: Generic (Response a) _ + +derive instance newtypeResponse :: Newtype (Response a) _ + +-------------------------------------------------------------------------------- + +_Response + :: forall a + . Iso' (Response a) + { rspRqID :: RequestID, rspItID :: IterationID, rspResponse :: a } +_Response = _Newtype + +-------------------------------------------------------------------------------- + +newtype RequestID = RequestID Int + +derive instance eqRequestID :: Eq RequestID + +derive instance ordRequestID :: Ord RequestID + +instance showRequestID :: Show RequestID where + show a = genericShow a + +instance encodeJsonRequestID :: EncodeJson RequestID where + encodeJson = defer \_ -> E.encode $ unwrap >$< E.value + +instance decodeJsonRequestID :: DecodeJson RequestID where + decodeJson = defer \_ -> D.decode $ (RequestID <$> D.value) + +derive instance genericRequestID :: Generic RequestID _ + +derive instance newtypeRequestID :: Newtype RequestID _ + +-------------------------------------------------------------------------------- + +_RequestID :: Iso' RequestID Int +_RequestID = _Newtype + +-------------------------------------------------------------------------------- + +newtype IterationID = IterationID Int + +derive instance eqIterationID :: Eq IterationID + +derive instance ordIterationID :: Ord IterationID + +instance showIterationID :: Show IterationID where + show a = genericShow a + +instance encodeJsonIterationID :: EncodeJson IterationID where + encodeJson = defer \_ -> E.encode $ unwrap >$< E.value + +instance decodeJsonIterationID :: DecodeJson IterationID where + decodeJson = defer \_ -> D.decode $ (IterationID <$> D.value) + +derive instance genericIterationID :: Generic IterationID _ + +derive instance newtypeIterationID :: Newtype IterationID _ + +-------------------------------------------------------------------------------- + +_IterationID :: Iso' IterationID Int +_IterationID = _Newtype \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/Plutus/Contract/StateMachine.purs b/marlowe-dashboard-client/generated/Plutus/Contract/StateMachine.purs new file mode 100644 index 0000000000..1d61152df5 --- /dev/null +++ b/marlowe-dashboard-client/generated/Plutus/Contract/StateMachine.purs @@ -0,0 +1,125 @@ +-- File auto generated by purescript-bridge! -- +module Plutus.Contract.StateMachine where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Plutus.Contract.StateMachine.OnChain (State) +import Type.Proxy (Proxy(Proxy)) +import Wallet.Types (ContractError) + +newtype InvalidTransition a b = InvalidTransition + { tfState :: Maybe (State a) + , tfInput :: b + } + +derive instance eqInvalidTransition :: + ( Eq a + , Eq b + ) => + Eq (InvalidTransition a b) + +instance showInvalidTransition :: + ( Show a + , Show b + ) => + Show (InvalidTransition a b) where + show a = genericShow a + +instance encodeJsonInvalidTransition :: + ( EncodeJson a + , EncodeJson b + ) => + EncodeJson (InvalidTransition a b) where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { tfState: (E.maybe E.value) :: _ (Maybe (State a)) + , tfInput: E.value :: _ b + } + ) + +instance decodeJsonInvalidTransition :: + ( DecodeJson a + , DecodeJson b + ) => + DecodeJson (InvalidTransition a b) where + decodeJson = defer \_ -> D.decode $ + ( InvalidTransition <$> D.record "InvalidTransition" + { tfState: (D.maybe D.value) :: _ (Maybe (State a)) + , tfInput: D.value :: _ b + } + ) + +derive instance genericInvalidTransition :: Generic (InvalidTransition a b) _ + +derive instance newtypeInvalidTransition :: Newtype (InvalidTransition a b) _ + +-------------------------------------------------------------------------------- + +_InvalidTransition + :: forall a b + . Iso' (InvalidTransition a b) { tfState :: Maybe (State a), tfInput :: b } +_InvalidTransition = _Newtype + +-------------------------------------------------------------------------------- + +data SMContractError + = ChooserError String + | UnableToExtractTransition + | SMCContractError ContractError + +derive instance eqSMContractError :: Eq SMContractError + +instance showSMContractError :: Show SMContractError where + show a = genericShow a + +instance encodeJsonSMContractError :: EncodeJson SMContractError where + encodeJson = defer \_ -> case _ of + ChooserError a -> E.encodeTagged "ChooserError" a E.value + UnableToExtractTransition -> encodeJson + { tag: "UnableToExtractTransition", contents: jsonNull } + SMCContractError a -> E.encodeTagged "SMCContractError" a E.value + +instance decodeJsonSMContractError :: DecodeJson SMContractError where + decodeJson = defer \_ -> D.decode + $ D.sumType "SMContractError" + $ Map.fromFoldable + [ "ChooserError" /\ D.content (ChooserError <$> D.value) + , "UnableToExtractTransition" /\ pure UnableToExtractTransition + , "SMCContractError" /\ D.content (SMCContractError <$> D.value) + ] + +derive instance genericSMContractError :: Generic SMContractError _ + +-------------------------------------------------------------------------------- + +_ChooserError :: Prism' SMContractError String +_ChooserError = prism' ChooserError case _ of + (ChooserError a) -> Just a + _ -> Nothing + +_UnableToExtractTransition :: Prism' SMContractError Unit +_UnableToExtractTransition = prism' (const UnableToExtractTransition) case _ of + UnableToExtractTransition -> Just unit + _ -> Nothing + +_SMCContractError :: Prism' SMContractError ContractError +_SMCContractError = prism' SMCContractError case _ of + (SMCContractError a) -> Just a + _ -> Nothing \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/Plutus/Contract/StateMachine/OnChain.purs b/marlowe-dashboard-client/generated/Plutus/Contract/StateMachine/OnChain.purs new file mode 100644 index 0000000000..954be6954d --- /dev/null +++ b/marlowe-dashboard-client/generated/Plutus/Contract/StateMachine/OnChain.purs @@ -0,0 +1,59 @@ +-- File auto generated by purescript-bridge! -- +module Plutus.Contract.StateMachine.OnChain where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Plutus.V1.Ledger.Value (Value) +import Type.Proxy (Proxy(Proxy)) + +newtype State a = State + { stateData :: a + , stateValue :: Value + } + +derive instance eqState :: (Eq a) => Eq (State a) + +instance showState :: (Show a) => Show (State a) where + show a = genericShow a + +instance encodeJsonState :: (EncodeJson a) => EncodeJson (State a) where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { stateData: E.value :: _ a + , stateValue: E.value :: _ Value + } + ) + +instance decodeJsonState :: (DecodeJson a) => DecodeJson (State a) where + decodeJson = defer \_ -> D.decode $ + ( State <$> D.record "State" + { stateData: D.value :: _ a + , stateValue: D.value :: _ Value + } + ) + +derive instance genericState :: Generic (State a) _ + +derive instance newtypeState :: Newtype (State a) _ + +-------------------------------------------------------------------------------- + +_State :: forall a. Iso' (State a) { stateData :: a, stateValue :: Value } +_State = _Newtype \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/Plutus/PAB/Events/ContractInstanceState.purs b/marlowe-dashboard-client/generated/Plutus/PAB/Events/ContractInstanceState.purs new file mode 100644 index 0000000000..f6c590c706 --- /dev/null +++ b/marlowe-dashboard-client/generated/Plutus/PAB/Events/ContractInstanceState.purs @@ -0,0 +1,92 @@ +-- File auto generated by purescript-bridge! -- +module Plutus.PAB.Events.ContractInstanceState where + +import Prelude + +import Control.Lazy (defer) +import Control.Monad.Freer.Extras.Log (LogMessage) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.RawJson (RawJson) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Plutus.Contract.Resumable (Request) +import Type.Proxy (Proxy(Proxy)) + +newtype PartiallyDecodedResponse a = PartiallyDecodedResponse + { hooks :: Array (Request a) + , logs :: Array (LogMessage RawJson) + , lastLogs :: Array (LogMessage RawJson) + , err :: Maybe RawJson + , observableState :: RawJson + } + +derive instance eqPartiallyDecodedResponse :: + ( Eq a + ) => + Eq (PartiallyDecodedResponse a) + +instance showPartiallyDecodedResponse :: + ( Show a + ) => + Show (PartiallyDecodedResponse a) where + show a = genericShow a + +instance encodeJsonPartiallyDecodedResponse :: + ( EncodeJson a + ) => + EncodeJson (PartiallyDecodedResponse a) where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { hooks: E.value :: _ (Array (Request a)) + , logs: E.value :: _ (Array (LogMessage RawJson)) + , lastLogs: E.value :: _ (Array (LogMessage RawJson)) + , err: (E.maybe E.value) :: _ (Maybe RawJson) + , observableState: E.value :: _ RawJson + } + ) + +instance decodeJsonPartiallyDecodedResponse :: + ( DecodeJson a + ) => + DecodeJson (PartiallyDecodedResponse a) where + decodeJson = defer \_ -> D.decode $ + ( PartiallyDecodedResponse <$> D.record "PartiallyDecodedResponse" + { hooks: D.value :: _ (Array (Request a)) + , logs: D.value :: _ (Array (LogMessage RawJson)) + , lastLogs: D.value :: _ (Array (LogMessage RawJson)) + , err: (D.maybe D.value) :: _ (Maybe RawJson) + , observableState: D.value :: _ RawJson + } + ) + +derive instance genericPartiallyDecodedResponse :: + Generic (PartiallyDecodedResponse a) _ + +derive instance newtypePartiallyDecodedResponse :: + Newtype (PartiallyDecodedResponse a) _ + +-------------------------------------------------------------------------------- + +_PartiallyDecodedResponse + :: forall a + . Iso' (PartiallyDecodedResponse a) + { hooks :: Array (Request a) + , logs :: Array (LogMessage RawJson) + , lastLogs :: Array (LogMessage RawJson) + , err :: Maybe RawJson + , observableState :: RawJson + } +_PartiallyDecodedResponse = _Newtype \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/Plutus/PAB/Webserver.js b/marlowe-dashboard-client/generated/Plutus/PAB/Webserver.js new file mode 100644 index 0000000000..c0dcec34c3 --- /dev/null +++ b/marlowe-dashboard-client/generated/Plutus/PAB/Webserver.js @@ -0,0 +1,3 @@ +"use strict"; + +exports.encodeURIComponent = encodeURIComponent; diff --git a/marlowe-dashboard-client/generated/Plutus/PAB/Webserver.purs b/marlowe-dashboard-client/generated/Plutus/PAB/Webserver.purs new file mode 100644 index 0000000000..b52413c458 --- /dev/null +++ b/marlowe-dashboard-client/generated/Plutus/PAB/Webserver.purs @@ -0,0 +1,1009 @@ +-- File auto generated by servant-purescript! -- +module Plutus.PAB.Webserver where + +import Prelude + +import Affjax (defaultRequest, request) +import Affjax.RequestBody (json) as Request +import Affjax.RequestHeader (RequestHeader(..)) +import Affjax.ResponseFormat (json) as Response +import Cardano.Wallet.Mock.Types (WalletInfo) +import Control.Monad.Error.Class (class MonadError, throwError) +import Control.Monad.Reader.Class (class MonadAsk, asks) +import Data.Argonaut.Decode (decodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Array (fromFoldable, null) +import Data.Either (Either(..)) +import Data.HTTP.Method (Method(..)) +import Data.Maybe (Maybe(..)) +import Data.Newtype (unwrap) +import Data.RawJson (RawJson) +import Data.String (joinWith) +import Effect.Aff.Class (class MonadAff, liftAff) +import Ledger.Constraints.OffChain (UnbalancedTx) +import MarloweContract (MarloweContract) +import Plutus.PAB.Webserver.Types + ( ContractActivationArgs + , ContractInstanceClientState + , ContractSignatureResponse + , FullReport + ) +import Plutus.V1.Ledger.Tx (Tx) +import Plutus.V1.Ledger.Value (Value) +import Servant.PureScript + ( class ToURLPiece + , AjaxError + , ErrorDescription(..) + , toURLPiece + ) +import Wallet.Emulator.Error (WalletAPIError) +import Wallet.Types (ContractInstanceId) + +foreign import encodeURIComponent :: String -> String + +type SPSettings_ + = + { baseURL :: String + } + +class HasSPSettings a where + spSettings :: a -> SPSettings_ + +getApiHealthcheck + :: forall env m + . HasSPSettings env + => MonadAsk env m + => MonadError AjaxError m + => MonadAff m + => m Unit +getApiHealthcheck = do + spSettings <- asks spSettings + let baseURL = spSettings.baseURL + let httpMethod = Left GET + let + encodeQueryItem :: forall a. ToURLPiece a => String -> a -> String + encodeQueryItem name val = name <> "=" <> toURLPiece val + let + queryArgs :: Array String + queryArgs = + [] + let + queryString = if null queryArgs then "" else "?" <> (joinWith "&" queryArgs) + let + reqURL = + baseURL + <> "api" + <> "/" + <> "healthcheck" + <> queryString + let + reqHeaders = + [ + ] + let + affReq = + defaultRequest + { method = httpMethod + , url = reqURL + , headers = defaultRequest.headers <> reqHeaders + , responseFormat = Response.json + } + let + decoder = + D.unit + result <- liftAff $ request affReq + response <- case result of + Left err -> throwError $ + { request: affReq, description: ConnectingError err } + Right r -> pure r + when (unwrap response.status < 200 || unwrap response.status >= 299) + $ throwError + $ { request: affReq, description: UnexpectedHTTPStatus response } + case D.decode decoder response.body of + Left err -> throwError $ { request: affReq, description: DecodingError err } + Right body -> pure body + +getApiFullreport + :: forall env m + . HasSPSettings env + => MonadAsk env m + => MonadError AjaxError m + => MonadAff m + => m (FullReport MarloweContract) +getApiFullreport = do + spSettings <- asks spSettings + let baseURL = spSettings.baseURL + let httpMethod = Left GET + let + encodeQueryItem :: forall a. ToURLPiece a => String -> a -> String + encodeQueryItem name val = name <> "=" <> toURLPiece val + let + queryArgs :: Array String + queryArgs = + [] + let + queryString = if null queryArgs then "" else "?" <> (joinWith "&" queryArgs) + let + reqURL = + baseURL + <> "api" + <> "/" + <> "fullreport" + <> queryString + let + reqHeaders = + [ + ] + let + affReq = + defaultRequest + { method = httpMethod + , url = reqURL + , headers = defaultRequest.headers <> reqHeaders + , responseFormat = Response.json + } + let + decoder = + D.value + result <- liftAff $ request affReq + response <- case result of + Left err -> throwError $ + { request: affReq, description: ConnectingError err } + Right r -> pure r + when (unwrap response.status < 200 || unwrap response.status >= 299) + $ throwError + $ { request: affReq, description: UnexpectedHTTPStatus response } + case D.decode decoder response.body of + Left err -> throwError $ { request: affReq, description: DecodingError err } + Right body -> pure body + +postApiContractActivate + :: forall env m + . HasSPSettings env + => MonadAsk env m + => MonadError AjaxError m + => MonadAff m + => ContractActivationArgs MarloweContract + -> m ContractInstanceId +postApiContractActivate reqBody = do + spSettings <- asks spSettings + let baseURL = spSettings.baseURL + let httpMethod = Left POST + let + encodeQueryItem :: forall a. ToURLPiece a => String -> a -> String + encodeQueryItem name val = name <> "=" <> toURLPiece val + let + queryArgs :: Array String + queryArgs = + [] + let + queryString = if null queryArgs then "" else "?" <> (joinWith "&" queryArgs) + let + reqURL = + baseURL + <> "api" + <> "/" + <> "contract" + <> "/" + <> "activate" + <> queryString + let + reqHeaders = + [ + ] + let + affReq = + defaultRequest + { method = httpMethod + , url = reqURL + , headers = defaultRequest.headers <> reqHeaders + , responseFormat = Response.json + , content = Just + $ Request.json + $ flip E.encode reqBody + $ E.value + } + let + decoder = + D.value + result <- liftAff $ request affReq + response <- case result of + Left err -> throwError $ + { request: affReq, description: ConnectingError err } + Right r -> pure r + when (unwrap response.status < 200 || unwrap response.status >= 299) + $ throwError + $ { request: affReq, description: UnexpectedHTTPStatus response } + case D.decode decoder response.body of + Left err -> throwError $ { request: affReq, description: DecodingError err } + Right body -> pure body + +getApiContractInstanceByContractinstanceidStatus + :: forall env m + . HasSPSettings env + => MonadAsk env m + => MonadError AjaxError m + => MonadAff m + => ContractInstanceId + -> m (ContractInstanceClientState MarloweContract) +getApiContractInstanceByContractinstanceidStatus contract_instance_id = do + spSettings <- asks spSettings + let baseURL = spSettings.baseURL + let httpMethod = Left GET + let + encodeQueryItem :: forall a. ToURLPiece a => String -> a -> String + encodeQueryItem name val = name <> "=" <> toURLPiece val + let + queryArgs :: Array String + queryArgs = + [] + let + queryString = if null queryArgs then "" else "?" <> (joinWith "&" queryArgs) + let + reqURL = + baseURL + <> "api" + <> "/" + <> "contract" + <> "/" + <> "instance" + <> "/" + <> encodeURIComponent (toURLPiece contract_instance_id) + <> "/" + <> "status" + <> queryString + let + reqHeaders = + [ + ] + let + affReq = + defaultRequest + { method = httpMethod + , url = reqURL + , headers = defaultRequest.headers <> reqHeaders + , responseFormat = Response.json + } + let + decoder = + D.value + result <- liftAff $ request affReq + response <- case result of + Left err -> throwError $ + { request: affReq, description: ConnectingError err } + Right r -> pure r + when (unwrap response.status < 200 || unwrap response.status >= 299) + $ throwError + $ { request: affReq, description: UnexpectedHTTPStatus response } + case D.decode decoder response.body of + Left err -> throwError $ { request: affReq, description: DecodingError err } + Right body -> pure body + +getApiContractInstanceByContractinstanceidSchema + :: forall env m + . HasSPSettings env + => MonadAsk env m + => MonadError AjaxError m + => MonadAff m + => ContractInstanceId + -> m (ContractSignatureResponse MarloweContract) +getApiContractInstanceByContractinstanceidSchema contract_instance_id = do + spSettings <- asks spSettings + let baseURL = spSettings.baseURL + let httpMethod = Left GET + let + encodeQueryItem :: forall a. ToURLPiece a => String -> a -> String + encodeQueryItem name val = name <> "=" <> toURLPiece val + let + queryArgs :: Array String + queryArgs = + [] + let + queryString = if null queryArgs then "" else "?" <> (joinWith "&" queryArgs) + let + reqURL = + baseURL + <> "api" + <> "/" + <> "contract" + <> "/" + <> "instance" + <> "/" + <> encodeURIComponent (toURLPiece contract_instance_id) + <> "/" + <> "schema" + <> queryString + let + reqHeaders = + [ + ] + let + affReq = + defaultRequest + { method = httpMethod + , url = reqURL + , headers = defaultRequest.headers <> reqHeaders + , responseFormat = Response.json + } + let + decoder = + D.value + result <- liftAff $ request affReq + response <- case result of + Left err -> throwError $ + { request: affReq, description: ConnectingError err } + Right r -> pure r + when (unwrap response.status < 200 || unwrap response.status >= 299) + $ throwError + $ { request: affReq, description: UnexpectedHTTPStatus response } + case D.decode decoder response.body of + Left err -> throwError $ { request: affReq, description: DecodingError err } + Right body -> pure body + +postApiContractInstanceByContractinstanceidEndpointByEndpointname + :: forall env m + . HasSPSettings env + => MonadAsk env m + => MonadError AjaxError m + => MonadAff m + => RawJson + -> ContractInstanceId + -> String + -> m Unit +postApiContractInstanceByContractinstanceidEndpointByEndpointname + reqBody + contract_instance_id + endpoint_name = do + spSettings <- asks spSettings + let baseURL = spSettings.baseURL + let httpMethod = Left POST + let + encodeQueryItem :: forall a. ToURLPiece a => String -> a -> String + encodeQueryItem name val = name <> "=" <> toURLPiece val + let + queryArgs :: Array String + queryArgs = + [] + let + queryString = if null queryArgs then "" else "?" <> (joinWith "&" queryArgs) + let + reqURL = + baseURL + <> "api" + <> "/" + <> "contract" + <> "/" + <> "instance" + <> "/" + <> encodeURIComponent (toURLPiece contract_instance_id) + <> "/" + <> "endpoint" + <> "/" + <> encodeURIComponent (toURLPiece endpoint_name) + <> queryString + let + reqHeaders = + [ + ] + let + affReq = + defaultRequest + { method = httpMethod + , url = reqURL + , headers = defaultRequest.headers <> reqHeaders + , responseFormat = Response.json + , content = Just + $ Request.json + $ flip E.encode reqBody + $ E.value + } + let + decoder = + D.unit + result <- liftAff $ request affReq + response <- case result of + Left err -> throwError $ + { request: affReq, description: ConnectingError err } + Right r -> pure r + when (unwrap response.status < 200 || unwrap response.status >= 299) + $ throwError + $ { request: affReq, description: UnexpectedHTTPStatus response } + case D.decode decoder response.body of + Left err -> throwError $ { request: affReq, description: DecodingError err } + Right body -> pure body + +putApiContractInstanceByContractinstanceidStop + :: forall env m + . HasSPSettings env + => MonadAsk env m + => MonadError AjaxError m + => MonadAff m + => ContractInstanceId + -> m Unit +putApiContractInstanceByContractinstanceidStop contract_instance_id = do + spSettings <- asks spSettings + let baseURL = spSettings.baseURL + let httpMethod = Left PUT + let + encodeQueryItem :: forall a. ToURLPiece a => String -> a -> String + encodeQueryItem name val = name <> "=" <> toURLPiece val + let + queryArgs :: Array String + queryArgs = + [] + let + queryString = if null queryArgs then "" else "?" <> (joinWith "&" queryArgs) + let + reqURL = + baseURL + <> "api" + <> "/" + <> "contract" + <> "/" + <> "instance" + <> "/" + <> encodeURIComponent (toURLPiece contract_instance_id) + <> "/" + <> "stop" + <> queryString + let + reqHeaders = + [ + ] + let + affReq = + defaultRequest + { method = httpMethod + , url = reqURL + , headers = defaultRequest.headers <> reqHeaders + , responseFormat = Response.json + } + let + decoder = + D.unit + result <- liftAff $ request affReq + response <- case result of + Left err -> throwError $ + { request: affReq, description: ConnectingError err } + Right r -> pure r + when (unwrap response.status < 200 || unwrap response.status >= 299) + $ throwError + $ { request: affReq, description: UnexpectedHTTPStatus response } + case D.decode decoder response.body of + Left err -> throwError $ { request: affReq, description: DecodingError err } + Right body -> pure body + +getApiContractInstancesWalletByWalletid + :: forall env m + . HasSPSettings env + => MonadAsk env m + => MonadError AjaxError m + => MonadAff m + => String + -> Maybe String + -> m (Array (ContractInstanceClientState MarloweContract)) +getApiContractInstancesWalletByWalletid wallet_id status = do + spSettings <- asks spSettings + let baseURL = spSettings.baseURL + let httpMethod = Left GET + let + encodeQueryItem :: forall a. ToURLPiece a => String -> a -> String + encodeQueryItem name val = name <> "=" <> toURLPiece val + let + queryArgs :: Array String + queryArgs = + [] + <> fromFoldable (encodeQueryItem "status" <$> status) + let + queryString = if null queryArgs then "" else "?" <> (joinWith "&" queryArgs) + let + reqURL = + baseURL + <> "api" + <> "/" + <> "contract" + <> "/" + <> "instances" + <> "/" + <> "wallet" + <> "/" + <> encodeURIComponent (toURLPiece wallet_id) + <> queryString + let + reqHeaders = + [ + ] + let + affReq = + defaultRequest + { method = httpMethod + , url = reqURL + , headers = defaultRequest.headers <> reqHeaders + , responseFormat = Response.json + } + let + decoder = + D.value + result <- liftAff $ request affReq + response <- case result of + Left err -> throwError $ + { request: affReq, description: ConnectingError err } + Right r -> pure r + when (unwrap response.status < 200 || unwrap response.status >= 299) + $ throwError + $ { request: affReq, description: UnexpectedHTTPStatus response } + case D.decode decoder response.body of + Left err -> throwError $ { request: affReq, description: DecodingError err } + Right body -> pure body + +getApiContractInstances + :: forall env m + . HasSPSettings env + => MonadAsk env m + => MonadError AjaxError m + => MonadAff m + => Maybe String + -> m (Array (ContractInstanceClientState MarloweContract)) +getApiContractInstances status = do + spSettings <- asks spSettings + let baseURL = spSettings.baseURL + let httpMethod = Left GET + let + encodeQueryItem :: forall a. ToURLPiece a => String -> a -> String + encodeQueryItem name val = name <> "=" <> toURLPiece val + let + queryArgs :: Array String + queryArgs = + [] + <> fromFoldable (encodeQueryItem "status" <$> status) + let + queryString = if null queryArgs then "" else "?" <> (joinWith "&" queryArgs) + let + reqURL = + baseURL + <> "api" + <> "/" + <> "contract" + <> "/" + <> "instances" + <> queryString + let + reqHeaders = + [ + ] + let + affReq = + defaultRequest + { method = httpMethod + , url = reqURL + , headers = defaultRequest.headers <> reqHeaders + , responseFormat = Response.json + } + let + decoder = + D.value + result <- liftAff $ request affReq + response <- case result of + Left err -> throwError $ + { request: affReq, description: ConnectingError err } + Right r -> pure r + when (unwrap response.status < 200 || unwrap response.status >= 299) + $ throwError + $ { request: affReq, description: UnexpectedHTTPStatus response } + case D.decode decoder response.body of + Left err -> throwError $ { request: affReq, description: DecodingError err } + Right body -> pure body + +getApiContractDefinitions + :: forall env m + . HasSPSettings env + => MonadAsk env m + => MonadError AjaxError m + => MonadAff m + => m (Array (ContractSignatureResponse MarloweContract)) +getApiContractDefinitions = do + spSettings <- asks spSettings + let baseURL = spSettings.baseURL + let httpMethod = Left GET + let + encodeQueryItem :: forall a. ToURLPiece a => String -> a -> String + encodeQueryItem name val = name <> "=" <> toURLPiece val + let + queryArgs :: Array String + queryArgs = + [] + let + queryString = if null queryArgs then "" else "?" <> (joinWith "&" queryArgs) + let + reqURL = + baseURL + <> "api" + <> "/" + <> "contract" + <> "/" + <> "definitions" + <> queryString + let + reqHeaders = + [ + ] + let + affReq = + defaultRequest + { method = httpMethod + , url = reqURL + , headers = defaultRequest.headers <> reqHeaders + , responseFormat = Response.json + } + let + decoder = + D.value + result <- liftAff $ request affReq + response <- case result of + Left err -> throwError $ + { request: affReq, description: ConnectingError err } + Right r -> pure r + when (unwrap response.status < 200 || unwrap response.status >= 299) + $ throwError + $ { request: affReq, description: UnexpectedHTTPStatus response } + case D.decode decoder response.body of + Left err -> throwError $ { request: affReq, description: DecodingError err } + Right body -> pure body + +postWalletCreate + :: forall env m + . HasSPSettings env + => MonadAsk env m + => MonadError AjaxError m + => MonadAff m + => m WalletInfo +postWalletCreate = do + spSettings <- asks spSettings + let baseURL = spSettings.baseURL + let httpMethod = Left POST + let + encodeQueryItem :: forall a. ToURLPiece a => String -> a -> String + encodeQueryItem name val = name <> "=" <> toURLPiece val + let + queryArgs :: Array String + queryArgs = + [] + let + queryString = if null queryArgs then "" else "?" <> (joinWith "&" queryArgs) + let + reqURL = + baseURL + <> "wallet" + <> "/" + <> "create" + <> queryString + let + reqHeaders = + [ + ] + let + affReq = + defaultRequest + { method = httpMethod + , url = reqURL + , headers = defaultRequest.headers <> reqHeaders + , responseFormat = Response.json + } + let + decoder = + D.value + result <- liftAff $ request affReq + response <- case result of + Left err -> throwError $ + { request: affReq, description: ConnectingError err } + Right r -> pure r + when (unwrap response.status < 200 || unwrap response.status >= 299) + $ throwError + $ { request: affReq, description: UnexpectedHTTPStatus response } + case D.decode decoder response.body of + Left err -> throwError $ { request: affReq, description: DecodingError err } + Right body -> pure body + +postWalletByWalletIdSubmittxn + :: forall env m + . HasSPSettings env + => MonadAsk env m + => MonadError AjaxError m + => MonadAff m + => Tx + -> String + -> m Unit +postWalletByWalletIdSubmittxn reqBody walletId = do + spSettings <- asks spSettings + let baseURL = spSettings.baseURL + let httpMethod = Left POST + let + encodeQueryItem :: forall a. ToURLPiece a => String -> a -> String + encodeQueryItem name val = name <> "=" <> toURLPiece val + let + queryArgs :: Array String + queryArgs = + [] + let + queryString = if null queryArgs then "" else "?" <> (joinWith "&" queryArgs) + let + reqURL = + baseURL + <> "wallet" + <> "/" + <> encodeURIComponent (toURLPiece walletId) + <> "/" + <> "submit-txn" + <> queryString + let + reqHeaders = + [ + ] + let + affReq = + defaultRequest + { method = httpMethod + , url = reqURL + , headers = defaultRequest.headers <> reqHeaders + , responseFormat = Response.json + , content = Just + $ Request.json + $ flip E.encode reqBody + $ E.value + } + let + decoder = + D.unit + result <- liftAff $ request affReq + response <- case result of + Left err -> throwError $ + { request: affReq, description: ConnectingError err } + Right r -> pure r + when (unwrap response.status < 200 || unwrap response.status >= 299) + $ throwError + $ { request: affReq, description: UnexpectedHTTPStatus response } + case D.decode decoder response.body of + Left err -> throwError $ { request: affReq, description: DecodingError err } + Right body -> pure body + +getWalletByWalletIdOwnpublickey + :: forall env m + . HasSPSettings env + => MonadAsk env m + => MonadError AjaxError m + => MonadAff m + => String + -> m WalletInfo +getWalletByWalletIdOwnpublickey walletId = do + spSettings <- asks spSettings + let baseURL = spSettings.baseURL + let httpMethod = Left GET + let + encodeQueryItem :: forall a. ToURLPiece a => String -> a -> String + encodeQueryItem name val = name <> "=" <> toURLPiece val + let + queryArgs :: Array String + queryArgs = + [] + let + queryString = if null queryArgs then "" else "?" <> (joinWith "&" queryArgs) + let + reqURL = + baseURL + <> "wallet" + <> "/" + <> encodeURIComponent (toURLPiece walletId) + <> "/" + <> "own-public-key" + <> queryString + let + reqHeaders = + [ + ] + let + affReq = + defaultRequest + { method = httpMethod + , url = reqURL + , headers = defaultRequest.headers <> reqHeaders + , responseFormat = Response.json + } + let + decoder = + D.value + result <- liftAff $ request affReq + response <- case result of + Left err -> throwError $ + { request: affReq, description: ConnectingError err } + Right r -> pure r + when (unwrap response.status < 200 || unwrap response.status >= 299) + $ throwError + $ { request: affReq, description: UnexpectedHTTPStatus response } + case D.decode decoder response.body of + Left err -> throwError $ { request: affReq, description: DecodingError err } + Right body -> pure body + +postWalletByWalletIdBalancetx + :: forall env m + . HasSPSettings env + => MonadAsk env m + => MonadError AjaxError m + => MonadAff m + => UnbalancedTx + -> String + -> m (Either WalletAPIError Tx) +postWalletByWalletIdBalancetx reqBody walletId = do + spSettings <- asks spSettings + let baseURL = spSettings.baseURL + let httpMethod = Left POST + let + encodeQueryItem :: forall a. ToURLPiece a => String -> a -> String + encodeQueryItem name val = name <> "=" <> toURLPiece val + let + queryArgs :: Array String + queryArgs = + [] + let + queryString = if null queryArgs then "" else "?" <> (joinWith "&" queryArgs) + let + reqURL = + baseURL + <> "wallet" + <> "/" + <> encodeURIComponent (toURLPiece walletId) + <> "/" + <> "balance-tx" + <> queryString + let + reqHeaders = + [ + ] + let + affReq = + defaultRequest + { method = httpMethod + , url = reqURL + , headers = defaultRequest.headers <> reqHeaders + , responseFormat = Response.json + , content = Just + $ Request.json + $ flip E.encode reqBody + $ E.value + } + let + decoder = + (D.either D.value D.value) + result <- liftAff $ request affReq + response <- case result of + Left err -> throwError $ + { request: affReq, description: ConnectingError err } + Right r -> pure r + when (unwrap response.status < 200 || unwrap response.status >= 299) + $ throwError + $ { request: affReq, description: UnexpectedHTTPStatus response } + case D.decode decoder response.body of + Left err -> throwError $ { request: affReq, description: DecodingError err } + Right body -> pure body + +getWalletByWalletIdTotalfunds + :: forall env m + . HasSPSettings env + => MonadAsk env m + => MonadError AjaxError m + => MonadAff m + => String + -> m Value +getWalletByWalletIdTotalfunds walletId = do + spSettings <- asks spSettings + let baseURL = spSettings.baseURL + let httpMethod = Left GET + let + encodeQueryItem :: forall a. ToURLPiece a => String -> a -> String + encodeQueryItem name val = name <> "=" <> toURLPiece val + let + queryArgs :: Array String + queryArgs = + [] + let + queryString = if null queryArgs then "" else "?" <> (joinWith "&" queryArgs) + let + reqURL = + baseURL + <> "wallet" + <> "/" + <> encodeURIComponent (toURLPiece walletId) + <> "/" + <> "total-funds" + <> queryString + let + reqHeaders = + [ + ] + let + affReq = + defaultRequest + { method = httpMethod + , url = reqURL + , headers = defaultRequest.headers <> reqHeaders + , responseFormat = Response.json + } + let + decoder = + D.value + result <- liftAff $ request affReq + response <- case result of + Left err -> throwError $ + { request: affReq, description: ConnectingError err } + Right r -> pure r + when (unwrap response.status < 200 || unwrap response.status >= 299) + $ throwError + $ { request: affReq, description: UnexpectedHTTPStatus response } + case D.decode decoder response.body of + Left err -> throwError $ { request: affReq, description: DecodingError err } + Right body -> pure body + +postWalletByWalletIdSign + :: forall env m + . HasSPSettings env + => MonadAsk env m + => MonadError AjaxError m + => MonadAff m + => Tx + -> String + -> m Tx +postWalletByWalletIdSign reqBody walletId = do + spSettings <- asks spSettings + let baseURL = spSettings.baseURL + let httpMethod = Left POST + let + encodeQueryItem :: forall a. ToURLPiece a => String -> a -> String + encodeQueryItem name val = name <> "=" <> toURLPiece val + let + queryArgs :: Array String + queryArgs = + [] + let + queryString = if null queryArgs then "" else "?" <> (joinWith "&" queryArgs) + let + reqURL = + baseURL + <> "wallet" + <> "/" + <> encodeURIComponent (toURLPiece walletId) + <> "/" + <> "sign" + <> queryString + let + reqHeaders = + [ + ] + let + affReq = + defaultRequest + { method = httpMethod + , url = reqURL + , headers = defaultRequest.headers <> reqHeaders + , responseFormat = Response.json + , content = Just + $ Request.json + $ flip E.encode reqBody + $ E.value + } + let + decoder = + D.value + result <- liftAff $ request affReq + response <- case result of + Left err -> throwError $ + { request: affReq, description: ConnectingError err } + Right r -> pure r + when (unwrap response.status < 200 || unwrap response.status >= 299) + $ throwError + $ { request: affReq, description: UnexpectedHTTPStatus response } + case D.decode decoder response.body of + Left err -> throwError $ { request: affReq, description: DecodingError err } + Right body -> pure body diff --git a/marlowe-dashboard-client/generated/Plutus/PAB/Webserver/Types.purs b/marlowe-dashboard-client/generated/Plutus/PAB/Webserver/Types.purs new file mode 100644 index 0000000000..d1c48c8fa2 --- /dev/null +++ b/marlowe-dashboard-client/generated/Plutus/PAB/Webserver/Types.purs @@ -0,0 +1,483 @@ +-- File auto generated by purescript-bridge! -- +module Plutus.PAB.Webserver.Types where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Either (Either) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map (Map) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.RawJson (RawJson) +import Data.Show.Generic (genericShow) +import Data.Tuple (Tuple) +import Data.Tuple.Nested ((/\)) +import Ledger.Index (UtxoIndex) +import Playground.Types (FunctionSchema) +import Plutus.Contract.Effects (ActiveEndpoint, PABReq) +import Plutus.PAB.Events.ContractInstanceState (PartiallyDecodedResponse) +import Plutus.V1.Ledger.Crypto (PubKeyHash) +import Plutus.V1.Ledger.Slot (Slot) +import Plutus.V1.Ledger.Tx (Tx) +import Plutus.V1.Ledger.TxId (TxId) +import Schema (FormSchema) +import Type.Proxy (Proxy(Proxy)) +import Wallet.Emulator.Wallet (Wallet) +import Wallet.Rollup.Types (AnnotatedTx) +import Wallet.Types (ContractActivityStatus, ContractInstanceId) + +newtype FullReport a = FullReport + { contractReport :: ContractReport a + , chainReport :: ChainReport + } + +derive instance eqFullReport :: (Eq a) => Eq (FullReport a) + +instance showFullReport :: (Show a) => Show (FullReport a) where + show a = genericShow a + +instance encodeJsonFullReport :: (EncodeJson a) => EncodeJson (FullReport a) where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { contractReport: E.value :: _ (ContractReport a) + , chainReport: E.value :: _ ChainReport + } + ) + +instance decodeJsonFullReport :: (DecodeJson a) => DecodeJson (FullReport a) where + decodeJson = defer \_ -> D.decode $ + ( FullReport <$> D.record "FullReport" + { contractReport: D.value :: _ (ContractReport a) + , chainReport: D.value :: _ ChainReport + } + ) + +derive instance genericFullReport :: Generic (FullReport a) _ + +derive instance newtypeFullReport :: Newtype (FullReport a) _ + +-------------------------------------------------------------------------------- + +_FullReport + :: forall a + . Iso' (FullReport a) + { contractReport :: ContractReport a, chainReport :: ChainReport } +_FullReport = _Newtype + +-------------------------------------------------------------------------------- + +newtype ChainReport = ChainReport + { transactionMap :: Map TxId Tx + , utxoIndex :: UtxoIndex + , annotatedBlockchain :: Array (Array AnnotatedTx) + } + +derive instance eqChainReport :: Eq ChainReport + +instance showChainReport :: Show ChainReport where + show a = genericShow a + +instance encodeJsonChainReport :: EncodeJson ChainReport where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { transactionMap: (E.dictionary E.value E.value) :: _ (Map TxId Tx) + , utxoIndex: E.value :: _ UtxoIndex + , annotatedBlockchain: E.value :: _ (Array (Array AnnotatedTx)) + } + ) + +instance decodeJsonChainReport :: DecodeJson ChainReport where + decodeJson = defer \_ -> D.decode $ + ( ChainReport <$> D.record "ChainReport" + { transactionMap: (D.dictionary D.value D.value) :: _ (Map TxId Tx) + , utxoIndex: D.value :: _ UtxoIndex + , annotatedBlockchain: D.value :: _ (Array (Array AnnotatedTx)) + } + ) + +derive instance genericChainReport :: Generic ChainReport _ + +derive instance newtypeChainReport :: Newtype ChainReport _ + +-------------------------------------------------------------------------------- + +_ChainReport :: Iso' ChainReport + { transactionMap :: Map TxId Tx + , utxoIndex :: UtxoIndex + , annotatedBlockchain :: Array (Array AnnotatedTx) + } +_ChainReport = _Newtype + +-------------------------------------------------------------------------------- + +newtype ContractReport a = ContractReport + { crAvailableContracts :: Array (ContractSignatureResponse a) + , crActiveContractStates :: + Array (Tuple ContractInstanceId (PartiallyDecodedResponse PABReq)) + } + +derive instance eqContractReport :: (Eq a) => Eq (ContractReport a) + +instance showContractReport :: (Show a) => Show (ContractReport a) where + show a = genericShow a + +instance encodeJsonContractReport :: + ( EncodeJson a + ) => + EncodeJson (ContractReport a) where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { crAvailableContracts: + E.value :: _ (Array (ContractSignatureResponse a)) + , crActiveContractStates: + E.value :: _ + ( Array + (Tuple ContractInstanceId (PartiallyDecodedResponse PABReq)) + ) + } + ) + +instance decodeJsonContractReport :: + ( DecodeJson a + ) => + DecodeJson (ContractReport a) where + decodeJson = defer \_ -> D.decode $ + ( ContractReport <$> D.record "ContractReport" + { crAvailableContracts: + D.value :: _ (Array (ContractSignatureResponse a)) + , crActiveContractStates: + D.value :: _ + ( Array + (Tuple ContractInstanceId (PartiallyDecodedResponse PABReq)) + ) + } + ) + +derive instance genericContractReport :: Generic (ContractReport a) _ + +derive instance newtypeContractReport :: Newtype (ContractReport a) _ + +-------------------------------------------------------------------------------- + +_ContractReport + :: forall a + . Iso' (ContractReport a) + { crAvailableContracts :: Array (ContractSignatureResponse a) + , crActiveContractStates :: + Array (Tuple ContractInstanceId (PartiallyDecodedResponse PABReq)) + } +_ContractReport = _Newtype + +-------------------------------------------------------------------------------- + +newtype ContractSignatureResponse a = ContractSignatureResponse + { csrDefinition :: a + , csrSchemas :: Array (FunctionSchema FormSchema) + } + +derive instance eqContractSignatureResponse :: + ( Eq a + ) => + Eq (ContractSignatureResponse a) + +instance showContractSignatureResponse :: + ( Show a + ) => + Show (ContractSignatureResponse a) where + show a = genericShow a + +instance encodeJsonContractSignatureResponse :: + ( EncodeJson a + ) => + EncodeJson (ContractSignatureResponse a) where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { csrDefinition: E.value :: _ a + , csrSchemas: E.value :: _ (Array (FunctionSchema FormSchema)) + } + ) + +instance decodeJsonContractSignatureResponse :: + ( DecodeJson a + ) => + DecodeJson (ContractSignatureResponse a) where + decodeJson = defer \_ -> D.decode $ + ( ContractSignatureResponse <$> D.record "ContractSignatureResponse" + { csrDefinition: D.value :: _ a + , csrSchemas: D.value :: _ (Array (FunctionSchema FormSchema)) + } + ) + +derive instance genericContractSignatureResponse :: + Generic (ContractSignatureResponse a) _ + +derive instance newtypeContractSignatureResponse :: + Newtype (ContractSignatureResponse a) _ + +-------------------------------------------------------------------------------- + +_ContractSignatureResponse + :: forall a + . Iso' (ContractSignatureResponse a) + { csrDefinition :: a, csrSchemas :: Array (FunctionSchema FormSchema) } +_ContractSignatureResponse = _Newtype + +-------------------------------------------------------------------------------- + +newtype ContractActivationArgs a = ContractActivationArgs + { caID :: a + , caWallet :: Maybe Wallet + } + +derive instance eqContractActivationArgs :: + ( Eq a + ) => + Eq (ContractActivationArgs a) + +instance showContractActivationArgs :: + ( Show a + ) => + Show (ContractActivationArgs a) where + show a = genericShow a + +instance encodeJsonContractActivationArgs :: + ( EncodeJson a + ) => + EncodeJson (ContractActivationArgs a) where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { caID: E.value :: _ a + , caWallet: (E.maybe E.value) :: _ (Maybe Wallet) + } + ) + +instance decodeJsonContractActivationArgs :: + ( DecodeJson a + ) => + DecodeJson (ContractActivationArgs a) where + decodeJson = defer \_ -> D.decode $ + ( ContractActivationArgs <$> D.record "ContractActivationArgs" + { caID: D.value :: _ a + , caWallet: (D.maybe D.value) :: _ (Maybe Wallet) + } + ) + +derive instance genericContractActivationArgs :: + Generic (ContractActivationArgs a) _ + +derive instance newtypeContractActivationArgs :: + Newtype (ContractActivationArgs a) _ + +-------------------------------------------------------------------------------- + +_ContractActivationArgs + :: forall a + . Iso' (ContractActivationArgs a) { caID :: a, caWallet :: Maybe Wallet } +_ContractActivationArgs = _Newtype + +-------------------------------------------------------------------------------- + +newtype ContractInstanceClientState a = ContractInstanceClientState + { cicContract :: ContractInstanceId + , cicCurrentState :: PartiallyDecodedResponse ActiveEndpoint + , cicWallet :: Wallet + , cicDefinition :: a + , cicStatus :: ContractActivityStatus + } + +instance showContractInstanceClientState :: + ( Show a + ) => + Show (ContractInstanceClientState a) where + show a = genericShow a + +instance encodeJsonContractInstanceClientState :: + ( EncodeJson a + ) => + EncodeJson (ContractInstanceClientState a) where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { cicContract: E.value :: _ ContractInstanceId + , cicCurrentState: + E.value :: _ (PartiallyDecodedResponse ActiveEndpoint) + , cicWallet: E.value :: _ Wallet + , cicDefinition: E.value :: _ a + , cicStatus: E.value :: _ ContractActivityStatus + } + ) + +instance decodeJsonContractInstanceClientState :: + ( DecodeJson a + ) => + DecodeJson (ContractInstanceClientState a) where + decodeJson = defer \_ -> D.decode $ + ( ContractInstanceClientState <$> D.record "ContractInstanceClientState" + { cicContract: D.value :: _ ContractInstanceId + , cicCurrentState: + D.value :: _ (PartiallyDecodedResponse ActiveEndpoint) + , cicWallet: D.value :: _ Wallet + , cicDefinition: D.value :: _ a + , cicStatus: D.value :: _ ContractActivityStatus + } + ) + +derive instance genericContractInstanceClientState :: + Generic (ContractInstanceClientState a) _ + +derive instance newtypeContractInstanceClientState :: + Newtype (ContractInstanceClientState a) _ + +-------------------------------------------------------------------------------- + +_ContractInstanceClientState + :: forall a + . Iso' (ContractInstanceClientState a) + { cicContract :: ContractInstanceId + , cicCurrentState :: PartiallyDecodedResponse ActiveEndpoint + , cicWallet :: Wallet + , cicDefinition :: a + , cicStatus :: ContractActivityStatus + } +_ContractInstanceClientState = _Newtype + +-------------------------------------------------------------------------------- + +data InstanceStatusToClient + = NewObservableState RawJson + | NewActiveEndpoints (Array ActiveEndpoint) + | ContractFinished (Maybe RawJson) + +instance showInstanceStatusToClient :: Show InstanceStatusToClient where + show a = genericShow a + +instance encodeJsonInstanceStatusToClient :: EncodeJson InstanceStatusToClient where + encodeJson = defer \_ -> case _ of + NewObservableState a -> E.encodeTagged "NewObservableState" a E.value + NewActiveEndpoints a -> E.encodeTagged "NewActiveEndpoints" a E.value + ContractFinished a -> E.encodeTagged "ContractFinished" a (E.maybe E.value) + +instance decodeJsonInstanceStatusToClient :: DecodeJson InstanceStatusToClient where + decodeJson = defer \_ -> D.decode + $ D.sumType "InstanceStatusToClient" + $ Map.fromFoldable + [ "NewObservableState" /\ D.content (NewObservableState <$> D.value) + , "NewActiveEndpoints" /\ D.content (NewActiveEndpoints <$> D.value) + , "ContractFinished" /\ D.content + (ContractFinished <$> (D.maybe D.value)) + ] + +derive instance genericInstanceStatusToClient :: + Generic InstanceStatusToClient _ + +-------------------------------------------------------------------------------- + +_NewObservableState :: Prism' InstanceStatusToClient RawJson +_NewObservableState = prism' NewObservableState case _ of + (NewObservableState a) -> Just a + _ -> Nothing + +_NewActiveEndpoints :: Prism' InstanceStatusToClient (Array ActiveEndpoint) +_NewActiveEndpoints = prism' NewActiveEndpoints case _ of + (NewActiveEndpoints a) -> Just a + _ -> Nothing + +_ContractFinished :: Prism' InstanceStatusToClient (Maybe RawJson) +_ContractFinished = prism' ContractFinished case _ of + (ContractFinished a) -> Just a + _ -> Nothing + +-------------------------------------------------------------------------------- + +data CombinedWSStreamToClient + = InstanceUpdate ContractInstanceId InstanceStatusToClient + | SlotChange Slot + +instance showCombinedWSStreamToClient :: Show CombinedWSStreamToClient where + show a = genericShow a + +instance encodeJsonCombinedWSStreamToClient :: + EncodeJson CombinedWSStreamToClient where + encodeJson = defer \_ -> case _ of + InstanceUpdate a b -> E.encodeTagged "InstanceUpdate" (a /\ b) + (E.tuple (E.value >/\< E.value)) + SlotChange a -> E.encodeTagged "SlotChange" a E.value + +instance decodeJsonCombinedWSStreamToClient :: + DecodeJson CombinedWSStreamToClient where + decodeJson = defer \_ -> D.decode + $ D.sumType "CombinedWSStreamToClient" + $ Map.fromFoldable + [ "InstanceUpdate" /\ D.content + (D.tuple $ InstanceUpdate D.value D.value) + , "SlotChange" /\ D.content (SlotChange <$> D.value) + ] + +derive instance genericCombinedWSStreamToClient :: + Generic CombinedWSStreamToClient _ + +-------------------------------------------------------------------------------- + +_InstanceUpdate :: Prism' CombinedWSStreamToClient + { a :: ContractInstanceId, b :: InstanceStatusToClient } +_InstanceUpdate = prism' (\{ a, b } -> (InstanceUpdate a b)) case _ of + (InstanceUpdate a b) -> Just { a, b } + _ -> Nothing + +_SlotChange :: Prism' CombinedWSStreamToClient Slot +_SlotChange = prism' SlotChange case _ of + (SlotChange a) -> Just a + _ -> Nothing + +-------------------------------------------------------------------------------- + +data CombinedWSStreamToServer + = Subscribe (Either ContractInstanceId PubKeyHash) + | Unsubscribe (Either ContractInstanceId PubKeyHash) + +instance showCombinedWSStreamToServer :: Show CombinedWSStreamToServer where + show a = genericShow a + +instance encodeJsonCombinedWSStreamToServer :: + EncodeJson CombinedWSStreamToServer where + encodeJson = defer \_ -> case _ of + Subscribe a -> E.encodeTagged "Subscribe" a (E.either E.value E.value) + Unsubscribe a -> E.encodeTagged "Unsubscribe" a (E.either E.value E.value) + +instance decodeJsonCombinedWSStreamToServer :: + DecodeJson CombinedWSStreamToServer where + decodeJson = defer \_ -> D.decode + $ D.sumType "CombinedWSStreamToServer" + $ Map.fromFoldable + [ "Subscribe" /\ D.content (Subscribe <$> (D.either D.value D.value)) + , "Unsubscribe" /\ D.content + (Unsubscribe <$> (D.either D.value D.value)) + ] + +derive instance genericCombinedWSStreamToServer :: + Generic CombinedWSStreamToServer _ + +-------------------------------------------------------------------------------- + +_Subscribe :: Prism' CombinedWSStreamToServer + (Either ContractInstanceId PubKeyHash) +_Subscribe = prism' Subscribe case _ of + (Subscribe a) -> Just a + _ -> Nothing + +_Unsubscribe :: Prism' CombinedWSStreamToServer + (Either ContractInstanceId PubKeyHash) +_Unsubscribe = prism' Unsubscribe case _ of + (Unsubscribe a) -> Just a + _ -> Nothing \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/Plutus/Trace/Emulator/Types.purs b/marlowe-dashboard-client/generated/Plutus/Trace/Emulator/Types.purs new file mode 100644 index 0000000000..1203295477 --- /dev/null +++ b/marlowe-dashboard-client/generated/Plutus/Trace/Emulator/Types.purs @@ -0,0 +1,390 @@ +-- File auto generated by purescript-bridge! -- +module Plutus.Trace.Emulator.Types where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.RawJson (RawJson) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Plutus.Contract.Resumable (Request, Response) +import Plutus.Trace.Scheduler (ThreadId) +import Type.Proxy (Proxy(Proxy)) +import Wallet.Emulator.Error (WalletAPIError) +import Wallet.Emulator.Wallet (Wallet) +import Wallet.Types + ( ContractInstanceId + , EndpointDescription + , Notification + , NotificationError + ) + +newtype ContractInstanceLog = ContractInstanceLog + { _cilMessage :: ContractInstanceMsg + , _cilId :: ContractInstanceId + , _cilTag :: ContractInstanceTag + } + +derive instance eqContractInstanceLog :: Eq ContractInstanceLog + +instance showContractInstanceLog :: Show ContractInstanceLog where + show a = genericShow a + +instance encodeJsonContractInstanceLog :: EncodeJson ContractInstanceLog where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { _cilMessage: E.value :: _ ContractInstanceMsg + , _cilId: E.value :: _ ContractInstanceId + , _cilTag: E.value :: _ ContractInstanceTag + } + ) + +instance decodeJsonContractInstanceLog :: DecodeJson ContractInstanceLog where + decodeJson = defer \_ -> D.decode $ + ( ContractInstanceLog <$> D.record "ContractInstanceLog" + { _cilMessage: D.value :: _ ContractInstanceMsg + , _cilId: D.value :: _ ContractInstanceId + , _cilTag: D.value :: _ ContractInstanceTag + } + ) + +derive instance genericContractInstanceLog :: Generic ContractInstanceLog _ + +derive instance newtypeContractInstanceLog :: Newtype ContractInstanceLog _ + +-------------------------------------------------------------------------------- + +_ContractInstanceLog :: Iso' ContractInstanceLog + { _cilMessage :: ContractInstanceMsg + , _cilId :: ContractInstanceId + , _cilTag :: ContractInstanceTag + } +_ContractInstanceLog = _Newtype + +cilMessage :: Lens' ContractInstanceLog ContractInstanceMsg +cilMessage = _Newtype <<< prop (Proxy :: _ "_cilMessage") + +cilId :: Lens' ContractInstanceLog ContractInstanceId +cilId = _Newtype <<< prop (Proxy :: _ "_cilId") + +cilTag :: Lens' ContractInstanceLog ContractInstanceTag +cilTag = _Newtype <<< prop (Proxy :: _ "_cilTag") + +-------------------------------------------------------------------------------- + +data UserThreadMsg + = UserThreadErr EmulatorRuntimeError + | UserLog String + +derive instance eqUserThreadMsg :: Eq UserThreadMsg + +instance showUserThreadMsg :: Show UserThreadMsg where + show a = genericShow a + +instance encodeJsonUserThreadMsg :: EncodeJson UserThreadMsg where + encodeJson = defer \_ -> case _ of + UserThreadErr a -> E.encodeTagged "UserThreadErr" a E.value + UserLog a -> E.encodeTagged "UserLog" a E.value + +instance decodeJsonUserThreadMsg :: DecodeJson UserThreadMsg where + decodeJson = defer \_ -> D.decode + $ D.sumType "UserThreadMsg" + $ Map.fromFoldable + [ "UserThreadErr" /\ D.content (UserThreadErr <$> D.value) + , "UserLog" /\ D.content (UserLog <$> D.value) + ] + +derive instance genericUserThreadMsg :: Generic UserThreadMsg _ + +-------------------------------------------------------------------------------- + +_UserThreadErr :: Prism' UserThreadMsg EmulatorRuntimeError +_UserThreadErr = prism' UserThreadErr case _ of + (UserThreadErr a) -> Just a + _ -> Nothing + +_UserLog :: Prism' UserThreadMsg String +_UserLog = prism' UserLog case _ of + (UserLog a) -> Just a + _ -> Nothing + +-------------------------------------------------------------------------------- + +data ContractInstanceMsg + = Started + | StoppedNoError + | StoppedWithError String + | ReceiveEndpointCall EndpointDescription RawJson + | ReceiveEndpointCallSuccess + | ReceiveEndpointCallFailure NotificationError + | NoRequestsHandled + | HandledRequest (Response RawJson) + | CurrentRequests (Array (Request RawJson)) + | InstErr EmulatorRuntimeError + | ContractLog RawJson + | SendingNotification Notification + | NotificationSuccess Notification + | NotificationFailure NotificationError + | SendingContractState ThreadId + | Freezing + +derive instance eqContractInstanceMsg :: Eq ContractInstanceMsg + +instance showContractInstanceMsg :: Show ContractInstanceMsg where + show a = genericShow a + +instance encodeJsonContractInstanceMsg :: EncodeJson ContractInstanceMsg where + encodeJson = defer \_ -> case _ of + Started -> encodeJson { tag: "Started", contents: jsonNull } + StoppedNoError -> encodeJson { tag: "StoppedNoError", contents: jsonNull } + StoppedWithError a -> E.encodeTagged "StoppedWithError" a E.value + ReceiveEndpointCall a b -> E.encodeTagged "ReceiveEndpointCall" (a /\ b) + (E.tuple (E.value >/\< E.value)) + ReceiveEndpointCallSuccess -> encodeJson + { tag: "ReceiveEndpointCallSuccess", contents: jsonNull } + ReceiveEndpointCallFailure a -> E.encodeTagged "ReceiveEndpointCallFailure" + a + E.value + NoRequestsHandled -> encodeJson + { tag: "NoRequestsHandled", contents: jsonNull } + HandledRequest a -> E.encodeTagged "HandledRequest" a E.value + CurrentRequests a -> E.encodeTagged "CurrentRequests" a E.value + InstErr a -> E.encodeTagged "InstErr" a E.value + ContractLog a -> E.encodeTagged "ContractLog" a E.value + SendingNotification a -> E.encodeTagged "SendingNotification" a E.value + NotificationSuccess a -> E.encodeTagged "NotificationSuccess" a E.value + NotificationFailure a -> E.encodeTagged "NotificationFailure" a E.value + SendingContractState a -> E.encodeTagged "SendingContractState" a E.value + Freezing -> encodeJson { tag: "Freezing", contents: jsonNull } + +instance decodeJsonContractInstanceMsg :: DecodeJson ContractInstanceMsg where + decodeJson = defer \_ -> D.decode + $ D.sumType "ContractInstanceMsg" + $ Map.fromFoldable + [ "Started" /\ pure Started + , "StoppedNoError" /\ pure StoppedNoError + , "StoppedWithError" /\ D.content (StoppedWithError <$> D.value) + , "ReceiveEndpointCall" /\ D.content + (D.tuple $ ReceiveEndpointCall D.value D.value) + , "ReceiveEndpointCallSuccess" /\ pure ReceiveEndpointCallSuccess + , "ReceiveEndpointCallFailure" /\ D.content + (ReceiveEndpointCallFailure <$> D.value) + , "NoRequestsHandled" /\ pure NoRequestsHandled + , "HandledRequest" /\ D.content (HandledRequest <$> D.value) + , "CurrentRequests" /\ D.content (CurrentRequests <$> D.value) + , "InstErr" /\ D.content (InstErr <$> D.value) + , "ContractLog" /\ D.content (ContractLog <$> D.value) + , "SendingNotification" /\ D.content (SendingNotification <$> D.value) + , "NotificationSuccess" /\ D.content (NotificationSuccess <$> D.value) + , "NotificationFailure" /\ D.content (NotificationFailure <$> D.value) + , "SendingContractState" /\ D.content (SendingContractState <$> D.value) + , "Freezing" /\ pure Freezing + ] + +derive instance genericContractInstanceMsg :: Generic ContractInstanceMsg _ + +-------------------------------------------------------------------------------- + +_Started :: Prism' ContractInstanceMsg Unit +_Started = prism' (const Started) case _ of + Started -> Just unit + _ -> Nothing + +_StoppedNoError :: Prism' ContractInstanceMsg Unit +_StoppedNoError = prism' (const StoppedNoError) case _ of + StoppedNoError -> Just unit + _ -> Nothing + +_StoppedWithError :: Prism' ContractInstanceMsg String +_StoppedWithError = prism' StoppedWithError case _ of + (StoppedWithError a) -> Just a + _ -> Nothing + +_ReceiveEndpointCall :: Prism' ContractInstanceMsg + { a :: EndpointDescription, b :: RawJson } +_ReceiveEndpointCall = prism' (\{ a, b } -> (ReceiveEndpointCall a b)) case _ of + (ReceiveEndpointCall a b) -> Just { a, b } + _ -> Nothing + +_ReceiveEndpointCallSuccess :: Prism' ContractInstanceMsg Unit +_ReceiveEndpointCallSuccess = prism' (const ReceiveEndpointCallSuccess) + case _ of + ReceiveEndpointCallSuccess -> Just unit + _ -> Nothing + +_ReceiveEndpointCallFailure :: Prism' ContractInstanceMsg NotificationError +_ReceiveEndpointCallFailure = prism' ReceiveEndpointCallFailure case _ of + (ReceiveEndpointCallFailure a) -> Just a + _ -> Nothing + +_NoRequestsHandled :: Prism' ContractInstanceMsg Unit +_NoRequestsHandled = prism' (const NoRequestsHandled) case _ of + NoRequestsHandled -> Just unit + _ -> Nothing + +_HandledRequest :: Prism' ContractInstanceMsg (Response RawJson) +_HandledRequest = prism' HandledRequest case _ of + (HandledRequest a) -> Just a + _ -> Nothing + +_CurrentRequests :: Prism' ContractInstanceMsg (Array (Request RawJson)) +_CurrentRequests = prism' CurrentRequests case _ of + (CurrentRequests a) -> Just a + _ -> Nothing + +_InstErr :: Prism' ContractInstanceMsg EmulatorRuntimeError +_InstErr = prism' InstErr case _ of + (InstErr a) -> Just a + _ -> Nothing + +_ContractLog :: Prism' ContractInstanceMsg RawJson +_ContractLog = prism' ContractLog case _ of + (ContractLog a) -> Just a + _ -> Nothing + +_SendingNotification :: Prism' ContractInstanceMsg Notification +_SendingNotification = prism' SendingNotification case _ of + (SendingNotification a) -> Just a + _ -> Nothing + +_NotificationSuccess :: Prism' ContractInstanceMsg Notification +_NotificationSuccess = prism' NotificationSuccess case _ of + (NotificationSuccess a) -> Just a + _ -> Nothing + +_NotificationFailure :: Prism' ContractInstanceMsg NotificationError +_NotificationFailure = prism' NotificationFailure case _ of + (NotificationFailure a) -> Just a + _ -> Nothing + +_SendingContractState :: Prism' ContractInstanceMsg ThreadId +_SendingContractState = prism' SendingContractState case _ of + (SendingContractState a) -> Just a + _ -> Nothing + +_Freezing :: Prism' ContractInstanceMsg Unit +_Freezing = prism' (const Freezing) case _ of + Freezing -> Just unit + _ -> Nothing + +-------------------------------------------------------------------------------- + +newtype ContractInstanceTag = ContractInstanceTag + { unContractInstanceTag :: String } + +derive instance eqContractInstanceTag :: Eq ContractInstanceTag + +instance showContractInstanceTag :: Show ContractInstanceTag where + show a = genericShow a + +instance encodeJsonContractInstanceTag :: EncodeJson ContractInstanceTag where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { unContractInstanceTag: E.value :: _ String } + ) + +instance decodeJsonContractInstanceTag :: DecodeJson ContractInstanceTag where + decodeJson = defer \_ -> D.decode $ + ( ContractInstanceTag <$> D.record "ContractInstanceTag" + { unContractInstanceTag: D.value :: _ String } + ) + +derive instance genericContractInstanceTag :: Generic ContractInstanceTag _ + +derive instance newtypeContractInstanceTag :: Newtype ContractInstanceTag _ + +-------------------------------------------------------------------------------- + +_ContractInstanceTag :: Iso' ContractInstanceTag + { unContractInstanceTag :: String } +_ContractInstanceTag = _Newtype + +-------------------------------------------------------------------------------- + +data EmulatorRuntimeError + = ThreadIdNotFound ContractInstanceId + | InstanceIdNotFound Wallet + | EmulatorJSONDecodingError String RawJson + | GenericError String + | EmulatedWalletError WalletAPIError + | AssertionError String + +derive instance eqEmulatorRuntimeError :: Eq EmulatorRuntimeError + +instance showEmulatorRuntimeError :: Show EmulatorRuntimeError where + show a = genericShow a + +instance encodeJsonEmulatorRuntimeError :: EncodeJson EmulatorRuntimeError where + encodeJson = defer \_ -> case _ of + ThreadIdNotFound a -> E.encodeTagged "ThreadIdNotFound" a E.value + InstanceIdNotFound a -> E.encodeTagged "InstanceIdNotFound" a E.value + EmulatorJSONDecodingError a b -> E.encodeTagged "EmulatorJSONDecodingError" + (a /\ b) + (E.tuple (E.value >/\< E.value)) + GenericError a -> E.encodeTagged "GenericError" a E.value + EmulatedWalletError a -> E.encodeTagged "EmulatedWalletError" a E.value + AssertionError a -> E.encodeTagged "AssertionError" a E.value + +instance decodeJsonEmulatorRuntimeError :: DecodeJson EmulatorRuntimeError where + decodeJson = defer \_ -> D.decode + $ D.sumType "EmulatorRuntimeError" + $ Map.fromFoldable + [ "ThreadIdNotFound" /\ D.content (ThreadIdNotFound <$> D.value) + , "InstanceIdNotFound" /\ D.content (InstanceIdNotFound <$> D.value) + , "EmulatorJSONDecodingError" /\ D.content + (D.tuple $ EmulatorJSONDecodingError D.value D.value) + , "GenericError" /\ D.content (GenericError <$> D.value) + , "EmulatedWalletError" /\ D.content (EmulatedWalletError <$> D.value) + , "AssertionError" /\ D.content (AssertionError <$> D.value) + ] + +derive instance genericEmulatorRuntimeError :: Generic EmulatorRuntimeError _ + +-------------------------------------------------------------------------------- + +_ThreadIdNotFound :: Prism' EmulatorRuntimeError ContractInstanceId +_ThreadIdNotFound = prism' ThreadIdNotFound case _ of + (ThreadIdNotFound a) -> Just a + _ -> Nothing + +_InstanceIdNotFound :: Prism' EmulatorRuntimeError Wallet +_InstanceIdNotFound = prism' InstanceIdNotFound case _ of + (InstanceIdNotFound a) -> Just a + _ -> Nothing + +_EmulatorJSONDecodingError :: Prism' EmulatorRuntimeError + { a :: String, b :: RawJson } +_EmulatorJSONDecodingError = prism' + (\{ a, b } -> (EmulatorJSONDecodingError a b)) + case _ of + (EmulatorJSONDecodingError a b) -> Just { a, b } + _ -> Nothing + +_GenericError :: Prism' EmulatorRuntimeError String +_GenericError = prism' GenericError case _ of + (GenericError a) -> Just a + _ -> Nothing + +_EmulatedWalletError :: Prism' EmulatorRuntimeError WalletAPIError +_EmulatedWalletError = prism' EmulatedWalletError case _ of + (EmulatedWalletError a) -> Just a + _ -> Nothing + +_AssertionError :: Prism' EmulatorRuntimeError String +_AssertionError = prism' AssertionError case _ of + (AssertionError a) -> Just a + _ -> Nothing \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/Plutus/Trace/Scheduler.purs b/marlowe-dashboard-client/generated/Plutus/Trace/Scheduler.purs new file mode 100644 index 0000000000..b8d8985414 --- /dev/null +++ b/marlowe-dashboard-client/generated/Plutus/Trace/Scheduler.purs @@ -0,0 +1,251 @@ +-- File auto generated by purescript-bridge! -- +module Plutus.Trace.Scheduler where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Bounded.Generic (genericBottom, genericTop) +import Data.Enum (class Enum) +import Data.Enum.Generic (genericPred, genericSucc) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Plutus.Trace.Tag (Tag) +import Type.Proxy (Proxy(Proxy)) + +newtype SchedulerLog = SchedulerLog + { slEvent :: ThreadEvent + , slThread :: ThreadId + , slTag :: Tag + , slPrio :: Priority + } + +derive instance eqSchedulerLog :: Eq SchedulerLog + +instance showSchedulerLog :: Show SchedulerLog where + show a = genericShow a + +instance encodeJsonSchedulerLog :: EncodeJson SchedulerLog where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { slEvent: E.value :: _ ThreadEvent + , slThread: E.value :: _ ThreadId + , slTag: E.value :: _ Tag + , slPrio: E.value :: _ Priority + } + ) + +instance decodeJsonSchedulerLog :: DecodeJson SchedulerLog where + decodeJson = defer \_ -> D.decode $ + ( SchedulerLog <$> D.record "SchedulerLog" + { slEvent: D.value :: _ ThreadEvent + , slThread: D.value :: _ ThreadId + , slTag: D.value :: _ Tag + , slPrio: D.value :: _ Priority + } + ) + +derive instance genericSchedulerLog :: Generic SchedulerLog _ + +derive instance newtypeSchedulerLog :: Newtype SchedulerLog _ + +-------------------------------------------------------------------------------- + +_SchedulerLog :: Iso' SchedulerLog + { slEvent :: ThreadEvent + , slThread :: ThreadId + , slTag :: Tag + , slPrio :: Priority + } +_SchedulerLog = _Newtype + +-------------------------------------------------------------------------------- + +data ThreadEvent + = Stopped StopReason + | Resumed + | Suspended + | Started + | Thawed + +derive instance eqThreadEvent :: Eq ThreadEvent + +instance showThreadEvent :: Show ThreadEvent where + show a = genericShow a + +instance encodeJsonThreadEvent :: EncodeJson ThreadEvent where + encodeJson = defer \_ -> case _ of + Stopped a -> E.encodeTagged "Stopped" a E.value + Resumed -> encodeJson { tag: "Resumed", contents: jsonNull } + Suspended -> encodeJson { tag: "Suspended", contents: jsonNull } + Started -> encodeJson { tag: "Started", contents: jsonNull } + Thawed -> encodeJson { tag: "Thawed", contents: jsonNull } + +instance decodeJsonThreadEvent :: DecodeJson ThreadEvent where + decodeJson = defer \_ -> D.decode + $ D.sumType "ThreadEvent" + $ Map.fromFoldable + [ "Stopped" /\ D.content (Stopped <$> D.value) + , "Resumed" /\ pure Resumed + , "Suspended" /\ pure Suspended + , "Started" /\ pure Started + , "Thawed" /\ pure Thawed + ] + +derive instance genericThreadEvent :: Generic ThreadEvent _ + +-------------------------------------------------------------------------------- + +_Stopped :: Prism' ThreadEvent StopReason +_Stopped = prism' Stopped case _ of + (Stopped a) -> Just a + _ -> Nothing + +_Resumed :: Prism' ThreadEvent Unit +_Resumed = prism' (const Resumed) case _ of + Resumed -> Just unit + _ -> Nothing + +_Suspended :: Prism' ThreadEvent Unit +_Suspended = prism' (const Suspended) case _ of + Suspended -> Just unit + _ -> Nothing + +_Started :: Prism' ThreadEvent Unit +_Started = prism' (const Started) case _ of + Started -> Just unit + _ -> Nothing + +_Thawed :: Prism' ThreadEvent Unit +_Thawed = prism' (const Thawed) case _ of + Thawed -> Just unit + _ -> Nothing + +-------------------------------------------------------------------------------- + +newtype ThreadId = ThreadId { unThreadId :: Int } + +derive instance eqThreadId :: Eq ThreadId + +instance showThreadId :: Show ThreadId where + show a = genericShow a + +instance encodeJsonThreadId :: EncodeJson ThreadId where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { unThreadId: E.value :: _ Int } + ) + +instance decodeJsonThreadId :: DecodeJson ThreadId where + decodeJson = defer \_ -> D.decode $ + (ThreadId <$> D.record "ThreadId" { unThreadId: D.value :: _ Int }) + +derive instance genericThreadId :: Generic ThreadId _ + +derive instance newtypeThreadId :: Newtype ThreadId _ + +-------------------------------------------------------------------------------- + +_ThreadId :: Iso' ThreadId { unThreadId :: Int } +_ThreadId = _Newtype + +-------------------------------------------------------------------------------- + +data Priority + = Normal + | Sleeping + | Frozen + +derive instance eqPriority :: Eq Priority + +derive instance ordPriority :: Ord Priority + +instance showPriority :: Show Priority where + show a = genericShow a + +instance encodeJsonPriority :: EncodeJson Priority where + encodeJson = defer \_ -> E.encode E.enum + +instance decodeJsonPriority :: DecodeJson Priority where + decodeJson = defer \_ -> D.decode D.enum + +derive instance genericPriority :: Generic Priority _ + +instance enumPriority :: Enum Priority where + succ = genericSucc + pred = genericPred + +instance boundedPriority :: Bounded Priority where + bottom = genericBottom + top = genericTop + +-------------------------------------------------------------------------------- + +_Normal :: Prism' Priority Unit +_Normal = prism' (const Normal) case _ of + Normal -> Just unit + _ -> Nothing + +_Sleeping :: Prism' Priority Unit +_Sleeping = prism' (const Sleeping) case _ of + Sleeping -> Just unit + _ -> Nothing + +_Frozen :: Prism' Priority Unit +_Frozen = prism' (const Frozen) case _ of + Frozen -> Just unit + _ -> Nothing + +-------------------------------------------------------------------------------- + +data StopReason + = ThreadDone + | ThreadExit + +derive instance eqStopReason :: Eq StopReason + +derive instance ordStopReason :: Ord StopReason + +instance showStopReason :: Show StopReason where + show a = genericShow a + +instance encodeJsonStopReason :: EncodeJson StopReason where + encodeJson = defer \_ -> E.encode E.enum + +instance decodeJsonStopReason :: DecodeJson StopReason where + decodeJson = defer \_ -> D.decode D.enum + +derive instance genericStopReason :: Generic StopReason _ + +instance enumStopReason :: Enum StopReason where + succ = genericSucc + pred = genericPred + +instance boundedStopReason :: Bounded StopReason where + bottom = genericBottom + top = genericTop + +-------------------------------------------------------------------------------- + +_ThreadDone :: Prism' StopReason Unit +_ThreadDone = prism' (const ThreadDone) case _ of + ThreadDone -> Just unit + _ -> Nothing + +_ThreadExit :: Prism' StopReason Unit +_ThreadExit = prism' (const ThreadExit) case _ of + ThreadExit -> Just unit + _ -> Nothing \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/Plutus/Trace/Tag.purs b/marlowe-dashboard-client/generated/Plutus/Trace/Tag.purs new file mode 100644 index 0000000000..dc26d9e3a9 --- /dev/null +++ b/marlowe-dashboard-client/generated/Plutus/Trace/Tag.purs @@ -0,0 +1,49 @@ +-- File auto generated by purescript-bridge! -- +module Plutus.Trace.Tag where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Type.Proxy (Proxy(Proxy)) + +newtype Tag = Tag { unTag :: String } + +derive instance eqTag :: Eq Tag + +instance showTag :: Show Tag where + show a = genericShow a + +instance encodeJsonTag :: EncodeJson Tag where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { unTag: E.value :: _ String } + ) + +instance decodeJsonTag :: DecodeJson Tag where + decodeJson = defer \_ -> D.decode $ + (Tag <$> D.record "Tag" { unTag: D.value :: _ String }) + +derive instance genericTag :: Generic Tag _ + +derive instance newtypeTag :: Newtype Tag _ + +-------------------------------------------------------------------------------- + +_Tag :: Iso' Tag { unTag :: String } +_Tag = _Newtype \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/Plutus/V1/Ledger/Ada.purs b/marlowe-dashboard-client/generated/Plutus/V1/Ledger/Ada.purs new file mode 100644 index 0000000000..42e7714417 --- /dev/null +++ b/marlowe-dashboard-client/generated/Plutus/V1/Ledger/Ada.purs @@ -0,0 +1,50 @@ +-- File auto generated by purescript-bridge! -- +module Plutus.V1.Ledger.Ada where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.BigInt.Argonaut (BigInt) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Type.Proxy (Proxy(Proxy)) + +newtype Ada = Lovelace { getLovelace :: BigInt } + +derive instance eqAda :: Eq Ada + +instance showAda :: Show Ada where + show a = genericShow a + +instance encodeJsonAda :: EncodeJson Ada where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { getLovelace: E.value :: _ BigInt } + ) + +instance decodeJsonAda :: DecodeJson Ada where + decodeJson = defer \_ -> D.decode $ + (Lovelace <$> D.record "Lovelace" { getLovelace: D.value :: _ BigInt }) + +derive instance genericAda :: Generic Ada _ + +derive instance newtypeAda :: Newtype Ada _ + +-------------------------------------------------------------------------------- + +_Lovelace :: Iso' Ada { getLovelace :: BigInt } +_Lovelace = _Newtype \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/Plutus/V1/Ledger/Address.purs b/marlowe-dashboard-client/generated/Plutus/V1/Ledger/Address.purs new file mode 100644 index 0000000000..6fac16888d --- /dev/null +++ b/marlowe-dashboard-client/generated/Plutus/V1/Ledger/Address.purs @@ -0,0 +1,66 @@ +-- File auto generated by purescript-bridge! -- +module Plutus.V1.Ledger.Address where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Plutus.V1.Ledger.Credential (Credential, StakingCredential) +import Type.Proxy (Proxy(Proxy)) + +newtype Address = Address + { addressCredential :: Credential + , addressStakingCredential :: Maybe StakingCredential + } + +derive instance eqAddress :: Eq Address + +derive instance ordAddress :: Ord Address + +instance showAddress :: Show Address where + show a = genericShow a + +instance encodeJsonAddress :: EncodeJson Address where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { addressCredential: E.value :: _ Credential + , addressStakingCredential: + (E.maybe E.value) :: _ (Maybe StakingCredential) + } + ) + +instance decodeJsonAddress :: DecodeJson Address where + decodeJson = defer \_ -> D.decode $ + ( Address <$> D.record "Address" + { addressCredential: D.value :: _ Credential + , addressStakingCredential: + (D.maybe D.value) :: _ (Maybe StakingCredential) + } + ) + +derive instance genericAddress :: Generic Address _ + +derive instance newtypeAddress :: Newtype Address _ + +-------------------------------------------------------------------------------- + +_Address :: Iso' Address + { addressCredential :: Credential + , addressStakingCredential :: Maybe StakingCredential + } +_Address = _Newtype \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/Plutus/V1/Ledger/Credential.purs b/marlowe-dashboard-client/generated/Plutus/V1/Ledger/Credential.purs new file mode 100644 index 0000000000..c19b3e3c7e --- /dev/null +++ b/marlowe-dashboard-client/generated/Plutus/V1/Ledger/Credential.purs @@ -0,0 +1,106 @@ +-- File auto generated by purescript-bridge! -- +module Plutus.V1.Ledger.Credential where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.BigInt.Argonaut (BigInt) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Plutus.V1.Ledger.Crypto (PubKeyHash) +import Type.Proxy (Proxy(Proxy)) + +data Credential + = PubKeyCredential PubKeyHash + | ScriptCredential String + +derive instance eqCredential :: Eq Credential + +derive instance ordCredential :: Ord Credential + +instance showCredential :: Show Credential where + show a = genericShow a + +instance encodeJsonCredential :: EncodeJson Credential where + encodeJson = defer \_ -> case _ of + PubKeyCredential a -> E.encodeTagged "PubKeyCredential" a E.value + ScriptCredential a -> E.encodeTagged "ScriptCredential" a E.value + +instance decodeJsonCredential :: DecodeJson Credential where + decodeJson = defer \_ -> D.decode + $ D.sumType "Credential" + $ Map.fromFoldable + [ "PubKeyCredential" /\ D.content (PubKeyCredential <$> D.value) + , "ScriptCredential" /\ D.content (ScriptCredential <$> D.value) + ] + +derive instance genericCredential :: Generic Credential _ + +-------------------------------------------------------------------------------- + +_PubKeyCredential :: Prism' Credential PubKeyHash +_PubKeyCredential = prism' PubKeyCredential case _ of + (PubKeyCredential a) -> Just a + _ -> Nothing + +_ScriptCredential :: Prism' Credential String +_ScriptCredential = prism' ScriptCredential case _ of + (ScriptCredential a) -> Just a + _ -> Nothing + +-------------------------------------------------------------------------------- + +data StakingCredential + = StakingHash Credential + | StakingPtr BigInt BigInt BigInt + +derive instance eqStakingCredential :: Eq StakingCredential + +derive instance ordStakingCredential :: Ord StakingCredential + +instance showStakingCredential :: Show StakingCredential where + show a = genericShow a + +instance encodeJsonStakingCredential :: EncodeJson StakingCredential where + encodeJson = defer \_ -> case _ of + StakingHash a -> E.encodeTagged "StakingHash" a E.value + StakingPtr a b c -> E.encodeTagged "StakingPtr" (a /\ b /\ c) + (E.tuple (E.value >/\< E.value >/\< E.value)) + +instance decodeJsonStakingCredential :: DecodeJson StakingCredential where + decodeJson = defer \_ -> D.decode + $ D.sumType "StakingCredential" + $ Map.fromFoldable + [ "StakingHash" /\ D.content (StakingHash <$> D.value) + , "StakingPtr" /\ D.content + (D.tuple $ StakingPtr D.value D.value D.value) + ] + +derive instance genericStakingCredential :: Generic StakingCredential _ + +-------------------------------------------------------------------------------- + +_StakingHash :: Prism' StakingCredential Credential +_StakingHash = prism' StakingHash case _ of + (StakingHash a) -> Just a + _ -> Nothing + +_StakingPtr :: Prism' StakingCredential + { a :: BigInt, b :: BigInt, c :: BigInt } +_StakingPtr = prism' (\{ a, b, c } -> (StakingPtr a b c)) case _ of + (StakingPtr a b c) -> Just { a, b, c } + _ -> Nothing \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/Plutus/V1/Ledger/Crypto.purs b/marlowe-dashboard-client/generated/Plutus/V1/Ledger/Crypto.purs new file mode 100644 index 0000000000..529e3bc054 --- /dev/null +++ b/marlowe-dashboard-client/generated/Plutus/V1/Ledger/Crypto.purs @@ -0,0 +1,113 @@ +-- File auto generated by purescript-bridge! -- +module Plutus.V1.Ledger.Crypto where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Type.Proxy (Proxy(Proxy)) + +newtype Signature = Signature { getSignature :: String } + +instance showSignature :: Show Signature where + show a = genericShow a + +derive instance eqSignature :: Eq Signature + +derive instance ordSignature :: Ord Signature + +instance encodeJsonSignature :: EncodeJson Signature where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { getSignature: E.value :: _ String } + ) + +instance decodeJsonSignature :: DecodeJson Signature where + decodeJson = defer \_ -> D.decode $ + (Signature <$> D.record "Signature" { getSignature: D.value :: _ String }) + +derive instance genericSignature :: Generic Signature _ + +derive instance newtypeSignature :: Newtype Signature _ + +-------------------------------------------------------------------------------- + +_Signature :: Iso' Signature { getSignature :: String } +_Signature = _Newtype + +-------------------------------------------------------------------------------- + +newtype PubKey = PubKey { getPubKey :: String } + +derive instance eqPubKey :: Eq PubKey + +derive instance ordPubKey :: Ord PubKey + +instance showPubKey :: Show PubKey where + show a = genericShow a + +instance encodeJsonPubKey :: EncodeJson PubKey where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { getPubKey: E.value :: _ String } + ) + +instance decodeJsonPubKey :: DecodeJson PubKey where + decodeJson = defer \_ -> D.decode $ + (PubKey <$> D.record "PubKey" { getPubKey: D.value :: _ String }) + +derive instance genericPubKey :: Generic PubKey _ + +derive instance newtypePubKey :: Newtype PubKey _ + +-------------------------------------------------------------------------------- + +_PubKey :: Iso' PubKey { getPubKey :: String } +_PubKey = _Newtype + +-------------------------------------------------------------------------------- + +newtype PubKeyHash = PubKeyHash { getPubKeyHash :: String } + +derive instance eqPubKeyHash :: Eq PubKeyHash + +derive instance ordPubKeyHash :: Ord PubKeyHash + +instance showPubKeyHash :: Show PubKeyHash where + show a = genericShow a + +instance encodeJsonPubKeyHash :: EncodeJson PubKeyHash where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { getPubKeyHash: E.value :: _ String } + ) + +instance decodeJsonPubKeyHash :: DecodeJson PubKeyHash where + decodeJson = defer \_ -> D.decode $ + ( PubKeyHash <$> D.record "PubKeyHash" + { getPubKeyHash: D.value :: _ String } + ) + +derive instance genericPubKeyHash :: Generic PubKeyHash _ + +derive instance newtypePubKeyHash :: Newtype PubKeyHash _ + +-------------------------------------------------------------------------------- + +_PubKeyHash :: Iso' PubKeyHash { getPubKeyHash :: String } +_PubKeyHash = _Newtype \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/Plutus/V1/Ledger/DCert.purs b/marlowe-dashboard-client/generated/Plutus/V1/Ledger/DCert.purs new file mode 100644 index 0000000000..4fdc57cf12 --- /dev/null +++ b/marlowe-dashboard-client/generated/Plutus/V1/Ledger/DCert.purs @@ -0,0 +1,110 @@ +-- File auto generated by purescript-bridge! -- +module Plutus.V1.Ledger.DCert where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.BigInt.Argonaut (BigInt) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Plutus.V1.Ledger.Credential (StakingCredential) +import Plutus.V1.Ledger.Crypto (PubKeyHash) +import Type.Proxy (Proxy(Proxy)) + +data DCert + = DCertDelegRegKey StakingCredential + | DCertDelegDeRegKey StakingCredential + | DCertDelegDelegate StakingCredential PubKeyHash + | DCertPoolRegister PubKeyHash PubKeyHash + | DCertPoolRetire PubKeyHash BigInt + | DCertGenesis + | DCertMir + +derive instance eqDCert :: Eq DCert + +derive instance ordDCert :: Ord DCert + +instance showDCert :: Show DCert where + show a = genericShow a + +instance encodeJsonDCert :: EncodeJson DCert where + encodeJson = defer \_ -> case _ of + DCertDelegRegKey a -> E.encodeTagged "DCertDelegRegKey" a E.value + DCertDelegDeRegKey a -> E.encodeTagged "DCertDelegDeRegKey" a E.value + DCertDelegDelegate a b -> E.encodeTagged "DCertDelegDelegate" (a /\ b) + (E.tuple (E.value >/\< E.value)) + DCertPoolRegister a b -> E.encodeTagged "DCertPoolRegister" (a /\ b) + (E.tuple (E.value >/\< E.value)) + DCertPoolRetire a b -> E.encodeTagged "DCertPoolRetire" (a /\ b) + (E.tuple (E.value >/\< E.value)) + DCertGenesis -> encodeJson { tag: "DCertGenesis", contents: jsonNull } + DCertMir -> encodeJson { tag: "DCertMir", contents: jsonNull } + +instance decodeJsonDCert :: DecodeJson DCert where + decodeJson = defer \_ -> D.decode + $ D.sumType "DCert" + $ Map.fromFoldable + [ "DCertDelegRegKey" /\ D.content (DCertDelegRegKey <$> D.value) + , "DCertDelegDeRegKey" /\ D.content (DCertDelegDeRegKey <$> D.value) + , "DCertDelegDelegate" /\ D.content + (D.tuple $ DCertDelegDelegate D.value D.value) + , "DCertPoolRegister" /\ D.content + (D.tuple $ DCertPoolRegister D.value D.value) + , "DCertPoolRetire" /\ D.content + (D.tuple $ DCertPoolRetire D.value D.value) + , "DCertGenesis" /\ pure DCertGenesis + , "DCertMir" /\ pure DCertMir + ] + +derive instance genericDCert :: Generic DCert _ + +-------------------------------------------------------------------------------- + +_DCertDelegRegKey :: Prism' DCert StakingCredential +_DCertDelegRegKey = prism' DCertDelegRegKey case _ of + (DCertDelegRegKey a) -> Just a + _ -> Nothing + +_DCertDelegDeRegKey :: Prism' DCert StakingCredential +_DCertDelegDeRegKey = prism' DCertDelegDeRegKey case _ of + (DCertDelegDeRegKey a) -> Just a + _ -> Nothing + +_DCertDelegDelegate :: Prism' DCert { a :: StakingCredential, b :: PubKeyHash } +_DCertDelegDelegate = prism' (\{ a, b } -> (DCertDelegDelegate a b)) case _ of + (DCertDelegDelegate a b) -> Just { a, b } + _ -> Nothing + +_DCertPoolRegister :: Prism' DCert { a :: PubKeyHash, b :: PubKeyHash } +_DCertPoolRegister = prism' (\{ a, b } -> (DCertPoolRegister a b)) case _ of + (DCertPoolRegister a b) -> Just { a, b } + _ -> Nothing + +_DCertPoolRetire :: Prism' DCert { a :: PubKeyHash, b :: BigInt } +_DCertPoolRetire = prism' (\{ a, b } -> (DCertPoolRetire a b)) case _ of + (DCertPoolRetire a b) -> Just { a, b } + _ -> Nothing + +_DCertGenesis :: Prism' DCert Unit +_DCertGenesis = prism' (const DCertGenesis) case _ of + DCertGenesis -> Just unit + _ -> Nothing + +_DCertMir :: Prism' DCert Unit +_DCertMir = prism' (const DCertMir) case _ of + DCertMir -> Just unit + _ -> Nothing \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/Plutus/V1/Ledger/Interval.purs b/marlowe-dashboard-client/generated/Plutus/V1/Ledger/Interval.purs new file mode 100644 index 0000000000..80192b7db1 --- /dev/null +++ b/marlowe-dashboard-client/generated/Plutus/V1/Ledger/Interval.purs @@ -0,0 +1,164 @@ +-- File auto generated by purescript-bridge! -- +module Plutus.V1.Ledger.Interval where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Type.Proxy (Proxy(Proxy)) + +data Extended a + = NegInf + | Finite a + | PosInf + +derive instance functorExtended :: Functor Extended + +derive instance eqExtended :: (Eq a) => Eq (Extended a) + +instance showExtended :: (Show a) => Show (Extended a) where + show a = genericShow a + +instance encodeJsonExtended :: (EncodeJson a) => EncodeJson (Extended a) where + encodeJson = defer \_ -> case _ of + NegInf -> encodeJson { tag: "NegInf", contents: jsonNull } + Finite a -> E.encodeTagged "Finite" a E.value + PosInf -> encodeJson { tag: "PosInf", contents: jsonNull } + +instance decodeJsonExtended :: (DecodeJson a) => DecodeJson (Extended a) where + decodeJson = defer \_ -> D.decode + $ D.sumType "Extended" + $ Map.fromFoldable + [ "NegInf" /\ pure NegInf + , "Finite" /\ D.content (Finite <$> D.value) + , "PosInf" /\ pure PosInf + ] + +derive instance genericExtended :: Generic (Extended a) _ + +-------------------------------------------------------------------------------- + +_NegInf :: forall a. Prism' (Extended a) Unit +_NegInf = prism' (const NegInf) case _ of + NegInf -> Just unit + _ -> Nothing + +_Finite :: forall a. Prism' (Extended a) a +_Finite = prism' Finite case _ of + (Finite a) -> Just a + _ -> Nothing + +_PosInf :: forall a. Prism' (Extended a) Unit +_PosInf = prism' (const PosInf) case _ of + PosInf -> Just unit + _ -> Nothing + +-------------------------------------------------------------------------------- + +newtype Interval a = Interval + { ivFrom :: LowerBound a + , ivTo :: UpperBound a + } + +derive instance functorInterval :: Functor Interval + +derive instance eqInterval :: (Eq a) => Eq (Interval a) + +instance showInterval :: (Show a) => Show (Interval a) where + show a = genericShow a + +instance encodeJsonInterval :: (EncodeJson a) => EncodeJson (Interval a) where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { ivFrom: E.value :: _ (LowerBound a) + , ivTo: E.value :: _ (UpperBound a) + } + ) + +instance decodeJsonInterval :: (DecodeJson a) => DecodeJson (Interval a) where + decodeJson = defer \_ -> D.decode $ + ( Interval <$> D.record "Interval" + { ivFrom: D.value :: _ (LowerBound a) + , ivTo: D.value :: _ (UpperBound a) + } + ) + +derive instance genericInterval :: Generic (Interval a) _ + +derive instance newtypeInterval :: Newtype (Interval a) _ + +-------------------------------------------------------------------------------- + +_Interval + :: forall a + . Iso' (Interval a) { ivFrom :: LowerBound a, ivTo :: UpperBound a } +_Interval = _Newtype + +-------------------------------------------------------------------------------- + +data LowerBound a = LowerBound (Extended a) Boolean + +derive instance functorLowerBound :: Functor LowerBound + +derive instance eqLowerBound :: (Eq a) => Eq (LowerBound a) + +instance showLowerBound :: (Show a) => Show (LowerBound a) where + show a = genericShow a + +instance encodeJsonLowerBound :: (EncodeJson a) => EncodeJson (LowerBound a) where + encodeJson = defer \_ -> E.encode $ (case _ of LowerBound a b -> (a /\ b)) >$< + (E.tuple (E.value >/\< E.value)) + +instance decodeJsonLowerBound :: (DecodeJson a) => DecodeJson (LowerBound a) where + decodeJson = defer \_ -> D.decode $ + (D.tuple $ LowerBound D.value D.value) + +derive instance genericLowerBound :: Generic (LowerBound a) _ + +-------------------------------------------------------------------------------- + +_LowerBound :: forall a. Iso' (LowerBound a) { a :: Extended a, b :: Boolean } +_LowerBound = iso (\(LowerBound a b) -> { a, b }) + (\{ a, b } -> (LowerBound a b)) + +-------------------------------------------------------------------------------- + +data UpperBound a = UpperBound (Extended a) Boolean + +derive instance functorUpperBound :: Functor UpperBound + +derive instance eqUpperBound :: (Eq a) => Eq (UpperBound a) + +instance showUpperBound :: (Show a) => Show (UpperBound a) where + show a = genericShow a + +instance encodeJsonUpperBound :: (EncodeJson a) => EncodeJson (UpperBound a) where + encodeJson = defer \_ -> E.encode $ (case _ of UpperBound a b -> (a /\ b)) >$< + (E.tuple (E.value >/\< E.value)) + +instance decodeJsonUpperBound :: (DecodeJson a) => DecodeJson (UpperBound a) where + decodeJson = defer \_ -> D.decode $ + (D.tuple $ UpperBound D.value D.value) + +derive instance genericUpperBound :: Generic (UpperBound a) _ + +-------------------------------------------------------------------------------- + +_UpperBound :: forall a. Iso' (UpperBound a) { a :: Extended a, b :: Boolean } +_UpperBound = iso (\(UpperBound a b) -> { a, b }) + (\{ a, b } -> (UpperBound a b)) \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/Plutus/V1/Ledger/Scripts.purs b/marlowe-dashboard-client/generated/Plutus/V1/Ledger/Scripts.purs new file mode 100644 index 0000000000..78cee06917 --- /dev/null +++ b/marlowe-dashboard-client/generated/Plutus/V1/Ledger/Scripts.purs @@ -0,0 +1,191 @@ +-- File auto generated by purescript-bridge! -- +module Plutus.V1.Ledger.Scripts where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Type.Proxy (Proxy(Proxy)) + +newtype MintingPolicy = MintingPolicy { getMintingPolicy :: String } + +instance showMintingPolicy :: Show MintingPolicy where + show a = genericShow a + +derive instance eqMintingPolicy :: Eq MintingPolicy + +derive instance ordMintingPolicy :: Ord MintingPolicy + +instance encodeJsonMintingPolicy :: EncodeJson MintingPolicy where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { getMintingPolicy: E.value :: _ String } + ) + +instance decodeJsonMintingPolicy :: DecodeJson MintingPolicy where + decodeJson = defer \_ -> D.decode $ + ( MintingPolicy <$> D.record "MintingPolicy" + { getMintingPolicy: D.value :: _ String } + ) + +derive instance genericMintingPolicy :: Generic MintingPolicy _ + +derive instance newtypeMintingPolicy :: Newtype MintingPolicy _ + +-------------------------------------------------------------------------------- + +_MintingPolicy :: Iso' MintingPolicy { getMintingPolicy :: String } +_MintingPolicy = _Newtype + +-------------------------------------------------------------------------------- + +newtype StakeValidator = StakeValidator { getStakeValidator :: String } + +instance showStakeValidator :: Show StakeValidator where + show a = genericShow a + +derive instance eqStakeValidator :: Eq StakeValidator + +derive instance ordStakeValidator :: Ord StakeValidator + +instance encodeJsonStakeValidator :: EncodeJson StakeValidator where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { getStakeValidator: E.value :: _ String } + ) + +instance decodeJsonStakeValidator :: DecodeJson StakeValidator where + decodeJson = defer \_ -> D.decode $ + ( StakeValidator <$> D.record "StakeValidator" + { getStakeValidator: D.value :: _ String } + ) + +derive instance genericStakeValidator :: Generic StakeValidator _ + +derive instance newtypeStakeValidator :: Newtype StakeValidator _ + +-------------------------------------------------------------------------------- + +_StakeValidator :: Iso' StakeValidator { getStakeValidator :: String } +_StakeValidator = _Newtype + +-------------------------------------------------------------------------------- + +newtype Validator = Validator { getValidator :: String } + +instance showValidator :: Show Validator where + show a = genericShow a + +derive instance eqValidator :: Eq Validator + +derive instance ordValidator :: Ord Validator + +instance encodeJsonValidator :: EncodeJson Validator where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { getValidator: E.value :: _ String } + ) + +instance decodeJsonValidator :: DecodeJson Validator where + decodeJson = defer \_ -> D.decode $ + (Validator <$> D.record "Validator" { getValidator: D.value :: _ String }) + +derive instance genericValidator :: Generic Validator _ + +derive instance newtypeValidator :: Newtype Validator _ + +-------------------------------------------------------------------------------- + +_Validator :: Iso' Validator { getValidator :: String } +_Validator = _Newtype + +-------------------------------------------------------------------------------- + +data ScriptError + = EvaluationError (Array String) String + | EvaluationException String String + | MalformedScript String + +derive instance eqScriptError :: Eq ScriptError + +instance showScriptError :: Show ScriptError where + show a = genericShow a + +instance encodeJsonScriptError :: EncodeJson ScriptError where + encodeJson = defer \_ -> case _ of + EvaluationError a b -> E.encodeTagged "EvaluationError" (a /\ b) + (E.tuple (E.value >/\< E.value)) + EvaluationException a b -> E.encodeTagged "EvaluationException" (a /\ b) + (E.tuple (E.value >/\< E.value)) + MalformedScript a -> E.encodeTagged "MalformedScript" a E.value + +instance decodeJsonScriptError :: DecodeJson ScriptError where + decodeJson = defer \_ -> D.decode + $ D.sumType "ScriptError" + $ Map.fromFoldable + [ "EvaluationError" /\ D.content + (D.tuple $ EvaluationError D.value D.value) + , "EvaluationException" /\ D.content + (D.tuple $ EvaluationException D.value D.value) + , "MalformedScript" /\ D.content (MalformedScript <$> D.value) + ] + +derive instance genericScriptError :: Generic ScriptError _ + +-------------------------------------------------------------------------------- + +_EvaluationError :: Prism' ScriptError { a :: Array String, b :: String } +_EvaluationError = prism' (\{ a, b } -> (EvaluationError a b)) case _ of + (EvaluationError a b) -> Just { a, b } + _ -> Nothing + +_EvaluationException :: Prism' ScriptError { a :: String, b :: String } +_EvaluationException = prism' (\{ a, b } -> (EvaluationException a b)) case _ of + (EvaluationException a b) -> Just { a, b } + _ -> Nothing + +_MalformedScript :: Prism' ScriptError String +_MalformedScript = prism' MalformedScript case _ of + (MalformedScript a) -> Just a + _ -> Nothing + +-------------------------------------------------------------------------------- + +newtype DatumHash = DatumHash String + +derive instance eqDatumHash :: Eq DatumHash + +derive instance ordDatumHash :: Ord DatumHash + +instance showDatumHash :: Show DatumHash where + show a = genericShow a + +instance encodeJsonDatumHash :: EncodeJson DatumHash where + encodeJson = defer \_ -> E.encode $ unwrap >$< E.value + +instance decodeJsonDatumHash :: DecodeJson DatumHash where + decodeJson = defer \_ -> D.decode $ (DatumHash <$> D.value) + +derive instance genericDatumHash :: Generic DatumHash _ + +derive instance newtypeDatumHash :: Newtype DatumHash _ + +-------------------------------------------------------------------------------- + +_DatumHash :: Iso' DatumHash String +_DatumHash = _Newtype \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/Plutus/V1/Ledger/Slot.purs b/marlowe-dashboard-client/generated/Plutus/V1/Ledger/Slot.purs new file mode 100644 index 0000000000..027ebb5130 --- /dev/null +++ b/marlowe-dashboard-client/generated/Plutus/V1/Ledger/Slot.purs @@ -0,0 +1,50 @@ +-- File auto generated by purescript-bridge! -- +module Plutus.V1.Ledger.Slot where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.BigInt.Argonaut (BigInt) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Type.Proxy (Proxy(Proxy)) + +newtype Slot = Slot { getSlot :: BigInt } + +derive instance eqSlot :: Eq Slot + +instance showSlot :: Show Slot where + show a = genericShow a + +instance encodeJsonSlot :: EncodeJson Slot where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { getSlot: E.value :: _ BigInt } + ) + +instance decodeJsonSlot :: DecodeJson Slot where + decodeJson = defer \_ -> D.decode $ + (Slot <$> D.record "Slot" { getSlot: D.value :: _ BigInt }) + +derive instance genericSlot :: Generic Slot _ + +derive instance newtypeSlot :: Newtype Slot _ + +-------------------------------------------------------------------------------- + +_Slot :: Iso' Slot { getSlot :: BigInt } +_Slot = _Newtype \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/Plutus/V1/Ledger/Tx.purs b/marlowe-dashboard-client/generated/Plutus/V1/Ledger/Tx.purs new file mode 100644 index 0000000000..b1cfb3ac9a --- /dev/null +++ b/marlowe-dashboard-client/generated/Plutus/V1/Ledger/Tx.purs @@ -0,0 +1,407 @@ +-- File auto generated by purescript-bridge! -- +module Plutus.V1.Ledger.Tx where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.BigInt.Argonaut (BigInt) +import Data.Bounded.Generic (genericBottom, genericTop) +import Data.Enum (class Enum) +import Data.Enum.Generic (genericPred, genericSucc) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map (Map) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Set (Set) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Plutus.V1.Ledger.Address (Address) +import Plutus.V1.Ledger.Crypto (PubKey, Signature) +import Plutus.V1.Ledger.Interval (Interval) +import Plutus.V1.Ledger.Scripts (DatumHash, MintingPolicy, Validator) +import Plutus.V1.Ledger.Slot (Slot) +import Plutus.V1.Ledger.TxId (TxId) +import Plutus.V1.Ledger.Value (Value) +import Type.Proxy (Proxy(Proxy)) + +newtype Tx = Tx + { txInputs :: Set TxIn + , txCollateral :: Set TxIn + , txOutputs :: Array TxOut + , txMint :: Value + , txFee :: Value + , txValidRange :: Interval Slot + , txMintScripts :: Set MintingPolicy + , txSignatures :: Map PubKey Signature + , txRedeemers :: Map RedeemerPtr String + , txData :: Map DatumHash String + } + +derive instance eqTx :: Eq Tx + +instance showTx :: Show Tx where + show a = genericShow a + +instance encodeJsonTx :: EncodeJson Tx where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { txInputs: E.value :: _ (Set TxIn) + , txCollateral: E.value :: _ (Set TxIn) + , txOutputs: E.value :: _ (Array TxOut) + , txMint: E.value :: _ Value + , txFee: E.value :: _ Value + , txValidRange: E.value :: _ (Interval Slot) + , txMintScripts: E.value :: _ (Set MintingPolicy) + , txSignatures: + (E.dictionary E.value E.value) :: _ (Map PubKey Signature) + , txRedeemers: + (E.dictionary E.value E.value) :: _ (Map RedeemerPtr String) + , txData: (E.dictionary E.value E.value) :: _ (Map DatumHash String) + } + ) + +instance decodeJsonTx :: DecodeJson Tx where + decodeJson = defer \_ -> D.decode $ + ( Tx <$> D.record "Tx" + { txInputs: D.value :: _ (Set TxIn) + , txCollateral: D.value :: _ (Set TxIn) + , txOutputs: D.value :: _ (Array TxOut) + , txMint: D.value :: _ Value + , txFee: D.value :: _ Value + , txValidRange: D.value :: _ (Interval Slot) + , txMintScripts: D.value :: _ (Set MintingPolicy) + , txSignatures: + (D.dictionary D.value D.value) :: _ (Map PubKey Signature) + , txRedeemers: + (D.dictionary D.value D.value) :: _ (Map RedeemerPtr String) + , txData: (D.dictionary D.value D.value) :: _ (Map DatumHash String) + } + ) + +derive instance genericTx :: Generic Tx _ + +derive instance newtypeTx :: Newtype Tx _ + +-------------------------------------------------------------------------------- + +_Tx :: Iso' Tx + { txInputs :: Set TxIn + , txCollateral :: Set TxIn + , txOutputs :: Array TxOut + , txMint :: Value + , txFee :: Value + , txValidRange :: Interval Slot + , txMintScripts :: Set MintingPolicy + , txSignatures :: Map PubKey Signature + , txRedeemers :: Map RedeemerPtr String + , txData :: Map DatumHash String + } +_Tx = _Newtype + +-------------------------------------------------------------------------------- + +newtype TxIn = TxIn + { txInRef :: TxOutRef + , txInType :: Maybe TxInType + } + +derive instance eqTxIn :: Eq TxIn + +derive instance ordTxIn :: Ord TxIn + +instance showTxIn :: Show TxIn where + show a = genericShow a + +instance encodeJsonTxIn :: EncodeJson TxIn where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { txInRef: E.value :: _ TxOutRef + , txInType: (E.maybe E.value) :: _ (Maybe TxInType) + } + ) + +instance decodeJsonTxIn :: DecodeJson TxIn where + decodeJson = defer \_ -> D.decode $ + ( TxIn <$> D.record "TxIn" + { txInRef: D.value :: _ TxOutRef + , txInType: (D.maybe D.value) :: _ (Maybe TxInType) + } + ) + +derive instance genericTxIn :: Generic TxIn _ + +derive instance newtypeTxIn :: Newtype TxIn _ + +-------------------------------------------------------------------------------- + +_TxIn :: Iso' TxIn { txInRef :: TxOutRef, txInType :: Maybe TxInType } +_TxIn = _Newtype + +-------------------------------------------------------------------------------- + +newtype TxOut = TxOut + { txOutAddress :: Address + , txOutValue :: Value + , txOutDatumHash :: Maybe DatumHash + } + +derive instance eqTxOut :: Eq TxOut + +instance showTxOut :: Show TxOut where + show a = genericShow a + +instance encodeJsonTxOut :: EncodeJson TxOut where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { txOutAddress: E.value :: _ Address + , txOutValue: E.value :: _ Value + , txOutDatumHash: (E.maybe E.value) :: _ (Maybe DatumHash) + } + ) + +instance decodeJsonTxOut :: DecodeJson TxOut where + decodeJson = defer \_ -> D.decode $ + ( TxOut <$> D.record "TxOut" + { txOutAddress: D.value :: _ Address + , txOutValue: D.value :: _ Value + , txOutDatumHash: (D.maybe D.value) :: _ (Maybe DatumHash) + } + ) + +derive instance genericTxOut :: Generic TxOut _ + +derive instance newtypeTxOut :: Newtype TxOut _ + +-------------------------------------------------------------------------------- + +_TxOut :: Iso' TxOut + { txOutAddress :: Address + , txOutValue :: Value + , txOutDatumHash :: Maybe DatumHash + } +_TxOut = _Newtype + +-------------------------------------------------------------------------------- + +newtype TxOutTx = TxOutTx + { txOutTxTx :: Tx + , txOutTxOut :: TxOut + } + +derive instance eqTxOutTx :: Eq TxOutTx + +instance showTxOutTx :: Show TxOutTx where + show a = genericShow a + +instance encodeJsonTxOutTx :: EncodeJson TxOutTx where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { txOutTxTx: E.value :: _ Tx + , txOutTxOut: E.value :: _ TxOut + } + ) + +instance decodeJsonTxOutTx :: DecodeJson TxOutTx where + decodeJson = defer \_ -> D.decode $ + ( TxOutTx <$> D.record "TxOutTx" + { txOutTxTx: D.value :: _ Tx + , txOutTxOut: D.value :: _ TxOut + } + ) + +derive instance genericTxOutTx :: Generic TxOutTx _ + +derive instance newtypeTxOutTx :: Newtype TxOutTx _ + +-------------------------------------------------------------------------------- + +_TxOutTx :: Iso' TxOutTx { txOutTxTx :: Tx, txOutTxOut :: TxOut } +_TxOutTx = _Newtype + +-------------------------------------------------------------------------------- + +newtype TxOutRef = TxOutRef + { txOutRefId :: TxId + , txOutRefIdx :: BigInt + } + +derive instance eqTxOutRef :: Eq TxOutRef + +derive instance ordTxOutRef :: Ord TxOutRef + +instance showTxOutRef :: Show TxOutRef where + show a = genericShow a + +instance encodeJsonTxOutRef :: EncodeJson TxOutRef where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { txOutRefId: E.value :: _ TxId + , txOutRefIdx: E.value :: _ BigInt + } + ) + +instance decodeJsonTxOutRef :: DecodeJson TxOutRef where + decodeJson = defer \_ -> D.decode $ + ( TxOutRef <$> D.record "TxOutRef" + { txOutRefId: D.value :: _ TxId + , txOutRefIdx: D.value :: _ BigInt + } + ) + +derive instance genericTxOutRef :: Generic TxOutRef _ + +derive instance newtypeTxOutRef :: Newtype TxOutRef _ + +-------------------------------------------------------------------------------- + +_TxOutRef :: Iso' TxOutRef { txOutRefId :: TxId, txOutRefIdx :: BigInt } +_TxOutRef = _Newtype + +-------------------------------------------------------------------------------- + +data RedeemerPtr = RedeemerPtr ScriptTag BigInt + +instance showRedeemerPtr :: Show RedeemerPtr where + show a = genericShow a + +derive instance eqRedeemerPtr :: Eq RedeemerPtr + +derive instance ordRedeemerPtr :: Ord RedeemerPtr + +instance encodeJsonRedeemerPtr :: EncodeJson RedeemerPtr where + encodeJson = defer \_ -> E.encode $ (case _ of RedeemerPtr a b -> (a /\ b)) + >$< (E.tuple (E.value >/\< E.value)) + +instance decodeJsonRedeemerPtr :: DecodeJson RedeemerPtr where + decodeJson = defer \_ -> D.decode $ + (D.tuple $ RedeemerPtr D.value D.value) + +derive instance genericRedeemerPtr :: Generic RedeemerPtr _ + +-------------------------------------------------------------------------------- + +_RedeemerPtr :: Iso' RedeemerPtr { a :: ScriptTag, b :: BigInt } +_RedeemerPtr = iso (\(RedeemerPtr a b) -> { a, b }) + (\{ a, b } -> (RedeemerPtr a b)) + +-------------------------------------------------------------------------------- + +data ScriptTag + = Spend + | Mint + | Cert + | Reward + +instance showScriptTag :: Show ScriptTag where + show a = genericShow a + +derive instance eqScriptTag :: Eq ScriptTag + +derive instance ordScriptTag :: Ord ScriptTag + +instance encodeJsonScriptTag :: EncodeJson ScriptTag where + encodeJson = defer \_ -> E.encode E.enum + +instance decodeJsonScriptTag :: DecodeJson ScriptTag where + decodeJson = defer \_ -> D.decode D.enum + +derive instance genericScriptTag :: Generic ScriptTag _ + +instance enumScriptTag :: Enum ScriptTag where + succ = genericSucc + pred = genericPred + +instance boundedScriptTag :: Bounded ScriptTag where + bottom = genericBottom + top = genericTop + +-------------------------------------------------------------------------------- + +_Spend :: Prism' ScriptTag Unit +_Spend = prism' (const Spend) case _ of + Spend -> Just unit + _ -> Nothing + +_Mint :: Prism' ScriptTag Unit +_Mint = prism' (const Mint) case _ of + Mint -> Just unit + _ -> Nothing + +_Cert :: Prism' ScriptTag Unit +_Cert = prism' (const Cert) case _ of + Cert -> Just unit + _ -> Nothing + +_Reward :: Prism' ScriptTag Unit +_Reward = prism' (const Reward) case _ of + Reward -> Just unit + _ -> Nothing + +-------------------------------------------------------------------------------- + +data TxInType + = ConsumeScriptAddress Validator String String + | ConsumePublicKeyAddress + | ConsumeSimpleScriptAddress + +instance showTxInType :: Show TxInType where + show a = genericShow a + +derive instance eqTxInType :: Eq TxInType + +derive instance ordTxInType :: Ord TxInType + +instance encodeJsonTxInType :: EncodeJson TxInType where + encodeJson = defer \_ -> case _ of + ConsumeScriptAddress a b c -> E.encodeTagged "ConsumeScriptAddress" + (a /\ b /\ c) + (E.tuple (E.value >/\< E.value >/\< E.value)) + ConsumePublicKeyAddress -> encodeJson + { tag: "ConsumePublicKeyAddress", contents: jsonNull } + ConsumeSimpleScriptAddress -> encodeJson + { tag: "ConsumeSimpleScriptAddress", contents: jsonNull } + +instance decodeJsonTxInType :: DecodeJson TxInType where + decodeJson = defer \_ -> D.decode + $ D.sumType "TxInType" + $ Map.fromFoldable + [ "ConsumeScriptAddress" /\ D.content + ( D.tuple $ ConsumeScriptAddress D.value D.value + D.value + ) + , "ConsumePublicKeyAddress" /\ pure ConsumePublicKeyAddress + , "ConsumeSimpleScriptAddress" /\ pure ConsumeSimpleScriptAddress + ] + +derive instance genericTxInType :: Generic TxInType _ + +-------------------------------------------------------------------------------- + +_ConsumeScriptAddress :: Prism' TxInType + { a :: Validator, b :: String, c :: String } +_ConsumeScriptAddress = prism' (\{ a, b, c } -> (ConsumeScriptAddress a b c)) + case _ of + (ConsumeScriptAddress a b c) -> Just { a, b, c } + _ -> Nothing + +_ConsumePublicKeyAddress :: Prism' TxInType Unit +_ConsumePublicKeyAddress = prism' (const ConsumePublicKeyAddress) case _ of + ConsumePublicKeyAddress -> Just unit + _ -> Nothing + +_ConsumeSimpleScriptAddress :: Prism' TxInType Unit +_ConsumeSimpleScriptAddress = prism' (const ConsumeSimpleScriptAddress) + case _ of + ConsumeSimpleScriptAddress -> Just unit + _ -> Nothing \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/Plutus/V1/Ledger/TxId.purs b/marlowe-dashboard-client/generated/Plutus/V1/Ledger/TxId.purs new file mode 100644 index 0000000000..a3c13bc8c8 --- /dev/null +++ b/marlowe-dashboard-client/generated/Plutus/V1/Ledger/TxId.purs @@ -0,0 +1,51 @@ +-- File auto generated by purescript-bridge! -- +module Plutus.V1.Ledger.TxId where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Type.Proxy (Proxy(Proxy)) + +newtype TxId = TxId { getTxId :: String } + +derive instance eqTxId :: Eq TxId + +derive instance ordTxId :: Ord TxId + +instance showTxId :: Show TxId where + show a = genericShow a + +instance encodeJsonTxId :: EncodeJson TxId where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { getTxId: E.value :: _ String } + ) + +instance decodeJsonTxId :: DecodeJson TxId where + decodeJson = defer \_ -> D.decode $ + (TxId <$> D.record "TxId" { getTxId: D.value :: _ String }) + +derive instance genericTxId :: Generic TxId _ + +derive instance newtypeTxId :: Newtype TxId _ + +-------------------------------------------------------------------------------- + +_TxId :: Iso' TxId { getTxId :: String } +_TxId = _Newtype \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/Plutus/V1/Ledger/Value.purs b/marlowe-dashboard-client/generated/Plutus/V1/Ledger/Value.purs new file mode 100644 index 0000000000..67761c77a7 --- /dev/null +++ b/marlowe-dashboard-client/generated/Plutus/V1/Ledger/Value.purs @@ -0,0 +1,156 @@ +-- File auto generated by purescript-bridge! -- +module Plutus.V1.Ledger.Value where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.BigInt.Argonaut (BigInt) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple (Tuple) +import Data.Tuple.Nested ((/\)) +import PlutusTx.AssocMap (Map) +import Type.Proxy (Proxy(Proxy)) + +newtype Value = Value { getValue :: Map CurrencySymbol (Map TokenName BigInt) } + +derive instance eqValue :: Eq Value + +instance showValue :: Show Value where + show a = genericShow a + +instance encodeJsonValue :: EncodeJson Value where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { getValue: E.value :: _ (Map CurrencySymbol (Map TokenName BigInt)) } + ) + +instance decodeJsonValue :: DecodeJson Value where + decodeJson = defer \_ -> D.decode $ + ( Value <$> D.record "Value" + { getValue: D.value :: _ (Map CurrencySymbol (Map TokenName BigInt)) } + ) + +derive instance genericValue :: Generic Value _ + +derive instance newtypeValue :: Newtype Value _ + +-------------------------------------------------------------------------------- + +_Value :: Iso' Value { getValue :: Map CurrencySymbol (Map TokenName BigInt) } +_Value = _Newtype + +-------------------------------------------------------------------------------- + +newtype CurrencySymbol = CurrencySymbol { unCurrencySymbol :: String } + +instance showCurrencySymbol :: Show CurrencySymbol where + show a = genericShow a + +derive instance eqCurrencySymbol :: Eq CurrencySymbol + +derive instance ordCurrencySymbol :: Ord CurrencySymbol + +instance encodeJsonCurrencySymbol :: EncodeJson CurrencySymbol where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { unCurrencySymbol: E.value :: _ String } + ) + +instance decodeJsonCurrencySymbol :: DecodeJson CurrencySymbol where + decodeJson = defer \_ -> D.decode $ + ( CurrencySymbol <$> D.record "CurrencySymbol" + { unCurrencySymbol: D.value :: _ String } + ) + +derive instance genericCurrencySymbol :: Generic CurrencySymbol _ + +derive instance newtypeCurrencySymbol :: Newtype CurrencySymbol _ + +-------------------------------------------------------------------------------- + +_CurrencySymbol :: Iso' CurrencySymbol { unCurrencySymbol :: String } +_CurrencySymbol = _Newtype + +-------------------------------------------------------------------------------- + +newtype AssetClass = AssetClass + { unAssetClass :: Tuple CurrencySymbol TokenName } + +instance showAssetClass :: Show AssetClass where + show a = genericShow a + +derive instance eqAssetClass :: Eq AssetClass + +derive instance ordAssetClass :: Ord AssetClass + +instance encodeJsonAssetClass :: EncodeJson AssetClass where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { unAssetClass: + (E.tuple (E.value >/\< E.value)) :: _ + (Tuple CurrencySymbol TokenName) + } + ) + +instance decodeJsonAssetClass :: DecodeJson AssetClass where + decodeJson = defer \_ -> D.decode $ + ( AssetClass <$> D.record "AssetClass" + { unAssetClass: + (D.tuple (D.value D.value)) :: _ + (Tuple CurrencySymbol TokenName) + } + ) + +derive instance genericAssetClass :: Generic AssetClass _ + +derive instance newtypeAssetClass :: Newtype AssetClass _ + +-------------------------------------------------------------------------------- + +_AssetClass :: Iso' AssetClass + { unAssetClass :: Tuple CurrencySymbol TokenName } +_AssetClass = _Newtype + +-------------------------------------------------------------------------------- + +newtype TokenName = TokenName { unTokenName :: String } + +instance showTokenName :: Show TokenName where + show a = genericShow a + +derive instance eqTokenName :: Eq TokenName + +derive instance ordTokenName :: Ord TokenName + +instance encodeJsonTokenName :: EncodeJson TokenName where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { unTokenName: E.value :: _ String } + ) + +instance decodeJsonTokenName :: DecodeJson TokenName where + decodeJson = defer \_ -> D.decode $ + (TokenName <$> D.record "TokenName" { unTokenName: D.value :: _ String }) + +derive instance genericTokenName :: Generic TokenName _ + +derive instance newtypeTokenName :: Newtype TokenName _ + +-------------------------------------------------------------------------------- + +_TokenName :: Iso' TokenName { unTokenName :: String } +_TokenName = _Newtype \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/PlutusCore/Evaluation/Machine/ExMemory.purs b/marlowe-dashboard-client/generated/PlutusCore/Evaluation/Machine/ExMemory.purs new file mode 100644 index 0000000000..d21990fdef --- /dev/null +++ b/marlowe-dashboard-client/generated/PlutusCore/Evaluation/Machine/ExMemory.purs @@ -0,0 +1,69 @@ +-- File auto generated by purescript-bridge! -- +module PlutusCore.Evaluation.Machine.ExMemory where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Type.Proxy (Proxy(Proxy)) + +newtype ExCPU = ExCPU Int + +derive instance eqExCPU :: Eq ExCPU + +instance showExCPU :: Show ExCPU where + show a = genericShow a + +instance encodeJsonExCPU :: EncodeJson ExCPU where + encodeJson = defer \_ -> E.encode $ unwrap >$< E.value + +instance decodeJsonExCPU :: DecodeJson ExCPU where + decodeJson = defer \_ -> D.decode $ (ExCPU <$> D.value) + +derive instance genericExCPU :: Generic ExCPU _ + +derive instance newtypeExCPU :: Newtype ExCPU _ + +-------------------------------------------------------------------------------- + +_ExCPU :: Iso' ExCPU Int +_ExCPU = _Newtype + +-------------------------------------------------------------------------------- + +newtype ExMemory = ExMemory Int + +derive instance eqExMemory :: Eq ExMemory + +instance showExMemory :: Show ExMemory where + show a = genericShow a + +instance encodeJsonExMemory :: EncodeJson ExMemory where + encodeJson = defer \_ -> E.encode $ unwrap >$< E.value + +instance decodeJsonExMemory :: DecodeJson ExMemory where + decodeJson = defer \_ -> D.decode $ (ExMemory <$> D.value) + +derive instance genericExMemory :: Generic ExMemory _ + +derive instance newtypeExMemory :: Newtype ExMemory _ + +-------------------------------------------------------------------------------- + +_ExMemory :: Iso' ExMemory Int +_ExMemory = _Newtype \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/Schema.purs b/marlowe-dashboard-client/generated/Schema.purs new file mode 100644 index 0000000000..25533752d9 --- /dev/null +++ b/marlowe-dashboard-client/generated/Schema.purs @@ -0,0 +1,322 @@ +-- File auto generated by purescript-bridge! -- +module Schema where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.BigInt.Argonaut (BigInt) +import Data.Eq (class Eq1) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple (Tuple) +import Data.Tuple.Nested ((/\)) +import Plutus.V1.Ledger.Interval (Interval) +import Plutus.V1.Ledger.Time (POSIXTime) +import Plutus.V1.Ledger.Value (Value) +import Type.Proxy (Proxy(Proxy)) + +data FormSchema + = FormSchemaUnit + | FormSchemaBool + | FormSchemaInt + | FormSchemaInteger + | FormSchemaString + | FormSchemaHex + | FormSchemaArray FormSchema + | FormSchemaMaybe FormSchema + | FormSchemaRadio (Array String) + | FormSchemaTuple FormSchema FormSchema + | FormSchemaObject (Array (Tuple String FormSchema)) + | FormSchemaValue + | FormSchemaPOSIXTimeRange + | FormSchemaUnsupported String + +instance showFormSchema :: Show FormSchema where + show a = genericShow a + +derive instance eqFormSchema :: Eq FormSchema + +instance encodeJsonFormSchema :: EncodeJson FormSchema where + encodeJson = defer \_ -> case _ of + FormSchemaUnit -> encodeJson { tag: "FormSchemaUnit", contents: jsonNull } + FormSchemaBool -> encodeJson { tag: "FormSchemaBool", contents: jsonNull } + FormSchemaInt -> encodeJson { tag: "FormSchemaInt", contents: jsonNull } + FormSchemaInteger -> encodeJson + { tag: "FormSchemaInteger", contents: jsonNull } + FormSchemaString -> encodeJson + { tag: "FormSchemaString", contents: jsonNull } + FormSchemaHex -> encodeJson { tag: "FormSchemaHex", contents: jsonNull } + FormSchemaArray a -> E.encodeTagged "FormSchemaArray" a E.value + FormSchemaMaybe a -> E.encodeTagged "FormSchemaMaybe" a E.value + FormSchemaRadio a -> E.encodeTagged "FormSchemaRadio" a E.value + FormSchemaTuple a b -> E.encodeTagged "FormSchemaTuple" (a /\ b) + (E.tuple (E.value >/\< E.value)) + FormSchemaObject a -> E.encodeTagged "FormSchemaObject" a E.value + FormSchemaValue -> encodeJson { tag: "FormSchemaValue", contents: jsonNull } + FormSchemaPOSIXTimeRange -> encodeJson + { tag: "FormSchemaPOSIXTimeRange", contents: jsonNull } + FormSchemaUnsupported a -> E.encodeTagged "FormSchemaUnsupported" a E.value + +instance decodeJsonFormSchema :: DecodeJson FormSchema where + decodeJson = defer \_ -> D.decode + $ D.sumType "FormSchema" + $ Map.fromFoldable + [ "FormSchemaUnit" /\ pure FormSchemaUnit + , "FormSchemaBool" /\ pure FormSchemaBool + , "FormSchemaInt" /\ pure FormSchemaInt + , "FormSchemaInteger" /\ pure FormSchemaInteger + , "FormSchemaString" /\ pure FormSchemaString + , "FormSchemaHex" /\ pure FormSchemaHex + , "FormSchemaArray" /\ D.content (FormSchemaArray <$> D.value) + , "FormSchemaMaybe" /\ D.content (FormSchemaMaybe <$> D.value) + , "FormSchemaRadio" /\ D.content (FormSchemaRadio <$> D.value) + , "FormSchemaTuple" /\ D.content + (D.tuple $ FormSchemaTuple D.value D.value) + , "FormSchemaObject" /\ D.content (FormSchemaObject <$> D.value) + , "FormSchemaValue" /\ pure FormSchemaValue + , "FormSchemaPOSIXTimeRange" /\ pure FormSchemaPOSIXTimeRange + , "FormSchemaUnsupported" /\ D.content + (FormSchemaUnsupported <$> D.value) + ] + +derive instance genericFormSchema :: Generic FormSchema _ + +-------------------------------------------------------------------------------- + +_FormSchemaUnit :: Prism' FormSchema Unit +_FormSchemaUnit = prism' (const FormSchemaUnit) case _ of + FormSchemaUnit -> Just unit + _ -> Nothing + +_FormSchemaBool :: Prism' FormSchema Unit +_FormSchemaBool = prism' (const FormSchemaBool) case _ of + FormSchemaBool -> Just unit + _ -> Nothing + +_FormSchemaInt :: Prism' FormSchema Unit +_FormSchemaInt = prism' (const FormSchemaInt) case _ of + FormSchemaInt -> Just unit + _ -> Nothing + +_FormSchemaInteger :: Prism' FormSchema Unit +_FormSchemaInteger = prism' (const FormSchemaInteger) case _ of + FormSchemaInteger -> Just unit + _ -> Nothing + +_FormSchemaString :: Prism' FormSchema Unit +_FormSchemaString = prism' (const FormSchemaString) case _ of + FormSchemaString -> Just unit + _ -> Nothing + +_FormSchemaHex :: Prism' FormSchema Unit +_FormSchemaHex = prism' (const FormSchemaHex) case _ of + FormSchemaHex -> Just unit + _ -> Nothing + +_FormSchemaArray :: Prism' FormSchema FormSchema +_FormSchemaArray = prism' FormSchemaArray case _ of + (FormSchemaArray a) -> Just a + _ -> Nothing + +_FormSchemaMaybe :: Prism' FormSchema FormSchema +_FormSchemaMaybe = prism' FormSchemaMaybe case _ of + (FormSchemaMaybe a) -> Just a + _ -> Nothing + +_FormSchemaRadio :: Prism' FormSchema (Array String) +_FormSchemaRadio = prism' FormSchemaRadio case _ of + (FormSchemaRadio a) -> Just a + _ -> Nothing + +_FormSchemaTuple :: Prism' FormSchema { a :: FormSchema, b :: FormSchema } +_FormSchemaTuple = prism' (\{ a, b } -> (FormSchemaTuple a b)) case _ of + (FormSchemaTuple a b) -> Just { a, b } + _ -> Nothing + +_FormSchemaObject :: Prism' FormSchema (Array (Tuple String FormSchema)) +_FormSchemaObject = prism' FormSchemaObject case _ of + (FormSchemaObject a) -> Just a + _ -> Nothing + +_FormSchemaValue :: Prism' FormSchema Unit +_FormSchemaValue = prism' (const FormSchemaValue) case _ of + FormSchemaValue -> Just unit + _ -> Nothing + +_FormSchemaPOSIXTimeRange :: Prism' FormSchema Unit +_FormSchemaPOSIXTimeRange = prism' (const FormSchemaPOSIXTimeRange) case _ of + FormSchemaPOSIXTimeRange -> Just unit + _ -> Nothing + +_FormSchemaUnsupported :: Prism' FormSchema String +_FormSchemaUnsupported = prism' FormSchemaUnsupported case _ of + (FormSchemaUnsupported a) -> Just a + _ -> Nothing + +-------------------------------------------------------------------------------- + +data FormArgumentF a + = FormUnitF + | FormBoolF Boolean + | FormIntF (Maybe Int) + | FormIntegerF (Maybe BigInt) + | FormStringF (Maybe String) + | FormHexF (Maybe String) + | FormRadioF (Array String) (Maybe String) + | FormArrayF FormSchema (Array a) + | FormMaybeF FormSchema (Maybe a) + | FormTupleF a a + | FormObjectF (Array (Tuple String a)) + | FormValueF Value + | FormPOSIXTimeRangeF (Interval POSIXTime) + | FormUnsupportedF String + +derive instance functorFormArgumentF :: Functor FormArgumentF + +derive instance eqFormArgumentF :: (Eq a) => Eq (FormArgumentF a) + +derive instance eq1FormArgumentF :: Eq1 FormArgumentF + +instance showFormArgumentF :: (Show a) => Show (FormArgumentF a) where + show a = genericShow a + +instance encodeJsonFormArgumentF :: + ( EncodeJson a + ) => + EncodeJson (FormArgumentF a) where + encodeJson = defer \_ -> case _ of + FormUnitF -> encodeJson { tag: "FormUnitF", contents: jsonNull } + FormBoolF a -> E.encodeTagged "FormBoolF" a E.value + FormIntF a -> E.encodeTagged "FormIntF" a (E.maybe E.value) + FormIntegerF a -> E.encodeTagged "FormIntegerF" a (E.maybe E.value) + FormStringF a -> E.encodeTagged "FormStringF" a (E.maybe E.value) + FormHexF a -> E.encodeTagged "FormHexF" a (E.maybe E.value) + FormRadioF a b -> E.encodeTagged "FormRadioF" (a /\ b) + (E.tuple (E.value >/\< (E.maybe E.value))) + FormArrayF a b -> E.encodeTagged "FormArrayF" (a /\ b) + (E.tuple (E.value >/\< E.value)) + FormMaybeF a b -> E.encodeTagged "FormMaybeF" (a /\ b) + (E.tuple (E.value >/\< (E.maybe E.value))) + FormTupleF a b -> E.encodeTagged "FormTupleF" (a /\ b) + (E.tuple (E.value >/\< E.value)) + FormObjectF a -> E.encodeTagged "FormObjectF" a E.value + FormValueF a -> E.encodeTagged "FormValueF" a E.value + FormPOSIXTimeRangeF a -> E.encodeTagged "FormPOSIXTimeRangeF" a E.value + FormUnsupportedF a -> E.encodeTagged "FormUnsupportedF" a E.value + +instance decodeJsonFormArgumentF :: + ( DecodeJson a + ) => + DecodeJson (FormArgumentF a) where + decodeJson = defer \_ -> D.decode + $ D.sumType "FormArgumentF" + $ Map.fromFoldable + [ "FormUnitF" /\ pure FormUnitF + , "FormBoolF" /\ D.content (FormBoolF <$> D.value) + , "FormIntF" /\ D.content (FormIntF <$> (D.maybe D.value)) + , "FormIntegerF" /\ D.content (FormIntegerF <$> (D.maybe D.value)) + , "FormStringF" /\ D.content (FormStringF <$> (D.maybe D.value)) + , "FormHexF" /\ D.content (FormHexF <$> (D.maybe D.value)) + , "FormRadioF" /\ D.content + (D.tuple $ FormRadioF D.value (D.maybe D.value)) + , "FormArrayF" /\ D.content + (D.tuple $ FormArrayF D.value D.value) + , "FormMaybeF" /\ D.content + (D.tuple $ FormMaybeF D.value (D.maybe D.value)) + , "FormTupleF" /\ D.content + (D.tuple $ FormTupleF D.value D.value) + , "FormObjectF" /\ D.content (FormObjectF <$> D.value) + , "FormValueF" /\ D.content (FormValueF <$> D.value) + , "FormPOSIXTimeRangeF" /\ D.content (FormPOSIXTimeRangeF <$> D.value) + , "FormUnsupportedF" /\ D.content (FormUnsupportedF <$> D.value) + ] + +derive instance genericFormArgumentF :: Generic (FormArgumentF a) _ + +-------------------------------------------------------------------------------- + +_FormUnitF :: forall a. Prism' (FormArgumentF a) Unit +_FormUnitF = prism' (const FormUnitF) case _ of + FormUnitF -> Just unit + _ -> Nothing + +_FormBoolF :: forall a. Prism' (FormArgumentF a) Boolean +_FormBoolF = prism' FormBoolF case _ of + (FormBoolF a) -> Just a + _ -> Nothing + +_FormIntF :: forall a. Prism' (FormArgumentF a) (Maybe Int) +_FormIntF = prism' FormIntF case _ of + (FormIntF a) -> Just a + _ -> Nothing + +_FormIntegerF :: forall a. Prism' (FormArgumentF a) (Maybe BigInt) +_FormIntegerF = prism' FormIntegerF case _ of + (FormIntegerF a) -> Just a + _ -> Nothing + +_FormStringF :: forall a. Prism' (FormArgumentF a) (Maybe String) +_FormStringF = prism' FormStringF case _ of + (FormStringF a) -> Just a + _ -> Nothing + +_FormHexF :: forall a. Prism' (FormArgumentF a) (Maybe String) +_FormHexF = prism' FormHexF case _ of + (FormHexF a) -> Just a + _ -> Nothing + +_FormRadioF + :: forall a. Prism' (FormArgumentF a) { a :: Array String, b :: Maybe String } +_FormRadioF = prism' (\{ a, b } -> (FormRadioF a b)) case _ of + (FormRadioF a b) -> Just { a, b } + _ -> Nothing + +_FormArrayF + :: forall a. Prism' (FormArgumentF a) { a :: FormSchema, b :: Array a } +_FormArrayF = prism' (\{ a, b } -> (FormArrayF a b)) case _ of + (FormArrayF a b) -> Just { a, b } + _ -> Nothing + +_FormMaybeF + :: forall a. Prism' (FormArgumentF a) { a :: FormSchema, b :: Maybe a } +_FormMaybeF = prism' (\{ a, b } -> (FormMaybeF a b)) case _ of + (FormMaybeF a b) -> Just { a, b } + _ -> Nothing + +_FormTupleF :: forall a. Prism' (FormArgumentF a) { a :: a, b :: a } +_FormTupleF = prism' (\{ a, b } -> (FormTupleF a b)) case _ of + (FormTupleF a b) -> Just { a, b } + _ -> Nothing + +_FormObjectF :: forall a. Prism' (FormArgumentF a) (Array (Tuple String a)) +_FormObjectF = prism' FormObjectF case _ of + (FormObjectF a) -> Just a + _ -> Nothing + +_FormValueF :: forall a. Prism' (FormArgumentF a) Value +_FormValueF = prism' FormValueF case _ of + (FormValueF a) -> Just a + _ -> Nothing + +_FormPOSIXTimeRangeF :: forall a. Prism' (FormArgumentF a) (Interval POSIXTime) +_FormPOSIXTimeRangeF = prism' FormPOSIXTimeRangeF case _ of + (FormPOSIXTimeRangeF a) -> Just a + _ -> Nothing + +_FormUnsupportedF :: forall a. Prism' (FormArgumentF a) String +_FormUnsupportedF = prism' FormUnsupportedF case _ of + (FormUnsupportedF a) -> Just a + _ -> Nothing \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/Wallet/Emulator/Error.purs b/marlowe-dashboard-client/generated/Wallet/Emulator/Error.purs new file mode 100644 index 0000000000..f5b7d5068a --- /dev/null +++ b/marlowe-dashboard-client/generated/Wallet/Emulator/Error.purs @@ -0,0 +1,86 @@ +-- File auto generated by purescript-bridge! -- +module Wallet.Emulator.Error where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Ledger.Index (ValidationError) +import Ledger.Tx.CardanoAPI (ToCardanoError) +import Plutus.V1.Ledger.Crypto (PubKeyHash) +import Type.Proxy (Proxy(Proxy)) + +data WalletAPIError + = InsufficientFunds String + | PrivateKeyNotFound PubKeyHash + | ValidationError ValidationError + | ToCardanoError ToCardanoError + | OtherError String + +derive instance eqWalletAPIError :: Eq WalletAPIError + +instance showWalletAPIError :: Show WalletAPIError where + show a = genericShow a + +instance encodeJsonWalletAPIError :: EncodeJson WalletAPIError where + encodeJson = defer \_ -> case _ of + InsufficientFunds a -> E.encodeTagged "InsufficientFunds" a E.value + PrivateKeyNotFound a -> E.encodeTagged "PrivateKeyNotFound" a E.value + ValidationError a -> E.encodeTagged "ValidationError" a E.value + ToCardanoError a -> E.encodeTagged "ToCardanoError" a E.value + OtherError a -> E.encodeTagged "OtherError" a E.value + +instance decodeJsonWalletAPIError :: DecodeJson WalletAPIError where + decodeJson = defer \_ -> D.decode + $ D.sumType "WalletAPIError" + $ Map.fromFoldable + [ "InsufficientFunds" /\ D.content (InsufficientFunds <$> D.value) + , "PrivateKeyNotFound" /\ D.content (PrivateKeyNotFound <$> D.value) + , "ValidationError" /\ D.content (ValidationError <$> D.value) + , "ToCardanoError" /\ D.content (ToCardanoError <$> D.value) + , "OtherError" /\ D.content (OtherError <$> D.value) + ] + +derive instance genericWalletAPIError :: Generic WalletAPIError _ + +-------------------------------------------------------------------------------- + +_InsufficientFunds :: Prism' WalletAPIError String +_InsufficientFunds = prism' InsufficientFunds case _ of + (InsufficientFunds a) -> Just a + _ -> Nothing + +_PrivateKeyNotFound :: Prism' WalletAPIError PubKeyHash +_PrivateKeyNotFound = prism' PrivateKeyNotFound case _ of + (PrivateKeyNotFound a) -> Just a + _ -> Nothing + +_ValidationError :: Prism' WalletAPIError ValidationError +_ValidationError = prism' ValidationError case _ of + (ValidationError a) -> Just a + _ -> Nothing + +_ToCardanoError :: Prism' WalletAPIError ToCardanoError +_ToCardanoError = prism' ToCardanoError case _ of + (ToCardanoError a) -> Just a + _ -> Nothing + +_OtherError :: Prism' WalletAPIError String +_OtherError = prism' OtherError case _ of + (OtherError a) -> Just a + _ -> Nothing \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/Wallet/Emulator/Wallet.purs b/marlowe-dashboard-client/generated/Wallet/Emulator/Wallet.purs new file mode 100644 index 0000000000..f8d4180c50 --- /dev/null +++ b/marlowe-dashboard-client/generated/Wallet/Emulator/Wallet.purs @@ -0,0 +1,49 @@ +-- File auto generated by purescript-bridge! -- +module Wallet.Emulator.Wallet where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Type.Proxy (Proxy(Proxy)) + +newtype Wallet = Wallet { getWalletId :: String } + +derive instance eqWallet :: Eq Wallet + +instance showWallet :: Show Wallet where + show a = genericShow a + +instance encodeJsonWallet :: EncodeJson Wallet where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { getWalletId: E.value :: _ String } + ) + +instance decodeJsonWallet :: DecodeJson Wallet where + decodeJson = defer \_ -> D.decode $ + (Wallet <$> D.record "Wallet" { getWalletId: D.value :: _ String }) + +derive instance genericWallet :: Generic Wallet _ + +derive instance newtypeWallet :: Newtype Wallet _ + +-------------------------------------------------------------------------------- + +_Wallet :: Iso' Wallet { getWalletId :: String } +_Wallet = _Newtype \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/Wallet/Rollup/Types.purs b/marlowe-dashboard-client/generated/Wallet/Rollup/Types.purs new file mode 100644 index 0000000000..3536dca020 --- /dev/null +++ b/marlowe-dashboard-client/generated/Wallet/Rollup/Types.purs @@ -0,0 +1,260 @@ +-- File auto generated by purescript-bridge! -- +module Wallet.Rollup.Types where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.BigInt.Argonaut (BigInt) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map (Map) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Plutus.V1.Ledger.Crypto (PubKeyHash) +import Plutus.V1.Ledger.Tx (Tx, TxIn, TxOut) +import Plutus.V1.Ledger.TxId (TxId) +import Plutus.V1.Ledger.Value (Value) +import Type.Proxy (Proxy(Proxy)) + +newtype AnnotatedTx = AnnotatedTx + { sequenceId :: SequenceId + , txId :: TxId + , tx :: Tx + , dereferencedInputs :: Array DereferencedInput + , balances :: Map BeneficialOwner Value + , valid :: Boolean + } + +derive instance eqAnnotatedTx :: Eq AnnotatedTx + +instance showAnnotatedTx :: Show AnnotatedTx where + show a = genericShow a + +instance encodeJsonAnnotatedTx :: EncodeJson AnnotatedTx where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { sequenceId: E.value :: _ SequenceId + , txId: E.value :: _ TxId + , tx: E.value :: _ Tx + , dereferencedInputs: E.value :: _ (Array DereferencedInput) + , balances: + (E.dictionary E.value E.value) :: _ (Map BeneficialOwner Value) + , valid: E.value :: _ Boolean + } + ) + +instance decodeJsonAnnotatedTx :: DecodeJson AnnotatedTx where + decodeJson = defer \_ -> D.decode $ + ( AnnotatedTx <$> D.record "AnnotatedTx" + { sequenceId: D.value :: _ SequenceId + , txId: D.value :: _ TxId + , tx: D.value :: _ Tx + , dereferencedInputs: D.value :: _ (Array DereferencedInput) + , balances: + (D.dictionary D.value D.value) :: _ (Map BeneficialOwner Value) + , valid: D.value :: _ Boolean + } + ) + +derive instance genericAnnotatedTx :: Generic AnnotatedTx _ + +derive instance newtypeAnnotatedTx :: Newtype AnnotatedTx _ + +-------------------------------------------------------------------------------- + +_AnnotatedTx :: Iso' AnnotatedTx + { sequenceId :: SequenceId + , txId :: TxId + , tx :: Tx + , dereferencedInputs :: Array DereferencedInput + , balances :: Map BeneficialOwner Value + , valid :: Boolean + } +_AnnotatedTx = _Newtype + +-------------------------------------------------------------------------------- + +data DereferencedInput + = DereferencedInput + { originalInput :: TxIn + , refersTo :: TxOut + } + | InputNotFound TxKey + +derive instance eqDereferencedInput :: Eq DereferencedInput + +instance showDereferencedInput :: Show DereferencedInput where + show a = genericShow a + +instance encodeJsonDereferencedInput :: EncodeJson DereferencedInput where + encodeJson = defer \_ -> case _ of + DereferencedInput { originalInput, refersTo } -> encodeJson + { tag: "DereferencedInput" + , originalInput: flip E.encode originalInput E.value + , refersTo: flip E.encode refersTo E.value + } + InputNotFound a -> E.encodeTagged "InputNotFound" a E.value + +instance decodeJsonDereferencedInput :: DecodeJson DereferencedInput where + decodeJson = defer \_ -> D.decode + $ D.sumType "DereferencedInput" + $ Map.fromFoldable + [ "DereferencedInput" /\ + ( DereferencedInput <$> D.object "DereferencedInput" + { originalInput: D.value :: _ TxIn + , refersTo: D.value :: _ TxOut + } + ) + , "InputNotFound" /\ D.content (InputNotFound <$> D.value) + ] + +derive instance genericDereferencedInput :: Generic DereferencedInput _ + +-------------------------------------------------------------------------------- + +_DereferencedInput :: Prism' DereferencedInput + { originalInput :: TxIn, refersTo :: TxOut } +_DereferencedInput = prism' DereferencedInput case _ of + (DereferencedInput a) -> Just a + _ -> Nothing + +_InputNotFound :: Prism' DereferencedInput TxKey +_InputNotFound = prism' InputNotFound case _ of + (InputNotFound a) -> Just a + _ -> Nothing + +-------------------------------------------------------------------------------- + +data BeneficialOwner + = OwnedByPubKey PubKeyHash + | OwnedByScript String + +derive instance eqBeneficialOwner :: Eq BeneficialOwner + +derive instance ordBeneficialOwner :: Ord BeneficialOwner + +instance showBeneficialOwner :: Show BeneficialOwner where + show a = genericShow a + +instance encodeJsonBeneficialOwner :: EncodeJson BeneficialOwner where + encodeJson = defer \_ -> case _ of + OwnedByPubKey a -> E.encodeTagged "OwnedByPubKey" a E.value + OwnedByScript a -> E.encodeTagged "OwnedByScript" a E.value + +instance decodeJsonBeneficialOwner :: DecodeJson BeneficialOwner where + decodeJson = defer \_ -> D.decode + $ D.sumType "BeneficialOwner" + $ Map.fromFoldable + [ "OwnedByPubKey" /\ D.content (OwnedByPubKey <$> D.value) + , "OwnedByScript" /\ D.content (OwnedByScript <$> D.value) + ] + +derive instance genericBeneficialOwner :: Generic BeneficialOwner _ + +-------------------------------------------------------------------------------- + +_OwnedByPubKey :: Prism' BeneficialOwner PubKeyHash +_OwnedByPubKey = prism' OwnedByPubKey case _ of + (OwnedByPubKey a) -> Just a + _ -> Nothing + +_OwnedByScript :: Prism' BeneficialOwner String +_OwnedByScript = prism' OwnedByScript case _ of + (OwnedByScript a) -> Just a + _ -> Nothing + +-------------------------------------------------------------------------------- + +newtype SequenceId = SequenceId + { slotIndex :: Int + , txIndex :: Int + } + +derive instance eqSequenceId :: Eq SequenceId + +derive instance ordSequenceId :: Ord SequenceId + +instance showSequenceId :: Show SequenceId where + show a = genericShow a + +instance encodeJsonSequenceId :: EncodeJson SequenceId where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { slotIndex: E.value :: _ Int + , txIndex: E.value :: _ Int + } + ) + +instance decodeJsonSequenceId :: DecodeJson SequenceId where + decodeJson = defer \_ -> D.decode $ + ( SequenceId <$> D.record "SequenceId" + { slotIndex: D.value :: _ Int + , txIndex: D.value :: _ Int + } + ) + +derive instance genericSequenceId :: Generic SequenceId _ + +derive instance newtypeSequenceId :: Newtype SequenceId _ + +-------------------------------------------------------------------------------- + +_SequenceId :: Iso' SequenceId { slotIndex :: Int, txIndex :: Int } +_SequenceId = _Newtype + +-------------------------------------------------------------------------------- + +newtype TxKey = TxKey + { _txKeyTxId :: TxId + , _txKeyTxOutRefIdx :: BigInt + } + +derive instance eqTxKey :: Eq TxKey + +derive instance ordTxKey :: Ord TxKey + +instance showTxKey :: Show TxKey where + show a = genericShow a + +instance encodeJsonTxKey :: EncodeJson TxKey where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { _txKeyTxId: E.value :: _ TxId + , _txKeyTxOutRefIdx: E.value :: _ BigInt + } + ) + +instance decodeJsonTxKey :: DecodeJson TxKey where + decodeJson = defer \_ -> D.decode $ + ( TxKey <$> D.record "TxKey" + { _txKeyTxId: D.value :: _ TxId + , _txKeyTxOutRefIdx: D.value :: _ BigInt + } + ) + +derive instance genericTxKey :: Generic TxKey _ + +derive instance newtypeTxKey :: Newtype TxKey _ + +-------------------------------------------------------------------------------- + +_TxKey :: Iso' TxKey { _txKeyTxId :: TxId, _txKeyTxOutRefIdx :: BigInt } +_TxKey = _Newtype + +txKeyTxId :: Lens' TxKey TxId +txKeyTxId = _Newtype <<< prop (Proxy :: _ "_txKeyTxId") + +txKeyTxOutRefIdx :: Lens' TxKey BigInt +txKeyTxOutRefIdx = _Newtype <<< prop (Proxy :: _ "_txKeyTxOutRefIdx") \ No newline at end of file diff --git a/marlowe-dashboard-client/generated/Wallet/Types.purs b/marlowe-dashboard-client/generated/Wallet/Types.purs new file mode 100644 index 0000000000..c6cb8d53be --- /dev/null +++ b/marlowe-dashboard-client/generated/Wallet/Types.purs @@ -0,0 +1,441 @@ +-- File auto generated by purescript-bridge! -- +module Wallet.Types where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Bounded.Generic (genericBottom, genericTop) +import Data.Enum (class Enum) +import Data.Enum.Generic (genericPred, genericSucc) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.RawJson (RawJson) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Data.UUID.Argonaut (UUID) +import Ledger.Constraints.OffChain (MkTxError) +import Plutus.Contract.Checkpoint (CheckpointError) +import Type.Proxy (Proxy(Proxy)) +import Wallet.Emulator.Error (WalletAPIError) + +data ContractError + = WalletError WalletAPIError + | EmulatorAssertionError AssertionError + | OtherError String + | ConstraintResolutionError MkTxError + | ResumableError MatchingError + | CCheckpointError CheckpointError + +derive instance eqContractError :: Eq ContractError + +instance showContractError :: Show ContractError where + show a = genericShow a + +instance encodeJsonContractError :: EncodeJson ContractError where + encodeJson = defer \_ -> case _ of + WalletError a -> E.encodeTagged "WalletError" a E.value + EmulatorAssertionError a -> E.encodeTagged "EmulatorAssertionError" a + E.value + OtherError a -> E.encodeTagged "OtherError" a E.value + ConstraintResolutionError a -> E.encodeTagged "ConstraintResolutionError" a + E.value + ResumableError a -> E.encodeTagged "ResumableError" a E.value + CCheckpointError a -> E.encodeTagged "CCheckpointError" a E.value + +instance decodeJsonContractError :: DecodeJson ContractError where + decodeJson = defer \_ -> D.decode + $ D.sumType "ContractError" + $ Map.fromFoldable + [ "WalletError" /\ D.content (WalletError <$> D.value) + , "EmulatorAssertionError" /\ D.content + (EmulatorAssertionError <$> D.value) + , "OtherError" /\ D.content (OtherError <$> D.value) + , "ConstraintResolutionError" /\ D.content + (ConstraintResolutionError <$> D.value) + , "ResumableError" /\ D.content (ResumableError <$> D.value) + , "CCheckpointError" /\ D.content (CCheckpointError <$> D.value) + ] + +derive instance genericContractError :: Generic ContractError _ + +-------------------------------------------------------------------------------- + +_WalletError :: Prism' ContractError WalletAPIError +_WalletError = prism' WalletError case _ of + (WalletError a) -> Just a + _ -> Nothing + +_EmulatorAssertionError :: Prism' ContractError AssertionError +_EmulatorAssertionError = prism' EmulatorAssertionError case _ of + (EmulatorAssertionError a) -> Just a + _ -> Nothing + +_OtherError :: Prism' ContractError String +_OtherError = prism' OtherError case _ of + (OtherError a) -> Just a + _ -> Nothing + +_ConstraintResolutionError :: Prism' ContractError MkTxError +_ConstraintResolutionError = prism' ConstraintResolutionError case _ of + (ConstraintResolutionError a) -> Just a + _ -> Nothing + +_ResumableError :: Prism' ContractError MatchingError +_ResumableError = prism' ResumableError case _ of + (ResumableError a) -> Just a + _ -> Nothing + +_CCheckpointError :: Prism' ContractError CheckpointError +_CCheckpointError = prism' CCheckpointError case _ of + (CCheckpointError a) -> Just a + _ -> Nothing + +-------------------------------------------------------------------------------- + +newtype Notification = Notification + { notificationContractID :: ContractInstanceId + , notificationContractEndpoint :: EndpointDescription + , notificationContractArg :: RawJson + } + +derive instance eqNotification :: Eq Notification + +instance showNotification :: Show Notification where + show a = genericShow a + +instance encodeJsonNotification :: EncodeJson Notification where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { notificationContractID: E.value :: _ ContractInstanceId + , notificationContractEndpoint: E.value :: _ EndpointDescription + , notificationContractArg: E.value :: _ RawJson + } + ) + +instance decodeJsonNotification :: DecodeJson Notification where + decodeJson = defer \_ -> D.decode $ + ( Notification <$> D.record "Notification" + { notificationContractID: D.value :: _ ContractInstanceId + , notificationContractEndpoint: D.value :: _ EndpointDescription + , notificationContractArg: D.value :: _ RawJson + } + ) + +derive instance genericNotification :: Generic Notification _ + +derive instance newtypeNotification :: Newtype Notification _ + +-------------------------------------------------------------------------------- + +_Notification :: Iso' Notification + { notificationContractID :: ContractInstanceId + , notificationContractEndpoint :: EndpointDescription + , notificationContractArg :: RawJson + } +_Notification = _Newtype + +-------------------------------------------------------------------------------- + +data NotificationError + = EndpointNotAvailable ContractInstanceId EndpointDescription + | MoreThanOneEndpointAvailable ContractInstanceId EndpointDescription + | InstanceDoesNotExist ContractInstanceId + | OtherNotificationError ContractError + | NotificationJSONDecodeError EndpointDescription RawJson String + +derive instance eqNotificationError :: Eq NotificationError + +instance showNotificationError :: Show NotificationError where + show a = genericShow a + +instance encodeJsonNotificationError :: EncodeJson NotificationError where + encodeJson = defer \_ -> case _ of + EndpointNotAvailable a b -> E.encodeTagged "EndpointNotAvailable" (a /\ b) + (E.tuple (E.value >/\< E.value)) + MoreThanOneEndpointAvailable a b -> E.encodeTagged + "MoreThanOneEndpointAvailable" + (a /\ b) + (E.tuple (E.value >/\< E.value)) + InstanceDoesNotExist a -> E.encodeTagged "InstanceDoesNotExist" a E.value + OtherNotificationError a -> E.encodeTagged "OtherNotificationError" a + E.value + NotificationJSONDecodeError a b c -> E.encodeTagged + "NotificationJSONDecodeError" + (a /\ b /\ c) + (E.tuple (E.value >/\< E.value >/\< E.value)) + +instance decodeJsonNotificationError :: DecodeJson NotificationError where + decodeJson = defer \_ -> D.decode + $ D.sumType "NotificationError" + $ Map.fromFoldable + [ "EndpointNotAvailable" /\ D.content + (D.tuple $ EndpointNotAvailable D.value D.value) + , "MoreThanOneEndpointAvailable" /\ D.content + (D.tuple $ MoreThanOneEndpointAvailable D.value D.value) + , "InstanceDoesNotExist" /\ D.content (InstanceDoesNotExist <$> D.value) + , "OtherNotificationError" /\ D.content + (OtherNotificationError <$> D.value) + , "NotificationJSONDecodeError" /\ D.content + ( D.tuple $ NotificationJSONDecodeError D.value D.value + D.value + ) + ] + +derive instance genericNotificationError :: Generic NotificationError _ + +-------------------------------------------------------------------------------- + +_EndpointNotAvailable :: Prism' NotificationError + { a :: ContractInstanceId, b :: EndpointDescription } +_EndpointNotAvailable = prism' (\{ a, b } -> (EndpointNotAvailable a b)) + case _ of + (EndpointNotAvailable a b) -> Just { a, b } + _ -> Nothing + +_MoreThanOneEndpointAvailable :: Prism' NotificationError + { a :: ContractInstanceId, b :: EndpointDescription } +_MoreThanOneEndpointAvailable = prism' + (\{ a, b } -> (MoreThanOneEndpointAvailable a b)) + case _ of + (MoreThanOneEndpointAvailable a b) -> Just { a, b } + _ -> Nothing + +_InstanceDoesNotExist :: Prism' NotificationError ContractInstanceId +_InstanceDoesNotExist = prism' InstanceDoesNotExist case _ of + (InstanceDoesNotExist a) -> Just a + _ -> Nothing + +_OtherNotificationError :: Prism' NotificationError ContractError +_OtherNotificationError = prism' OtherNotificationError case _ of + (OtherNotificationError a) -> Just a + _ -> Nothing + +_NotificationJSONDecodeError :: Prism' NotificationError + { a :: EndpointDescription, b :: RawJson, c :: String } +_NotificationJSONDecodeError = prism' + (\{ a, b, c } -> (NotificationJSONDecodeError a b c)) + case _ of + (NotificationJSONDecodeError a b c) -> Just { a, b, c } + _ -> Nothing + +-------------------------------------------------------------------------------- + +newtype MatchingError = WrongVariantError { unWrongVariantError :: String } + +derive instance eqMatchingError :: Eq MatchingError + +instance showMatchingError :: Show MatchingError where + show a = genericShow a + +instance encodeJsonMatchingError :: EncodeJson MatchingError where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { unWrongVariantError: E.value :: _ String } + ) + +instance decodeJsonMatchingError :: DecodeJson MatchingError where + decodeJson = defer \_ -> D.decode $ + ( WrongVariantError <$> D.record "WrongVariantError" + { unWrongVariantError: D.value :: _ String } + ) + +derive instance genericMatchingError :: Generic MatchingError _ + +derive instance newtypeMatchingError :: Newtype MatchingError _ + +-------------------------------------------------------------------------------- + +_WrongVariantError :: Iso' MatchingError { unWrongVariantError :: String } +_WrongVariantError = _Newtype + +-------------------------------------------------------------------------------- + +newtype AssertionError = GenericAssertion { unAssertionError :: String } + +derive instance eqAssertionError :: Eq AssertionError + +instance showAssertionError :: Show AssertionError where + show a = genericShow a + +instance encodeJsonAssertionError :: EncodeJson AssertionError where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { unAssertionError: E.value :: _ String } + ) + +instance decodeJsonAssertionError :: DecodeJson AssertionError where + decodeJson = defer \_ -> D.decode $ + ( GenericAssertion <$> D.record "GenericAssertion" + { unAssertionError: D.value :: _ String } + ) + +derive instance genericAssertionError :: Generic AssertionError _ + +derive instance newtypeAssertionError :: Newtype AssertionError _ + +-------------------------------------------------------------------------------- + +_GenericAssertion :: Iso' AssertionError { unAssertionError :: String } +_GenericAssertion = _Newtype + +-------------------------------------------------------------------------------- + +newtype ContractInstanceId = ContractInstanceId { unContractInstanceId :: UUID } + +derive instance eqContractInstanceId :: Eq ContractInstanceId + +derive instance ordContractInstanceId :: Ord ContractInstanceId + +instance showContractInstanceId :: Show ContractInstanceId where + show a = genericShow a + +instance encodeJsonContractInstanceId :: EncodeJson ContractInstanceId where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { unContractInstanceId: E.value :: _ UUID } + ) + +instance decodeJsonContractInstanceId :: DecodeJson ContractInstanceId where + decodeJson = defer \_ -> D.decode $ + ( ContractInstanceId <$> D.record "ContractInstanceId" + { unContractInstanceId: D.value :: _ UUID } + ) + +derive instance genericContractInstanceId :: Generic ContractInstanceId _ + +derive instance newtypeContractInstanceId :: Newtype ContractInstanceId _ + +-------------------------------------------------------------------------------- + +_ContractInstanceId :: Iso' ContractInstanceId { unContractInstanceId :: UUID } +_ContractInstanceId = _Newtype + +-------------------------------------------------------------------------------- + +data ContractActivityStatus + = Active + | Stopped + | Done + +derive instance eqContractActivityStatus :: Eq ContractActivityStatus + +derive instance ordContractActivityStatus :: Ord ContractActivityStatus + +instance showContractActivityStatus :: Show ContractActivityStatus where + show a = genericShow a + +instance encodeJsonContractActivityStatus :: EncodeJson ContractActivityStatus where + encodeJson = defer \_ -> E.encode E.enum + +instance decodeJsonContractActivityStatus :: DecodeJson ContractActivityStatus where + decodeJson = defer \_ -> D.decode D.enum + +derive instance genericContractActivityStatus :: + Generic ContractActivityStatus _ + +instance enumContractActivityStatus :: Enum ContractActivityStatus where + succ = genericSucc + pred = genericPred + +instance boundedContractActivityStatus :: Bounded ContractActivityStatus where + bottom = genericBottom + top = genericTop + +-------------------------------------------------------------------------------- + +_Active :: Prism' ContractActivityStatus Unit +_Active = prism' (const Active) case _ of + Active -> Just unit + _ -> Nothing + +_Stopped :: Prism' ContractActivityStatus Unit +_Stopped = prism' (const Stopped) case _ of + Stopped -> Just unit + _ -> Nothing + +_Done :: Prism' ContractActivityStatus Unit +_Done = prism' (const Done) case _ of + Done -> Just unit + _ -> Nothing + +-------------------------------------------------------------------------------- + +newtype EndpointValue a = EndpointValue { unEndpointValue :: a } + +derive instance eqEndpointValue :: (Eq a) => Eq (EndpointValue a) + +instance showEndpointValue :: (Show a) => Show (EndpointValue a) where + show a = genericShow a + +instance encodeJsonEndpointValue :: + ( EncodeJson a + ) => + EncodeJson (EndpointValue a) where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { unEndpointValue: E.value :: _ a } + ) + +instance decodeJsonEndpointValue :: + ( DecodeJson a + ) => + DecodeJson (EndpointValue a) where + decodeJson = defer \_ -> D.decode $ + ( EndpointValue <$> D.record "EndpointValue" + { unEndpointValue: D.value :: _ a } + ) + +derive instance genericEndpointValue :: Generic (EndpointValue a) _ + +derive instance newtypeEndpointValue :: Newtype (EndpointValue a) _ + +-------------------------------------------------------------------------------- + +_EndpointValue :: forall a. Iso' (EndpointValue a) { unEndpointValue :: a } +_EndpointValue = _Newtype + +-------------------------------------------------------------------------------- + +newtype EndpointDescription = EndpointDescription + { getEndpointDescription :: String } + +instance showEndpointDescription :: Show EndpointDescription where + show a = genericShow a + +derive instance eqEndpointDescription :: Eq EndpointDescription + +derive instance ordEndpointDescription :: Ord EndpointDescription + +instance encodeJsonEndpointDescription :: EncodeJson EndpointDescription where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { getEndpointDescription: E.value :: _ String } + ) + +instance decodeJsonEndpointDescription :: DecodeJson EndpointDescription where + decodeJson = defer \_ -> D.decode $ + ( EndpointDescription <$> D.record "EndpointDescription" + { getEndpointDescription: D.value :: _ String } + ) + +derive instance genericEndpointDescription :: Generic EndpointDescription _ + +derive instance newtypeEndpointDescription :: Newtype EndpointDescription _ + +-------------------------------------------------------------------------------- + +_EndpointDescription :: Iso' EndpointDescription + { getEndpointDescription :: String } +_EndpointDescription = _Newtype \ No newline at end of file diff --git a/marlowe-playground-client/generated/Auth.purs b/marlowe-playground-client/generated/Auth.purs new file mode 100644 index 0000000000..b3eef2195e --- /dev/null +++ b/marlowe-playground-client/generated/Auth.purs @@ -0,0 +1,98 @@ +-- File auto generated by purescript-bridge! -- +module Auth where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Bounded.Generic (genericBottom, genericTop) +import Data.Enum (class Enum) +import Data.Enum.Generic (genericPred, genericSucc) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Type.Proxy (Proxy(Proxy)) + +newtype AuthStatus = AuthStatus { _authStatusAuthRole :: AuthRole } + +derive instance eqAuthStatus :: Eq AuthStatus + +instance showAuthStatus :: Show AuthStatus where + show a = genericShow a + +instance encodeJsonAuthStatus :: EncodeJson AuthStatus where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { _authStatusAuthRole: E.value :: _ AuthRole } + ) + +instance decodeJsonAuthStatus :: DecodeJson AuthStatus where + decodeJson = defer \_ -> D.decode $ + ( AuthStatus <$> D.record "AuthStatus" + { _authStatusAuthRole: D.value :: _ AuthRole } + ) + +derive instance genericAuthStatus :: Generic AuthStatus _ + +derive instance newtypeAuthStatus :: Newtype AuthStatus _ + +-------------------------------------------------------------------------------- + +_AuthStatus :: Iso' AuthStatus { _authStatusAuthRole :: AuthRole } +_AuthStatus = _Newtype + +authStatusAuthRole :: Lens' AuthStatus AuthRole +authStatusAuthRole = _Newtype <<< prop (Proxy :: _ "_authStatusAuthRole") + +-------------------------------------------------------------------------------- + +data AuthRole + = Anonymous + | GithubUser + +derive instance eqAuthRole :: Eq AuthRole + +derive instance ordAuthRole :: Ord AuthRole + +instance showAuthRole :: Show AuthRole where + show a = genericShow a + +instance encodeJsonAuthRole :: EncodeJson AuthRole where + encodeJson = defer \_ -> E.encode E.enum + +instance decodeJsonAuthRole :: DecodeJson AuthRole where + decodeJson = defer \_ -> D.decode D.enum + +derive instance genericAuthRole :: Generic AuthRole _ + +instance enumAuthRole :: Enum AuthRole where + succ = genericSucc + pred = genericPred + +instance boundedAuthRole :: Bounded AuthRole where + bottom = genericBottom + top = genericTop + +-------------------------------------------------------------------------------- + +_Anonymous :: Prism' AuthRole Unit +_Anonymous = prism' (const Anonymous) case _ of + Anonymous -> Just unit + _ -> Nothing + +_GithubUser :: Prism' AuthRole Unit +_GithubUser = prism' (const GithubUser) case _ of + GithubUser -> Just unit + _ -> Nothing \ No newline at end of file diff --git a/marlowe-playground-client/generated/Control/Monad/Freer/Extras/Beam.purs b/marlowe-playground-client/generated/Control/Monad/Freer/Extras/Beam.purs new file mode 100644 index 0000000000..06812fb4d5 --- /dev/null +++ b/marlowe-playground-client/generated/Control/Monad/Freer/Extras/Beam.purs @@ -0,0 +1,69 @@ +-- File auto generated by purescript-bridge! -- +module Control.Monad.Freer.Extras.Beam where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Type.Proxy (Proxy(Proxy)) + +newtype BeamError = SqlError String + +derive instance eqBeamError :: Eq BeamError + +instance showBeamError :: Show BeamError where + show a = genericShow a + +instance encodeJsonBeamError :: EncodeJson BeamError where + encodeJson = defer \_ -> E.encode $ unwrap >$< E.value + +instance decodeJsonBeamError :: DecodeJson BeamError where + decodeJson = defer \_ -> D.decode $ (SqlError <$> D.value) + +derive instance genericBeamError :: Generic BeamError _ + +derive instance newtypeBeamError :: Newtype BeamError _ + +-------------------------------------------------------------------------------- + +_SqlError :: Iso' BeamError String +_SqlError = _Newtype + +-------------------------------------------------------------------------------- + +newtype BeamLog = SqlLog String + +derive instance eqBeamLog :: Eq BeamLog + +instance showBeamLog :: Show BeamLog where + show a = genericShow a + +instance encodeJsonBeamLog :: EncodeJson BeamLog where + encodeJson = defer \_ -> E.encode $ unwrap >$< E.value + +instance decodeJsonBeamLog :: DecodeJson BeamLog where + decodeJson = defer \_ -> D.decode $ (SqlLog <$> D.value) + +derive instance genericBeamLog :: Generic BeamLog _ + +derive instance newtypeBeamLog :: Newtype BeamLog _ + +-------------------------------------------------------------------------------- + +_SqlLog :: Iso' BeamLog String +_SqlLog = _Newtype \ No newline at end of file diff --git a/marlowe-playground-client/generated/Control/Monad/Freer/Extras/Pagination.purs b/marlowe-playground-client/generated/Control/Monad/Freer/Extras/Pagination.purs new file mode 100644 index 0000000000..d73fdfe0f8 --- /dev/null +++ b/marlowe-playground-client/generated/Control/Monad/Freer/Extras/Pagination.purs @@ -0,0 +1,135 @@ +-- File auto generated by purescript-bridge! -- +module Control.Monad.Freer.Extras.Pagination where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Type.Proxy (Proxy(Proxy)) + +newtype Page a = Page + { currentPageQuery :: PageQuery a + , nextPageQuery :: Maybe (PageQuery a) + , pageItems :: Array a + } + +derive instance eqPage :: (Eq a) => Eq (Page a) + +instance showPage :: (Show a) => Show (Page a) where + show a = genericShow a + +instance encodeJsonPage :: (EncodeJson a) => EncodeJson (Page a) where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { currentPageQuery: E.value :: _ (PageQuery a) + , nextPageQuery: (E.maybe E.value) :: _ (Maybe (PageQuery a)) + , pageItems: E.value :: _ (Array a) + } + ) + +instance decodeJsonPage :: (DecodeJson a) => DecodeJson (Page a) where + decodeJson = defer \_ -> D.decode $ + ( Page <$> D.record "Page" + { currentPageQuery: D.value :: _ (PageQuery a) + , nextPageQuery: (D.maybe D.value) :: _ (Maybe (PageQuery a)) + , pageItems: D.value :: _ (Array a) + } + ) + +derive instance genericPage :: Generic (Page a) _ + +derive instance newtypePage :: Newtype (Page a) _ + +-------------------------------------------------------------------------------- + +_Page + :: forall a + . Iso' (Page a) + { currentPageQuery :: PageQuery a + , nextPageQuery :: Maybe (PageQuery a) + , pageItems :: Array a + } +_Page = _Newtype + +-------------------------------------------------------------------------------- + +newtype PageQuery a = PageQuery + { pageQuerySize :: PageSize + , pageQueryLastItem :: Maybe a + } + +derive instance eqPageQuery :: (Eq a) => Eq (PageQuery a) + +instance showPageQuery :: (Show a) => Show (PageQuery a) where + show a = genericShow a + +instance encodeJsonPageQuery :: (EncodeJson a) => EncodeJson (PageQuery a) where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { pageQuerySize: E.value :: _ PageSize + , pageQueryLastItem: (E.maybe E.value) :: _ (Maybe a) + } + ) + +instance decodeJsonPageQuery :: (DecodeJson a) => DecodeJson (PageQuery a) where + decodeJson = defer \_ -> D.decode $ + ( PageQuery <$> D.record "PageQuery" + { pageQuerySize: D.value :: _ PageSize + , pageQueryLastItem: (D.maybe D.value) :: _ (Maybe a) + } + ) + +derive instance genericPageQuery :: Generic (PageQuery a) _ + +derive instance newtypePageQuery :: Newtype (PageQuery a) _ + +-------------------------------------------------------------------------------- + +_PageQuery + :: forall a + . Iso' (PageQuery a) + { pageQuerySize :: PageSize, pageQueryLastItem :: Maybe a } +_PageQuery = _Newtype + +-------------------------------------------------------------------------------- + +newtype PageSize = PageSize { getPageSize :: Int } + +derive instance eqPageSize :: Eq PageSize + +instance showPageSize :: Show PageSize where + show a = genericShow a + +instance encodeJsonPageSize :: EncodeJson PageSize where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { getPageSize: E.value :: _ Int } + ) + +instance decodeJsonPageSize :: DecodeJson PageSize where + decodeJson = defer \_ -> D.decode $ + (PageSize <$> D.record "PageSize" { getPageSize: D.value :: _ Int }) + +derive instance genericPageSize :: Generic PageSize _ + +derive instance newtypePageSize :: Newtype PageSize _ + +-------------------------------------------------------------------------------- + +_PageSize :: Iso' PageSize { getPageSize :: Int } +_PageSize = _Newtype \ No newline at end of file diff --git a/marlowe-playground-client/generated/Examples/Haskell/Contracts.purs b/marlowe-playground-client/generated/Examples/Haskell/Contracts.purs new file mode 100644 index 0000000000..2b1657d0bd --- /dev/null +++ b/marlowe-playground-client/generated/Examples/Haskell/Contracts.purs @@ -0,0 +1,606 @@ +module Examples.Haskell.Contracts where + +example :: String +example = + """{-# LANGUAGE OverloadedStrings #-} +module Example where + +import Language.Marlowe.Extended + +main :: IO () +main = print . pretty $ contract + + +{- Define a contract, Close is the simplest contract which just ends the contract straight away +-} + +contract :: Contract +contract = Close +""" + +escrow :: String +escrow = + """{-# LANGUAGE OverloadedStrings #-} +module Escrow where + +import Language.Marlowe.Extended + +main :: IO () +main = print . pretty $ contract + +-- We can set explicitRefunds True to run Close refund analysis +-- but we get a shorter contract if we set it to False +explicitRefunds :: Bool +explicitRefunds = False + +seller, buyer, arbiter :: Party +buyer = Role "Buyer" +seller = Role "Seller" +arbiter = Role "Mediator" + +price :: Value +price = ConstantParam "Price" + +depositTimeout, disputeTimeout, answerTimeout, arbitrageTimeout :: Timeout +depositTimeout = SlotParam "Payment deadline" +disputeTimeout = SlotParam "Complaint response deadline" +answerTimeout = SlotParam "Complaint deadline" +arbitrageTimeout = SlotParam "Mediation deadline" + +choice :: ChoiceName -> Party -> Integer -> Contract -> Case +choice choiceName chooser choiceValue = Case (Choice (ChoiceId choiceName chooser) + [Bound choiceValue choiceValue]) + +deposit :: Timeout -> Contract -> Contract -> Contract +deposit timeout timeoutContinuation continuation = + When [Case (Deposit seller buyer ada price) continuation] + timeout + timeoutContinuation + +choices :: Timeout -> Party -> Contract -> [(Integer, ChoiceName, Contract)] -> Contract +choices timeout chooser timeoutContinuation list = + When [choice choiceName chooser choiceValue continuation + | (choiceValue, choiceName, continuation) <- list] + timeout + timeoutContinuation + +sellerToBuyer, paySeller :: Contract -> Contract +sellerToBuyer = Pay seller (Account buyer) ada price +paySeller = Pay buyer (Party seller) ada price + +refundBuyer :: Contract +refundBuyer + | explicitRefunds = Pay buyer (Party buyer) ada price Close + | otherwise = Close + +refundSeller :: Contract +refundSeller + | explicitRefunds = Pay seller (Party seller) ada price Close + | otherwise = Close + +contract :: Contract +contract = deposit depositTimeout Close $ + choices disputeTimeout buyer refundSeller + [ (0, "Everything is alright" + , refundSeller + ) + , (1, "Report problem" + , sellerToBuyer $ + choices answerTimeout seller refundBuyer + [ (1, "Confirm problem" + , refundBuyer + ) + , (0, "Dispute problem" + , choices arbitrageTimeout arbiter refundBuyer + [ (0, "Dismiss claim" + , paySeller + Close + ) + , (1, "Confirm problem" + , refundBuyer + ) + ] + ) + ] + ) + ] +""" + +escrowWithCollateral :: String +escrowWithCollateral = + """{-# LANGUAGE OverloadedStrings #-} +module EscrowWithCollateral where + +import Language.Marlowe.Extended + +main :: IO () +main = print . pretty $ contract + +-- We can set explicitRefunds True to run Close refund analysis +-- but we get a shorter contract if we set it to False +explicitRefunds :: Bool +explicitRefunds = False + +seller, buyer, burnAddress :: Party +buyer = Role "Buyer" +seller = Role "Seller" +burnAddress = PK "0000000000000000000000000000000000000000000000000000000000000000" + +price, collateral :: Value +price = ConstantParam "Price" +collateral = ConstantParam "Collateral amount" + +sellerCollateralTimeout, buyerCollateralTimeout, depositTimeout, disputeTimeout, answerTimeout :: Timeout +sellerCollateralTimeout = SlotParam "Collateral deposit by seller timeout" +buyerCollateralTimeout = SlotParam "Deposit of collateral by buyer timeout" +depositTimeout = SlotParam "Deposit of price by buyer timeout" +disputeTimeout = SlotParam "Dispute by buyer timeout" +answerTimeout = SlotParam "Complaint deadline" + +depositCollateral :: Party -> Timeout -> Contract -> Contract -> Contract +depositCollateral party timeout timeoutContinuation continuation = + When [Case (Deposit party party ada collateral) continuation] + timeout + timeoutContinuation + +burnCollaterals :: Contract -> Contract +burnCollaterals = + Pay seller (Party burnAddress) ada collateral + . Pay buyer (Party burnAddress) ada collateral + +deposit :: Timeout -> Contract -> Contract -> Contract +deposit timeout timeoutContinuation continuation = + When [Case (Deposit seller buyer ada price) continuation] + timeout + timeoutContinuation + +choice :: ChoiceName -> Party -> Integer -> Contract -> Case +choice choiceName chooser choiceValue = Case (Choice (ChoiceId choiceName chooser) + [Bound choiceValue choiceValue]) + +choices :: Timeout -> Party -> Contract -> [(Integer, ChoiceName, Contract)] -> Contract +choices timeout chooser timeoutContinuation list = + When [choice choiceName chooser choiceValue continuation + | (choiceValue, choiceName, continuation) <- list] + timeout + timeoutContinuation + +sellerToBuyer :: Contract -> Contract +sellerToBuyer = Pay seller (Account buyer) ada price + +refundSellerCollateral :: Contract -> Contract +refundSellerCollateral + | explicitRefunds = Pay seller (Party seller) ada collateral + | otherwise = id + +refundBuyerCollateral :: Contract -> Contract +refundBuyerCollateral + | explicitRefunds = Pay buyer (Party buyer) ada collateral + | otherwise = id + +refundCollaterals :: Contract -> Contract +refundCollaterals = refundSellerCollateral . refundBuyerCollateral + +refundBuyer :: Contract +refundBuyer + | explicitRefunds = Pay buyer (Party buyer) ada price Close + | otherwise = Close + +refundSeller :: Contract +refundSeller + | explicitRefunds = Pay seller (Party seller) ada price Close + | otherwise = Close + +contract :: Contract +contract = depositCollateral seller sellerCollateralTimeout Close $ + depositCollateral buyer buyerCollateralTimeout (refundSellerCollateral Close) $ + deposit depositTimeout (refundCollaterals Close) $ + choices disputeTimeout buyer (refundCollaterals refundSeller) + [ (0, "Everything is alright" + , refundCollaterals refundSeller + ) + , (1, "Report problem" + , sellerToBuyer $ + choices answerTimeout seller (refundCollaterals refundBuyer) + [ (1, "Confirm problem" + , refundCollaterals refundBuyer + ) + , (0, "Dispute problem" + , burnCollaterals refundBuyer + ) + ] + ) + ] +""" + +zeroCouponBond :: String +zeroCouponBond = + """{-# LANGUAGE OverloadedStrings #-} +module ZeroCouponBond where + +import Language.Marlowe.Extended + +main :: IO () +main = print . pretty $ contract + +discountedPrice, notionalPrice :: Value +discountedPrice = ConstantParam "Amount" +notionalPrice = AddValue (ConstantParam "Interest") discountedPrice + +investor, issuer :: Party +investor = Role "Lender" +issuer = Role "Borrower" + +initialExchange, maturityExchangeTimeout :: Timeout +initialExchange = SlotParam "Loan deadline" +maturityExchangeTimeout = SlotParam "Payback deadline" + +transfer :: Timeout -> Party -> Party -> Value -> Contract -> Contract +transfer timeout from to amount continuation = + When [ Case (Deposit from from ada amount) + (Pay from (Party to) ada amount continuation) ] + timeout + Close + +contract :: Contract +contract = transfer initialExchange investor issuer discountedPrice + $ transfer maturityExchangeTimeout issuer investor notionalPrice + Close +""" + +couponBondGuaranteed :: String +couponBondGuaranteed = + """{-# LANGUAGE OverloadedStrings #-} +module CouponBondGuaranteed where + +import Language.Marlowe.Extended + +main :: IO () +main = print . pretty $ contract + +-- We can set explicitRefunds True to run Close refund analysis +-- but we get a shorter contract if we set it to False +explicitRefunds :: Bool +explicitRefunds = False + +guarantor, investor, issuer :: Party +guarantor = Role "Guarantor" +investor = Role "Lender" +issuer = Role "Borrower" + +principal, instalment :: Value +principal = ConstantParam "Principal" +instalment = ConstantParam "Interest instalment" + +guaranteedAmount :: Integer -> Value +guaranteedAmount instalments = AddValue (MulValue (Constant instalments) instalment) principal + +lastInstalment :: Value +lastInstalment = AddValue instalment principal + +deposit :: Value -> Party -> Party -> Timeout -> Contract -> Contract -> Contract +deposit amount by toAccount timeout timeoutContinuation continuation = + When [Case (Deposit toAccount by ada amount) continuation] + timeout + timeoutContinuation + +refundGuarantor :: Value -> Contract -> Contract +refundGuarantor = Pay investor (Party guarantor) ada + +transfer :: Value -> Party -> Party -> Timeout -> Contract -> Contract -> Contract +transfer amount from to timeout timeoutContinuation continuation = + deposit amount from to timeout timeoutContinuation + $ Pay to (Party to) ada amount + continuation + +giveCollateralToLender :: Value -> Contract +giveCollateralToLender amount + | explicitRefunds = Pay investor (Party investor) ada amount Close + | otherwise = Close + +contract :: Contract +contract = deposit (guaranteedAmount 3) guarantor investor + 300 Close + $ transfer principal investor issuer + 600 (refundGuarantor (guaranteedAmount 3) Close) + $ transfer instalment issuer investor + 900 (giveCollateralToLender $ guaranteedAmount 3) + $ refundGuarantor instalment + $ transfer instalment issuer investor + 1200 (giveCollateralToLender $ guaranteedAmount 2) + $ refundGuarantor instalment + $ transfer lastInstalment issuer investor + 1500 (giveCollateralToLender $ guaranteedAmount 1) + $ refundGuarantor lastInstalment + Close +""" + +swap :: String +swap = + """{-# LANGUAGE OverloadedStrings #-} +module Swap where + +import Language.Marlowe.Extended + +main :: IO () +main = print . pretty $ contract + +-- We can set explicitRefunds True to run Close refund analysis +-- but we get a shorter contract if we set it to False +explicitRefunds :: Bool +explicitRefunds = False + +lovelacePerAda, amountOfAda, amountOfLovelace, amountOfDollars :: Value +lovelacePerAda = Constant 1000000 +amountOfAda = ConstantParam "Amount of Ada" +amountOfLovelace = MulValue lovelacePerAda amountOfAda +amountOfDollars = ConstantParam "Amount of dollars" + +adaDepositTimeout, dollarDepositTimeout :: Timeout +adaDepositTimeout = SlotParam "Timeout for Ada deposit" +dollarDepositTimeout = SlotParam "Timeout for dollar deposit" + +dollars :: Token +dollars = Token "85bb65" "dollar" + +data SwapParty = SwapParty { party :: Party + , currency :: Token + , amount :: Value + } + +adaProvider, dollarProvider :: SwapParty +adaProvider = SwapParty { party = Role "Ada provider" + , currency = ada + , amount = amountOfLovelace + } +dollarProvider = SwapParty { party = Role "Dollar provider" + , currency = dollars + , amount = amountOfDollars + } + +makeDeposit :: SwapParty -> Timeout -> Contract -> Contract -> Contract +makeDeposit src timeout timeoutContinuation continuation = + When [ Case (Deposit (party src) (party src) (currency src) (amount src)) + continuation + ] timeout + timeoutContinuation + +refundSwapParty :: SwapParty -> Contract +refundSwapParty swapParty + | explicitRefunds = Pay (party swapParty) (Party (party swapParty)) (currency swapParty) (amount swapParty) Close + | otherwise = Close + +makePayment :: SwapParty -> SwapParty -> Contract -> Contract +makePayment src dest = + Pay (party src) (Party $ party dest) (currency src) (amount src) + +contract :: Contract +contract = makeDeposit adaProvider adaDepositTimeout Close + $ makeDeposit dollarProvider dollarDepositTimeout (refundSwapParty adaProvider) + $ makePayment adaProvider dollarProvider + $ makePayment dollarProvider adaProvider + Close +""" + +contractForDifferences :: String +contractForDifferences = + """{-# LANGUAGE NumericUnderscores #-} +{-# LANGUAGE OverloadedStrings #-} +module ContractForDifferences where + +import Language.Marlowe.Extended + +main :: IO () +main = print . pretty $ contract + +-- We can set explicitRefunds True to run Close refund analysis +-- but we get a shorter contract if we set it to False +explicitRefunds :: Bool +explicitRefunds = False + +party, counterparty, oracle :: Party +party = Role "Party" +counterparty = Role "Counterparty" +oracle = Role "Oracle" + +partyDeposit, counterpartyDeposit, bothDeposits :: Value +partyDeposit = ConstantParam "Amount paid by party" +counterpartyDeposit = ConstantParam "Amount paid by counterparty" +bothDeposits = AddValue partyDeposit counterpartyDeposit + +priceBeginning, priceEnd :: ChoiceId +priceBeginning = ChoiceId "Price in first window" oracle +priceEnd = ChoiceId "Price in second window" oracle + +decreaseInPrice, increaseInPrice :: ValueId +decreaseInPrice = "Decrease in price" +increaseInPrice = "Increase in price" + +initialDeposit :: Party -> Value -> Timeout -> Contract -> Contract -> Contract +initialDeposit by deposit timeout timeoutContinuation continuation = + When [Case (Deposit by by ada deposit) continuation] + timeout + timeoutContinuation + +oracleInput :: ChoiceId -> Timeout -> Contract -> Contract -> Contract +oracleInput choiceId timeout timeoutContinuation continuation = + When [Case (Choice choiceId [Bound 0 1_000_000_000]) continuation] + timeout + timeoutContinuation + +wait :: Timeout -> Contract -> Contract +wait = When [] + +gtLtEq :: Value -> Value -> Contract -> Contract -> Contract -> Contract +gtLtEq value1 value2 gtContinuation ltContinuation eqContinuation = + If (ValueGT value1 value2) gtContinuation + $ If (ValueLT value1 value2) ltContinuation + eqContinuation + +recordDifference :: ValueId -> ChoiceId -> ChoiceId -> Contract -> Contract +recordDifference name choiceId1 choiceId2 = + Let name (SubValue (ChoiceValue choiceId1) (ChoiceValue choiceId2)) + +transferUpToDeposit :: Party -> Value -> Party -> Value -> Contract -> Contract +transferUpToDeposit from payerDeposit to amount = + Pay from (Account to) ada (Cond (ValueLT amount payerDeposit) amount payerDeposit) + +refund :: Party -> Value -> Contract -> Contract +refund who amount + | explicitRefunds = Pay who (Party who) ada amount + | otherwise = id + +refundBoth :: Contract +refundBoth = refund party partyDeposit (refund counterparty counterpartyDeposit Close) + +refundIfGtZero :: Party -> Value -> Contract -> Contract +refundIfGtZero who amount continuation + | explicitRefunds = If (ValueGT amount (Constant 0)) (refund who amount continuation) continuation + | otherwise = continuation + +refundUpToBothDeposits :: Party -> Value -> Contract -> Contract +refundUpToBothDeposits who amount + | explicitRefunds = refund who $ Cond (ValueGT amount bothDeposits) bothDeposits amount + | otherwise = id + +refundAfterDifference :: Party -> Value -> Party -> Value -> Value -> Contract +refundAfterDifference payer payerDeposit payee payeeDeposit difference = + refundIfGtZero payer (SubValue payerDeposit difference) + $ refundUpToBothDeposits payee (AddValue payeeDeposit difference) + Close + +contract :: Contract +contract = initialDeposit party partyDeposit (SlotParam "Party deposit deadline") Close + $ initialDeposit counterparty counterpartyDeposit (SlotParam "Counterparty deposit deadline") (refund party partyDeposit Close) + $ wait (SlotParam "First window beginning") + $ oracleInput priceBeginning (SlotParam "First window deadline") refundBoth + $ wait (SlotParam "Second window beginning") + $ oracleInput priceEnd (SlotParam "Second window deadline") refundBoth + $ gtLtEq (ChoiceValue priceBeginning) (ChoiceValue priceEnd) + ( recordDifference decreaseInPrice priceBeginning priceEnd + $ transferUpToDeposit counterparty counterpartyDeposit party (UseValue decreaseInPrice) + $ refundAfterDifference counterparty counterpartyDeposit party partyDeposit (UseValue decreaseInPrice) + ) + ( recordDifference increaseInPrice priceEnd priceBeginning + $ transferUpToDeposit party partyDeposit counterparty (UseValue increaseInPrice) + $ refundAfterDifference party partyDeposit counterparty counterpartyDeposit (UseValue increaseInPrice) + ) + refundBoth +""" + +contractForDifferencesWithOracle :: String +contractForDifferencesWithOracle = + """{-# LANGUAGE NumericUnderscores #-} +{-# LANGUAGE OverloadedStrings #-} +module ContractForDifferencesWithOracle where + +import Language.Marlowe.Extended + +main :: IO () +main = print . pretty $ contract + +-- We can set explicitRefunds True to run Close refund analysis +-- but we get a shorter contract if we set it to False +explicitRefunds :: Bool +explicitRefunds = False + +party, counterparty, oracle :: Party +party = Role "Party" +counterparty = Role "Counterparty" +oracle = Role "kraken" + +partyDeposit, counterpartyDeposit, bothDeposits :: Value +partyDeposit = ConstantParam "Amount paid by party" +counterpartyDeposit = ConstantParam "Amount paid by counterparty" +bothDeposits = AddValue partyDeposit counterpartyDeposit + +priceBeginning :: Value +priceBeginning = ConstantParam "Amount of Ada to use as asset" + +priceEnd :: ValueId +priceEnd = "Price in second window" + +exchangeBeginning, exchangeEnd :: ChoiceId +exchangeBeginning = ChoiceId "dir-adausd" oracle +exchangeEnd = ChoiceId "inv-adausd" oracle + +decreaseInPrice, increaseInPrice :: ValueId +decreaseInPrice = "Decrease in price" +increaseInPrice = "Increase in price" + +initialDeposit :: Party -> Value -> Timeout -> Contract -> Contract -> Contract +initialDeposit by deposit timeout timeoutContinuation continuation = + When [Case (Deposit by by ada deposit) continuation] + timeout + timeoutContinuation + +oracleInput :: ChoiceId -> Timeout -> Contract -> Contract -> Contract +oracleInput choiceId timeout timeoutContinuation continuation = + When [Case (Choice choiceId [Bound 0 100_000_000_000]) continuation] + timeout + timeoutContinuation + +wait :: Timeout -> Contract -> Contract +wait = When [] + +gtLtEq :: Value -> Value -> Contract -> Contract -> Contract -> Contract +gtLtEq value1 value2 gtContinuation ltContinuation eqContinuation = + If (ValueGT value1 value2) gtContinuation + $ If (ValueLT value1 value2) ltContinuation + eqContinuation + +recordEndPrice :: ValueId -> ChoiceId -> ChoiceId -> Contract -> Contract +recordEndPrice name choiceId1 choiceId2 = + Let name (DivValue (MulValue priceBeginning (MulValue (ChoiceValue choiceId1) (ChoiceValue choiceId2))) + (Constant 10_000_000_000_000_000)) + +recordDifference :: ValueId -> Value -> Value -> Contract -> Contract +recordDifference name val1 val2 = Let name (SubValue val1 val2) + +transferUpToDeposit :: Party -> Value -> Party -> Value -> Contract -> Contract +transferUpToDeposit from payerDeposit to amount = + Pay from (Account to) ada (Cond (ValueLT amount payerDeposit) amount payerDeposit) + +refund :: Party -> Value -> Contract -> Contract +refund who amount + | explicitRefunds = Pay who (Party who) ada amount + | otherwise = id + +refundBoth :: Contract +refundBoth = refund party partyDeposit (refund counterparty counterpartyDeposit Close) + +refundIfGtZero :: Party -> Value -> Contract -> Contract +refundIfGtZero who amount continuation + | explicitRefunds = If (ValueGT amount (Constant 0)) (refund who amount continuation) continuation + | otherwise = continuation + +refundUpToBothDeposits :: Party -> Value -> Contract -> Contract +refundUpToBothDeposits who amount + | explicitRefunds = refund who $ Cond (ValueGT amount bothDeposits) bothDeposits amount + | otherwise = id + +refundAfterDifference :: Party -> Value -> Party -> Value -> Value -> Contract +refundAfterDifference payer payerDeposit payee payeeDeposit difference = + refundIfGtZero payer (SubValue payerDeposit difference) + $ refundUpToBothDeposits payee (AddValue payeeDeposit difference) + Close + +contract :: Contract +contract = initialDeposit party partyDeposit (SlotParam "Party deposit deadline") Close + $ initialDeposit counterparty counterpartyDeposit (SlotParam "Counterparty deposit deadline") (refund party partyDeposit Close) + $ wait (SlotParam "First window beginning") + $ oracleInput exchangeBeginning (SlotParam "First window deadline") refundBoth + $ wait (SlotParam "Second window beginning") + $ oracleInput exchangeEnd (SlotParam "Second window deadline") refundBoth + $ recordEndPrice priceEnd exchangeBeginning exchangeEnd + $ gtLtEq priceBeginning (UseValue priceEnd) + ( recordDifference decreaseInPrice priceBeginning (UseValue priceEnd) + $ transferUpToDeposit counterparty counterpartyDeposit party (UseValue decreaseInPrice) + $ refundAfterDifference counterparty counterpartyDeposit party partyDeposit (UseValue decreaseInPrice) + ) + ( recordDifference increaseInPrice (UseValue priceEnd) priceBeginning + $ transferUpToDeposit party partyDeposit counterparty (UseValue increaseInPrice) + $ refundAfterDifference party partyDeposit counterparty counterpartyDeposit (UseValue increaseInPrice) + ) + refundBoth +""" \ No newline at end of file diff --git a/marlowe-playground-client/generated/Examples/Marlowe/Contracts.purs b/marlowe-playground-client/generated/Examples/Marlowe/Contracts.purs new file mode 100644 index 0000000000..1919e4a400 --- /dev/null +++ b/marlowe-playground-client/generated/Examples/Marlowe/Contracts.purs @@ -0,0 +1,460 @@ +module Examples.Marlowe.Contracts where + +example :: String +example = """Close""" + +escrow :: String +escrow = + """When [ + (Case + (Deposit + (Role "Seller") + (Role "Buyer") + (Token "" "") + (ConstantParam "Price")) + (When [ + (Case + (Choice + (ChoiceId "Everything is alright" + (Role "Buyer")) [ + (Bound 0 0)]) Close) + , + (Case + (Choice + (ChoiceId "Report problem" + (Role "Buyer")) [ + (Bound 1 1)]) + (Pay + (Role "Seller") + (Account + (Role "Buyer")) + (Token "" "") + (ConstantParam "Price") + (When [ + (Case + (Choice + (ChoiceId "Confirm problem" + (Role "Seller")) [ + (Bound 1 1)]) Close) + , + (Case + (Choice + (ChoiceId "Dispute problem" + (Role "Seller")) [ + (Bound 0 0)]) + (When [ + (Case + (Choice + (ChoiceId "Dismiss claim" + (Role "Mediator")) [ + (Bound 0 0)]) + (Pay + (Role "Buyer") + (Party + (Role "Seller")) + (Token "" "") + (ConstantParam "Price") Close)) + , + (Case + (Choice + (ChoiceId "Confirm problem" + (Role "Mediator")) [ + (Bound 1 1)]) Close)] (SlotParam "Mediation deadline") Close))] (SlotParam "Complaint deadline") Close)))] (SlotParam "Complaint response deadline") Close))] (SlotParam "Payment deadline") Close""" + +escrowWithCollateral :: String +escrowWithCollateral = + """When [ + (Case + (Deposit + (Role "Seller") + (Role "Seller") + (Token "" "") + (ConstantParam "Collateral amount")) + (When [ + (Case + (Deposit + (Role "Buyer") + (Role "Buyer") + (Token "" "") + (ConstantParam "Collateral amount")) + (When [ + (Case + (Deposit + (Role "Seller") + (Role "Buyer") + (Token "" "") + (ConstantParam "Price")) + (When [ + (Case + (Choice + (ChoiceId "Everything is alright" + (Role "Buyer")) [ + (Bound 0 0)]) Close) + , + (Case + (Choice + (ChoiceId "Report problem" + (Role "Buyer")) [ + (Bound 1 1)]) + (Pay + (Role "Seller") + (Account + (Role "Buyer")) + (Token "" "") + (ConstantParam "Price") + (When [ + (Case + (Choice + (ChoiceId "Confirm problem" + (Role "Seller")) [ + (Bound 1 1)]) Close) + , + (Case + (Choice + (ChoiceId "Dispute problem" + (Role "Seller")) [ + (Bound 0 0)]) + (Pay + (Role "Seller") + (Party + (PK "0000000000000000000000000000000000000000000000000000000000000000")) + (Token "" "") + (ConstantParam "Collateral amount") + (Pay + (Role "Buyer") + (Party + (PK "0000000000000000000000000000000000000000000000000000000000000000")) + (Token "" "") + (ConstantParam "Collateral amount") Close)))] (SlotParam "Complaint deadline") Close)))] (SlotParam "Dispute by buyer timeout") Close))] (SlotParam "Deposit of price by buyer timeout") Close))] (SlotParam "Deposit of collateral by buyer timeout") Close))] (SlotParam "Collateral deposit by seller timeout") Close""" + +zeroCouponBond :: String +zeroCouponBond = + """When [ + (Case + (Deposit + (Role "Lender") + (Role "Lender") + (Token "" "") + (ConstantParam "Amount")) + (Pay + (Role "Lender") + (Party + (Role "Borrower")) + (Token "" "") + (ConstantParam "Amount") + (When [ + (Case + (Deposit + (Role "Borrower") + (Role "Borrower") + (Token "" "") + (AddValue + (ConstantParam "Interest") + (ConstantParam "Amount"))) + (Pay + (Role "Borrower") + (Party + (Role "Lender")) + (Token "" "") + (AddValue + (ConstantParam "Interest") + (ConstantParam "Amount")) Close))] (SlotParam "Payback deadline") Close)))] (SlotParam "Loan deadline") Close""" + +couponBondGuaranteed :: String +couponBondGuaranteed = + """When [ + (Case + (Deposit + (Role "Lender") + (Role "Guarantor") + (Token "" "") + (AddValue + (MulValue + (Constant 3) + (ConstantParam "Interest instalment")) + (ConstantParam "Principal"))) + (When [ + (Case + (Deposit + (Role "Borrower") + (Role "Lender") + (Token "" "") + (ConstantParam "Principal")) + (Pay + (Role "Borrower") + (Party + (Role "Borrower")) + (Token "" "") + (ConstantParam "Principal") + (When [ + (Case + (Deposit + (Role "Lender") + (Role "Borrower") + (Token "" "") + (ConstantParam "Interest instalment")) + (Pay + (Role "Lender") + (Party + (Role "Lender")) + (Token "" "") + (ConstantParam "Interest instalment") + (Pay + (Role "Lender") + (Party + (Role "Guarantor")) + (Token "" "") + (ConstantParam "Interest instalment") + (When [ + (Case + (Deposit + (Role "Lender") + (Role "Borrower") + (Token "" "") + (ConstantParam "Interest instalment")) + (Pay + (Role "Lender") + (Party + (Role "Lender")) + (Token "" "") + (ConstantParam "Interest instalment") + (Pay + (Role "Lender") + (Party + (Role "Guarantor")) + (Token "" "") + (ConstantParam "Interest instalment") + (When [ + (Case + (Deposit + (Role "Lender") + (Role "Borrower") + (Token "" "") + (AddValue + (ConstantParam "Interest instalment") + (ConstantParam "Principal"))) + (Pay + (Role "Lender") + (Party + (Role "Lender")) + (Token "" "") + (AddValue + (ConstantParam "Interest instalment") + (ConstantParam "Principal")) + (Pay + (Role "Lender") + (Party + (Role "Guarantor")) + (Token "" "") + (AddValue + (ConstantParam "Interest instalment") + (ConstantParam "Principal")) Close)))] 1500 Close))))] 1200 Close))))] 900 Close)))] 600 + (Pay + (Role "Lender") + (Party + (Role "Guarantor")) + (Token "" "") + (AddValue + (MulValue + (Constant 3) + (ConstantParam "Interest instalment")) + (ConstantParam "Principal")) Close)))] 300 Close""" + +swap :: String +swap = + """When [ + (Case + (Deposit + (Role "Ada provider") + (Role "Ada provider") + (Token "" "") + (MulValue + (Constant 1000000) + (ConstantParam "Amount of Ada"))) + (When [ + (Case + (Deposit + (Role "Dollar provider") + (Role "Dollar provider") + (Token "85bb65" "dollar") + (ConstantParam "Amount of dollars")) + (Pay + (Role "Ada provider") + (Party + (Role "Dollar provider")) + (Token "" "") + (MulValue + (Constant 1000000) + (ConstantParam "Amount of Ada")) + (Pay + (Role "Dollar provider") + (Party + (Role "Ada provider")) + (Token "85bb65" "dollar") + (ConstantParam "Amount of dollars") Close)))] (SlotParam "Timeout for dollar deposit") Close))] (SlotParam "Timeout for Ada deposit") Close""" + +contractForDifferences :: String +contractForDifferences = + """When [ + (Case + (Deposit + (Role "Party") + (Role "Party") + (Token "" "") + (ConstantParam "Amount paid by party")) + (When [ + (Case + (Deposit + (Role "Counterparty") + (Role "Counterparty") + (Token "" "") + (ConstantParam "Amount paid by counterparty")) + (When [] (SlotParam "First window beginning") + (When [ + (Case + (Choice + (ChoiceId "Price in first window" + (Role "Oracle")) [ + (Bound 0 1000000000)]) + (When [] (SlotParam "Second window beginning") + (When [ + (Case + (Choice + (ChoiceId "Price in second window" + (Role "Oracle")) [ + (Bound 0 1000000000)]) + (If + (ValueGT + (ChoiceValue + (ChoiceId "Price in first window" + (Role "Oracle"))) + (ChoiceValue + (ChoiceId "Price in second window" + (Role "Oracle")))) + (Let "Decrease in price" + (SubValue + (ChoiceValue + (ChoiceId "Price in first window" + (Role "Oracle"))) + (ChoiceValue + (ChoiceId "Price in second window" + (Role "Oracle")))) + (Pay + (Role "Counterparty") + (Account + (Role "Party")) + (Token "" "") + (Cond + (ValueLT + (UseValue "Decrease in price") + (ConstantParam "Amount paid by counterparty")) + (UseValue "Decrease in price") + (ConstantParam "Amount paid by counterparty")) Close)) + (If + (ValueLT + (ChoiceValue + (ChoiceId "Price in first window" + (Role "Oracle"))) + (ChoiceValue + (ChoiceId "Price in second window" + (Role "Oracle")))) + (Let "Increase in price" + (SubValue + (ChoiceValue + (ChoiceId "Price in second window" + (Role "Oracle"))) + (ChoiceValue + (ChoiceId "Price in first window" + (Role "Oracle")))) + (Pay + (Role "Party") + (Account + (Role "Counterparty")) + (Token "" "") + (Cond + (ValueLT + (UseValue "Increase in price") + (ConstantParam "Amount paid by party")) + (UseValue "Increase in price") + (ConstantParam "Amount paid by party")) Close)) Close)))] (SlotParam "Second window deadline") Close)))] (SlotParam "First window deadline") Close)))] (SlotParam "Counterparty deposit deadline") Close))] (SlotParam "Party deposit deadline") Close""" + +contractForDifferencesWithOracle :: String +contractForDifferencesWithOracle = + """When [ + (Case + (Deposit + (Role "Party") + (Role "Party") + (Token "" "") + (ConstantParam "Amount paid by party")) + (When [ + (Case + (Deposit + (Role "Counterparty") + (Role "Counterparty") + (Token "" "") + (ConstantParam "Amount paid by counterparty")) + (When [] (SlotParam "First window beginning") + (When [ + (Case + (Choice + (ChoiceId "dir-adausd" + (Role "kraken")) [ + (Bound 0 100000000000)]) + (When [] (SlotParam "Second window beginning") + (When [ + (Case + (Choice + (ChoiceId "inv-adausd" + (Role "kraken")) [ + (Bound 0 100000000000)]) + (Let "Price in second window" + (DivValue + (MulValue + (ConstantParam "Amount of Ada to use as asset") + (MulValue + (ChoiceValue + (ChoiceId "dir-adausd" + (Role "kraken"))) + (ChoiceValue + (ChoiceId "inv-adausd" + (Role "kraken"))))) + (Constant 10000000000000000)) + (If + (ValueGT + (ConstantParam "Amount of Ada to use as asset") + (UseValue "Price in second window")) + (Let "Decrease in price" + (SubValue + (ConstantParam "Amount of Ada to use as asset") + (UseValue "Price in second window")) + (Pay + (Role "Counterparty") + (Account + (Role "Party")) + (Token "" "") + (Cond + (ValueLT + (UseValue "Decrease in price") + (ConstantParam "Amount paid by counterparty")) + (UseValue "Decrease in price") + (ConstantParam "Amount paid by counterparty")) Close)) + (If + (ValueLT + (ConstantParam "Amount of Ada to use as asset") + (UseValue "Price in second window")) + (Let "Increase in price" + (SubValue + (UseValue "Price in second window") + (ConstantParam "Amount of Ada to use as asset")) + (Pay + (Role "Party") + (Account + (Role "Counterparty")) + (Token "" "") + (Cond + (ValueLT + (UseValue "Increase in price") + (ConstantParam "Amount paid by party")) + (UseValue "Increase in price") + (ConstantParam "Amount paid by party")) Close)) Close))))] (SlotParam "Second window deadline") Close)))] (SlotParam "First window deadline") Close)))] (SlotParam "Counterparty deposit deadline") Close))] (SlotParam "Party deposit deadline") Close""" \ No newline at end of file diff --git a/marlowe-playground-client/generated/Gist.purs b/marlowe-playground-client/generated/Gist.purs new file mode 100644 index 0000000000..de61342967 --- /dev/null +++ b/marlowe-playground-client/generated/Gist.purs @@ -0,0 +1,340 @@ +-- File auto generated by purescript-bridge! -- +module Gist where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map (Map) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Type.Proxy (Proxy(Proxy)) + +newtype GistId = GistId String + +derive instance eqGistId :: Eq GistId + +derive instance ordGistId :: Ord GistId + +instance showGistId :: Show GistId where + show a = genericShow a + +instance encodeJsonGistId :: EncodeJson GistId where + encodeJson = defer \_ -> E.encode $ unwrap >$< E.value + +instance decodeJsonGistId :: DecodeJson GistId where + decodeJson = defer \_ -> D.decode $ (GistId <$> D.value) + +derive instance genericGistId :: Generic GistId _ + +derive instance newtypeGistId :: Newtype GistId _ + +-------------------------------------------------------------------------------- + +_GistId :: Iso' GistId String +_GistId = _Newtype + +-------------------------------------------------------------------------------- + +newtype Gist = Gist + { _gistId :: GistId + , _gistGitPushUrl :: String + , _gistHtmlUrl :: String + , _gistOwner :: Owner + , _gistFiles :: Map String GistFile + , _gistTruncated :: Boolean + , _gistCreatedAt :: String + , _gistUpdatedAt :: String + , _gistDescription :: String + } + +derive instance eqGist :: Eq Gist + +instance showGist :: Show Gist where + show a = genericShow a + +instance encodeJsonGist :: EncodeJson Gist where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { _gistId: E.value :: _ GistId + , _gistGitPushUrl: E.value :: _ String + , _gistHtmlUrl: E.value :: _ String + , _gistOwner: E.value :: _ Owner + , _gistFiles: (E.dictionary E.value E.value) :: _ (Map String GistFile) + , _gistTruncated: E.value :: _ Boolean + , _gistCreatedAt: E.value :: _ String + , _gistUpdatedAt: E.value :: _ String + , _gistDescription: E.value :: _ String + } + ) + +instance decodeJsonGist :: DecodeJson Gist where + decodeJson = defer \_ -> D.decode $ + ( Gist <$> D.record "Gist" + { _gistId: D.value :: _ GistId + , _gistGitPushUrl: D.value :: _ String + , _gistHtmlUrl: D.value :: _ String + , _gistOwner: D.value :: _ Owner + , _gistFiles: (D.dictionary D.value D.value) :: _ (Map String GistFile) + , _gistTruncated: D.value :: _ Boolean + , _gistCreatedAt: D.value :: _ String + , _gistUpdatedAt: D.value :: _ String + , _gistDescription: D.value :: _ String + } + ) + +derive instance genericGist :: Generic Gist _ + +derive instance newtypeGist :: Newtype Gist _ + +-------------------------------------------------------------------------------- + +_Gist :: Iso' Gist + { _gistId :: GistId + , _gistGitPushUrl :: String + , _gistHtmlUrl :: String + , _gistOwner :: Owner + , _gistFiles :: Map String GistFile + , _gistTruncated :: Boolean + , _gistCreatedAt :: String + , _gistUpdatedAt :: String + , _gistDescription :: String + } +_Gist = _Newtype + +gistId :: Lens' Gist GistId +gistId = _Newtype <<< prop (Proxy :: _ "_gistId") + +gistGitPushUrl :: Lens' Gist String +gistGitPushUrl = _Newtype <<< prop (Proxy :: _ "_gistGitPushUrl") + +gistHtmlUrl :: Lens' Gist String +gistHtmlUrl = _Newtype <<< prop (Proxy :: _ "_gistHtmlUrl") + +gistOwner :: Lens' Gist Owner +gistOwner = _Newtype <<< prop (Proxy :: _ "_gistOwner") + +gistFiles :: Lens' Gist (Map String GistFile) +gistFiles = _Newtype <<< prop (Proxy :: _ "_gistFiles") + +gistTruncated :: Lens' Gist Boolean +gistTruncated = _Newtype <<< prop (Proxy :: _ "_gistTruncated") + +gistCreatedAt :: Lens' Gist String +gistCreatedAt = _Newtype <<< prop (Proxy :: _ "_gistCreatedAt") + +gistUpdatedAt :: Lens' Gist String +gistUpdatedAt = _Newtype <<< prop (Proxy :: _ "_gistUpdatedAt") + +gistDescription :: Lens' Gist String +gistDescription = _Newtype <<< prop (Proxy :: _ "_gistDescription") + +-------------------------------------------------------------------------------- + +newtype GistFile = GistFile + { _gistFileFilename :: String + , _gistFileLanguage :: Maybe String + , _gistFileType :: String + , _gistFileTruncated :: Maybe Boolean + , _gistFileContent :: Maybe String + } + +derive instance eqGistFile :: Eq GistFile + +instance showGistFile :: Show GistFile where + show a = genericShow a + +instance encodeJsonGistFile :: EncodeJson GistFile where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { _gistFileFilename: E.value :: _ String + , _gistFileLanguage: (E.maybe E.value) :: _ (Maybe String) + , _gistFileType: E.value :: _ String + , _gistFileTruncated: (E.maybe E.value) :: _ (Maybe Boolean) + , _gistFileContent: (E.maybe E.value) :: _ (Maybe String) + } + ) + +instance decodeJsonGistFile :: DecodeJson GistFile where + decodeJson = defer \_ -> D.decode $ + ( GistFile <$> D.record "GistFile" + { _gistFileFilename: D.value :: _ String + , _gistFileLanguage: (D.maybe D.value) :: _ (Maybe String) + , _gistFileType: D.value :: _ String + , _gistFileTruncated: (D.maybe D.value) :: _ (Maybe Boolean) + , _gistFileContent: (D.maybe D.value) :: _ (Maybe String) + } + ) + +derive instance genericGistFile :: Generic GistFile _ + +derive instance newtypeGistFile :: Newtype GistFile _ + +-------------------------------------------------------------------------------- + +_GistFile :: Iso' GistFile + { _gistFileFilename :: String + , _gistFileLanguage :: Maybe String + , _gistFileType :: String + , _gistFileTruncated :: Maybe Boolean + , _gistFileContent :: Maybe String + } +_GistFile = _Newtype + +gistFileFilename :: Lens' GistFile String +gistFileFilename = _Newtype <<< prop (Proxy :: _ "_gistFileFilename") + +gistFileLanguage :: Lens' GistFile (Maybe String) +gistFileLanguage = _Newtype <<< prop (Proxy :: _ "_gistFileLanguage") + +gistFileType :: Lens' GistFile String +gistFileType = _Newtype <<< prop (Proxy :: _ "_gistFileType") + +gistFileTruncated :: Lens' GistFile (Maybe Boolean) +gistFileTruncated = _Newtype <<< prop (Proxy :: _ "_gistFileTruncated") + +gistFileContent :: Lens' GistFile (Maybe String) +gistFileContent = _Newtype <<< prop (Proxy :: _ "_gistFileContent") + +-------------------------------------------------------------------------------- + +newtype NewGist = NewGist + { _newGistDescription :: String + , _newGistPublic :: Boolean + , _newGistFiles :: Array NewGistFile + } + +instance encodeJsonNewGist :: EncodeJson NewGist where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { _newGistDescription: E.value :: _ String + , _newGistPublic: E.value :: _ Boolean + , _newGistFiles: E.value :: _ (Array NewGistFile) + } + ) + +instance decodeJsonNewGist :: DecodeJson NewGist where + decodeJson = defer \_ -> D.decode $ + ( NewGist <$> D.record "NewGist" + { _newGistDescription: D.value :: _ String + , _newGistPublic: D.value :: _ Boolean + , _newGistFiles: D.value :: _ (Array NewGistFile) + } + ) + +derive instance genericNewGist :: Generic NewGist _ + +derive instance newtypeNewGist :: Newtype NewGist _ + +-------------------------------------------------------------------------------- + +_NewGist :: Iso' NewGist + { _newGistDescription :: String + , _newGistPublic :: Boolean + , _newGistFiles :: Array NewGistFile + } +_NewGist = _Newtype + +newGistDescription :: Lens' NewGist String +newGistDescription = _Newtype <<< prop (Proxy :: _ "_newGistDescription") + +newGistPublic :: Lens' NewGist Boolean +newGistPublic = _Newtype <<< prop (Proxy :: _ "_newGistPublic") + +newGistFiles :: Lens' NewGist (Array NewGistFile) +newGistFiles = _Newtype <<< prop (Proxy :: _ "_newGistFiles") + +-------------------------------------------------------------------------------- + +newtype NewGistFile = NewGistFile + { _newGistFilename :: String + , _newGistFileContent :: String + } + +instance encodeJsonNewGistFile :: EncodeJson NewGistFile where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { _newGistFilename: E.value :: _ String + , _newGistFileContent: E.value :: _ String + } + ) + +instance decodeJsonNewGistFile :: DecodeJson NewGistFile where + decodeJson = defer \_ -> D.decode $ + ( NewGistFile <$> D.record "NewGistFile" + { _newGistFilename: D.value :: _ String + , _newGistFileContent: D.value :: _ String + } + ) + +derive instance genericNewGistFile :: Generic NewGistFile _ + +derive instance newtypeNewGistFile :: Newtype NewGistFile _ + +-------------------------------------------------------------------------------- + +_NewGistFile :: Iso' NewGistFile + { _newGistFilename :: String, _newGistFileContent :: String } +_NewGistFile = _Newtype + +newGistFilename :: Lens' NewGistFile String +newGistFilename = _Newtype <<< prop (Proxy :: _ "_newGistFilename") + +newGistFileContent :: Lens' NewGistFile String +newGistFileContent = _Newtype <<< prop (Proxy :: _ "_newGistFileContent") + +-------------------------------------------------------------------------------- + +newtype Owner = Owner + { _ownerLogin :: String + , _ownerHtmlUrl :: String + } + +derive instance eqOwner :: Eq Owner + +instance showOwner :: Show Owner where + show a = genericShow a + +instance encodeJsonOwner :: EncodeJson Owner where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { _ownerLogin: E.value :: _ String + , _ownerHtmlUrl: E.value :: _ String + } + ) + +instance decodeJsonOwner :: DecodeJson Owner where + decodeJson = defer \_ -> D.decode $ + ( Owner <$> D.record "Owner" + { _ownerLogin: D.value :: _ String + , _ownerHtmlUrl: D.value :: _ String + } + ) + +derive instance genericOwner :: Generic Owner _ + +derive instance newtypeOwner :: Newtype Owner _ + +-------------------------------------------------------------------------------- + +_Owner :: Iso' Owner { _ownerLogin :: String, _ownerHtmlUrl :: String } +_Owner = _Newtype + +ownerLogin :: Lens' Owner String +ownerLogin = _Newtype <<< prop (Proxy :: _ "_ownerLogin") + +ownerHtmlUrl :: Lens' Owner String +ownerHtmlUrl = _Newtype <<< prop (Proxy :: _ "_ownerHtmlUrl") \ No newline at end of file diff --git a/marlowe-playground-client/generated/JSON/contract.json b/marlowe-playground-client/generated/JSON/contract.json new file mode 100644 index 0000000000..a479ce5df0 --- /dev/null +++ b/marlowe-playground-client/generated/JSON/contract.json @@ -0,0 +1 @@ +{"then":{"timeout":100,"when":[{"then":{"be":{"add":100,"and":{"minus":{"negate":100},"value":100}},"then":{"to":{"party":{"role_token":"Bob"}},"then":"close","token":{"currency_symbol":"","token_name":""},"from_account":{"pk_hash":"a2c20c77887ace1cd986193e4e75babd8993cfd56995cd5cfce609c2"},"pay":{"if":true,"then":{"use_value":"x"},"else":{"use_value":"y"}}},"let":"x"},"case":{"deposits":{"add":100,"and":{"minus":{"negate":100},"value":100}},"party":{"pk_hash":"a2c20c77887ace1cd986193e4e75babd8993cfd56995cd5cfce609c2"},"of_token":{"currency_symbol":"","token_name":""},"into_account":{"pk_hash":"a2c20c77887ace1cd986193e4e75babd8993cfd56995cd5cfce609c2"}}},{"then":{"if":{"either":{"chose_something_for":{"choice_owner":{"pk_hash":"a2c20c77887ace1cd986193e4e75babd8993cfd56995cd5cfce609c2"},"choice_name":"choice"}},"or":{"value":{"value_of_choice":{"choice_owner":{"pk_hash":"a2c20c77887ace1cd986193e4e75babd8993cfd56995cd5cfce609c2"},"choice_name":"choice"}},"equal_to":100}},"then":{"to":{"account":{"pk_hash":"a2c20c77887ace1cd986193e4e75babd8993cfd56995cd5cfce609c2"}},"then":"close","token":{"currency_symbol":"aa","token_name":"name"},"from_account":{"pk_hash":"a2c20c77887ace1cd986193e4e75babd8993cfd56995cd5cfce609c2"},"pay":{"by":100,"divide":{"amount_of_token":{"currency_symbol":"aa","token_name":"name"},"in_account":{"pk_hash":"a2c20c77887ace1cd986193e4e75babd8993cfd56995cd5cfce609c2"}}}},"else":"close"},"case":{"for_choice":{"choice_owner":{"pk_hash":"a2c20c77887ace1cd986193e4e75babd8993cfd56995cd5cfce609c2"},"choice_name":"choice"},"choose_between":[{"to":1,"from":0},{"to":20,"from":10}]}},{"then":"close","case":{"notify_if":{"both":{"value":"slot_interval_start","lt":"slot_interval_end"},"and":true}}}],"timeout_continuation":"close"},"assert":true} \ No newline at end of file diff --git a/marlowe-playground-client/generated/JSON/state.json b/marlowe-playground-client/generated/JSON/state.json new file mode 100644 index 0000000000..d3cba827b2 --- /dev/null +++ b/marlowe-playground-client/generated/JSON/state.json @@ -0,0 +1 @@ +{"choices":[[{"choice_owner":{"pk_hash":"a2c20c77887ace1cd986193e4e75babd8993cfd56995cd5cfce609c2"},"choice_name":"choice"},42]],"accounts":[[[{"pk_hash":"a2c20c77887ace1cd986193e4e75babd8993cfd56995cd5cfce609c2"},{"currency_symbol":"aa","token_name":"name"}],12]],"minSlot":123,"boundValues":[["x",1],["y",2]]} \ No newline at end of file diff --git a/marlowe-playground-client/generated/Language/Haskell/Interpreter.purs b/marlowe-playground-client/generated/Language/Haskell/Interpreter.purs new file mode 100644 index 0000000000..85fe3268bd --- /dev/null +++ b/marlowe-playground-client/generated/Language/Haskell/Interpreter.purs @@ -0,0 +1,183 @@ +-- File auto generated by purescript-bridge! -- +module Language.Haskell.Interpreter where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Tuple.Nested ((/\)) +import Type.Proxy (Proxy(Proxy)) + +newtype SourceCode = SourceCode String + +instance encodeJsonSourceCode :: EncodeJson SourceCode where + encodeJson = defer \_ -> E.encode $ unwrap >$< E.value + +instance decodeJsonSourceCode :: DecodeJson SourceCode where + decodeJson = defer \_ -> D.decode $ (SourceCode <$> D.value) + +derive instance genericSourceCode :: Generic SourceCode _ + +derive instance newtypeSourceCode :: Newtype SourceCode _ + +-------------------------------------------------------------------------------- + +_SourceCode :: Iso' SourceCode String +_SourceCode = _Newtype + +-------------------------------------------------------------------------------- + +data CompilationError + = RawError String + | CompilationError + { filename :: String + , row :: Int + , column :: Int + , text :: Array String + } + +instance encodeJsonCompilationError :: EncodeJson CompilationError where + encodeJson = defer \_ -> case _ of + RawError a -> E.encodeTagged "RawError" a E.value + CompilationError { filename, row, column, text } -> encodeJson + { tag: "CompilationError" + , filename: flip E.encode filename E.value + , row: flip E.encode row E.value + , column: flip E.encode column E.value + , text: flip E.encode text E.value + } + +instance decodeJsonCompilationError :: DecodeJson CompilationError where + decodeJson = defer \_ -> D.decode + $ D.sumType "CompilationError" + $ Map.fromFoldable + [ "RawError" /\ D.content (RawError <$> D.value) + , "CompilationError" /\ + ( CompilationError <$> D.object "CompilationError" + { filename: D.value :: _ String + , row: D.value :: _ Int + , column: D.value :: _ Int + , text: D.value :: _ (Array String) + } + ) + ] + +derive instance genericCompilationError :: Generic CompilationError _ + +-------------------------------------------------------------------------------- + +_RawError :: Prism' CompilationError String +_RawError = prism' RawError case _ of + (RawError a) -> Just a + _ -> Nothing + +_CompilationError :: Prism' CompilationError + { filename :: String, row :: Int, column :: Int, text :: Array String } +_CompilationError = prism' CompilationError case _ of + (CompilationError a) -> Just a + _ -> Nothing + +-------------------------------------------------------------------------------- + +data InterpreterError + = CompilationErrors (Array CompilationError) + | TimeoutError String + +instance encodeJsonInterpreterError :: EncodeJson InterpreterError where + encodeJson = defer \_ -> case _ of + CompilationErrors a -> E.encodeTagged "CompilationErrors" a E.value + TimeoutError a -> E.encodeTagged "TimeoutError" a E.value + +instance decodeJsonInterpreterError :: DecodeJson InterpreterError where + decodeJson = defer \_ -> D.decode + $ D.sumType "InterpreterError" + $ Map.fromFoldable + [ "CompilationErrors" /\ D.content (CompilationErrors <$> D.value) + , "TimeoutError" /\ D.content (TimeoutError <$> D.value) + ] + +derive instance genericInterpreterError :: Generic InterpreterError _ + +-------------------------------------------------------------------------------- + +_CompilationErrors :: Prism' InterpreterError (Array CompilationError) +_CompilationErrors = prism' CompilationErrors case _ of + (CompilationErrors a) -> Just a + _ -> Nothing + +_TimeoutError :: Prism' InterpreterError String +_TimeoutError = prism' TimeoutError case _ of + (TimeoutError a) -> Just a + _ -> Nothing + +-------------------------------------------------------------------------------- + +newtype Warning = Warning String + +instance encodeJsonWarning :: EncodeJson Warning where + encodeJson = defer \_ -> E.encode $ unwrap >$< E.value + +instance decodeJsonWarning :: DecodeJson Warning where + decodeJson = defer \_ -> D.decode $ (Warning <$> D.value) + +derive instance genericWarning :: Generic Warning _ + +derive instance newtypeWarning :: Newtype Warning _ + +-------------------------------------------------------------------------------- + +_Warning :: Iso' Warning String +_Warning = _Newtype + +-------------------------------------------------------------------------------- + +newtype InterpreterResult a = InterpreterResult + { warnings :: Array Warning + , result :: a + } + +instance encodeJsonInterpreterResult :: + ( EncodeJson a + ) => + EncodeJson (InterpreterResult a) where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { warnings: E.value :: _ (Array Warning) + , result: E.value :: _ a + } + ) + +instance decodeJsonInterpreterResult :: + ( DecodeJson a + ) => + DecodeJson (InterpreterResult a) where + decodeJson = defer \_ -> D.decode $ + ( InterpreterResult <$> D.record "InterpreterResult" + { warnings: D.value :: _ (Array Warning) + , result: D.value :: _ a + } + ) + +derive instance genericInterpreterResult :: Generic (InterpreterResult a) _ + +derive instance newtypeInterpreterResult :: Newtype (InterpreterResult a) _ + +-------------------------------------------------------------------------------- + +_InterpreterResult + :: forall a + . Iso' (InterpreterResult a) { warnings :: Array Warning, result :: a } +_InterpreterResult = _Newtype \ No newline at end of file diff --git a/marlowe-playground-client/generated/Language/Marlowe/ACTUS/Domain/BusinessEvents.purs b/marlowe-playground-client/generated/Language/Marlowe/ACTUS/Domain/BusinessEvents.purs new file mode 100644 index 0000000000..df5cdef925 --- /dev/null +++ b/marlowe-playground-client/generated/Language/Marlowe/ACTUS/Domain/BusinessEvents.purs @@ -0,0 +1,203 @@ +-- File auto generated by purescript-bridge! -- +module Language.Marlowe.ACTUS.Domain.BusinessEvents where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Bounded.Generic (genericBottom, genericTop) +import Data.Enum (class Enum) +import Data.Enum.Generic (genericPred, genericSucc) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Type.Proxy (Proxy(Proxy)) + +data EventType + = IED + | FP + | PR + | PD + | PY + | PP + | IP + | IPFX + | IPFL + | IPCI + | CE + | RRF + | RR + | PRF + | DV + | PRD + | MR + | TD + | SC + | IPCB + | MD + | XD + | STD + | PI + | AD + +derive instance eqEventType :: Eq EventType + +derive instance ordEventType :: Ord EventType + +instance showEventType :: Show EventType where + show a = genericShow a + +instance encodeJsonEventType :: EncodeJson EventType where + encodeJson = defer \_ -> E.encode E.enum + +instance decodeJsonEventType :: DecodeJson EventType where + decodeJson = defer \_ -> D.decode D.enum + +derive instance genericEventType :: Generic EventType _ + +instance enumEventType :: Enum EventType where + succ = genericSucc + pred = genericPred + +instance boundedEventType :: Bounded EventType where + bottom = genericBottom + top = genericTop + +-------------------------------------------------------------------------------- + +_IED :: Prism' EventType Unit +_IED = prism' (const IED) case _ of + IED -> Just unit + _ -> Nothing + +_FP :: Prism' EventType Unit +_FP = prism' (const FP) case _ of + FP -> Just unit + _ -> Nothing + +_PR :: Prism' EventType Unit +_PR = prism' (const PR) case _ of + PR -> Just unit + _ -> Nothing + +_PD :: Prism' EventType Unit +_PD = prism' (const PD) case _ of + PD -> Just unit + _ -> Nothing + +_PY :: Prism' EventType Unit +_PY = prism' (const PY) case _ of + PY -> Just unit + _ -> Nothing + +_PP :: Prism' EventType Unit +_PP = prism' (const PP) case _ of + PP -> Just unit + _ -> Nothing + +_IP :: Prism' EventType Unit +_IP = prism' (const IP) case _ of + IP -> Just unit + _ -> Nothing + +_IPFX :: Prism' EventType Unit +_IPFX = prism' (const IPFX) case _ of + IPFX -> Just unit + _ -> Nothing + +_IPFL :: Prism' EventType Unit +_IPFL = prism' (const IPFL) case _ of + IPFL -> Just unit + _ -> Nothing + +_IPCI :: Prism' EventType Unit +_IPCI = prism' (const IPCI) case _ of + IPCI -> Just unit + _ -> Nothing + +_CE :: Prism' EventType Unit +_CE = prism' (const CE) case _ of + CE -> Just unit + _ -> Nothing + +_RRF :: Prism' EventType Unit +_RRF = prism' (const RRF) case _ of + RRF -> Just unit + _ -> Nothing + +_RR :: Prism' EventType Unit +_RR = prism' (const RR) case _ of + RR -> Just unit + _ -> Nothing + +_PRF :: Prism' EventType Unit +_PRF = prism' (const PRF) case _ of + PRF -> Just unit + _ -> Nothing + +_DV :: Prism' EventType Unit +_DV = prism' (const DV) case _ of + DV -> Just unit + _ -> Nothing + +_PRD :: Prism' EventType Unit +_PRD = prism' (const PRD) case _ of + PRD -> Just unit + _ -> Nothing + +_MR :: Prism' EventType Unit +_MR = prism' (const MR) case _ of + MR -> Just unit + _ -> Nothing + +_TD :: Prism' EventType Unit +_TD = prism' (const TD) case _ of + TD -> Just unit + _ -> Nothing + +_SC :: Prism' EventType Unit +_SC = prism' (const SC) case _ of + SC -> Just unit + _ -> Nothing + +_IPCB :: Prism' EventType Unit +_IPCB = prism' (const IPCB) case _ of + IPCB -> Just unit + _ -> Nothing + +_MD :: Prism' EventType Unit +_MD = prism' (const MD) case _ of + MD -> Just unit + _ -> Nothing + +_XD :: Prism' EventType Unit +_XD = prism' (const XD) case _ of + XD -> Just unit + _ -> Nothing + +_STD :: Prism' EventType Unit +_STD = prism' (const STD) case _ of + STD -> Just unit + _ -> Nothing + +_PI :: Prism' EventType Unit +_PI = prism' (const PI) case _ of + PI -> Just unit + _ -> Nothing + +_AD :: Prism' EventType Unit +_AD = prism' (const AD) case _ of + AD -> Just unit + _ -> Nothing \ No newline at end of file diff --git a/marlowe-playground-client/generated/Language/Marlowe/ACTUS/Domain/ContractTerms.purs b/marlowe-playground-client/generated/Language/Marlowe/ACTUS/Domain/ContractTerms.purs new file mode 100644 index 0000000000..7b427cb3a7 --- /dev/null +++ b/marlowe-playground-client/generated/Language/Marlowe/ACTUS/Domain/ContractTerms.purs @@ -0,0 +1,1662 @@ +-- File auto generated by purescript-bridge! -- +module Language.Marlowe.ACTUS.Domain.ContractTerms where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.BigInt.Argonaut (BigInt) +import Data.Bounded.Generic (genericBottom, genericTop) +import Data.Enum (class Enum) +import Data.Enum.Generic (genericPred, genericSucc) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Type.Proxy (Proxy(Proxy)) + +newtype ContractTermsPoly a = ContractTermsPoly + { contractId :: String + , contractType :: CT + , contractStructure :: Array ContractStructure + , contractRole :: CR + , settlementCurrency :: Maybe String + , initialExchangeDate :: Maybe String + , dayCountConvention :: Maybe DCC + , scheduleConfig :: ScheduleConfig + , statusDate :: String + , contractPerformance :: Maybe PRF + , cycleOfFee :: Maybe Cycle + , cycleAnchorDateOfFee :: Maybe String + , feeAccrued :: Maybe a + , feeBasis :: Maybe FEB + , feeRate :: Maybe a + , cycleAnchorDateOfInterestPayment :: Maybe String + , cycleOfInterestPayment :: Maybe Cycle + , accruedInterest :: Maybe a + , capitalizationEndDate :: Maybe String + , cycleAnchorDateOfInterestCalculationBase :: Maybe String + , cycleOfInterestCalculationBase :: Maybe Cycle + , interestCalculationBase :: Maybe IPCB + , interestCalculationBaseA :: Maybe a + , nominalInterestRate :: Maybe a + , nominalInterestRate2 :: Maybe a + , interestScalingMultiplier :: Maybe a + , maturityDate :: Maybe String + , amortizationDate :: Maybe String + , exerciseDate :: Maybe String + , notionalPrincipal :: Maybe a + , premiumDiscountAtIED :: Maybe a + , cycleAnchorDateOfPrincipalRedemption :: Maybe String + , cycleOfPrincipalRedemption :: Maybe Cycle + , nextPrincipalRedemptionPayment :: Maybe a + , purchaseDate :: Maybe String + , priceAtPurchaseDate :: Maybe a + , terminationDate :: Maybe String + , priceAtTerminationDate :: Maybe a + , scalingIndexAtStatusDate :: Maybe a + , cycleAnchorDateOfScalingIndex :: Maybe String + , cycleOfScalingIndex :: Maybe Cycle + , scalingEffect :: Maybe SCEF + , scalingIndexAtContractDealDate :: Maybe a + , marketObjectCodeOfScalingIndex :: Maybe String + , notionalScalingMultiplier :: Maybe a + , cycleOfOptionality :: Maybe Cycle + , cycleAnchorDateOfOptionality :: Maybe String + , optionType :: Maybe OPTP + , optionStrike1 :: Maybe a + , optionExerciseType :: Maybe OPXT + , settlementPeriod :: Maybe Cycle + , deliverySettlement :: Maybe DS + , exerciseAmount :: Maybe a + , futuresPrice :: Maybe a + , penaltyRate :: Maybe a + , penaltyType :: Maybe PYTP + , prepaymentEffect :: Maybe PPEF + , cycleOfRateReset :: Maybe Cycle + , cycleAnchorDateOfRateReset :: Maybe String + , nextResetRate :: Maybe a + , rateSpread :: Maybe a + , rateMultiplier :: Maybe a + , periodFloor :: Maybe a + , periodCap :: Maybe a + , lifeCap :: Maybe a + , lifeFloor :: Maybe a + , marketObjectCodeOfRateReset :: Maybe String + , cycleOfDividend :: Maybe Cycle + , cycleAnchorDateOfDividend :: Maybe String + , nextDividendPaymentAmount :: Maybe a + , enableSettlement :: Boolean + , constraints :: Maybe Assertions + } + +instance encodeJsonContractTermsPoly :: + ( EncodeJson a + ) => + EncodeJson (ContractTermsPoly a) where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { contractId: E.value :: _ String + , contractType: E.value :: _ CT + , contractStructure: E.value :: _ (Array ContractStructure) + , contractRole: E.value :: _ CR + , settlementCurrency: (E.maybe E.value) :: _ (Maybe String) + , initialExchangeDate: (E.maybe E.value) :: _ (Maybe String) + , dayCountConvention: (E.maybe E.value) :: _ (Maybe DCC) + , scheduleConfig: E.value :: _ ScheduleConfig + , statusDate: E.value :: _ String + , contractPerformance: (E.maybe E.value) :: _ (Maybe PRF) + , cycleOfFee: (E.maybe E.value) :: _ (Maybe Cycle) + , cycleAnchorDateOfFee: (E.maybe E.value) :: _ (Maybe String) + , feeAccrued: (E.maybe E.value) :: _ (Maybe a) + , feeBasis: (E.maybe E.value) :: _ (Maybe FEB) + , feeRate: (E.maybe E.value) :: _ (Maybe a) + , cycleAnchorDateOfInterestPayment: + (E.maybe E.value) :: _ (Maybe String) + , cycleOfInterestPayment: (E.maybe E.value) :: _ (Maybe Cycle) + , accruedInterest: (E.maybe E.value) :: _ (Maybe a) + , capitalizationEndDate: (E.maybe E.value) :: _ (Maybe String) + , cycleAnchorDateOfInterestCalculationBase: + (E.maybe E.value) :: _ (Maybe String) + , cycleOfInterestCalculationBase: (E.maybe E.value) :: _ (Maybe Cycle) + , interestCalculationBase: (E.maybe E.value) :: _ (Maybe IPCB) + , interestCalculationBaseA: (E.maybe E.value) :: _ (Maybe a) + , nominalInterestRate: (E.maybe E.value) :: _ (Maybe a) + , nominalInterestRate2: (E.maybe E.value) :: _ (Maybe a) + , interestScalingMultiplier: (E.maybe E.value) :: _ (Maybe a) + , maturityDate: (E.maybe E.value) :: _ (Maybe String) + , amortizationDate: (E.maybe E.value) :: _ (Maybe String) + , exerciseDate: (E.maybe E.value) :: _ (Maybe String) + , notionalPrincipal: (E.maybe E.value) :: _ (Maybe a) + , premiumDiscountAtIED: (E.maybe E.value) :: _ (Maybe a) + , cycleAnchorDateOfPrincipalRedemption: + (E.maybe E.value) :: _ (Maybe String) + , cycleOfPrincipalRedemption: (E.maybe E.value) :: _ (Maybe Cycle) + , nextPrincipalRedemptionPayment: (E.maybe E.value) :: _ (Maybe a) + , purchaseDate: (E.maybe E.value) :: _ (Maybe String) + , priceAtPurchaseDate: (E.maybe E.value) :: _ (Maybe a) + , terminationDate: (E.maybe E.value) :: _ (Maybe String) + , priceAtTerminationDate: (E.maybe E.value) :: _ (Maybe a) + , scalingIndexAtStatusDate: (E.maybe E.value) :: _ (Maybe a) + , cycleAnchorDateOfScalingIndex: (E.maybe E.value) :: _ (Maybe String) + , cycleOfScalingIndex: (E.maybe E.value) :: _ (Maybe Cycle) + , scalingEffect: (E.maybe E.value) :: _ (Maybe SCEF) + , scalingIndexAtContractDealDate: (E.maybe E.value) :: _ (Maybe a) + , marketObjectCodeOfScalingIndex: (E.maybe E.value) :: _ (Maybe String) + , notionalScalingMultiplier: (E.maybe E.value) :: _ (Maybe a) + , cycleOfOptionality: (E.maybe E.value) :: _ (Maybe Cycle) + , cycleAnchorDateOfOptionality: (E.maybe E.value) :: _ (Maybe String) + , optionType: (E.maybe E.value) :: _ (Maybe OPTP) + , optionStrike1: (E.maybe E.value) :: _ (Maybe a) + , optionExerciseType: (E.maybe E.value) :: _ (Maybe OPXT) + , settlementPeriod: (E.maybe E.value) :: _ (Maybe Cycle) + , deliverySettlement: (E.maybe E.value) :: _ (Maybe DS) + , exerciseAmount: (E.maybe E.value) :: _ (Maybe a) + , futuresPrice: (E.maybe E.value) :: _ (Maybe a) + , penaltyRate: (E.maybe E.value) :: _ (Maybe a) + , penaltyType: (E.maybe E.value) :: _ (Maybe PYTP) + , prepaymentEffect: (E.maybe E.value) :: _ (Maybe PPEF) + , cycleOfRateReset: (E.maybe E.value) :: _ (Maybe Cycle) + , cycleAnchorDateOfRateReset: (E.maybe E.value) :: _ (Maybe String) + , nextResetRate: (E.maybe E.value) :: _ (Maybe a) + , rateSpread: (E.maybe E.value) :: _ (Maybe a) + , rateMultiplier: (E.maybe E.value) :: _ (Maybe a) + , periodFloor: (E.maybe E.value) :: _ (Maybe a) + , periodCap: (E.maybe E.value) :: _ (Maybe a) + , lifeCap: (E.maybe E.value) :: _ (Maybe a) + , lifeFloor: (E.maybe E.value) :: _ (Maybe a) + , marketObjectCodeOfRateReset: (E.maybe E.value) :: _ (Maybe String) + , cycleOfDividend: (E.maybe E.value) :: _ (Maybe Cycle) + , cycleAnchorDateOfDividend: (E.maybe E.value) :: _ (Maybe String) + , nextDividendPaymentAmount: (E.maybe E.value) :: _ (Maybe a) + , enableSettlement: E.value :: _ Boolean + , constraints: (E.maybe E.value) :: _ (Maybe Assertions) + } + ) + +instance decodeJsonContractTermsPoly :: + ( DecodeJson a + ) => + DecodeJson (ContractTermsPoly a) where + decodeJson = defer \_ -> D.decode $ + ( ContractTermsPoly <$> D.record "ContractTermsPoly" + { contractId: D.value :: _ String + , contractType: D.value :: _ CT + , contractStructure: D.value :: _ (Array ContractStructure) + , contractRole: D.value :: _ CR + , settlementCurrency: (D.maybe D.value) :: _ (Maybe String) + , initialExchangeDate: (D.maybe D.value) :: _ (Maybe String) + , dayCountConvention: (D.maybe D.value) :: _ (Maybe DCC) + , scheduleConfig: D.value :: _ ScheduleConfig + , statusDate: D.value :: _ String + , contractPerformance: (D.maybe D.value) :: _ (Maybe PRF) + , cycleOfFee: (D.maybe D.value) :: _ (Maybe Cycle) + , cycleAnchorDateOfFee: (D.maybe D.value) :: _ (Maybe String) + , feeAccrued: (D.maybe D.value) :: _ (Maybe a) + , feeBasis: (D.maybe D.value) :: _ (Maybe FEB) + , feeRate: (D.maybe D.value) :: _ (Maybe a) + , cycleAnchorDateOfInterestPayment: + (D.maybe D.value) :: _ (Maybe String) + , cycleOfInterestPayment: (D.maybe D.value) :: _ (Maybe Cycle) + , accruedInterest: (D.maybe D.value) :: _ (Maybe a) + , capitalizationEndDate: (D.maybe D.value) :: _ (Maybe String) + , cycleAnchorDateOfInterestCalculationBase: + (D.maybe D.value) :: _ (Maybe String) + , cycleOfInterestCalculationBase: (D.maybe D.value) :: _ (Maybe Cycle) + , interestCalculationBase: (D.maybe D.value) :: _ (Maybe IPCB) + , interestCalculationBaseA: (D.maybe D.value) :: _ (Maybe a) + , nominalInterestRate: (D.maybe D.value) :: _ (Maybe a) + , nominalInterestRate2: (D.maybe D.value) :: _ (Maybe a) + , interestScalingMultiplier: (D.maybe D.value) :: _ (Maybe a) + , maturityDate: (D.maybe D.value) :: _ (Maybe String) + , amortizationDate: (D.maybe D.value) :: _ (Maybe String) + , exerciseDate: (D.maybe D.value) :: _ (Maybe String) + , notionalPrincipal: (D.maybe D.value) :: _ (Maybe a) + , premiumDiscountAtIED: (D.maybe D.value) :: _ (Maybe a) + , cycleAnchorDateOfPrincipalRedemption: + (D.maybe D.value) :: _ (Maybe String) + , cycleOfPrincipalRedemption: (D.maybe D.value) :: _ (Maybe Cycle) + , nextPrincipalRedemptionPayment: (D.maybe D.value) :: _ (Maybe a) + , purchaseDate: (D.maybe D.value) :: _ (Maybe String) + , priceAtPurchaseDate: (D.maybe D.value) :: _ (Maybe a) + , terminationDate: (D.maybe D.value) :: _ (Maybe String) + , priceAtTerminationDate: (D.maybe D.value) :: _ (Maybe a) + , scalingIndexAtStatusDate: (D.maybe D.value) :: _ (Maybe a) + , cycleAnchorDateOfScalingIndex: (D.maybe D.value) :: _ (Maybe String) + , cycleOfScalingIndex: (D.maybe D.value) :: _ (Maybe Cycle) + , scalingEffect: (D.maybe D.value) :: _ (Maybe SCEF) + , scalingIndexAtContractDealDate: (D.maybe D.value) :: _ (Maybe a) + , marketObjectCodeOfScalingIndex: (D.maybe D.value) :: _ (Maybe String) + , notionalScalingMultiplier: (D.maybe D.value) :: _ (Maybe a) + , cycleOfOptionality: (D.maybe D.value) :: _ (Maybe Cycle) + , cycleAnchorDateOfOptionality: (D.maybe D.value) :: _ (Maybe String) + , optionType: (D.maybe D.value) :: _ (Maybe OPTP) + , optionStrike1: (D.maybe D.value) :: _ (Maybe a) + , optionExerciseType: (D.maybe D.value) :: _ (Maybe OPXT) + , settlementPeriod: (D.maybe D.value) :: _ (Maybe Cycle) + , deliverySettlement: (D.maybe D.value) :: _ (Maybe DS) + , exerciseAmount: (D.maybe D.value) :: _ (Maybe a) + , futuresPrice: (D.maybe D.value) :: _ (Maybe a) + , penaltyRate: (D.maybe D.value) :: _ (Maybe a) + , penaltyType: (D.maybe D.value) :: _ (Maybe PYTP) + , prepaymentEffect: (D.maybe D.value) :: _ (Maybe PPEF) + , cycleOfRateReset: (D.maybe D.value) :: _ (Maybe Cycle) + , cycleAnchorDateOfRateReset: (D.maybe D.value) :: _ (Maybe String) + , nextResetRate: (D.maybe D.value) :: _ (Maybe a) + , rateSpread: (D.maybe D.value) :: _ (Maybe a) + , rateMultiplier: (D.maybe D.value) :: _ (Maybe a) + , periodFloor: (D.maybe D.value) :: _ (Maybe a) + , periodCap: (D.maybe D.value) :: _ (Maybe a) + , lifeCap: (D.maybe D.value) :: _ (Maybe a) + , lifeFloor: (D.maybe D.value) :: _ (Maybe a) + , marketObjectCodeOfRateReset: (D.maybe D.value) :: _ (Maybe String) + , cycleOfDividend: (D.maybe D.value) :: _ (Maybe Cycle) + , cycleAnchorDateOfDividend: (D.maybe D.value) :: _ (Maybe String) + , nextDividendPaymentAmount: (D.maybe D.value) :: _ (Maybe a) + , enableSettlement: D.value :: _ Boolean + , constraints: (D.maybe D.value) :: _ (Maybe Assertions) + } + ) + +derive instance genericContractTermsPoly :: Generic (ContractTermsPoly a) _ + +derive instance newtypeContractTermsPoly :: Newtype (ContractTermsPoly a) _ + +-------------------------------------------------------------------------------- + +_ContractTermsPoly + :: forall a + . Iso' (ContractTermsPoly a) + { contractId :: String + , contractType :: CT + , contractStructure :: Array ContractStructure + , contractRole :: CR + , settlementCurrency :: Maybe String + , initialExchangeDate :: Maybe String + , dayCountConvention :: Maybe DCC + , scheduleConfig :: ScheduleConfig + , statusDate :: String + , contractPerformance :: Maybe PRF + , cycleOfFee :: Maybe Cycle + , cycleAnchorDateOfFee :: Maybe String + , feeAccrued :: Maybe a + , feeBasis :: Maybe FEB + , feeRate :: Maybe a + , cycleAnchorDateOfInterestPayment :: Maybe String + , cycleOfInterestPayment :: Maybe Cycle + , accruedInterest :: Maybe a + , capitalizationEndDate :: Maybe String + , cycleAnchorDateOfInterestCalculationBase :: Maybe String + , cycleOfInterestCalculationBase :: Maybe Cycle + , interestCalculationBase :: Maybe IPCB + , interestCalculationBaseA :: Maybe a + , nominalInterestRate :: Maybe a + , nominalInterestRate2 :: Maybe a + , interestScalingMultiplier :: Maybe a + , maturityDate :: Maybe String + , amortizationDate :: Maybe String + , exerciseDate :: Maybe String + , notionalPrincipal :: Maybe a + , premiumDiscountAtIED :: Maybe a + , cycleAnchorDateOfPrincipalRedemption :: Maybe String + , cycleOfPrincipalRedemption :: Maybe Cycle + , nextPrincipalRedemptionPayment :: Maybe a + , purchaseDate :: Maybe String + , priceAtPurchaseDate :: Maybe a + , terminationDate :: Maybe String + , priceAtTerminationDate :: Maybe a + , scalingIndexAtStatusDate :: Maybe a + , cycleAnchorDateOfScalingIndex :: Maybe String + , cycleOfScalingIndex :: Maybe Cycle + , scalingEffect :: Maybe SCEF + , scalingIndexAtContractDealDate :: Maybe a + , marketObjectCodeOfScalingIndex :: Maybe String + , notionalScalingMultiplier :: Maybe a + , cycleOfOptionality :: Maybe Cycle + , cycleAnchorDateOfOptionality :: Maybe String + , optionType :: Maybe OPTP + , optionStrike1 :: Maybe a + , optionExerciseType :: Maybe OPXT + , settlementPeriod :: Maybe Cycle + , deliverySettlement :: Maybe DS + , exerciseAmount :: Maybe a + , futuresPrice :: Maybe a + , penaltyRate :: Maybe a + , penaltyType :: Maybe PYTP + , prepaymentEffect :: Maybe PPEF + , cycleOfRateReset :: Maybe Cycle + , cycleAnchorDateOfRateReset :: Maybe String + , nextResetRate :: Maybe a + , rateSpread :: Maybe a + , rateMultiplier :: Maybe a + , periodFloor :: Maybe a + , periodCap :: Maybe a + , lifeCap :: Maybe a + , lifeFloor :: Maybe a + , marketObjectCodeOfRateReset :: Maybe String + , cycleOfDividend :: Maybe Cycle + , cycleAnchorDateOfDividend :: Maybe String + , nextDividendPaymentAmount :: Maybe a + , enableSettlement :: Boolean + , constraints :: Maybe Assertions + } +_ContractTermsPoly = _Newtype + +-------------------------------------------------------------------------------- + +data PYTP + = PYTP_A + | PYTP_N + | PYTP_I + | PYTP_O + +derive instance eqPYTP :: Eq PYTP + +derive instance ordPYTP :: Ord PYTP + +instance showPYTP :: Show PYTP where + show a = genericShow a + +instance encodeJsonPYTP :: EncodeJson PYTP where + encodeJson = defer \_ -> E.encode E.enum + +instance decodeJsonPYTP :: DecodeJson PYTP where + decodeJson = defer \_ -> D.decode D.enum + +derive instance genericPYTP :: Generic PYTP _ + +instance enumPYTP :: Enum PYTP where + succ = genericSucc + pred = genericPred + +instance boundedPYTP :: Bounded PYTP where + bottom = genericBottom + top = genericTop + +-------------------------------------------------------------------------------- + +_PYTP_A :: Prism' PYTP Unit +_PYTP_A = prism' (const PYTP_A) case _ of + PYTP_A -> Just unit + _ -> Nothing + +_PYTP_N :: Prism' PYTP Unit +_PYTP_N = prism' (const PYTP_N) case _ of + PYTP_N -> Just unit + _ -> Nothing + +_PYTP_I :: Prism' PYTP Unit +_PYTP_I = prism' (const PYTP_I) case _ of + PYTP_I -> Just unit + _ -> Nothing + +_PYTP_O :: Prism' PYTP Unit +_PYTP_O = prism' (const PYTP_O) case _ of + PYTP_O -> Just unit + _ -> Nothing + +-------------------------------------------------------------------------------- + +data PPEF + = PPEF_N + | PPEF_A + | PPEF_M + +derive instance eqPPEF :: Eq PPEF + +derive instance ordPPEF :: Ord PPEF + +instance showPPEF :: Show PPEF where + show a = genericShow a + +instance encodeJsonPPEF :: EncodeJson PPEF where + encodeJson = defer \_ -> E.encode E.enum + +instance decodeJsonPPEF :: DecodeJson PPEF where + decodeJson = defer \_ -> D.decode D.enum + +derive instance genericPPEF :: Generic PPEF _ + +instance enumPPEF :: Enum PPEF where + succ = genericSucc + pred = genericPred + +instance boundedPPEF :: Bounded PPEF where + bottom = genericBottom + top = genericTop + +-------------------------------------------------------------------------------- + +_PPEF_N :: Prism' PPEF Unit +_PPEF_N = prism' (const PPEF_N) case _ of + PPEF_N -> Just unit + _ -> Nothing + +_PPEF_A :: Prism' PPEF Unit +_PPEF_A = prism' (const PPEF_A) case _ of + PPEF_A -> Just unit + _ -> Nothing + +_PPEF_M :: Prism' PPEF Unit +_PPEF_M = prism' (const PPEF_M) case _ of + PPEF_M -> Just unit + _ -> Nothing + +-------------------------------------------------------------------------------- + +data SCEF + = SE_OOO + | SE_IOO + | SE_ONO + | SE_OOM + | SE_INO + | SE_ONM + | SE_IOM + | SE_INM + +derive instance eqSCEF :: Eq SCEF + +derive instance ordSCEF :: Ord SCEF + +instance showSCEF :: Show SCEF where + show a = genericShow a + +instance encodeJsonSCEF :: EncodeJson SCEF where + encodeJson = defer \_ -> E.encode E.enum + +instance decodeJsonSCEF :: DecodeJson SCEF where + decodeJson = defer \_ -> D.decode D.enum + +derive instance genericSCEF :: Generic SCEF _ + +instance enumSCEF :: Enum SCEF where + succ = genericSucc + pred = genericPred + +instance boundedSCEF :: Bounded SCEF where + bottom = genericBottom + top = genericTop + +-------------------------------------------------------------------------------- + +_SE_OOO :: Prism' SCEF Unit +_SE_OOO = prism' (const SE_OOO) case _ of + SE_OOO -> Just unit + _ -> Nothing + +_SE_IOO :: Prism' SCEF Unit +_SE_IOO = prism' (const SE_IOO) case _ of + SE_IOO -> Just unit + _ -> Nothing + +_SE_ONO :: Prism' SCEF Unit +_SE_ONO = prism' (const SE_ONO) case _ of + SE_ONO -> Just unit + _ -> Nothing + +_SE_OOM :: Prism' SCEF Unit +_SE_OOM = prism' (const SE_OOM) case _ of + SE_OOM -> Just unit + _ -> Nothing + +_SE_INO :: Prism' SCEF Unit +_SE_INO = prism' (const SE_INO) case _ of + SE_INO -> Just unit + _ -> Nothing + +_SE_ONM :: Prism' SCEF Unit +_SE_ONM = prism' (const SE_ONM) case _ of + SE_ONM -> Just unit + _ -> Nothing + +_SE_IOM :: Prism' SCEF Unit +_SE_IOM = prism' (const SE_IOM) case _ of + SE_IOM -> Just unit + _ -> Nothing + +_SE_INM :: Prism' SCEF Unit +_SE_INM = prism' (const SE_INM) case _ of + SE_INM -> Just unit + _ -> Nothing + +-------------------------------------------------------------------------------- + +data OPTP + = OPTP_C + | OPTP_P + | OPTP_CP + +derive instance eqOPTP :: Eq OPTP + +derive instance ordOPTP :: Ord OPTP + +instance showOPTP :: Show OPTP where + show a = genericShow a + +instance encodeJsonOPTP :: EncodeJson OPTP where + encodeJson = defer \_ -> E.encode E.enum + +instance decodeJsonOPTP :: DecodeJson OPTP where + decodeJson = defer \_ -> D.decode D.enum + +derive instance genericOPTP :: Generic OPTP _ + +instance enumOPTP :: Enum OPTP where + succ = genericSucc + pred = genericPred + +instance boundedOPTP :: Bounded OPTP where + bottom = genericBottom + top = genericTop + +-------------------------------------------------------------------------------- + +_OPTP_C :: Prism' OPTP Unit +_OPTP_C = prism' (const OPTP_C) case _ of + OPTP_C -> Just unit + _ -> Nothing + +_OPTP_P :: Prism' OPTP Unit +_OPTP_P = prism' (const OPTP_P) case _ of + OPTP_P -> Just unit + _ -> Nothing + +_OPTP_CP :: Prism' OPTP Unit +_OPTP_CP = prism' (const OPTP_CP) case _ of + OPTP_CP -> Just unit + _ -> Nothing + +-------------------------------------------------------------------------------- + +data OPXT + = OPXT_E + | OPXT_B + | OPXT_A + +derive instance eqOPXT :: Eq OPXT + +derive instance ordOPXT :: Ord OPXT + +instance showOPXT :: Show OPXT where + show a = genericShow a + +instance encodeJsonOPXT :: EncodeJson OPXT where + encodeJson = defer \_ -> E.encode E.enum + +instance decodeJsonOPXT :: DecodeJson OPXT where + decodeJson = defer \_ -> D.decode D.enum + +derive instance genericOPXT :: Generic OPXT _ + +instance enumOPXT :: Enum OPXT where + succ = genericSucc + pred = genericPred + +instance boundedOPXT :: Bounded OPXT where + bottom = genericBottom + top = genericTop + +-------------------------------------------------------------------------------- + +_OPXT_E :: Prism' OPXT Unit +_OPXT_E = prism' (const OPXT_E) case _ of + OPXT_E -> Just unit + _ -> Nothing + +_OPXT_B :: Prism' OPXT Unit +_OPXT_B = prism' (const OPXT_B) case _ of + OPXT_B -> Just unit + _ -> Nothing + +_OPXT_A :: Prism' OPXT Unit +_OPXT_A = prism' (const OPXT_A) case _ of + OPXT_A -> Just unit + _ -> Nothing + +-------------------------------------------------------------------------------- + +data DS + = DS_S + | DS_D + +derive instance eqDS :: Eq DS + +derive instance ordDS :: Ord DS + +instance showDS :: Show DS where + show a = genericShow a + +instance encodeJsonDS :: EncodeJson DS where + encodeJson = defer \_ -> E.encode E.enum + +instance decodeJsonDS :: DecodeJson DS where + decodeJson = defer \_ -> D.decode D.enum + +derive instance genericDS :: Generic DS _ + +instance enumDS :: Enum DS where + succ = genericSucc + pred = genericPred + +instance boundedDS :: Bounded DS where + bottom = genericBottom + top = genericTop + +-------------------------------------------------------------------------------- + +_DS_S :: Prism' DS Unit +_DS_S = prism' (const DS_S) case _ of + DS_S -> Just unit + _ -> Nothing + +_DS_D :: Prism' DS Unit +_DS_D = prism' (const DS_D) case _ of + DS_D -> Just unit + _ -> Nothing + +-------------------------------------------------------------------------------- + +newtype Cycle = Cycle + { n :: BigInt + , p :: Period + , stub :: Stub + , includeEndDay :: Boolean + } + +instance encodeJsonCycle :: EncodeJson Cycle where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { n: E.value :: _ BigInt + , p: E.value :: _ Period + , stub: E.value :: _ Stub + , includeEndDay: E.value :: _ Boolean + } + ) + +instance decodeJsonCycle :: DecodeJson Cycle where + decodeJson = defer \_ -> D.decode $ + ( Cycle <$> D.record "Cycle" + { n: D.value :: _ BigInt + , p: D.value :: _ Period + , stub: D.value :: _ Stub + , includeEndDay: D.value :: _ Boolean + } + ) + +derive instance genericCycle :: Generic Cycle _ + +derive instance newtypeCycle :: Newtype Cycle _ + +-------------------------------------------------------------------------------- + +_Cycle :: Iso' Cycle + { n :: BigInt, p :: Period, stub :: Stub, includeEndDay :: Boolean } +_Cycle = _Newtype + +-------------------------------------------------------------------------------- + +data Period + = P_D + | P_W + | P_M + | P_Q + | P_H + | P_Y + +derive instance eqPeriod :: Eq Period + +derive instance ordPeriod :: Ord Period + +instance showPeriod :: Show Period where + show a = genericShow a + +instance encodeJsonPeriod :: EncodeJson Period where + encodeJson = defer \_ -> E.encode E.enum + +instance decodeJsonPeriod :: DecodeJson Period where + decodeJson = defer \_ -> D.decode D.enum + +derive instance genericPeriod :: Generic Period _ + +instance enumPeriod :: Enum Period where + succ = genericSucc + pred = genericPred + +instance boundedPeriod :: Bounded Period where + bottom = genericBottom + top = genericTop + +-------------------------------------------------------------------------------- + +_P_D :: Prism' Period Unit +_P_D = prism' (const P_D) case _ of + P_D -> Just unit + _ -> Nothing + +_P_W :: Prism' Period Unit +_P_W = prism' (const P_W) case _ of + P_W -> Just unit + _ -> Nothing + +_P_M :: Prism' Period Unit +_P_M = prism' (const P_M) case _ of + P_M -> Just unit + _ -> Nothing + +_P_Q :: Prism' Period Unit +_P_Q = prism' (const P_Q) case _ of + P_Q -> Just unit + _ -> Nothing + +_P_H :: Prism' Period Unit +_P_H = prism' (const P_H) case _ of + P_H -> Just unit + _ -> Nothing + +_P_Y :: Prism' Period Unit +_P_Y = prism' (const P_Y) case _ of + P_Y -> Just unit + _ -> Nothing + +-------------------------------------------------------------------------------- + +data Stub + = ShortStub + | LongStub + +derive instance eqStub :: Eq Stub + +derive instance ordStub :: Ord Stub + +instance showStub :: Show Stub where + show a = genericShow a + +instance encodeJsonStub :: EncodeJson Stub where + encodeJson = defer \_ -> E.encode E.enum + +instance decodeJsonStub :: DecodeJson Stub where + decodeJson = defer \_ -> D.decode D.enum + +derive instance genericStub :: Generic Stub _ + +instance enumStub :: Enum Stub where + succ = genericSucc + pred = genericPred + +instance boundedStub :: Bounded Stub where + bottom = genericBottom + top = genericTop + +-------------------------------------------------------------------------------- + +_ShortStub :: Prism' Stub Unit +_ShortStub = prism' (const ShortStub) case _ of + ShortStub -> Just unit + _ -> Nothing + +_LongStub :: Prism' Stub Unit +_LongStub = prism' (const LongStub) case _ of + LongStub -> Just unit + _ -> Nothing + +-------------------------------------------------------------------------------- + +newtype ScheduleConfig = ScheduleConfig + { calendar :: Maybe Calendar + , endOfMonthConvention :: Maybe EOMC + , businessDayConvention :: Maybe BDC + } + +instance encodeJsonScheduleConfig :: EncodeJson ScheduleConfig where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { calendar: (E.maybe E.value) :: _ (Maybe Calendar) + , endOfMonthConvention: (E.maybe E.value) :: _ (Maybe EOMC) + , businessDayConvention: (E.maybe E.value) :: _ (Maybe BDC) + } + ) + +instance decodeJsonScheduleConfig :: DecodeJson ScheduleConfig where + decodeJson = defer \_ -> D.decode $ + ( ScheduleConfig <$> D.record "ScheduleConfig" + { calendar: (D.maybe D.value) :: _ (Maybe Calendar) + , endOfMonthConvention: (D.maybe D.value) :: _ (Maybe EOMC) + , businessDayConvention: (D.maybe D.value) :: _ (Maybe BDC) + } + ) + +derive instance genericScheduleConfig :: Generic ScheduleConfig _ + +derive instance newtypeScheduleConfig :: Newtype ScheduleConfig _ + +-------------------------------------------------------------------------------- + +_ScheduleConfig :: Iso' ScheduleConfig + { calendar :: Maybe Calendar + , endOfMonthConvention :: Maybe EOMC + , businessDayConvention :: Maybe BDC + } +_ScheduleConfig = _Newtype + +-------------------------------------------------------------------------------- + +newtype ContractStructure = ContractStructure + { marketObjectCode :: String + , referenceType :: ReferenceType + , referenceRole :: ReferenceRole + } + +instance encodeJsonContractStructure :: EncodeJson ContractStructure where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { marketObjectCode: E.value :: _ String + , referenceType: E.value :: _ ReferenceType + , referenceRole: E.value :: _ ReferenceRole + } + ) + +instance decodeJsonContractStructure :: DecodeJson ContractStructure where + decodeJson = defer \_ -> D.decode $ + ( ContractStructure <$> D.record "ContractStructure" + { marketObjectCode: D.value :: _ String + , referenceType: D.value :: _ ReferenceType + , referenceRole: D.value :: _ ReferenceRole + } + ) + +derive instance genericContractStructure :: Generic ContractStructure _ + +derive instance newtypeContractStructure :: Newtype ContractStructure _ + +-------------------------------------------------------------------------------- + +_ContractStructure :: Iso' ContractStructure + { marketObjectCode :: String + , referenceType :: ReferenceType + , referenceRole :: ReferenceRole + } +_ContractStructure = _Newtype + +-------------------------------------------------------------------------------- + +data ReferenceType + = CNT + | CID + | MOC + | EID + | CST + +derive instance eqReferenceType :: Eq ReferenceType + +derive instance ordReferenceType :: Ord ReferenceType + +instance showReferenceType :: Show ReferenceType where + show a = genericShow a + +instance encodeJsonReferenceType :: EncodeJson ReferenceType where + encodeJson = defer \_ -> E.encode E.enum + +instance decodeJsonReferenceType :: DecodeJson ReferenceType where + decodeJson = defer \_ -> D.decode D.enum + +derive instance genericReferenceType :: Generic ReferenceType _ + +instance enumReferenceType :: Enum ReferenceType where + succ = genericSucc + pred = genericPred + +instance boundedReferenceType :: Bounded ReferenceType where + bottom = genericBottom + top = genericTop + +-------------------------------------------------------------------------------- + +_CNT :: Prism' ReferenceType Unit +_CNT = prism' (const CNT) case _ of + CNT -> Just unit + _ -> Nothing + +_CID :: Prism' ReferenceType Unit +_CID = prism' (const CID) case _ of + CID -> Just unit + _ -> Nothing + +_MOC :: Prism' ReferenceType Unit +_MOC = prism' (const MOC) case _ of + MOC -> Just unit + _ -> Nothing + +_EID :: Prism' ReferenceType Unit +_EID = prism' (const EID) case _ of + EID -> Just unit + _ -> Nothing + +_CST :: Prism' ReferenceType Unit +_CST = prism' (const CST) case _ of + CST -> Just unit + _ -> Nothing + +-------------------------------------------------------------------------------- + +data ReferenceRole + = UDL + | FIL + | SEL + | COVE + | COVI + +derive instance eqReferenceRole :: Eq ReferenceRole + +derive instance ordReferenceRole :: Ord ReferenceRole + +instance showReferenceRole :: Show ReferenceRole where + show a = genericShow a + +instance encodeJsonReferenceRole :: EncodeJson ReferenceRole where + encodeJson = defer \_ -> E.encode E.enum + +instance decodeJsonReferenceRole :: DecodeJson ReferenceRole where + decodeJson = defer \_ -> D.decode D.enum + +derive instance genericReferenceRole :: Generic ReferenceRole _ + +instance enumReferenceRole :: Enum ReferenceRole where + succ = genericSucc + pred = genericPred + +instance boundedReferenceRole :: Bounded ReferenceRole where + bottom = genericBottom + top = genericTop + +-------------------------------------------------------------------------------- + +_UDL :: Prism' ReferenceRole Unit +_UDL = prism' (const UDL) case _ of + UDL -> Just unit + _ -> Nothing + +_FIL :: Prism' ReferenceRole Unit +_FIL = prism' (const FIL) case _ of + FIL -> Just unit + _ -> Nothing + +_SEL :: Prism' ReferenceRole Unit +_SEL = prism' (const SEL) case _ of + SEL -> Just unit + _ -> Nothing + +_COVE :: Prism' ReferenceRole Unit +_COVE = prism' (const COVE) case _ of + COVE -> Just unit + _ -> Nothing + +_COVI :: Prism' ReferenceRole Unit +_COVI = prism' (const COVI) case _ of + COVI -> Just unit + _ -> Nothing + +-------------------------------------------------------------------------------- + +data DCC + = DCC_A_AISDA + | DCC_A_360 + | DCC_A_365 + | DCC_E30_360ISDA + | DCC_E30_360 + | DCC_B_252 + +derive instance eqDCC :: Eq DCC + +derive instance ordDCC :: Ord DCC + +instance showDCC :: Show DCC where + show a = genericShow a + +instance encodeJsonDCC :: EncodeJson DCC where + encodeJson = defer \_ -> E.encode E.enum + +instance decodeJsonDCC :: DecodeJson DCC where + decodeJson = defer \_ -> D.decode D.enum + +derive instance genericDCC :: Generic DCC _ + +instance enumDCC :: Enum DCC where + succ = genericSucc + pred = genericPred + +instance boundedDCC :: Bounded DCC where + bottom = genericBottom + top = genericTop + +-------------------------------------------------------------------------------- + +_DCC_A_AISDA :: Prism' DCC Unit +_DCC_A_AISDA = prism' (const DCC_A_AISDA) case _ of + DCC_A_AISDA -> Just unit + _ -> Nothing + +_DCC_A_360 :: Prism' DCC Unit +_DCC_A_360 = prism' (const DCC_A_360) case _ of + DCC_A_360 -> Just unit + _ -> Nothing + +_DCC_A_365 :: Prism' DCC Unit +_DCC_A_365 = prism' (const DCC_A_365) case _ of + DCC_A_365 -> Just unit + _ -> Nothing + +_DCC_E30_360ISDA :: Prism' DCC Unit +_DCC_E30_360ISDA = prism' (const DCC_E30_360ISDA) case _ of + DCC_E30_360ISDA -> Just unit + _ -> Nothing + +_DCC_E30_360 :: Prism' DCC Unit +_DCC_E30_360 = prism' (const DCC_E30_360) case _ of + DCC_E30_360 -> Just unit + _ -> Nothing + +_DCC_B_252 :: Prism' DCC Unit +_DCC_B_252 = prism' (const DCC_B_252) case _ of + DCC_B_252 -> Just unit + _ -> Nothing + +-------------------------------------------------------------------------------- + +data BDC + = BDC_NULL + | BDC_SCF + | BDC_SCMF + | BDC_CSF + | BDC_CSMF + | BDC_SCP + | BDC_SCMP + | BDC_CSP + | BDC_CSMP + +derive instance eqBDC :: Eq BDC + +derive instance ordBDC :: Ord BDC + +instance showBDC :: Show BDC where + show a = genericShow a + +instance encodeJsonBDC :: EncodeJson BDC where + encodeJson = defer \_ -> E.encode E.enum + +instance decodeJsonBDC :: DecodeJson BDC where + decodeJson = defer \_ -> D.decode D.enum + +derive instance genericBDC :: Generic BDC _ + +instance enumBDC :: Enum BDC where + succ = genericSucc + pred = genericPred + +instance boundedBDC :: Bounded BDC where + bottom = genericBottom + top = genericTop + +-------------------------------------------------------------------------------- + +_BDC_NULL :: Prism' BDC Unit +_BDC_NULL = prism' (const BDC_NULL) case _ of + BDC_NULL -> Just unit + _ -> Nothing + +_BDC_SCF :: Prism' BDC Unit +_BDC_SCF = prism' (const BDC_SCF) case _ of + BDC_SCF -> Just unit + _ -> Nothing + +_BDC_SCMF :: Prism' BDC Unit +_BDC_SCMF = prism' (const BDC_SCMF) case _ of + BDC_SCMF -> Just unit + _ -> Nothing + +_BDC_CSF :: Prism' BDC Unit +_BDC_CSF = prism' (const BDC_CSF) case _ of + BDC_CSF -> Just unit + _ -> Nothing + +_BDC_CSMF :: Prism' BDC Unit +_BDC_CSMF = prism' (const BDC_CSMF) case _ of + BDC_CSMF -> Just unit + _ -> Nothing + +_BDC_SCP :: Prism' BDC Unit +_BDC_SCP = prism' (const BDC_SCP) case _ of + BDC_SCP -> Just unit + _ -> Nothing + +_BDC_SCMP :: Prism' BDC Unit +_BDC_SCMP = prism' (const BDC_SCMP) case _ of + BDC_SCMP -> Just unit + _ -> Nothing + +_BDC_CSP :: Prism' BDC Unit +_BDC_CSP = prism' (const BDC_CSP) case _ of + BDC_CSP -> Just unit + _ -> Nothing + +_BDC_CSMP :: Prism' BDC Unit +_BDC_CSMP = prism' (const BDC_CSMP) case _ of + BDC_CSMP -> Just unit + _ -> Nothing + +-------------------------------------------------------------------------------- + +data EOMC + = EOMC_EOM + | EOMC_SD + +derive instance eqEOMC :: Eq EOMC + +derive instance ordEOMC :: Ord EOMC + +instance showEOMC :: Show EOMC where + show a = genericShow a + +instance encodeJsonEOMC :: EncodeJson EOMC where + encodeJson = defer \_ -> E.encode E.enum + +instance decodeJsonEOMC :: DecodeJson EOMC where + decodeJson = defer \_ -> D.decode D.enum + +derive instance genericEOMC :: Generic EOMC _ + +instance enumEOMC :: Enum EOMC where + succ = genericSucc + pred = genericPred + +instance boundedEOMC :: Bounded EOMC where + bottom = genericBottom + top = genericTop + +-------------------------------------------------------------------------------- + +_EOMC_EOM :: Prism' EOMC Unit +_EOMC_EOM = prism' (const EOMC_EOM) case _ of + EOMC_EOM -> Just unit + _ -> Nothing + +_EOMC_SD :: Prism' EOMC Unit +_EOMC_SD = prism' (const EOMC_SD) case _ of + EOMC_SD -> Just unit + _ -> Nothing + +-------------------------------------------------------------------------------- + +data PRF + = PRF_PF + | PRF_DL + | PRF_DQ + | PRF_DF + +derive instance eqPRF :: Eq PRF + +derive instance ordPRF :: Ord PRF + +instance showPRF :: Show PRF where + show a = genericShow a + +instance encodeJsonPRF :: EncodeJson PRF where + encodeJson = defer \_ -> E.encode E.enum + +instance decodeJsonPRF :: DecodeJson PRF where + decodeJson = defer \_ -> D.decode D.enum + +derive instance genericPRF :: Generic PRF _ + +instance enumPRF :: Enum PRF where + succ = genericSucc + pred = genericPred + +instance boundedPRF :: Bounded PRF where + bottom = genericBottom + top = genericTop + +-------------------------------------------------------------------------------- + +_PRF_PF :: Prism' PRF Unit +_PRF_PF = prism' (const PRF_PF) case _ of + PRF_PF -> Just unit + _ -> Nothing + +_PRF_DL :: Prism' PRF Unit +_PRF_DL = prism' (const PRF_DL) case _ of + PRF_DL -> Just unit + _ -> Nothing + +_PRF_DQ :: Prism' PRF Unit +_PRF_DQ = prism' (const PRF_DQ) case _ of + PRF_DQ -> Just unit + _ -> Nothing + +_PRF_DF :: Prism' PRF Unit +_PRF_DF = prism' (const PRF_DF) case _ of + PRF_DF -> Just unit + _ -> Nothing + +-------------------------------------------------------------------------------- + +data FEB + = FEB_A + | FEB_N + +derive instance eqFEB :: Eq FEB + +derive instance ordFEB :: Ord FEB + +instance showFEB :: Show FEB where + show a = genericShow a + +instance encodeJsonFEB :: EncodeJson FEB where + encodeJson = defer \_ -> E.encode E.enum + +instance decodeJsonFEB :: DecodeJson FEB where + decodeJson = defer \_ -> D.decode D.enum + +derive instance genericFEB :: Generic FEB _ + +instance enumFEB :: Enum FEB where + succ = genericSucc + pred = genericPred + +instance boundedFEB :: Bounded FEB where + bottom = genericBottom + top = genericTop + +-------------------------------------------------------------------------------- + +_FEB_A :: Prism' FEB Unit +_FEB_A = prism' (const FEB_A) case _ of + FEB_A -> Just unit + _ -> Nothing + +_FEB_N :: Prism' FEB Unit +_FEB_N = prism' (const FEB_N) case _ of + FEB_N -> Just unit + _ -> Nothing + +-------------------------------------------------------------------------------- + +data IPCB + = IPCB_NT + | IPCB_NTIED + | IPCB_NTL + +derive instance eqIPCB :: Eq IPCB + +derive instance ordIPCB :: Ord IPCB + +instance showIPCB :: Show IPCB where + show a = genericShow a + +instance encodeJsonIPCB :: EncodeJson IPCB where + encodeJson = defer \_ -> E.encode E.enum + +instance decodeJsonIPCB :: DecodeJson IPCB where + decodeJson = defer \_ -> D.decode D.enum + +derive instance genericIPCB :: Generic IPCB _ + +instance enumIPCB :: Enum IPCB where + succ = genericSucc + pred = genericPred + +instance boundedIPCB :: Bounded IPCB where + bottom = genericBottom + top = genericTop + +-------------------------------------------------------------------------------- + +_IPCB_NT :: Prism' IPCB Unit +_IPCB_NT = prism' (const IPCB_NT) case _ of + IPCB_NT -> Just unit + _ -> Nothing + +_IPCB_NTIED :: Prism' IPCB Unit +_IPCB_NTIED = prism' (const IPCB_NTIED) case _ of + IPCB_NTIED -> Just unit + _ -> Nothing + +_IPCB_NTL :: Prism' IPCB Unit +_IPCB_NTL = prism' (const IPCB_NTL) case _ of + IPCB_NTL -> Just unit + _ -> Nothing + +-------------------------------------------------------------------------------- + +data CR + = CR_RPA + | CR_RPL + | CR_CLO + | CR_CNO + | CR_COL + | CR_LG + | CR_ST + | CR_BUY + | CR_SEL + | CR_RFL + | CR_PFL + | CR_RF + | CR_PF + +derive instance eqCR :: Eq CR + +derive instance ordCR :: Ord CR + +instance showCR :: Show CR where + show a = genericShow a + +instance encodeJsonCR :: EncodeJson CR where + encodeJson = defer \_ -> E.encode E.enum + +instance decodeJsonCR :: DecodeJson CR where + decodeJson = defer \_ -> D.decode D.enum + +derive instance genericCR :: Generic CR _ + +instance enumCR :: Enum CR where + succ = genericSucc + pred = genericPred + +instance boundedCR :: Bounded CR where + bottom = genericBottom + top = genericTop + +-------------------------------------------------------------------------------- + +_CR_RPA :: Prism' CR Unit +_CR_RPA = prism' (const CR_RPA) case _ of + CR_RPA -> Just unit + _ -> Nothing + +_CR_RPL :: Prism' CR Unit +_CR_RPL = prism' (const CR_RPL) case _ of + CR_RPL -> Just unit + _ -> Nothing + +_CR_CLO :: Prism' CR Unit +_CR_CLO = prism' (const CR_CLO) case _ of + CR_CLO -> Just unit + _ -> Nothing + +_CR_CNO :: Prism' CR Unit +_CR_CNO = prism' (const CR_CNO) case _ of + CR_CNO -> Just unit + _ -> Nothing + +_CR_COL :: Prism' CR Unit +_CR_COL = prism' (const CR_COL) case _ of + CR_COL -> Just unit + _ -> Nothing + +_CR_LG :: Prism' CR Unit +_CR_LG = prism' (const CR_LG) case _ of + CR_LG -> Just unit + _ -> Nothing + +_CR_ST :: Prism' CR Unit +_CR_ST = prism' (const CR_ST) case _ of + CR_ST -> Just unit + _ -> Nothing + +_CR_BUY :: Prism' CR Unit +_CR_BUY = prism' (const CR_BUY) case _ of + CR_BUY -> Just unit + _ -> Nothing + +_CR_SEL :: Prism' CR Unit +_CR_SEL = prism' (const CR_SEL) case _ of + CR_SEL -> Just unit + _ -> Nothing + +_CR_RFL :: Prism' CR Unit +_CR_RFL = prism' (const CR_RFL) case _ of + CR_RFL -> Just unit + _ -> Nothing + +_CR_PFL :: Prism' CR Unit +_CR_PFL = prism' (const CR_PFL) case _ of + CR_PFL -> Just unit + _ -> Nothing + +_CR_RF :: Prism' CR Unit +_CR_RF = prism' (const CR_RF) case _ of + CR_RF -> Just unit + _ -> Nothing + +_CR_PF :: Prism' CR Unit +_CR_PF = prism' (const CR_PF) case _ of + CR_PF -> Just unit + _ -> Nothing + +-------------------------------------------------------------------------------- + +data CT + = PAM + | LAM + | NAM + | ANN + | STK + | OPTNS + | FUTUR + | SWPPV + +derive instance eqCT :: Eq CT + +derive instance ordCT :: Ord CT + +instance showCT :: Show CT where + show a = genericShow a + +instance encodeJsonCT :: EncodeJson CT where + encodeJson = defer \_ -> E.encode E.enum + +instance decodeJsonCT :: DecodeJson CT where + decodeJson = defer \_ -> D.decode D.enum + +derive instance genericCT :: Generic CT _ + +instance enumCT :: Enum CT where + succ = genericSucc + pred = genericPred + +instance boundedCT :: Bounded CT where + bottom = genericBottom + top = genericTop + +-------------------------------------------------------------------------------- + +_PAM :: Prism' CT Unit +_PAM = prism' (const PAM) case _ of + PAM -> Just unit + _ -> Nothing + +_LAM :: Prism' CT Unit +_LAM = prism' (const LAM) case _ of + LAM -> Just unit + _ -> Nothing + +_NAM :: Prism' CT Unit +_NAM = prism' (const NAM) case _ of + NAM -> Just unit + _ -> Nothing + +_ANN :: Prism' CT Unit +_ANN = prism' (const ANN) case _ of + ANN -> Just unit + _ -> Nothing + +_STK :: Prism' CT Unit +_STK = prism' (const STK) case _ of + STK -> Just unit + _ -> Nothing + +_OPTNS :: Prism' CT Unit +_OPTNS = prism' (const OPTNS) case _ of + OPTNS -> Just unit + _ -> Nothing + +_FUTUR :: Prism' CT Unit +_FUTUR = prism' (const FUTUR) case _ of + FUTUR -> Just unit + _ -> Nothing + +_SWPPV :: Prism' CT Unit +_SWPPV = prism' (const SWPPV) case _ of + SWPPV -> Just unit + _ -> Nothing + +-------------------------------------------------------------------------------- + +data Calendar + = CLDR_MF + | CLDR_NC + +derive instance eqCalendar :: Eq Calendar + +derive instance ordCalendar :: Ord Calendar + +instance showCalendar :: Show Calendar where + show a = genericShow a + +instance encodeJsonCalendar :: EncodeJson Calendar where + encodeJson = defer \_ -> E.encode E.enum + +instance decodeJsonCalendar :: DecodeJson Calendar where + decodeJson = defer \_ -> D.decode D.enum + +derive instance genericCalendar :: Generic Calendar _ + +instance enumCalendar :: Enum Calendar where + succ = genericSucc + pred = genericPred + +instance boundedCalendar :: Bounded Calendar where + bottom = genericBottom + top = genericTop + +-------------------------------------------------------------------------------- + +_CLDR_MF :: Prism' Calendar Unit +_CLDR_MF = prism' (const CLDR_MF) case _ of + CLDR_MF -> Just unit + _ -> Nothing + +_CLDR_NC :: Prism' Calendar Unit +_CLDR_NC = prism' (const CLDR_NC) case _ of + CLDR_NC -> Just unit + _ -> Nothing + +-------------------------------------------------------------------------------- + +newtype Assertion = NpvAssertionAgainstZeroRiskBond + { zeroRiskInterest :: Number + , expectedNpv :: Number + } + +instance encodeJsonAssertion :: EncodeJson Assertion where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { zeroRiskInterest: E.value :: _ Number + , expectedNpv: E.value :: _ Number + } + ) + +instance decodeJsonAssertion :: DecodeJson Assertion where + decodeJson = defer \_ -> D.decode $ + ( NpvAssertionAgainstZeroRiskBond <$> D.record + "NpvAssertionAgainstZeroRiskBond" + { zeroRiskInterest: D.value :: _ Number + , expectedNpv: D.value :: _ Number + } + ) + +derive instance genericAssertion :: Generic Assertion _ + +derive instance newtypeAssertion :: Newtype Assertion _ + +-------------------------------------------------------------------------------- + +_NpvAssertionAgainstZeroRiskBond :: Iso' Assertion + { zeroRiskInterest :: Number, expectedNpv :: Number } +_NpvAssertionAgainstZeroRiskBond = _Newtype + +-------------------------------------------------------------------------------- + +newtype Assertions = Assertions + { context :: AssertionContext + , assertions :: Array Assertion + } + +instance encodeJsonAssertions :: EncodeJson Assertions where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { context: E.value :: _ AssertionContext + , assertions: E.value :: _ (Array Assertion) + } + ) + +instance decodeJsonAssertions :: DecodeJson Assertions where + decodeJson = defer \_ -> D.decode $ + ( Assertions <$> D.record "Assertions" + { context: D.value :: _ AssertionContext + , assertions: D.value :: _ (Array Assertion) + } + ) + +derive instance genericAssertions :: Generic Assertions _ + +derive instance newtypeAssertions :: Newtype Assertions _ + +-------------------------------------------------------------------------------- + +_Assertions :: Iso' Assertions + { context :: AssertionContext, assertions :: Array Assertion } +_Assertions = _Newtype + +-------------------------------------------------------------------------------- + +newtype AssertionContext = AssertionContext + { rrmoMin :: Number + , rrmoMax :: Number + } + +instance encodeJsonAssertionContext :: EncodeJson AssertionContext where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { rrmoMin: E.value :: _ Number + , rrmoMax: E.value :: _ Number + } + ) + +instance decodeJsonAssertionContext :: DecodeJson AssertionContext where + decodeJson = defer \_ -> D.decode $ + ( AssertionContext <$> D.record "AssertionContext" + { rrmoMin: D.value :: _ Number + , rrmoMax: D.value :: _ Number + } + ) + +derive instance genericAssertionContext :: Generic AssertionContext _ + +derive instance newtypeAssertionContext :: Newtype AssertionContext _ + +-------------------------------------------------------------------------------- + +_AssertionContext :: Iso' AssertionContext + { rrmoMin :: Number, rrmoMax :: Number } +_AssertionContext = _Newtype \ No newline at end of file diff --git a/marlowe-playground-client/generated/Language/Marlowe/ACTUS/Domain/Schedule.purs b/marlowe-playground-client/generated/Language/Marlowe/ACTUS/Domain/Schedule.purs new file mode 100644 index 0000000000..e72c9a20fb --- /dev/null +++ b/marlowe-playground-client/generated/Language/Marlowe/ACTUS/Domain/Schedule.purs @@ -0,0 +1,91 @@ +-- File auto generated by purescript-bridge! -- +module Language.Marlowe.ACTUS.Domain.Schedule where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.BigInt.Argonaut (BigInt) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Tuple.Nested ((/\)) +import Language.Marlowe.ACTUS.Domain.BusinessEvents (EventType) +import Type.Proxy (Proxy(Proxy)) + +newtype CashFlowPoly a = CashFlowPoly + { tick :: BigInt + , cashContractId :: String + , cashParty :: String + , cashCounterParty :: String + , cashPaymentDay :: String + , cashCalculationDay :: String + , cashEvent :: EventType + , amount :: a + , notional :: a + , currency :: String + } + +instance encodeJsonCashFlowPoly :: (EncodeJson a) => EncodeJson (CashFlowPoly a) where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { tick: E.value :: _ BigInt + , cashContractId: E.value :: _ String + , cashParty: E.value :: _ String + , cashCounterParty: E.value :: _ String + , cashPaymentDay: E.value :: _ String + , cashCalculationDay: E.value :: _ String + , cashEvent: E.value :: _ EventType + , amount: E.value :: _ a + , notional: E.value :: _ a + , currency: E.value :: _ String + } + ) + +instance decodeJsonCashFlowPoly :: (DecodeJson a) => DecodeJson (CashFlowPoly a) where + decodeJson = defer \_ -> D.decode $ + ( CashFlowPoly <$> D.record "CashFlowPoly" + { tick: D.value :: _ BigInt + , cashContractId: D.value :: _ String + , cashParty: D.value :: _ String + , cashCounterParty: D.value :: _ String + , cashPaymentDay: D.value :: _ String + , cashCalculationDay: D.value :: _ String + , cashEvent: D.value :: _ EventType + , amount: D.value :: _ a + , notional: D.value :: _ a + , currency: D.value :: _ String + } + ) + +derive instance genericCashFlowPoly :: Generic (CashFlowPoly a) _ + +derive instance newtypeCashFlowPoly :: Newtype (CashFlowPoly a) _ + +-------------------------------------------------------------------------------- + +_CashFlowPoly + :: forall a + . Iso' (CashFlowPoly a) + { tick :: BigInt + , cashContractId :: String + , cashParty :: String + , cashCounterParty :: String + , cashPaymentDay :: String + , cashCalculationDay :: String + , cashEvent :: EventType + , amount :: a + , notional :: a + , currency :: String + } +_CashFlowPoly = _Newtype \ No newline at end of file diff --git a/marlowe-playground-client/generated/Ledger/Blockchain.purs b/marlowe-playground-client/generated/Ledger/Blockchain.purs new file mode 100644 index 0000000000..7c355ca105 --- /dev/null +++ b/marlowe-playground-client/generated/Ledger/Blockchain.purs @@ -0,0 +1,90 @@ +-- File auto generated by purescript-bridge! -- +module Ledger.Blockchain where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Plutus.V1.Ledger.Tx (Tx) +import Type.Proxy (Proxy(Proxy)) + +data OnChainTx + = Invalid Tx + | Valid Tx + +derive instance eqOnChainTx :: Eq OnChainTx + +instance showOnChainTx :: Show OnChainTx where + show a = genericShow a + +instance encodeJsonOnChainTx :: EncodeJson OnChainTx where + encodeJson = defer \_ -> case _ of + Invalid a -> E.encodeTagged "Invalid" a E.value + Valid a -> E.encodeTagged "Valid" a E.value + +instance decodeJsonOnChainTx :: DecodeJson OnChainTx where + decodeJson = defer \_ -> D.decode + $ D.sumType "OnChainTx" + $ Map.fromFoldable + [ "Invalid" /\ D.content (Invalid <$> D.value) + , "Valid" /\ D.content (Valid <$> D.value) + ] + +derive instance genericOnChainTx :: Generic OnChainTx _ + +-------------------------------------------------------------------------------- + +_Invalid :: Prism' OnChainTx Tx +_Invalid = prism' Invalid case _ of + (Invalid a) -> Just a + _ -> Nothing + +_Valid :: Prism' OnChainTx Tx +_Valid = prism' Valid case _ of + (Valid a) -> Just a + _ -> Nothing + +-------------------------------------------------------------------------------- + +newtype BlockId = BlockId { getBlockId :: String } + +derive instance eqBlockId :: Eq BlockId + +derive instance ordBlockId :: Ord BlockId + +instance showBlockId :: Show BlockId where + show a = genericShow a + +instance encodeJsonBlockId :: EncodeJson BlockId where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { getBlockId: E.value :: _ String } + ) + +instance decodeJsonBlockId :: DecodeJson BlockId where + decodeJson = defer \_ -> D.decode $ + (BlockId <$> D.record "BlockId" { getBlockId: D.value :: _ String }) + +derive instance genericBlockId :: Generic BlockId _ + +derive instance newtypeBlockId :: Newtype BlockId _ + +-------------------------------------------------------------------------------- + +_BlockId :: Iso' BlockId { getBlockId :: String } +_BlockId = _Newtype \ No newline at end of file diff --git a/marlowe-playground-client/generated/Ledger/CardanoWallet.purs b/marlowe-playground-client/generated/Ledger/CardanoWallet.purs new file mode 100644 index 0000000000..7b4114e68f --- /dev/null +++ b/marlowe-playground-client/generated/Ledger/CardanoWallet.purs @@ -0,0 +1,52 @@ +-- File auto generated by purescript-bridge! -- +module Ledger.CardanoWallet where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.BigInt.Argonaut (BigInt) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Type.Proxy (Proxy(Proxy)) + +newtype WalletNumber = WalletNumber { getWallet :: BigInt } + +derive instance eqWalletNumber :: Eq WalletNumber + +instance showWalletNumber :: Show WalletNumber where + show a = genericShow a + +instance encodeJsonWalletNumber :: EncodeJson WalletNumber where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { getWallet: E.value :: _ BigInt } + ) + +instance decodeJsonWalletNumber :: DecodeJson WalletNumber where + decodeJson = defer \_ -> D.decode $ + ( WalletNumber <$> D.record "WalletNumber" + { getWallet: D.value :: _ BigInt } + ) + +derive instance genericWalletNumber :: Generic WalletNumber _ + +derive instance newtypeWalletNumber :: Newtype WalletNumber _ + +-------------------------------------------------------------------------------- + +_WalletNumber :: Iso' WalletNumber { getWallet :: BigInt } +_WalletNumber = _Newtype \ No newline at end of file diff --git a/marlowe-playground-client/generated/Ledger/Constraints/OffChain.purs b/marlowe-playground-client/generated/Ledger/Constraints/OffChain.purs new file mode 100644 index 0000000000..f31d7d4bbb --- /dev/null +++ b/marlowe-playground-client/generated/Ledger/Constraints/OffChain.purs @@ -0,0 +1,191 @@ +-- File auto generated by purescript-bridge! -- +module Ledger.Constraints.OffChain where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map (Map) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Ledger.Typed.Tx (ConnectionError) +import Plutus.V1.Ledger.Crypto (PubKey, PubKeyHash) +import Plutus.V1.Ledger.Interval (Interval) +import Plutus.V1.Ledger.Scripts (DatumHash) +import Plutus.V1.Ledger.Time (POSIXTime) +import Plutus.V1.Ledger.Tx (Tx, TxOut, TxOutRef) +import Type.Proxy (Proxy(Proxy)) + +data MkTxError + = TypeCheckFailed ConnectionError + | TxOutRefNotFound TxOutRef + | TxOutRefWrongType TxOutRef + | DatumNotFound DatumHash + | MintingPolicyNotFound String + | ValidatorHashNotFound String + | OwnPubKeyMissing + | TypedValidatorMissing + | DatumWrongHash DatumHash String + | CannotSatisfyAny + +derive instance eqMkTxError :: Eq MkTxError + +instance showMkTxError :: Show MkTxError where + show a = genericShow a + +instance encodeJsonMkTxError :: EncodeJson MkTxError where + encodeJson = defer \_ -> case _ of + TypeCheckFailed a -> E.encodeTagged "TypeCheckFailed" a E.value + TxOutRefNotFound a -> E.encodeTagged "TxOutRefNotFound" a E.value + TxOutRefWrongType a -> E.encodeTagged "TxOutRefWrongType" a E.value + DatumNotFound a -> E.encodeTagged "DatumNotFound" a E.value + MintingPolicyNotFound a -> E.encodeTagged "MintingPolicyNotFound" a E.value + ValidatorHashNotFound a -> E.encodeTagged "ValidatorHashNotFound" a E.value + OwnPubKeyMissing -> encodeJson + { tag: "OwnPubKeyMissing", contents: jsonNull } + TypedValidatorMissing -> encodeJson + { tag: "TypedValidatorMissing", contents: jsonNull } + DatumWrongHash a b -> E.encodeTagged "DatumWrongHash" (a /\ b) + (E.tuple (E.value >/\< E.value)) + CannotSatisfyAny -> encodeJson + { tag: "CannotSatisfyAny", contents: jsonNull } + +instance decodeJsonMkTxError :: DecodeJson MkTxError where + decodeJson = defer \_ -> D.decode + $ D.sumType "MkTxError" + $ Map.fromFoldable + [ "TypeCheckFailed" /\ D.content (TypeCheckFailed <$> D.value) + , "TxOutRefNotFound" /\ D.content (TxOutRefNotFound <$> D.value) + , "TxOutRefWrongType" /\ D.content (TxOutRefWrongType <$> D.value) + , "DatumNotFound" /\ D.content (DatumNotFound <$> D.value) + , "MintingPolicyNotFound" /\ D.content + (MintingPolicyNotFound <$> D.value) + , "ValidatorHashNotFound" /\ D.content + (ValidatorHashNotFound <$> D.value) + , "OwnPubKeyMissing" /\ pure OwnPubKeyMissing + , "TypedValidatorMissing" /\ pure TypedValidatorMissing + , "DatumWrongHash" /\ D.content + (D.tuple $ DatumWrongHash D.value D.value) + , "CannotSatisfyAny" /\ pure CannotSatisfyAny + ] + +derive instance genericMkTxError :: Generic MkTxError _ + +-------------------------------------------------------------------------------- + +_TypeCheckFailed :: Prism' MkTxError ConnectionError +_TypeCheckFailed = prism' TypeCheckFailed case _ of + (TypeCheckFailed a) -> Just a + _ -> Nothing + +_TxOutRefNotFound :: Prism' MkTxError TxOutRef +_TxOutRefNotFound = prism' TxOutRefNotFound case _ of + (TxOutRefNotFound a) -> Just a + _ -> Nothing + +_TxOutRefWrongType :: Prism' MkTxError TxOutRef +_TxOutRefWrongType = prism' TxOutRefWrongType case _ of + (TxOutRefWrongType a) -> Just a + _ -> Nothing + +_DatumNotFound :: Prism' MkTxError DatumHash +_DatumNotFound = prism' DatumNotFound case _ of + (DatumNotFound a) -> Just a + _ -> Nothing + +_MintingPolicyNotFound :: Prism' MkTxError String +_MintingPolicyNotFound = prism' MintingPolicyNotFound case _ of + (MintingPolicyNotFound a) -> Just a + _ -> Nothing + +_ValidatorHashNotFound :: Prism' MkTxError String +_ValidatorHashNotFound = prism' ValidatorHashNotFound case _ of + (ValidatorHashNotFound a) -> Just a + _ -> Nothing + +_OwnPubKeyMissing :: Prism' MkTxError Unit +_OwnPubKeyMissing = prism' (const OwnPubKeyMissing) case _ of + OwnPubKeyMissing -> Just unit + _ -> Nothing + +_TypedValidatorMissing :: Prism' MkTxError Unit +_TypedValidatorMissing = prism' (const TypedValidatorMissing) case _ of + TypedValidatorMissing -> Just unit + _ -> Nothing + +_DatumWrongHash :: Prism' MkTxError { a :: DatumHash, b :: String } +_DatumWrongHash = prism' (\{ a, b } -> (DatumWrongHash a b)) case _ of + (DatumWrongHash a b) -> Just { a, b } + _ -> Nothing + +_CannotSatisfyAny :: Prism' MkTxError Unit +_CannotSatisfyAny = prism' (const CannotSatisfyAny) case _ of + CannotSatisfyAny -> Just unit + _ -> Nothing + +-------------------------------------------------------------------------------- + +newtype UnbalancedTx = UnbalancedTx + { unBalancedTxTx :: Tx + , unBalancedTxRequiredSignatories :: Map PubKeyHash (Maybe PubKey) + , unBalancedTxUtxoIndex :: Map TxOutRef TxOut + , unBalancedTxValidityTimeRange :: Interval POSIXTime + } + +derive instance eqUnbalancedTx :: Eq UnbalancedTx + +instance showUnbalancedTx :: Show UnbalancedTx where + show a = genericShow a + +instance encodeJsonUnbalancedTx :: EncodeJson UnbalancedTx where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { unBalancedTxTx: E.value :: _ Tx + , unBalancedTxRequiredSignatories: + (E.dictionary E.value (E.maybe E.value)) :: _ + (Map PubKeyHash (Maybe PubKey)) + , unBalancedTxUtxoIndex: + (E.dictionary E.value E.value) :: _ (Map TxOutRef TxOut) + , unBalancedTxValidityTimeRange: E.value :: _ (Interval POSIXTime) + } + ) + +instance decodeJsonUnbalancedTx :: DecodeJson UnbalancedTx where + decodeJson = defer \_ -> D.decode $ + ( UnbalancedTx <$> D.record "UnbalancedTx" + { unBalancedTxTx: D.value :: _ Tx + , unBalancedTxRequiredSignatories: + (D.dictionary D.value (D.maybe D.value)) :: _ + (Map PubKeyHash (Maybe PubKey)) + , unBalancedTxUtxoIndex: + (D.dictionary D.value D.value) :: _ (Map TxOutRef TxOut) + , unBalancedTxValidityTimeRange: D.value :: _ (Interval POSIXTime) + } + ) + +derive instance genericUnbalancedTx :: Generic UnbalancedTx _ + +derive instance newtypeUnbalancedTx :: Newtype UnbalancedTx _ + +-------------------------------------------------------------------------------- + +_UnbalancedTx :: Iso' UnbalancedTx + { unBalancedTxTx :: Tx + , unBalancedTxRequiredSignatories :: Map PubKeyHash (Maybe PubKey) + , unBalancedTxUtxoIndex :: Map TxOutRef TxOut + , unBalancedTxValidityTimeRange :: Interval POSIXTime + } +_UnbalancedTx = _Newtype \ No newline at end of file diff --git a/marlowe-playground-client/generated/Ledger/Index.purs b/marlowe-playground-client/generated/Ledger/Index.purs new file mode 100644 index 0000000000..3a1107d585 --- /dev/null +++ b/marlowe-playground-client/generated/Ledger/Index.purs @@ -0,0 +1,349 @@ +-- File auto generated by purescript-bridge! -- +module Ledger.Index where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Bounded.Generic (genericBottom, genericTop) +import Data.Either (Either) +import Data.Enum (class Enum) +import Data.Enum.Generic (genericPred, genericSucc) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map (Map) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.RawJson (RawJson) +import Data.Show.Generic (genericShow) +import Data.Tuple (Tuple) +import Data.Tuple.Nested ((/\)) +import Plutus.V1.Ledger.Crypto (PubKey, PubKeyHash, Signature) +import Plutus.V1.Ledger.Scripts + ( DatumHash + , MintingPolicy + , ScriptError + , Validator + ) +import Plutus.V1.Ledger.Slot (Slot) +import Plutus.V1.Ledger.Tx (RedeemerPtr, Tx, TxIn, TxOut, TxOutRef) +import Plutus.V1.Ledger.Value (Value) +import Type.Proxy (Proxy(Proxy)) + +newtype UtxoIndex = UtxoIndex { getIndex :: Map TxOutRef TxOut } + +derive instance eqUtxoIndex :: Eq UtxoIndex + +instance showUtxoIndex :: Show UtxoIndex where + show a = genericShow a + +instance encodeJsonUtxoIndex :: EncodeJson UtxoIndex where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { getIndex: (E.dictionary E.value E.value) :: _ (Map TxOutRef TxOut) } + ) + +instance decodeJsonUtxoIndex :: DecodeJson UtxoIndex where + decodeJson = defer \_ -> D.decode $ + ( UtxoIndex <$> D.record "UtxoIndex" + { getIndex: (D.dictionary D.value D.value) :: _ (Map TxOutRef TxOut) } + ) + +derive instance genericUtxoIndex :: Generic UtxoIndex _ + +derive instance newtypeUtxoIndex :: Newtype UtxoIndex _ + +-------------------------------------------------------------------------------- + +_UtxoIndex :: Iso' UtxoIndex { getIndex :: Map TxOutRef TxOut } +_UtxoIndex = _Newtype + +-------------------------------------------------------------------------------- + +data ValidationError + = InOutTypeMismatch TxIn TxOut + | TxOutRefNotFound TxOutRef + | InvalidScriptHash Validator String + | InvalidDatumHash String DatumHash + | MissingRedeemer RedeemerPtr + | InvalidSignature PubKey Signature + | ValueNotPreserved Value Value + | NegativeValue Tx + | NonAdaFees Tx + | ScriptFailure ScriptError + | CurrentSlotOutOfRange Slot + | SignatureMissing PubKeyHash + | MintWithoutScript String + | TransactionFeeTooLow Value Value + +derive instance eqValidationError :: Eq ValidationError + +instance showValidationError :: Show ValidationError where + show a = genericShow a + +instance encodeJsonValidationError :: EncodeJson ValidationError where + encodeJson = defer \_ -> case _ of + InOutTypeMismatch a b -> E.encodeTagged "InOutTypeMismatch" (a /\ b) + (E.tuple (E.value >/\< E.value)) + TxOutRefNotFound a -> E.encodeTagged "TxOutRefNotFound" a E.value + InvalidScriptHash a b -> E.encodeTagged "InvalidScriptHash" (a /\ b) + (E.tuple (E.value >/\< E.value)) + InvalidDatumHash a b -> E.encodeTagged "InvalidDatumHash" (a /\ b) + (E.tuple (E.value >/\< E.value)) + MissingRedeemer a -> E.encodeTagged "MissingRedeemer" a E.value + InvalidSignature a b -> E.encodeTagged "InvalidSignature" (a /\ b) + (E.tuple (E.value >/\< E.value)) + ValueNotPreserved a b -> E.encodeTagged "ValueNotPreserved" (a /\ b) + (E.tuple (E.value >/\< E.value)) + NegativeValue a -> E.encodeTagged "NegativeValue" a E.value + NonAdaFees a -> E.encodeTagged "NonAdaFees" a E.value + ScriptFailure a -> E.encodeTagged "ScriptFailure" a E.value + CurrentSlotOutOfRange a -> E.encodeTagged "CurrentSlotOutOfRange" a E.value + SignatureMissing a -> E.encodeTagged "SignatureMissing" a E.value + MintWithoutScript a -> E.encodeTagged "MintWithoutScript" a E.value + TransactionFeeTooLow a b -> E.encodeTagged "TransactionFeeTooLow" (a /\ b) + (E.tuple (E.value >/\< E.value)) + +instance decodeJsonValidationError :: DecodeJson ValidationError where + decodeJson = defer \_ -> D.decode + $ D.sumType "ValidationError" + $ Map.fromFoldable + [ "InOutTypeMismatch" /\ D.content + (D.tuple $ InOutTypeMismatch D.value D.value) + , "TxOutRefNotFound" /\ D.content (TxOutRefNotFound <$> D.value) + , "InvalidScriptHash" /\ D.content + (D.tuple $ InvalidScriptHash D.value D.value) + , "InvalidDatumHash" /\ D.content + (D.tuple $ InvalidDatumHash D.value D.value) + , "MissingRedeemer" /\ D.content (MissingRedeemer <$> D.value) + , "InvalidSignature" /\ D.content + (D.tuple $ InvalidSignature D.value D.value) + , "ValueNotPreserved" /\ D.content + (D.tuple $ ValueNotPreserved D.value D.value) + , "NegativeValue" /\ D.content (NegativeValue <$> D.value) + , "NonAdaFees" /\ D.content (NonAdaFees <$> D.value) + , "ScriptFailure" /\ D.content (ScriptFailure <$> D.value) + , "CurrentSlotOutOfRange" /\ D.content + (CurrentSlotOutOfRange <$> D.value) + , "SignatureMissing" /\ D.content (SignatureMissing <$> D.value) + , "MintWithoutScript" /\ D.content (MintWithoutScript <$> D.value) + , "TransactionFeeTooLow" /\ D.content + (D.tuple $ TransactionFeeTooLow D.value D.value) + ] + +derive instance genericValidationError :: Generic ValidationError _ + +-------------------------------------------------------------------------------- + +_InOutTypeMismatch :: Prism' ValidationError { a :: TxIn, b :: TxOut } +_InOutTypeMismatch = prism' (\{ a, b } -> (InOutTypeMismatch a b)) case _ of + (InOutTypeMismatch a b) -> Just { a, b } + _ -> Nothing + +_TxOutRefNotFound :: Prism' ValidationError TxOutRef +_TxOutRefNotFound = prism' TxOutRefNotFound case _ of + (TxOutRefNotFound a) -> Just a + _ -> Nothing + +_InvalidScriptHash :: Prism' ValidationError { a :: Validator, b :: String } +_InvalidScriptHash = prism' (\{ a, b } -> (InvalidScriptHash a b)) case _ of + (InvalidScriptHash a b) -> Just { a, b } + _ -> Nothing + +_InvalidDatumHash :: Prism' ValidationError { a :: String, b :: DatumHash } +_InvalidDatumHash = prism' (\{ a, b } -> (InvalidDatumHash a b)) case _ of + (InvalidDatumHash a b) -> Just { a, b } + _ -> Nothing + +_MissingRedeemer :: Prism' ValidationError RedeemerPtr +_MissingRedeemer = prism' MissingRedeemer case _ of + (MissingRedeemer a) -> Just a + _ -> Nothing + +_InvalidSignature :: Prism' ValidationError { a :: PubKey, b :: Signature } +_InvalidSignature = prism' (\{ a, b } -> (InvalidSignature a b)) case _ of + (InvalidSignature a b) -> Just { a, b } + _ -> Nothing + +_ValueNotPreserved :: Prism' ValidationError { a :: Value, b :: Value } +_ValueNotPreserved = prism' (\{ a, b } -> (ValueNotPreserved a b)) case _ of + (ValueNotPreserved a b) -> Just { a, b } + _ -> Nothing + +_NegativeValue :: Prism' ValidationError Tx +_NegativeValue = prism' NegativeValue case _ of + (NegativeValue a) -> Just a + _ -> Nothing + +_NonAdaFees :: Prism' ValidationError Tx +_NonAdaFees = prism' NonAdaFees case _ of + (NonAdaFees a) -> Just a + _ -> Nothing + +_ScriptFailure :: Prism' ValidationError ScriptError +_ScriptFailure = prism' ScriptFailure case _ of + (ScriptFailure a) -> Just a + _ -> Nothing + +_CurrentSlotOutOfRange :: Prism' ValidationError Slot +_CurrentSlotOutOfRange = prism' CurrentSlotOutOfRange case _ of + (CurrentSlotOutOfRange a) -> Just a + _ -> Nothing + +_SignatureMissing :: Prism' ValidationError PubKeyHash +_SignatureMissing = prism' SignatureMissing case _ of + (SignatureMissing a) -> Just a + _ -> Nothing + +_MintWithoutScript :: Prism' ValidationError String +_MintWithoutScript = prism' MintWithoutScript case _ of + (MintWithoutScript a) -> Just a + _ -> Nothing + +_TransactionFeeTooLow :: Prism' ValidationError { a :: Value, b :: Value } +_TransactionFeeTooLow = prism' (\{ a, b } -> (TransactionFeeTooLow a b)) + case _ of + (TransactionFeeTooLow a b) -> Just { a, b } + _ -> Nothing + +-------------------------------------------------------------------------------- + +data ValidationPhase + = Phase1 + | Phase2 + +derive instance eqValidationPhase :: Eq ValidationPhase + +derive instance ordValidationPhase :: Ord ValidationPhase + +instance showValidationPhase :: Show ValidationPhase where + show a = genericShow a + +instance encodeJsonValidationPhase :: EncodeJson ValidationPhase where + encodeJson = defer \_ -> E.encode E.enum + +instance decodeJsonValidationPhase :: DecodeJson ValidationPhase where + decodeJson = defer \_ -> D.decode D.enum + +derive instance genericValidationPhase :: Generic ValidationPhase _ + +instance enumValidationPhase :: Enum ValidationPhase where + succ = genericSucc + pred = genericPred + +instance boundedValidationPhase :: Bounded ValidationPhase where + bottom = genericBottom + top = genericTop + +-------------------------------------------------------------------------------- + +_Phase1 :: Prism' ValidationPhase Unit +_Phase1 = prism' (const Phase1) case _ of + Phase1 -> Just unit + _ -> Nothing + +_Phase2 :: Prism' ValidationPhase Unit +_Phase2 = prism' (const Phase2) case _ of + Phase2 -> Just unit + _ -> Nothing + +-------------------------------------------------------------------------------- + +newtype ScriptValidationEvent = ScriptValidationEvent + { sveScript :: String + , sveResult :: Either ScriptError (Tuple RawJson (Array String)) + , sveRedeemer :: String + , sveType :: ScriptType + } + +derive instance eqScriptValidationEvent :: Eq ScriptValidationEvent + +instance showScriptValidationEvent :: Show ScriptValidationEvent where + show a = genericShow a + +instance encodeJsonScriptValidationEvent :: EncodeJson ScriptValidationEvent where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { sveScript: E.value :: _ String + , sveResult: + (E.either E.value (E.tuple (E.value >/\< E.value))) :: _ + (Either ScriptError (Tuple RawJson (Array String))) + , sveRedeemer: E.value :: _ String + , sveType: E.value :: _ ScriptType + } + ) + +instance decodeJsonScriptValidationEvent :: DecodeJson ScriptValidationEvent where + decodeJson = defer \_ -> D.decode $ + ( ScriptValidationEvent <$> D.record "ScriptValidationEvent" + { sveScript: D.value :: _ String + , sveResult: + (D.either D.value (D.tuple (D.value D.value))) :: _ + (Either ScriptError (Tuple RawJson (Array String))) + , sveRedeemer: D.value :: _ String + , sveType: D.value :: _ ScriptType + } + ) + +derive instance genericScriptValidationEvent :: Generic ScriptValidationEvent _ + +derive instance newtypeScriptValidationEvent :: Newtype ScriptValidationEvent _ + +-------------------------------------------------------------------------------- + +_ScriptValidationEvent :: Iso' ScriptValidationEvent + { sveScript :: String + , sveResult :: Either ScriptError (Tuple RawJson (Array String)) + , sveRedeemer :: String + , sveType :: ScriptType + } +_ScriptValidationEvent = _Newtype + +-------------------------------------------------------------------------------- + +data ScriptType + = ValidatorScript Validator String + | MintingPolicyScript MintingPolicy + +derive instance eqScriptType :: Eq ScriptType + +instance showScriptType :: Show ScriptType where + show a = genericShow a + +instance encodeJsonScriptType :: EncodeJson ScriptType where + encodeJson = defer \_ -> case _ of + ValidatorScript a b -> E.encodeTagged "ValidatorScript" (a /\ b) + (E.tuple (E.value >/\< E.value)) + MintingPolicyScript a -> E.encodeTagged "MintingPolicyScript" a E.value + +instance decodeJsonScriptType :: DecodeJson ScriptType where + decodeJson = defer \_ -> D.decode + $ D.sumType "ScriptType" + $ Map.fromFoldable + [ "ValidatorScript" /\ D.content + (D.tuple $ ValidatorScript D.value D.value) + , "MintingPolicyScript" /\ D.content (MintingPolicyScript <$> D.value) + ] + +derive instance genericScriptType :: Generic ScriptType _ + +-------------------------------------------------------------------------------- + +_ValidatorScript :: Prism' ScriptType { a :: Validator, b :: String } +_ValidatorScript = prism' (\{ a, b } -> (ValidatorScript a b)) case _ of + (ValidatorScript a b) -> Just { a, b } + _ -> Nothing + +_MintingPolicyScript :: Prism' ScriptType MintingPolicy +_MintingPolicyScript = prism' MintingPolicyScript case _ of + (MintingPolicyScript a) -> Just a + _ -> Nothing \ No newline at end of file diff --git a/marlowe-playground-client/generated/Ledger/TimeSlot.purs b/marlowe-playground-client/generated/Ledger/TimeSlot.purs new file mode 100644 index 0000000000..9ee43b4bd4 --- /dev/null +++ b/marlowe-playground-client/generated/Ledger/TimeSlot.purs @@ -0,0 +1,101 @@ +-- File auto generated by purescript-bridge! -- +module Ledger.TimeSlot where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.BigInt.Argonaut (BigInt) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple (Tuple) +import Data.Tuple.Nested ((/\)) +import Plutus.V1.Ledger.Slot (Slot) +import Plutus.V1.Ledger.Time (POSIXTime) +import Type.Proxy (Proxy(Proxy)) + +newtype SlotConfig = SlotConfig + { scSlotLength :: BigInt + , scSlotZeroTime :: POSIXTime + } + +derive instance eqSlotConfig :: Eq SlotConfig + +instance showSlotConfig :: Show SlotConfig where + show a = genericShow a + +instance encodeJsonSlotConfig :: EncodeJson SlotConfig where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { scSlotLength: E.value :: _ BigInt + , scSlotZeroTime: E.value :: _ POSIXTime + } + ) + +instance decodeJsonSlotConfig :: DecodeJson SlotConfig where + decodeJson = defer \_ -> D.decode $ + ( SlotConfig <$> D.record "SlotConfig" + { scSlotLength: D.value :: _ BigInt + , scSlotZeroTime: D.value :: _ POSIXTime + } + ) + +derive instance genericSlotConfig :: Generic SlotConfig _ + +derive instance newtypeSlotConfig :: Newtype SlotConfig _ + +-------------------------------------------------------------------------------- + +_SlotConfig :: Iso' SlotConfig + { scSlotLength :: BigInt, scSlotZeroTime :: POSIXTime } +_SlotConfig = _Newtype + +-------------------------------------------------------------------------------- + +newtype SlotConversionError = SlotOutOfRange + { requestedSlot :: Slot + , horizon :: Tuple Slot POSIXTime + } + +derive instance eqSlotConversionError :: Eq SlotConversionError + +instance showSlotConversionError :: Show SlotConversionError where + show a = genericShow a + +instance encodeJsonSlotConversionError :: EncodeJson SlotConversionError where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { requestedSlot: E.value :: _ Slot + , horizon: (E.tuple (E.value >/\< E.value)) :: _ (Tuple Slot POSIXTime) + } + ) + +instance decodeJsonSlotConversionError :: DecodeJson SlotConversionError where + decodeJson = defer \_ -> D.decode $ + ( SlotOutOfRange <$> D.record "SlotOutOfRange" + { requestedSlot: D.value :: _ Slot + , horizon: (D.tuple (D.value D.value)) :: _ (Tuple Slot POSIXTime) + } + ) + +derive instance genericSlotConversionError :: Generic SlotConversionError _ + +derive instance newtypeSlotConversionError :: Newtype SlotConversionError _ + +-------------------------------------------------------------------------------- + +_SlotOutOfRange :: Iso' SlotConversionError + { requestedSlot :: Slot, horizon :: Tuple Slot POSIXTime } +_SlotOutOfRange = _Newtype \ No newline at end of file diff --git a/marlowe-playground-client/generated/Ledger/Tx.purs b/marlowe-playground-client/generated/Ledger/Tx.purs new file mode 100644 index 0000000000..3c94c37735 --- /dev/null +++ b/marlowe-playground-client/generated/Ledger/Tx.purs @@ -0,0 +1,104 @@ +-- File auto generated by purescript-bridge! -- +module Ledger.Tx where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Either (Either) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Plutus.V1.Ledger.Address (Address) +import Plutus.V1.Ledger.Scripts (DatumHash, Validator) +import Plutus.V1.Ledger.Value (Value) +import Type.Proxy (Proxy(Proxy)) + +data ChainIndexTxOut + = PublicKeyChainIndexTxOut + { _ciTxOutAddress :: Address + , _ciTxOutValue :: Value + } + | ScriptChainIndexTxOut + { _ciTxOutAddress :: Address + , _ciTxOutValidator :: Either String Validator + , _ciTxOutDatum :: Either DatumHash String + , _ciTxOutValue :: Value + } + +derive instance eqChainIndexTxOut :: Eq ChainIndexTxOut + +instance showChainIndexTxOut :: Show ChainIndexTxOut where + show a = genericShow a + +instance encodeJsonChainIndexTxOut :: EncodeJson ChainIndexTxOut where + encodeJson = defer \_ -> case _ of + PublicKeyChainIndexTxOut { _ciTxOutAddress, _ciTxOutValue } -> encodeJson + { tag: "PublicKeyChainIndexTxOut" + , _ciTxOutAddress: flip E.encode _ciTxOutAddress E.value + , _ciTxOutValue: flip E.encode _ciTxOutValue E.value + } + ScriptChainIndexTxOut + { _ciTxOutAddress, _ciTxOutValidator, _ciTxOutDatum, _ciTxOutValue } -> + encodeJson + { tag: "ScriptChainIndexTxOut" + , _ciTxOutAddress: flip E.encode _ciTxOutAddress E.value + , _ciTxOutValidator: flip E.encode _ciTxOutValidator + (E.either E.value E.value) + , _ciTxOutDatum: flip E.encode _ciTxOutDatum (E.either E.value E.value) + , _ciTxOutValue: flip E.encode _ciTxOutValue E.value + } + +instance decodeJsonChainIndexTxOut :: DecodeJson ChainIndexTxOut where + decodeJson = defer \_ -> D.decode + $ D.sumType "ChainIndexTxOut" + $ Map.fromFoldable + [ "PublicKeyChainIndexTxOut" /\ + ( PublicKeyChainIndexTxOut <$> D.object "PublicKeyChainIndexTxOut" + { _ciTxOutAddress: D.value :: _ Address + , _ciTxOutValue: D.value :: _ Value + } + ) + , "ScriptChainIndexTxOut" /\ + ( ScriptChainIndexTxOut <$> D.object "ScriptChainIndexTxOut" + { _ciTxOutAddress: D.value :: _ Address + , _ciTxOutValidator: + (D.either D.value D.value) :: _ (Either String Validator) + , _ciTxOutDatum: + (D.either D.value D.value) :: _ (Either DatumHash String) + , _ciTxOutValue: D.value :: _ Value + } + ) + ] + +derive instance genericChainIndexTxOut :: Generic ChainIndexTxOut _ + +-------------------------------------------------------------------------------- + +_PublicKeyChainIndexTxOut :: Prism' ChainIndexTxOut + { _ciTxOutAddress :: Address, _ciTxOutValue :: Value } +_PublicKeyChainIndexTxOut = prism' PublicKeyChainIndexTxOut case _ of + (PublicKeyChainIndexTxOut a) -> Just a + _ -> Nothing + +_ScriptChainIndexTxOut :: Prism' ChainIndexTxOut + { _ciTxOutAddress :: Address + , _ciTxOutValidator :: Either String Validator + , _ciTxOutDatum :: Either DatumHash String + , _ciTxOutValue :: Value + } +_ScriptChainIndexTxOut = prism' ScriptChainIndexTxOut case _ of + (ScriptChainIndexTxOut a) -> Just a + _ -> Nothing \ No newline at end of file diff --git a/marlowe-playground-client/generated/Ledger/Tx/CardanoAPI.purs b/marlowe-playground-client/generated/Ledger/Tx/CardanoAPI.purs new file mode 100644 index 0000000000..4a878b5cb0 --- /dev/null +++ b/marlowe-playground-client/generated/Ledger/Tx/CardanoAPI.purs @@ -0,0 +1,199 @@ +-- File auto generated by purescript-bridge! -- +module Ledger.Tx.CardanoAPI where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Bounded.Generic (genericBottom, genericTop) +import Data.Enum (class Enum) +import Data.Enum.Generic (genericPred, genericSucc) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Plutus.V1.Ledger.Tx (ScriptTag) +import Type.Proxy (Proxy(Proxy)) + +data FromCardanoError = SimpleScriptsNotSupported + +derive instance eqFromCardanoError :: Eq FromCardanoError + +derive instance ordFromCardanoError :: Ord FromCardanoError + +instance showFromCardanoError :: Show FromCardanoError where + show a = genericShow a + +instance encodeJsonFromCardanoError :: EncodeJson FromCardanoError where + encodeJson = defer \_ -> E.encode E.enum + +instance decodeJsonFromCardanoError :: DecodeJson FromCardanoError where + decodeJson = defer \_ -> D.decode D.enum + +derive instance genericFromCardanoError :: Generic FromCardanoError _ + +instance enumFromCardanoError :: Enum FromCardanoError where + succ = genericSucc + pred = genericPred + +instance boundedFromCardanoError :: Bounded FromCardanoError where + bottom = genericBottom + top = genericTop + +-------------------------------------------------------------------------------- + +_SimpleScriptsNotSupported :: Iso' FromCardanoError Unit +_SimpleScriptsNotSupported = iso (const unit) (const SimpleScriptsNotSupported) + +-------------------------------------------------------------------------------- + +data ToCardanoError + = TxBodyError String + | DeserialisationError + | InvalidValidityRange + | ValueNotPureAda + | OutputHasZeroAda + | StakingPointersNotSupported + | SimpleScriptsNotSupportedToCardano + | MissingTxInType + | MissingMintingPolicyRedeemer + | MissingMintingPolicy + | ScriptPurposeNotSupported ScriptTag + | PublicKeyInputsNotSupported + | Tag String ToCardanoError + +derive instance eqToCardanoError :: Eq ToCardanoError + +instance showToCardanoError :: Show ToCardanoError where + show a = genericShow a + +instance encodeJsonToCardanoError :: EncodeJson ToCardanoError where + encodeJson = defer \_ -> case _ of + TxBodyError a -> E.encodeTagged "TxBodyError" a E.value + DeserialisationError -> encodeJson + { tag: "DeserialisationError", contents: jsonNull } + InvalidValidityRange -> encodeJson + { tag: "InvalidValidityRange", contents: jsonNull } + ValueNotPureAda -> encodeJson { tag: "ValueNotPureAda", contents: jsonNull } + OutputHasZeroAda -> encodeJson + { tag: "OutputHasZeroAda", contents: jsonNull } + StakingPointersNotSupported -> encodeJson + { tag: "StakingPointersNotSupported", contents: jsonNull } + SimpleScriptsNotSupportedToCardano -> encodeJson + { tag: "SimpleScriptsNotSupportedToCardano", contents: jsonNull } + MissingTxInType -> encodeJson { tag: "MissingTxInType", contents: jsonNull } + MissingMintingPolicyRedeemer -> encodeJson + { tag: "MissingMintingPolicyRedeemer", contents: jsonNull } + MissingMintingPolicy -> encodeJson + { tag: "MissingMintingPolicy", contents: jsonNull } + ScriptPurposeNotSupported a -> E.encodeTagged "ScriptPurposeNotSupported" a + E.value + PublicKeyInputsNotSupported -> encodeJson + { tag: "PublicKeyInputsNotSupported", contents: jsonNull } + Tag a b -> E.encodeTagged "Tag" (a /\ b) (E.tuple (E.value >/\< E.value)) + +instance decodeJsonToCardanoError :: DecodeJson ToCardanoError where + decodeJson = defer \_ -> D.decode + $ D.sumType "ToCardanoError" + $ Map.fromFoldable + [ "TxBodyError" /\ D.content (TxBodyError <$> D.value) + , "DeserialisationError" /\ pure DeserialisationError + , "InvalidValidityRange" /\ pure InvalidValidityRange + , "ValueNotPureAda" /\ pure ValueNotPureAda + , "OutputHasZeroAda" /\ pure OutputHasZeroAda + , "StakingPointersNotSupported" /\ pure StakingPointersNotSupported + , "SimpleScriptsNotSupportedToCardano" /\ pure + SimpleScriptsNotSupportedToCardano + , "MissingTxInType" /\ pure MissingTxInType + , "MissingMintingPolicyRedeemer" /\ pure MissingMintingPolicyRedeemer + , "MissingMintingPolicy" /\ pure MissingMintingPolicy + , "ScriptPurposeNotSupported" /\ D.content + (ScriptPurposeNotSupported <$> D.value) + , "PublicKeyInputsNotSupported" /\ pure PublicKeyInputsNotSupported + , "Tag" /\ D.content (D.tuple $ Tag D.value D.value) + ] + +derive instance genericToCardanoError :: Generic ToCardanoError _ + +-------------------------------------------------------------------------------- + +_TxBodyError :: Prism' ToCardanoError String +_TxBodyError = prism' TxBodyError case _ of + (TxBodyError a) -> Just a + _ -> Nothing + +_DeserialisationError :: Prism' ToCardanoError Unit +_DeserialisationError = prism' (const DeserialisationError) case _ of + DeserialisationError -> Just unit + _ -> Nothing + +_InvalidValidityRange :: Prism' ToCardanoError Unit +_InvalidValidityRange = prism' (const InvalidValidityRange) case _ of + InvalidValidityRange -> Just unit + _ -> Nothing + +_ValueNotPureAda :: Prism' ToCardanoError Unit +_ValueNotPureAda = prism' (const ValueNotPureAda) case _ of + ValueNotPureAda -> Just unit + _ -> Nothing + +_OutputHasZeroAda :: Prism' ToCardanoError Unit +_OutputHasZeroAda = prism' (const OutputHasZeroAda) case _ of + OutputHasZeroAda -> Just unit + _ -> Nothing + +_StakingPointersNotSupported :: Prism' ToCardanoError Unit +_StakingPointersNotSupported = prism' (const StakingPointersNotSupported) + case _ of + StakingPointersNotSupported -> Just unit + _ -> Nothing + +_SimpleScriptsNotSupportedToCardano :: Prism' ToCardanoError Unit +_SimpleScriptsNotSupportedToCardano = prism' + (const SimpleScriptsNotSupportedToCardano) + case _ of + SimpleScriptsNotSupportedToCardano -> Just unit + _ -> Nothing + +_MissingTxInType :: Prism' ToCardanoError Unit +_MissingTxInType = prism' (const MissingTxInType) case _ of + MissingTxInType -> Just unit + _ -> Nothing + +_MissingMintingPolicyRedeemer :: Prism' ToCardanoError Unit +_MissingMintingPolicyRedeemer = prism' (const MissingMintingPolicyRedeemer) + case _ of + MissingMintingPolicyRedeemer -> Just unit + _ -> Nothing + +_MissingMintingPolicy :: Prism' ToCardanoError Unit +_MissingMintingPolicy = prism' (const MissingMintingPolicy) case _ of + MissingMintingPolicy -> Just unit + _ -> Nothing + +_ScriptPurposeNotSupported :: Prism' ToCardanoError ScriptTag +_ScriptPurposeNotSupported = prism' ScriptPurposeNotSupported case _ of + (ScriptPurposeNotSupported a) -> Just a + _ -> Nothing + +_PublicKeyInputsNotSupported :: Prism' ToCardanoError Unit +_PublicKeyInputsNotSupported = prism' (const PublicKeyInputsNotSupported) + case _ of + PublicKeyInputsNotSupported -> Just unit + _ -> Nothing + +_Tag :: Prism' ToCardanoError { a :: String, b :: ToCardanoError } +_Tag = prism' (\{ a, b } -> (Tag a b)) case _ of + (Tag a b) -> Just { a, b } + _ -> Nothing \ No newline at end of file diff --git a/marlowe-playground-client/generated/Ledger/Typed/Tx.purs b/marlowe-playground-client/generated/Ledger/Typed/Tx.purs new file mode 100644 index 0000000000..4ddf754035 --- /dev/null +++ b/marlowe-playground-client/generated/Ledger/Typed/Tx.purs @@ -0,0 +1,166 @@ +-- File auto generated by purescript-bridge! -- +module Ledger.Typed.Tx where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Bounded.Generic (genericBottom, genericTop) +import Data.Enum (class Enum) +import Data.Enum.Generic (genericPred, genericSucc) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Plutus.V1.Ledger.Address (Address) +import Plutus.V1.Ledger.Scripts (DatumHash) +import Plutus.V1.Ledger.Tx (TxInType, TxOutRef) +import Type.Proxy (Proxy(Proxy)) + +data ConnectionError + = WrongValidatorAddress Address Address + | WrongOutType WrongOutTypeError + | WrongInType TxInType + | MissingInType + | WrongValidatorType String + | WrongRedeemerType String + | WrongDatumType String + | NoDatum TxOutRef DatumHash + | UnknownRef + +derive instance eqConnectionError :: Eq ConnectionError + +instance showConnectionError :: Show ConnectionError where + show a = genericShow a + +instance encodeJsonConnectionError :: EncodeJson ConnectionError where + encodeJson = defer \_ -> case _ of + WrongValidatorAddress a b -> E.encodeTagged "WrongValidatorAddress" (a /\ b) + (E.tuple (E.value >/\< E.value)) + WrongOutType a -> E.encodeTagged "WrongOutType" a E.value + WrongInType a -> E.encodeTagged "WrongInType" a E.value + MissingInType -> encodeJson { tag: "MissingInType", contents: jsonNull } + WrongValidatorType a -> E.encodeTagged "WrongValidatorType" a E.value + WrongRedeemerType a -> E.encodeTagged "WrongRedeemerType" a E.value + WrongDatumType a -> E.encodeTagged "WrongDatumType" a E.value + NoDatum a b -> E.encodeTagged "NoDatum" (a /\ b) + (E.tuple (E.value >/\< E.value)) + UnknownRef -> encodeJson { tag: "UnknownRef", contents: jsonNull } + +instance decodeJsonConnectionError :: DecodeJson ConnectionError where + decodeJson = defer \_ -> D.decode + $ D.sumType "ConnectionError" + $ Map.fromFoldable + [ "WrongValidatorAddress" /\ D.content + (D.tuple $ WrongValidatorAddress D.value D.value) + , "WrongOutType" /\ D.content (WrongOutType <$> D.value) + , "WrongInType" /\ D.content (WrongInType <$> D.value) + , "MissingInType" /\ pure MissingInType + , "WrongValidatorType" /\ D.content (WrongValidatorType <$> D.value) + , "WrongRedeemerType" /\ D.content (WrongRedeemerType <$> D.value) + , "WrongDatumType" /\ D.content (WrongDatumType <$> D.value) + , "NoDatum" /\ D.content (D.tuple $ NoDatum D.value D.value) + , "UnknownRef" /\ pure UnknownRef + ] + +derive instance genericConnectionError :: Generic ConnectionError _ + +-------------------------------------------------------------------------------- + +_WrongValidatorAddress :: Prism' ConnectionError { a :: Address, b :: Address } +_WrongValidatorAddress = prism' (\{ a, b } -> (WrongValidatorAddress a b)) + case _ of + (WrongValidatorAddress a b) -> Just { a, b } + _ -> Nothing + +_WrongOutType :: Prism' ConnectionError WrongOutTypeError +_WrongOutType = prism' WrongOutType case _ of + (WrongOutType a) -> Just a + _ -> Nothing + +_WrongInType :: Prism' ConnectionError TxInType +_WrongInType = prism' WrongInType case _ of + (WrongInType a) -> Just a + _ -> Nothing + +_MissingInType :: Prism' ConnectionError Unit +_MissingInType = prism' (const MissingInType) case _ of + MissingInType -> Just unit + _ -> Nothing + +_WrongValidatorType :: Prism' ConnectionError String +_WrongValidatorType = prism' WrongValidatorType case _ of + (WrongValidatorType a) -> Just a + _ -> Nothing + +_WrongRedeemerType :: Prism' ConnectionError String +_WrongRedeemerType = prism' WrongRedeemerType case _ of + (WrongRedeemerType a) -> Just a + _ -> Nothing + +_WrongDatumType :: Prism' ConnectionError String +_WrongDatumType = prism' WrongDatumType case _ of + (WrongDatumType a) -> Just a + _ -> Nothing + +_NoDatum :: Prism' ConnectionError { a :: TxOutRef, b :: DatumHash } +_NoDatum = prism' (\{ a, b } -> (NoDatum a b)) case _ of + (NoDatum a b) -> Just { a, b } + _ -> Nothing + +_UnknownRef :: Prism' ConnectionError Unit +_UnknownRef = prism' (const UnknownRef) case _ of + UnknownRef -> Just unit + _ -> Nothing + +-------------------------------------------------------------------------------- + +data WrongOutTypeError + = ExpectedScriptGotPubkey + | ExpectedPubkeyGotScript + +derive instance eqWrongOutTypeError :: Eq WrongOutTypeError + +derive instance ordWrongOutTypeError :: Ord WrongOutTypeError + +instance showWrongOutTypeError :: Show WrongOutTypeError where + show a = genericShow a + +instance encodeJsonWrongOutTypeError :: EncodeJson WrongOutTypeError where + encodeJson = defer \_ -> E.encode E.enum + +instance decodeJsonWrongOutTypeError :: DecodeJson WrongOutTypeError where + decodeJson = defer \_ -> D.decode D.enum + +derive instance genericWrongOutTypeError :: Generic WrongOutTypeError _ + +instance enumWrongOutTypeError :: Enum WrongOutTypeError where + succ = genericSucc + pred = genericPred + +instance boundedWrongOutTypeError :: Bounded WrongOutTypeError where + bottom = genericBottom + top = genericTop + +-------------------------------------------------------------------------------- + +_ExpectedScriptGotPubkey :: Prism' WrongOutTypeError Unit +_ExpectedScriptGotPubkey = prism' (const ExpectedScriptGotPubkey) case _ of + ExpectedScriptGotPubkey -> Just unit + _ -> Nothing + +_ExpectedPubkeyGotScript :: Prism' WrongOutTypeError Unit +_ExpectedPubkeyGotScript = prism' (const ExpectedPubkeyGotScript) case _ of + ExpectedPubkeyGotScript -> Just unit + _ -> Nothing \ No newline at end of file diff --git a/marlowe-playground-client/generated/Marlowe.js b/marlowe-playground-client/generated/Marlowe.js new file mode 100644 index 0000000000..c0dcec34c3 --- /dev/null +++ b/marlowe-playground-client/generated/Marlowe.js @@ -0,0 +1,3 @@ +"use strict"; + +exports.encodeURIComponent = encodeURIComponent; diff --git a/marlowe-playground-client/generated/Marlowe.purs b/marlowe-playground-client/generated/Marlowe.purs new file mode 100644 index 0000000000..4818544921 --- /dev/null +++ b/marlowe-playground-client/generated/Marlowe.purs @@ -0,0 +1,811 @@ +-- File auto generated by servant-purescript! -- +module Marlowe where + +import Prelude + +import Affjax (defaultRequest, request) +import Affjax.RequestBody (json) as Request +import Affjax.RequestHeader (RequestHeader(..)) +import Affjax.ResponseFormat (json) as Response +import Auth (AuthStatus) +import Control.Monad.Error.Class (class MonadError, throwError) +import Control.Monad.Reader.Class (class MonadAsk, asks) +import Data.Argonaut.Decode (decodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Array (fromFoldable, null) +import Data.Either (Either(..)) +import Data.HTTP.Method (Method(..)) +import Data.Maybe (Maybe(..)) +import Data.Newtype (unwrap) +import Data.RawJson (RawJson) +import Data.String (joinWith) +import Effect.Aff.Class (class MonadAff, liftAff) +import Gist (Gist, GistId, NewGist) +import Language.Haskell.Interpreter (InterpreterError, InterpreterResult) +import Language.Marlowe.ACTUS.Domain.ContractTerms (ContractTermsPoly) +import Language.Marlowe.ACTUS.Domain.Schedule (CashFlowPoly) +import Marlowe.Symbolic.Types.Request (Request) +import Marlowe.Symbolic.Types.Response (Response) +import Servant.PureScript + ( class ToURLPiece + , AjaxError + , ErrorDescription(..) + , toURLPiece + ) +import Webghc.Server (CompileRequest) + +foreign import encodeURIComponent :: String -> String + +type SPSettings_ + = + { baseURL :: String + } + +class HasSPSettings a where + spSettings :: a -> SPSettings_ + +getApiOracleByExchangeByPair + :: forall env m + . HasSPSettings env + => MonadAsk env m + => MonadError AjaxError m + => MonadAff m + => String + -> String + -> m RawJson +getApiOracleByExchangeByPair exchange pair = do + spSettings <- asks spSettings + let baseURL = spSettings.baseURL + let httpMethod = Left GET + let + encodeQueryItem :: forall a. ToURLPiece a => String -> a -> String + encodeQueryItem name val = name <> "=" <> toURLPiece val + let + queryArgs :: Array String + queryArgs = + [] + let + queryString = if null queryArgs then "" else "?" <> (joinWith "&" queryArgs) + let + reqURL = + baseURL + <> "api" + <> "/" + <> "oracle" + <> "/" + <> encodeURIComponent (toURLPiece exchange) + <> "/" + <> encodeURIComponent (toURLPiece pair) + <> queryString + let + reqHeaders = + [ + ] + let + affReq = + defaultRequest + { method = httpMethod + , url = reqURL + , headers = defaultRequest.headers <> reqHeaders + , responseFormat = Response.json + } + let + decoder = + D.value + result <- liftAff $ request affReq + response <- case result of + Left err -> throwError $ + { request: affReq, description: ConnectingError err } + Right r -> pure r + when (unwrap response.status < 200 || unwrap response.status >= 299) + $ throwError + $ { request: affReq, description: UnexpectedHTTPStatus response } + case D.decode decoder response.body of + Left err -> throwError $ { request: affReq, description: DecodingError err } + Right body -> pure body + +postApiActusGenerate + :: forall env m + . HasSPSettings env + => MonadAsk env m + => MonadError AjaxError m + => MonadAff m + => ContractTermsPoly Number + -> m String +postApiActusGenerate reqBody = do + spSettings <- asks spSettings + let baseURL = spSettings.baseURL + let httpMethod = Left POST + let + encodeQueryItem :: forall a. ToURLPiece a => String -> a -> String + encodeQueryItem name val = name <> "=" <> toURLPiece val + let + queryArgs :: Array String + queryArgs = + [] + let + queryString = if null queryArgs then "" else "?" <> (joinWith "&" queryArgs) + let + reqURL = + baseURL + <> "api" + <> "/" + <> "actus" + <> "/" + <> "generate" + <> queryString + let + reqHeaders = + [ + ] + let + affReq = + defaultRequest + { method = httpMethod + , url = reqURL + , headers = defaultRequest.headers <> reqHeaders + , responseFormat = Response.json + , content = Just + $ Request.json + $ flip E.encode reqBody + $ E.value + } + let + decoder = + D.value + result <- liftAff $ request affReq + response <- case result of + Left err -> throwError $ + { request: affReq, description: ConnectingError err } + Right r -> pure r + when (unwrap response.status < 200 || unwrap response.status >= 299) + $ throwError + $ { request: affReq, description: UnexpectedHTTPStatus response } + case D.decode decoder response.body of + Left err -> throwError $ { request: affReq, description: DecodingError err } + Right body -> pure body + +postApiActusGeneratestatic + :: forall env m + . HasSPSettings env + => MonadAsk env m + => MonadError AjaxError m + => MonadAff m + => ContractTermsPoly Number + -> m String +postApiActusGeneratestatic reqBody = do + spSettings <- asks spSettings + let baseURL = spSettings.baseURL + let httpMethod = Left POST + let + encodeQueryItem :: forall a. ToURLPiece a => String -> a -> String + encodeQueryItem name val = name <> "=" <> toURLPiece val + let + queryArgs :: Array String + queryArgs = + [] + let + queryString = if null queryArgs then "" else "?" <> (joinWith "&" queryArgs) + let + reqURL = + baseURL + <> "api" + <> "/" + <> "actus" + <> "/" + <> "generate-static" + <> queryString + let + reqHeaders = + [ + ] + let + affReq = + defaultRequest + { method = httpMethod + , url = reqURL + , headers = defaultRequest.headers <> reqHeaders + , responseFormat = Response.json + , content = Just + $ Request.json + $ flip E.encode reqBody + $ E.value + } + let + decoder = + D.value + result <- liftAff $ request affReq + response <- case result of + Left err -> throwError $ + { request: affReq, description: ConnectingError err } + Right r -> pure r + when (unwrap response.status < 200 || unwrap response.status >= 299) + $ throwError + $ { request: affReq, description: UnexpectedHTTPStatus response } + case D.decode decoder response.body of + Left err -> throwError $ { request: affReq, description: DecodingError err } + Right body -> pure body + +postApiActusCashflows + :: forall env m + . HasSPSettings env + => MonadAsk env m + => MonadError AjaxError m + => MonadAff m + => ContractTermsPoly Number + -> m (Array (CashFlowPoly Number)) +postApiActusCashflows reqBody = do + spSettings <- asks spSettings + let baseURL = spSettings.baseURL + let httpMethod = Left POST + let + encodeQueryItem :: forall a. ToURLPiece a => String -> a -> String + encodeQueryItem name val = name <> "=" <> toURLPiece val + let + queryArgs :: Array String + queryArgs = + [] + let + queryString = if null queryArgs then "" else "?" <> (joinWith "&" queryArgs) + let + reqURL = + baseURL + <> "api" + <> "/" + <> "actus" + <> "/" + <> "cashflows" + <> queryString + let + reqHeaders = + [ + ] + let + affReq = + defaultRequest + { method = httpMethod + , url = reqURL + , headers = defaultRequest.headers <> reqHeaders + , responseFormat = Response.json + , content = Just + $ Request.json + $ flip E.encode reqBody + $ E.value + } + let + decoder = + D.value + result <- liftAff $ request affReq + response <- case result of + Left err -> throwError $ + { request: affReq, description: ConnectingError err } + Right r -> pure r + when (unwrap response.status < 200 || unwrap response.status >= 299) + $ throwError + $ { request: affReq, description: UnexpectedHTTPStatus response } + case D.decode decoder response.body of + Left err -> throwError $ { request: affReq, description: DecodingError err } + Right body -> pure body + +postApiCompile + :: forall env m + . HasSPSettings env + => MonadAsk env m + => MonadError AjaxError m + => MonadAff m + => CompileRequest + -> m (Either InterpreterError (InterpreterResult String)) +postApiCompile reqBody = do + spSettings <- asks spSettings + let baseURL = spSettings.baseURL + let httpMethod = Left POST + let + encodeQueryItem :: forall a. ToURLPiece a => String -> a -> String + encodeQueryItem name val = name <> "=" <> toURLPiece val + let + queryArgs :: Array String + queryArgs = + [] + let + queryString = if null queryArgs then "" else "?" <> (joinWith "&" queryArgs) + let + reqURL = + baseURL + <> "api" + <> "/" + <> "compile" + <> queryString + let + reqHeaders = + [ + ] + let + affReq = + defaultRequest + { method = httpMethod + , url = reqURL + , headers = defaultRequest.headers <> reqHeaders + , responseFormat = Response.json + , content = Just + $ Request.json + $ flip E.encode reqBody + $ E.value + } + let + decoder = + (D.either D.value D.value) + result <- liftAff $ request affReq + response <- case result of + Left err -> throwError $ + { request: affReq, description: ConnectingError err } + Right r -> pure r + when (unwrap response.status < 200 || unwrap response.status >= 299) + $ throwError + $ { request: affReq, description: UnexpectedHTTPStatus response } + case D.decode decoder response.body of + Left err -> throwError $ { request: affReq, description: DecodingError err } + Right body -> pure body + +getApiOauthStatus + :: forall env m + . HasSPSettings env + => MonadAsk env m + => MonadError AjaxError m + => MonadAff m + => m AuthStatus +getApiOauthStatus = do + spSettings <- asks spSettings + let baseURL = spSettings.baseURL + let httpMethod = Left GET + let + encodeQueryItem :: forall a. ToURLPiece a => String -> a -> String + encodeQueryItem name val = name <> "=" <> toURLPiece val + let + queryArgs :: Array String + queryArgs = + [] + let + queryString = if null queryArgs then "" else "?" <> (joinWith "&" queryArgs) + let + reqURL = + baseURL + <> "api" + <> "/" + <> "oauth" + <> "/" + <> "status" + <> queryString + let + reqHeaders = + [ + ] + let + affReq = + defaultRequest + { method = httpMethod + , url = reqURL + , headers = defaultRequest.headers <> reqHeaders + , responseFormat = Response.json + } + let + decoder = + D.value + result <- liftAff $ request affReq + response <- case result of + Left err -> throwError $ + { request: affReq, description: ConnectingError err } + Right r -> pure r + when (unwrap response.status < 200 || unwrap response.status >= 299) + $ throwError + $ { request: affReq, description: UnexpectedHTTPStatus response } + case D.decode decoder response.body of + Left err -> throwError $ { request: affReq, description: DecodingError err } + Right body -> pure body + +getApiOauthGithub + :: forall env m + . HasSPSettings env + => MonadAsk env m + => MonadError AjaxError m + => MonadAff m + => m Unit +getApiOauthGithub = do + spSettings <- asks spSettings + let baseURL = spSettings.baseURL + let httpMethod = Left GET + let + encodeQueryItem :: forall a. ToURLPiece a => String -> a -> String + encodeQueryItem name val = name <> "=" <> toURLPiece val + let + queryArgs :: Array String + queryArgs = + [] + let + queryString = if null queryArgs then "" else "?" <> (joinWith "&" queryArgs) + let + reqURL = + baseURL + <> "api" + <> "/" + <> "oauth" + <> "/" + <> "github" + <> queryString + let + reqHeaders = + [ + ] + let + affReq = + defaultRequest + { method = httpMethod + , url = reqURL + , headers = defaultRequest.headers <> reqHeaders + , responseFormat = Response.json + } + let + decoder = + D.unit + result <- liftAff $ request affReq + response <- case result of + Left err -> throwError $ + { request: affReq, description: ConnectingError err } + Right r -> pure r + when (unwrap response.status < 200 || unwrap response.status >= 299) + $ throwError + $ { request: affReq, description: UnexpectedHTTPStatus response } + case D.decode decoder response.body of + Left err -> throwError $ { request: affReq, description: DecodingError err } + Right body -> pure body + +getApiGists + :: forall env m + . HasSPSettings env + => MonadAsk env m + => MonadError AjaxError m + => MonadAff m + => m (Array Gist) +getApiGists = do + spSettings <- asks spSettings + let baseURL = spSettings.baseURL + let httpMethod = Left GET + let + encodeQueryItem :: forall a. ToURLPiece a => String -> a -> String + encodeQueryItem name val = name <> "=" <> toURLPiece val + let + queryArgs :: Array String + queryArgs = + [] + let + queryString = if null queryArgs then "" else "?" <> (joinWith "&" queryArgs) + let + reqURL = + baseURL + <> "api" + <> "/" + <> "gists" + <> queryString + let + reqHeaders = + [ + ] + let + affReq = + defaultRequest + { method = httpMethod + , url = reqURL + , headers = defaultRequest.headers <> reqHeaders + , responseFormat = Response.json + } + let + decoder = + D.value + result <- liftAff $ request affReq + response <- case result of + Left err -> throwError $ + { request: affReq, description: ConnectingError err } + Right r -> pure r + when (unwrap response.status < 200 || unwrap response.status >= 299) + $ throwError + $ { request: affReq, description: UnexpectedHTTPStatus response } + case D.decode decoder response.body of + Left err -> throwError $ { request: affReq, description: DecodingError err } + Right body -> pure body + +postApiGists + :: forall env m + . HasSPSettings env + => MonadAsk env m + => MonadError AjaxError m + => MonadAff m + => NewGist + -> m Gist +postApiGists reqBody = do + spSettings <- asks spSettings + let baseURL = spSettings.baseURL + let httpMethod = Left POST + let + encodeQueryItem :: forall a. ToURLPiece a => String -> a -> String + encodeQueryItem name val = name <> "=" <> toURLPiece val + let + queryArgs :: Array String + queryArgs = + [] + let + queryString = if null queryArgs then "" else "?" <> (joinWith "&" queryArgs) + let + reqURL = + baseURL + <> "api" + <> "/" + <> "gists" + <> queryString + let + reqHeaders = + [ + ] + let + affReq = + defaultRequest + { method = httpMethod + , url = reqURL + , headers = defaultRequest.headers <> reqHeaders + , responseFormat = Response.json + , content = Just + $ Request.json + $ flip E.encode reqBody + $ E.value + } + let + decoder = + D.value + result <- liftAff $ request affReq + response <- case result of + Left err -> throwError $ + { request: affReq, description: ConnectingError err } + Right r -> pure r + when (unwrap response.status < 200 || unwrap response.status >= 299) + $ throwError + $ { request: affReq, description: UnexpectedHTTPStatus response } + case D.decode decoder response.body of + Left err -> throwError $ { request: affReq, description: DecodingError err } + Right body -> pure body + +getApiGistsByGistId + :: forall env m + . HasSPSettings env + => MonadAsk env m + => MonadError AjaxError m + => MonadAff m + => GistId + -> m Gist +getApiGistsByGistId gistId = do + spSettings <- asks spSettings + let baseURL = spSettings.baseURL + let httpMethod = Left GET + let + encodeQueryItem :: forall a. ToURLPiece a => String -> a -> String + encodeQueryItem name val = name <> "=" <> toURLPiece val + let + queryArgs :: Array String + queryArgs = + [] + let + queryString = if null queryArgs then "" else "?" <> (joinWith "&" queryArgs) + let + reqURL = + baseURL + <> "api" + <> "/" + <> "gists" + <> "/" + <> encodeURIComponent (toURLPiece gistId) + <> queryString + let + reqHeaders = + [ + ] + let + affReq = + defaultRequest + { method = httpMethod + , url = reqURL + , headers = defaultRequest.headers <> reqHeaders + , responseFormat = Response.json + } + let + decoder = + D.value + result <- liftAff $ request affReq + response <- case result of + Left err -> throwError $ + { request: affReq, description: ConnectingError err } + Right r -> pure r + when (unwrap response.status < 200 || unwrap response.status >= 299) + $ throwError + $ { request: affReq, description: UnexpectedHTTPStatus response } + case D.decode decoder response.body of + Left err -> throwError $ { request: affReq, description: DecodingError err } + Right body -> pure body + +postApiGistsByGistId + :: forall env m + . HasSPSettings env + => MonadAsk env m + => MonadError AjaxError m + => MonadAff m + => NewGist + -> GistId + -> m Gist +postApiGistsByGistId reqBody gistId = do + spSettings <- asks spSettings + let baseURL = spSettings.baseURL + let httpMethod = Left POST + let + encodeQueryItem :: forall a. ToURLPiece a => String -> a -> String + encodeQueryItem name val = name <> "=" <> toURLPiece val + let + queryArgs :: Array String + queryArgs = + [] + let + queryString = if null queryArgs then "" else "?" <> (joinWith "&" queryArgs) + let + reqURL = + baseURL + <> "api" + <> "/" + <> "gists" + <> "/" + <> encodeURIComponent (toURLPiece gistId) + <> queryString + let + reqHeaders = + [ + ] + let + affReq = + defaultRequest + { method = httpMethod + , url = reqURL + , headers = defaultRequest.headers <> reqHeaders + , responseFormat = Response.json + , content = Just + $ Request.json + $ flip E.encode reqBody + $ E.value + } + let + decoder = + D.value + result <- liftAff $ request affReq + response <- case result of + Left err -> throwError $ + { request: affReq, description: ConnectingError err } + Right r -> pure r + when (unwrap response.status < 200 || unwrap response.status >= 299) + $ throwError + $ { request: affReq, description: UnexpectedHTTPStatus response } + case D.decode decoder response.body of + Left err -> throwError $ { request: affReq, description: DecodingError err } + Right body -> pure body + +postApiMarloweanalysis + :: forall env m + . HasSPSettings env + => MonadAsk env m + => MonadError AjaxError m + => MonadAff m + => Request + -> m Response +postApiMarloweanalysis reqBody = do + spSettings <- asks spSettings + let baseURL = spSettings.baseURL + let httpMethod = Left POST + let + encodeQueryItem :: forall a. ToURLPiece a => String -> a -> String + encodeQueryItem name val = name <> "=" <> toURLPiece val + let + queryArgs :: Array String + queryArgs = + [] + let + queryString = if null queryArgs then "" else "?" <> (joinWith "&" queryArgs) + let + reqURL = + baseURL + <> "api" + <> "/" + <> "marlowe-analysis" + <> queryString + let + reqHeaders = + [ + ] + let + affReq = + defaultRequest + { method = httpMethod + , url = reqURL + , headers = defaultRequest.headers <> reqHeaders + , responseFormat = Response.json + , content = Just + $ Request.json + $ flip E.encode reqBody + $ E.value + } + let + decoder = + D.value + result <- liftAff $ request affReq + response <- case result of + Left err -> throwError $ + { request: affReq, description: ConnectingError err } + Right r -> pure r + when (unwrap response.status < 200 || unwrap response.status >= 299) + $ throwError + $ { request: affReq, description: UnexpectedHTTPStatus response } + case D.decode decoder response.body of + Left err -> throwError $ { request: affReq, description: DecodingError err } + Right body -> pure body + +postRunghc + :: forall env m + . HasSPSettings env + => MonadAsk env m + => MonadError AjaxError m + => MonadAff m + => CompileRequest + -> m (Either InterpreterError (InterpreterResult String)) +postRunghc reqBody = do + spSettings <- asks spSettings + let baseURL = spSettings.baseURL + let httpMethod = Left POST + let + encodeQueryItem :: forall a. ToURLPiece a => String -> a -> String + encodeQueryItem name val = name <> "=" <> toURLPiece val + let + queryArgs :: Array String + queryArgs = + [] + let + queryString = if null queryArgs then "" else "?" <> (joinWith "&" queryArgs) + let + reqURL = + baseURL + <> "runghc" + <> queryString + let + reqHeaders = + [ + ] + let + affReq = + defaultRequest + { method = httpMethod + , url = reqURL + , headers = defaultRequest.headers <> reqHeaders + , responseFormat = Response.json + , content = Just + $ Request.json + $ flip E.encode reqBody + $ E.value + } + let + decoder = + (D.either D.value D.value) + result <- liftAff $ request affReq + response <- case result of + Left err -> throwError $ + { request: affReq, description: ConnectingError err } + Right r -> pure r + when (unwrap response.status < 200 || unwrap response.status >= 299) + $ throwError + $ { request: affReq, description: UnexpectedHTTPStatus response } + case D.decode decoder response.body of + Left err -> throwError $ { request: affReq, description: DecodingError err } + Right body -> pure body diff --git a/marlowe-playground-client/generated/Marlowe/Symbolic/Types/Request.purs b/marlowe-playground-client/generated/Marlowe/Symbolic/Types/Request.purs new file mode 100644 index 0000000000..7ad8bac458 --- /dev/null +++ b/marlowe-playground-client/generated/Marlowe/Symbolic/Types/Request.purs @@ -0,0 +1,57 @@ +-- File auto generated by purescript-bridge! -- +module Marlowe.Symbolic.Types.Request where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Tuple.Nested ((/\)) +import Marlowe.Semantics (Contract, State) +import Type.Proxy (Proxy(Proxy)) + +newtype Request = Request + { onlyAssertions :: Boolean + , contract :: Contract + , state :: State + } + +instance encodeJsonRequest :: EncodeJson Request where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { onlyAssertions: E.value :: _ Boolean + , contract: E.value :: _ Contract + , state: E.value :: _ State + } + ) + +instance decodeJsonRequest :: DecodeJson Request where + decodeJson = defer \_ -> D.decode $ + ( Request <$> D.record "Request" + { onlyAssertions: D.value :: _ Boolean + , contract: D.value :: _ Contract + , state: D.value :: _ State + } + ) + +derive instance genericRequest :: Generic Request _ + +derive instance newtypeRequest :: Newtype Request _ + +-------------------------------------------------------------------------------- + +_Request :: Iso' Request + { onlyAssertions :: Boolean, contract :: Contract, state :: State } +_Request = _Newtype \ No newline at end of file diff --git a/marlowe-playground-client/generated/Marlowe/Symbolic/Types/Response.purs b/marlowe-playground-client/generated/Marlowe/Symbolic/Types/Response.purs new file mode 100644 index 0000000000..671f48093d --- /dev/null +++ b/marlowe-playground-client/generated/Marlowe/Symbolic/Types/Response.purs @@ -0,0 +1,122 @@ +-- File auto generated by purescript-bridge! -- +module Marlowe.Symbolic.Types.Response where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.BigInt.Argonaut (BigInt) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Marlowe.Semantics (TransactionInput, TransactionWarning) +import Type.Proxy (Proxy(Proxy)) + +newtype Response = Response + { result :: Result + , durationMs :: BigInt + } + +instance showResponse :: Show Response where + show a = genericShow a + +instance encodeJsonResponse :: EncodeJson Response where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { result: E.value :: _ Result + , durationMs: E.value :: _ BigInt + } + ) + +instance decodeJsonResponse :: DecodeJson Response where + decodeJson = defer \_ -> D.decode $ + ( Response <$> D.record "Response" + { result: D.value :: _ Result + , durationMs: D.value :: _ BigInt + } + ) + +derive instance genericResponse :: Generic Response _ + +derive instance newtypeResponse :: Newtype Response _ + +-------------------------------------------------------------------------------- + +_Response :: Iso' Response { result :: Result, durationMs :: BigInt } +_Response = _Newtype + +-------------------------------------------------------------------------------- + +data Result + = Valid + | CounterExample + { initialSlot :: BigInt + , transactionList :: Array TransactionInput + , transactionWarning :: Array TransactionWarning + } + | Error String + +instance showResult :: Show Result where + show a = genericShow a + +instance encodeJsonResult :: EncodeJson Result where + encodeJson = defer \_ -> case _ of + Valid -> encodeJson { tag: "Valid", contents: jsonNull } + CounterExample { initialSlot, transactionList, transactionWarning } -> + encodeJson + { tag: "CounterExample" + , initialSlot: flip E.encode initialSlot E.value + , transactionList: flip E.encode transactionList E.value + , transactionWarning: flip E.encode transactionWarning E.value + } + Error a -> E.encodeTagged "Error" a E.value + +instance decodeJsonResult :: DecodeJson Result where + decodeJson = defer \_ -> D.decode + $ D.sumType "Result" + $ Map.fromFoldable + [ "Valid" /\ pure Valid + , "CounterExample" /\ + ( CounterExample <$> D.object "CounterExample" + { initialSlot: D.value :: _ BigInt + , transactionList: D.value :: _ (Array TransactionInput) + , transactionWarning: D.value :: _ (Array TransactionWarning) + } + ) + , "Error" /\ D.content (Error <$> D.value) + ] + +derive instance genericResult :: Generic Result _ + +-------------------------------------------------------------------------------- + +_Valid :: Prism' Result Unit +_Valid = prism' (const Valid) case _ of + Valid -> Just unit + _ -> Nothing + +_CounterExample :: Prism' Result + { initialSlot :: BigInt + , transactionList :: Array TransactionInput + , transactionWarning :: Array TransactionWarning + } +_CounterExample = prism' CounterExample case _ of + (CounterExample a) -> Just a + _ -> Nothing + +_Error :: Prism' Result String +_Error = prism' Error case _ of + (Error a) -> Just a + _ -> Nothing \ No newline at end of file diff --git a/marlowe-playground-client/generated/Playground/Types.purs b/marlowe-playground-client/generated/Playground/Types.purs new file mode 100644 index 0000000000..cb0da7998b --- /dev/null +++ b/marlowe-playground-client/generated/Playground/Types.purs @@ -0,0 +1,216 @@ +-- File auto generated by purescript-bridge! -- +module Playground.Types where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.BigInt.Argonaut (BigInt) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.List.Types (NonEmptyList) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Ledger.CardanoWallet (WalletNumber) +import Plutus.V1.Ledger.Slot (Slot) +import Plutus.V1.Ledger.Value (TokenName, Value) +import Type.Proxy (Proxy(Proxy)) +import Wallet.Types (EndpointDescription) + +newtype FunctionSchema a = FunctionSchema + { endpointDescription :: EndpointDescription + , argument :: a + } + +derive instance functorFunctionSchema :: Functor FunctionSchema + +instance showFunctionSchema :: (Show a) => Show (FunctionSchema a) where + show a = genericShow a + +derive instance eqFunctionSchema :: (Eq a) => Eq (FunctionSchema a) + +instance encodeJsonFunctionSchema :: + ( EncodeJson a + ) => + EncodeJson (FunctionSchema a) where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { endpointDescription: E.value :: _ EndpointDescription + , argument: E.value :: _ a + } + ) + +instance decodeJsonFunctionSchema :: + ( DecodeJson a + ) => + DecodeJson (FunctionSchema a) where + decodeJson = defer \_ -> D.decode $ + ( FunctionSchema <$> D.record "FunctionSchema" + { endpointDescription: D.value :: _ EndpointDescription + , argument: D.value :: _ a + } + ) + +derive instance genericFunctionSchema :: Generic (FunctionSchema a) _ + +derive instance newtypeFunctionSchema :: Newtype (FunctionSchema a) _ + +-------------------------------------------------------------------------------- + +_FunctionSchema + :: forall a + . Iso' (FunctionSchema a) + { endpointDescription :: EndpointDescription, argument :: a } +_FunctionSchema = _Newtype + +-------------------------------------------------------------------------------- + +newtype KnownCurrency = KnownCurrency + { hash :: String + , friendlyName :: String + , knownTokens :: NonEmptyList TokenName + } + +instance showKnownCurrency :: Show KnownCurrency where + show a = genericShow a + +derive instance eqKnownCurrency :: Eq KnownCurrency + +instance encodeJsonKnownCurrency :: EncodeJson KnownCurrency where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { hash: E.value :: _ String + , friendlyName: E.value :: _ String + , knownTokens: E.value :: _ (NonEmptyList TokenName) + } + ) + +instance decodeJsonKnownCurrency :: DecodeJson KnownCurrency where + decodeJson = defer \_ -> D.decode $ + ( KnownCurrency <$> D.record "KnownCurrency" + { hash: D.value :: _ String + , friendlyName: D.value :: _ String + , knownTokens: D.value :: _ (NonEmptyList TokenName) + } + ) + +derive instance genericKnownCurrency :: Generic KnownCurrency _ + +derive instance newtypeKnownCurrency :: Newtype KnownCurrency _ + +-------------------------------------------------------------------------------- + +_KnownCurrency :: Iso' KnownCurrency + { hash :: String + , friendlyName :: String + , knownTokens :: NonEmptyList TokenName + } +_KnownCurrency = _Newtype + +-------------------------------------------------------------------------------- + +data ContractCall a + = CallEndpoint + { caller :: WalletNumber + , argumentValues :: FunctionSchema a + } + | AddBlocks { blocks :: BigInt } + | AddBlocksUntil { slot :: Slot } + | PayToWallet + { sender :: WalletNumber + , recipient :: WalletNumber + , amount :: Value + } + +instance showContractCall :: (Show a) => Show (ContractCall a) where + show a = genericShow a + +derive instance eqContractCall :: (Eq a) => Eq (ContractCall a) + +instance encodeJsonContractCall :: (EncodeJson a) => EncodeJson (ContractCall a) where + encodeJson = defer \_ -> case _ of + CallEndpoint { caller, argumentValues } -> encodeJson + { tag: "CallEndpoint" + , caller: flip E.encode caller E.value + , argumentValues: flip E.encode argumentValues E.value + } + AddBlocks { blocks } -> encodeJson + { tag: "AddBlocks" + , blocks: flip E.encode blocks E.value + } + AddBlocksUntil { slot } -> encodeJson + { tag: "AddBlocksUntil" + , slot: flip E.encode slot E.value + } + PayToWallet { sender, recipient, amount } -> encodeJson + { tag: "PayToWallet" + , sender: flip E.encode sender E.value + , recipient: flip E.encode recipient E.value + , amount: flip E.encode amount E.value + } + +instance decodeJsonContractCall :: (DecodeJson a) => DecodeJson (ContractCall a) where + decodeJson = defer \_ -> D.decode + $ D.sumType "ContractCall" + $ Map.fromFoldable + [ "CallEndpoint" /\ + ( CallEndpoint <$> D.object "CallEndpoint" + { caller: D.value :: _ WalletNumber + , argumentValues: D.value :: _ (FunctionSchema a) + } + ) + , "AddBlocks" /\ + (AddBlocks <$> D.object "AddBlocks" { blocks: D.value :: _ BigInt }) + , "AddBlocksUntil" /\ + ( AddBlocksUntil <$> D.object "AddBlocksUntil" + { slot: D.value :: _ Slot } + ) + , "PayToWallet" /\ + ( PayToWallet <$> D.object "PayToWallet" + { sender: D.value :: _ WalletNumber + , recipient: D.value :: _ WalletNumber + , amount: D.value :: _ Value + } + ) + ] + +derive instance genericContractCall :: Generic (ContractCall a) _ + +-------------------------------------------------------------------------------- + +_CallEndpoint + :: forall a + . Prism' (ContractCall a) + { caller :: WalletNumber, argumentValues :: FunctionSchema a } +_CallEndpoint = prism' CallEndpoint case _ of + (CallEndpoint a) -> Just a + _ -> Nothing + +_AddBlocks :: forall a. Prism' (ContractCall a) { blocks :: BigInt } +_AddBlocks = prism' AddBlocks case _ of + (AddBlocks a) -> Just a + _ -> Nothing + +_AddBlocksUntil :: forall a. Prism' (ContractCall a) { slot :: Slot } +_AddBlocksUntil = prism' AddBlocksUntil case _ of + (AddBlocksUntil a) -> Just a + _ -> Nothing + +_PayToWallet + :: forall a + . Prism' (ContractCall a) + { sender :: WalletNumber, recipient :: WalletNumber, amount :: Value } +_PayToWallet = prism' PayToWallet case _ of + (PayToWallet a) -> Just a + _ -> Nothing \ No newline at end of file diff --git a/marlowe-playground-client/generated/Plutus/ChainIndex/ChainIndexError.purs b/marlowe-playground-client/generated/Plutus/ChainIndex/ChainIndexError.purs new file mode 100644 index 0000000000..ad4e441d41 --- /dev/null +++ b/marlowe-playground-client/generated/Plutus/ChainIndex/ChainIndexError.purs @@ -0,0 +1,183 @@ +-- File auto generated by purescript-bridge! -- +module Plutus.ChainIndex.ChainIndexError where + +import Prelude + +import Control.Lazy (defer) +import Control.Monad.Freer.Extras.Beam (BeamError) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Plutus.ChainIndex.Types (Point, Tip) +import Type.Proxy (Proxy(Proxy)) + +data ChainIndexError + = InsertionFailed InsertUtxoFailed + | RollbackFailed RollbackFailed + | ResumeNotSupported + | QueryFailedNoTip + | BeamEffectError BeamError + +derive instance eqChainIndexError :: Eq ChainIndexError + +instance showChainIndexError :: Show ChainIndexError where + show a = genericShow a + +instance encodeJsonChainIndexError :: EncodeJson ChainIndexError where + encodeJson = defer \_ -> case _ of + InsertionFailed a -> E.encodeTagged "InsertionFailed" a E.value + RollbackFailed a -> E.encodeTagged "RollbackFailed" a E.value + ResumeNotSupported -> encodeJson + { tag: "ResumeNotSupported", contents: jsonNull } + QueryFailedNoTip -> encodeJson + { tag: "QueryFailedNoTip", contents: jsonNull } + BeamEffectError a -> E.encodeTagged "BeamEffectError" a E.value + +instance decodeJsonChainIndexError :: DecodeJson ChainIndexError where + decodeJson = defer \_ -> D.decode + $ D.sumType "ChainIndexError" + $ Map.fromFoldable + [ "InsertionFailed" /\ D.content (InsertionFailed <$> D.value) + , "RollbackFailed" /\ D.content (RollbackFailed <$> D.value) + , "ResumeNotSupported" /\ pure ResumeNotSupported + , "QueryFailedNoTip" /\ pure QueryFailedNoTip + , "BeamEffectError" /\ D.content (BeamEffectError <$> D.value) + ] + +derive instance genericChainIndexError :: Generic ChainIndexError _ + +-------------------------------------------------------------------------------- + +_InsertionFailed :: Prism' ChainIndexError InsertUtxoFailed +_InsertionFailed = prism' InsertionFailed case _ of + (InsertionFailed a) -> Just a + _ -> Nothing + +_RollbackFailed :: Prism' ChainIndexError RollbackFailed +_RollbackFailed = prism' RollbackFailed case _ of + (RollbackFailed a) -> Just a + _ -> Nothing + +_ResumeNotSupported :: Prism' ChainIndexError Unit +_ResumeNotSupported = prism' (const ResumeNotSupported) case _ of + ResumeNotSupported -> Just unit + _ -> Nothing + +_QueryFailedNoTip :: Prism' ChainIndexError Unit +_QueryFailedNoTip = prism' (const QueryFailedNoTip) case _ of + QueryFailedNoTip -> Just unit + _ -> Nothing + +_BeamEffectError :: Prism' ChainIndexError BeamError +_BeamEffectError = prism' BeamEffectError case _ of + (BeamEffectError a) -> Just a + _ -> Nothing + +-------------------------------------------------------------------------------- + +data InsertUtxoFailed + = DuplicateBlock Tip + | InsertUtxoNoTip + +derive instance eqInsertUtxoFailed :: Eq InsertUtxoFailed + +instance showInsertUtxoFailed :: Show InsertUtxoFailed where + show a = genericShow a + +instance encodeJsonInsertUtxoFailed :: EncodeJson InsertUtxoFailed where + encodeJson = defer \_ -> case _ of + DuplicateBlock a -> E.encodeTagged "DuplicateBlock" a E.value + InsertUtxoNoTip -> encodeJson { tag: "InsertUtxoNoTip", contents: jsonNull } + +instance decodeJsonInsertUtxoFailed :: DecodeJson InsertUtxoFailed where + decodeJson = defer \_ -> D.decode + $ D.sumType "InsertUtxoFailed" + $ Map.fromFoldable + [ "DuplicateBlock" /\ D.content (DuplicateBlock <$> D.value) + , "InsertUtxoNoTip" /\ pure InsertUtxoNoTip + ] + +derive instance genericInsertUtxoFailed :: Generic InsertUtxoFailed _ + +-------------------------------------------------------------------------------- + +_DuplicateBlock :: Prism' InsertUtxoFailed Tip +_DuplicateBlock = prism' DuplicateBlock case _ of + (DuplicateBlock a) -> Just a + _ -> Nothing + +_InsertUtxoNoTip :: Prism' InsertUtxoFailed Unit +_InsertUtxoNoTip = prism' (const InsertUtxoNoTip) case _ of + InsertUtxoNoTip -> Just unit + _ -> Nothing + +-------------------------------------------------------------------------------- + +data RollbackFailed + = RollbackNoTip + | TipMismatch + { foundTip :: Tip + , targetPoint :: Point + } + | OldPointNotFound Point + +derive instance eqRollbackFailed :: Eq RollbackFailed + +instance showRollbackFailed :: Show RollbackFailed where + show a = genericShow a + +instance encodeJsonRollbackFailed :: EncodeJson RollbackFailed where + encodeJson = defer \_ -> case _ of + RollbackNoTip -> encodeJson { tag: "RollbackNoTip", contents: jsonNull } + TipMismatch { foundTip, targetPoint } -> encodeJson + { tag: "TipMismatch" + , foundTip: flip E.encode foundTip E.value + , targetPoint: flip E.encode targetPoint E.value + } + OldPointNotFound a -> E.encodeTagged "OldPointNotFound" a E.value + +instance decodeJsonRollbackFailed :: DecodeJson RollbackFailed where + decodeJson = defer \_ -> D.decode + $ D.sumType "RollbackFailed" + $ Map.fromFoldable + [ "RollbackNoTip" /\ pure RollbackNoTip + , "TipMismatch" /\ + ( TipMismatch <$> D.object "TipMismatch" + { foundTip: D.value :: _ Tip + , targetPoint: D.value :: _ Point + } + ) + , "OldPointNotFound" /\ D.content (OldPointNotFound <$> D.value) + ] + +derive instance genericRollbackFailed :: Generic RollbackFailed _ + +-------------------------------------------------------------------------------- + +_RollbackNoTip :: Prism' RollbackFailed Unit +_RollbackNoTip = prism' (const RollbackNoTip) case _ of + RollbackNoTip -> Just unit + _ -> Nothing + +_TipMismatch :: Prism' RollbackFailed { foundTip :: Tip, targetPoint :: Point } +_TipMismatch = prism' TipMismatch case _ of + (TipMismatch a) -> Just a + _ -> Nothing + +_OldPointNotFound :: Prism' RollbackFailed Point +_OldPointNotFound = prism' OldPointNotFound case _ of + (OldPointNotFound a) -> Just a + _ -> Nothing \ No newline at end of file diff --git a/marlowe-playground-client/generated/Plutus/ChainIndex/ChainIndexLog.purs b/marlowe-playground-client/generated/Plutus/ChainIndex/ChainIndexLog.purs new file mode 100644 index 0000000000..b8a2c7072b --- /dev/null +++ b/marlowe-playground-client/generated/Plutus/ChainIndex/ChainIndexLog.purs @@ -0,0 +1,167 @@ +-- File auto generated by purescript-bridge! -- +module Plutus.ChainIndex.ChainIndexLog where + +import Prelude + +import Control.Lazy (defer) +import Control.Monad.Freer.Extras.Beam (BeamLog) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Bounded.Generic (genericBottom, genericTop) +import Data.Enum (class Enum) +import Data.Enum.Generic (genericPred, genericSucc) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Ledger.Tx.CardanoAPI (FromCardanoError) +import Plutus.ChainIndex.ChainIndexError (ChainIndexError) +import Plutus.ChainIndex.Types (Tip) +import Plutus.V1.Ledger.Tx (TxOut, TxOutRef) +import Plutus.V1.Ledger.TxId (TxId) +import Type.Proxy (Proxy(Proxy)) + +data ChainIndexLog + = InsertionSuccess Tip InsertUtxoPosition + | ConversionFailed FromCardanoError + | RollbackSuccess Tip + | Err ChainIndexError + | TxNotFound TxId + | TxOutNotFound TxOutRef + | TipIsGenesis + | NoDatumScriptAddr TxOut + | BeamLogItem BeamLog + +derive instance eqChainIndexLog :: Eq ChainIndexLog + +instance showChainIndexLog :: Show ChainIndexLog where + show a = genericShow a + +instance encodeJsonChainIndexLog :: EncodeJson ChainIndexLog where + encodeJson = defer \_ -> case _ of + InsertionSuccess a b -> E.encodeTagged "InsertionSuccess" (a /\ b) + (E.tuple (E.value >/\< E.value)) + ConversionFailed a -> E.encodeTagged "ConversionFailed" a E.value + RollbackSuccess a -> E.encodeTagged "RollbackSuccess" a E.value + Err a -> E.encodeTagged "Err" a E.value + TxNotFound a -> E.encodeTagged "TxNotFound" a E.value + TxOutNotFound a -> E.encodeTagged "TxOutNotFound" a E.value + TipIsGenesis -> encodeJson { tag: "TipIsGenesis", contents: jsonNull } + NoDatumScriptAddr a -> E.encodeTagged "NoDatumScriptAddr" a E.value + BeamLogItem a -> E.encodeTagged "BeamLogItem" a E.value + +instance decodeJsonChainIndexLog :: DecodeJson ChainIndexLog where + decodeJson = defer \_ -> D.decode + $ D.sumType "ChainIndexLog" + $ Map.fromFoldable + [ "InsertionSuccess" /\ D.content + (D.tuple $ InsertionSuccess D.value D.value) + , "ConversionFailed" /\ D.content (ConversionFailed <$> D.value) + , "RollbackSuccess" /\ D.content (RollbackSuccess <$> D.value) + , "Err" /\ D.content (Err <$> D.value) + , "TxNotFound" /\ D.content (TxNotFound <$> D.value) + , "TxOutNotFound" /\ D.content (TxOutNotFound <$> D.value) + , "TipIsGenesis" /\ pure TipIsGenesis + , "NoDatumScriptAddr" /\ D.content (NoDatumScriptAddr <$> D.value) + , "BeamLogItem" /\ D.content (BeamLogItem <$> D.value) + ] + +derive instance genericChainIndexLog :: Generic ChainIndexLog _ + +-------------------------------------------------------------------------------- + +_InsertionSuccess :: Prism' ChainIndexLog { a :: Tip, b :: InsertUtxoPosition } +_InsertionSuccess = prism' (\{ a, b } -> (InsertionSuccess a b)) case _ of + (InsertionSuccess a b) -> Just { a, b } + _ -> Nothing + +_ConversionFailed :: Prism' ChainIndexLog FromCardanoError +_ConversionFailed = prism' ConversionFailed case _ of + (ConversionFailed a) -> Just a + _ -> Nothing + +_RollbackSuccess :: Prism' ChainIndexLog Tip +_RollbackSuccess = prism' RollbackSuccess case _ of + (RollbackSuccess a) -> Just a + _ -> Nothing + +_Err :: Prism' ChainIndexLog ChainIndexError +_Err = prism' Err case _ of + (Err a) -> Just a + _ -> Nothing + +_TxNotFound :: Prism' ChainIndexLog TxId +_TxNotFound = prism' TxNotFound case _ of + (TxNotFound a) -> Just a + _ -> Nothing + +_TxOutNotFound :: Prism' ChainIndexLog TxOutRef +_TxOutNotFound = prism' TxOutNotFound case _ of + (TxOutNotFound a) -> Just a + _ -> Nothing + +_TipIsGenesis :: Prism' ChainIndexLog Unit +_TipIsGenesis = prism' (const TipIsGenesis) case _ of + TipIsGenesis -> Just unit + _ -> Nothing + +_NoDatumScriptAddr :: Prism' ChainIndexLog TxOut +_NoDatumScriptAddr = prism' NoDatumScriptAddr case _ of + (NoDatumScriptAddr a) -> Just a + _ -> Nothing + +_BeamLogItem :: Prism' ChainIndexLog BeamLog +_BeamLogItem = prism' BeamLogItem case _ of + (BeamLogItem a) -> Just a + _ -> Nothing + +-------------------------------------------------------------------------------- + +data InsertUtxoPosition + = InsertAtEnd + | InsertBeforeEnd + +derive instance eqInsertUtxoPosition :: Eq InsertUtxoPosition + +derive instance ordInsertUtxoPosition :: Ord InsertUtxoPosition + +instance showInsertUtxoPosition :: Show InsertUtxoPosition where + show a = genericShow a + +instance encodeJsonInsertUtxoPosition :: EncodeJson InsertUtxoPosition where + encodeJson = defer \_ -> E.encode E.enum + +instance decodeJsonInsertUtxoPosition :: DecodeJson InsertUtxoPosition where + decodeJson = defer \_ -> D.decode D.enum + +derive instance genericInsertUtxoPosition :: Generic InsertUtxoPosition _ + +instance enumInsertUtxoPosition :: Enum InsertUtxoPosition where + succ = genericSucc + pred = genericPred + +instance boundedInsertUtxoPosition :: Bounded InsertUtxoPosition where + bottom = genericBottom + top = genericTop + +-------------------------------------------------------------------------------- + +_InsertAtEnd :: Prism' InsertUtxoPosition Unit +_InsertAtEnd = prism' (const InsertAtEnd) case _ of + InsertAtEnd -> Just unit + _ -> Nothing + +_InsertBeforeEnd :: Prism' InsertUtxoPosition Unit +_InsertBeforeEnd = prism' (const InsertBeforeEnd) case _ of + InsertBeforeEnd -> Just unit + _ -> Nothing \ No newline at end of file diff --git a/marlowe-playground-client/generated/Plutus/ChainIndex/Tx.purs b/marlowe-playground-client/generated/Plutus/ChainIndex/Tx.purs new file mode 100644 index 0000000000..dad282ad09 --- /dev/null +++ b/marlowe-playground-client/generated/Plutus/ChainIndex/Tx.purs @@ -0,0 +1,157 @@ +-- File auto generated by purescript-bridge! -- +module Plutus.ChainIndex.Tx where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map (Map) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.RawJson (RawJson) +import Data.Set (Set) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Plutus.V1.Ledger.Interval (Interval) +import Plutus.V1.Ledger.Scripts (DatumHash) +import Plutus.V1.Ledger.Slot (Slot) +import Plutus.V1.Ledger.Tx (TxIn, TxOut) +import Plutus.V1.Ledger.TxId (TxId) +import Type.Proxy (Proxy(Proxy)) + +newtype ChainIndexTx = ChainIndexTx + { _citxTxId :: TxId + , _citxInputs :: Set TxIn + , _citxOutputs :: ChainIndexTxOutputs + , _citxValidRange :: Interval Slot + , _citxData :: Map DatumHash String + , _citxRedeemers :: Map String String + , _citxScripts :: Map String String + , _citxCardanoTx :: Maybe RawJson + } + +derive instance eqChainIndexTx :: Eq ChainIndexTx + +instance showChainIndexTx :: Show ChainIndexTx where + show a = genericShow a + +instance encodeJsonChainIndexTx :: EncodeJson ChainIndexTx where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { _citxTxId: E.value :: _ TxId + , _citxInputs: E.value :: _ (Set TxIn) + , _citxOutputs: E.value :: _ ChainIndexTxOutputs + , _citxValidRange: E.value :: _ (Interval Slot) + , _citxData: (E.dictionary E.value E.value) :: _ (Map DatumHash String) + , _citxRedeemers: + (E.dictionary E.value E.value) :: _ (Map String String) + , _citxScripts: (E.dictionary E.value E.value) :: _ (Map String String) + , _citxCardanoTx: (E.maybe E.value) :: _ (Maybe RawJson) + } + ) + +instance decodeJsonChainIndexTx :: DecodeJson ChainIndexTx where + decodeJson = defer \_ -> D.decode $ + ( ChainIndexTx <$> D.record "ChainIndexTx" + { _citxTxId: D.value :: _ TxId + , _citxInputs: D.value :: _ (Set TxIn) + , _citxOutputs: D.value :: _ ChainIndexTxOutputs + , _citxValidRange: D.value :: _ (Interval Slot) + , _citxData: (D.dictionary D.value D.value) :: _ (Map DatumHash String) + , _citxRedeemers: + (D.dictionary D.value D.value) :: _ (Map String String) + , _citxScripts: (D.dictionary D.value D.value) :: _ (Map String String) + , _citxCardanoTx: (D.maybe D.value) :: _ (Maybe RawJson) + } + ) + +derive instance genericChainIndexTx :: Generic ChainIndexTx _ + +derive instance newtypeChainIndexTx :: Newtype ChainIndexTx _ + +-------------------------------------------------------------------------------- + +_ChainIndexTx :: Iso' ChainIndexTx + { _citxTxId :: TxId + , _citxInputs :: Set TxIn + , _citxOutputs :: ChainIndexTxOutputs + , _citxValidRange :: Interval Slot + , _citxData :: Map DatumHash String + , _citxRedeemers :: Map String String + , _citxScripts :: Map String String + , _citxCardanoTx :: Maybe RawJson + } +_ChainIndexTx = _Newtype + +citxTxId :: Lens' ChainIndexTx TxId +citxTxId = _Newtype <<< prop (Proxy :: _ "_citxTxId") + +citxInputs :: Lens' ChainIndexTx (Set TxIn) +citxInputs = _Newtype <<< prop (Proxy :: _ "_citxInputs") + +citxOutputs :: Lens' ChainIndexTx ChainIndexTxOutputs +citxOutputs = _Newtype <<< prop (Proxy :: _ "_citxOutputs") + +citxValidRange :: Lens' ChainIndexTx (Interval Slot) +citxValidRange = _Newtype <<< prop (Proxy :: _ "_citxValidRange") + +citxData :: Lens' ChainIndexTx (Map DatumHash String) +citxData = _Newtype <<< prop (Proxy :: _ "_citxData") + +citxRedeemers :: Lens' ChainIndexTx (Map String String) +citxRedeemers = _Newtype <<< prop (Proxy :: _ "_citxRedeemers") + +citxScripts :: Lens' ChainIndexTx (Map String String) +citxScripts = _Newtype <<< prop (Proxy :: _ "_citxScripts") + +citxCardanoTx :: Lens' ChainIndexTx (Maybe RawJson) +citxCardanoTx = _Newtype <<< prop (Proxy :: _ "_citxCardanoTx") + +-------------------------------------------------------------------------------- + +data ChainIndexTxOutputs + = InvalidTx + | ValidTx (Array TxOut) + +derive instance eqChainIndexTxOutputs :: Eq ChainIndexTxOutputs + +instance showChainIndexTxOutputs :: Show ChainIndexTxOutputs where + show a = genericShow a + +instance encodeJsonChainIndexTxOutputs :: EncodeJson ChainIndexTxOutputs where + encodeJson = defer \_ -> case _ of + InvalidTx -> encodeJson { tag: "InvalidTx", contents: jsonNull } + ValidTx a -> E.encodeTagged "ValidTx" a E.value + +instance decodeJsonChainIndexTxOutputs :: DecodeJson ChainIndexTxOutputs where + decodeJson = defer \_ -> D.decode + $ D.sumType "ChainIndexTxOutputs" + $ Map.fromFoldable + [ "InvalidTx" /\ pure InvalidTx + , "ValidTx" /\ D.content (ValidTx <$> D.value) + ] + +derive instance genericChainIndexTxOutputs :: Generic ChainIndexTxOutputs _ + +-------------------------------------------------------------------------------- + +_InvalidTx :: Prism' ChainIndexTxOutputs Unit +_InvalidTx = prism' (const InvalidTx) case _ of + InvalidTx -> Just unit + _ -> Nothing + +_ValidTx :: Prism' ChainIndexTxOutputs (Array TxOut) +_ValidTx = prism' ValidTx case _ of + (ValidTx a) -> Just a + _ -> Nothing \ No newline at end of file diff --git a/marlowe-playground-client/generated/Plutus/ChainIndex/Types.purs b/marlowe-playground-client/generated/Plutus/ChainIndex/Types.purs new file mode 100644 index 0000000000..85565bb91d --- /dev/null +++ b/marlowe-playground-client/generated/Plutus/ChainIndex/Types.purs @@ -0,0 +1,336 @@ +-- File auto generated by purescript-bridge! -- +module Plutus.ChainIndex.Types where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.BigInt.Argonaut (BigInt) +import Data.Bounded.Generic (genericBottom, genericTop) +import Data.Enum (class Enum) +import Data.Enum.Generic (genericPred, genericSucc) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Ledger.Blockchain (BlockId) +import Plutus.V1.Ledger.Slot (Slot) +import Plutus.V1.Ledger.TxId (TxId) +import Type.Proxy (Proxy(Proxy)) + +data Tip + = TipAtGenesis + | Tip + { tipSlot :: Slot + , tipBlockId :: BlockId + , tipBlockNo :: BlockNumber + } + +derive instance eqTip :: Eq Tip + +instance showTip :: Show Tip where + show a = genericShow a + +instance encodeJsonTip :: EncodeJson Tip where + encodeJson = defer \_ -> case _ of + TipAtGenesis -> encodeJson { tag: "TipAtGenesis", contents: jsonNull } + Tip { tipSlot, tipBlockId, tipBlockNo } -> encodeJson + { tag: "Tip" + , tipSlot: flip E.encode tipSlot E.value + , tipBlockId: flip E.encode tipBlockId E.value + , tipBlockNo: flip E.encode tipBlockNo E.value + } + +instance decodeJsonTip :: DecodeJson Tip where + decodeJson = defer \_ -> D.decode + $ D.sumType "Tip" + $ Map.fromFoldable + [ "TipAtGenesis" /\ pure TipAtGenesis + , "Tip" /\ + ( Tip <$> D.object "Tip" + { tipSlot: D.value :: _ Slot + , tipBlockId: D.value :: _ BlockId + , tipBlockNo: D.value :: _ BlockNumber + } + ) + ] + +derive instance genericTip :: Generic Tip _ + +-------------------------------------------------------------------------------- + +_TipAtGenesis :: Prism' Tip Unit +_TipAtGenesis = prism' (const TipAtGenesis) case _ of + TipAtGenesis -> Just unit + _ -> Nothing + +_Tip :: Prism' Tip + { tipSlot :: Slot, tipBlockId :: BlockId, tipBlockNo :: BlockNumber } +_Tip = prism' Tip case _ of + (Tip a) -> Just a + _ -> Nothing + +-------------------------------------------------------------------------------- + +data Point + = PointAtGenesis + | Point + { pointSlot :: Slot + , pointBlockId :: BlockId + } + +derive instance eqPoint :: Eq Point + +instance showPoint :: Show Point where + show a = genericShow a + +instance encodeJsonPoint :: EncodeJson Point where + encodeJson = defer \_ -> case _ of + PointAtGenesis -> encodeJson { tag: "PointAtGenesis", contents: jsonNull } + Point { pointSlot, pointBlockId } -> encodeJson + { tag: "Point" + , pointSlot: flip E.encode pointSlot E.value + , pointBlockId: flip E.encode pointBlockId E.value + } + +instance decodeJsonPoint :: DecodeJson Point where + decodeJson = defer \_ -> D.decode + $ D.sumType "Point" + $ Map.fromFoldable + [ "PointAtGenesis" /\ pure PointAtGenesis + , "Point" /\ + ( Point <$> D.object "Point" + { pointSlot: D.value :: _ Slot + , pointBlockId: D.value :: _ BlockId + } + ) + ] + +derive instance genericPoint :: Generic Point _ + +-------------------------------------------------------------------------------- + +_PointAtGenesis :: Prism' Point Unit +_PointAtGenesis = prism' (const PointAtGenesis) case _ of + PointAtGenesis -> Just unit + _ -> Nothing + +_Point :: Prism' Point { pointSlot :: Slot, pointBlockId :: BlockId } +_Point = prism' Point case _ of + (Point a) -> Just a + _ -> Nothing + +-------------------------------------------------------------------------------- + +data TxValidity + = TxValid + | TxInvalid + | UnknownValidity + +derive instance eqTxValidity :: Eq TxValidity + +derive instance ordTxValidity :: Ord TxValidity + +instance showTxValidity :: Show TxValidity where + show a = genericShow a + +instance encodeJsonTxValidity :: EncodeJson TxValidity where + encodeJson = defer \_ -> E.encode E.enum + +instance decodeJsonTxValidity :: DecodeJson TxValidity where + decodeJson = defer \_ -> D.decode D.enum + +derive instance genericTxValidity :: Generic TxValidity _ + +instance enumTxValidity :: Enum TxValidity where + succ = genericSucc + pred = genericPred + +instance boundedTxValidity :: Bounded TxValidity where + bottom = genericBottom + top = genericTop + +-------------------------------------------------------------------------------- + +_TxValid :: Prism' TxValidity Unit +_TxValid = prism' (const TxValid) case _ of + TxValid -> Just unit + _ -> Nothing + +_TxInvalid :: Prism' TxValidity Unit +_TxInvalid = prism' (const TxInvalid) case _ of + TxInvalid -> Just unit + _ -> Nothing + +_UnknownValidity :: Prism' TxValidity Unit +_UnknownValidity = prism' (const UnknownValidity) case _ of + UnknownValidity -> Just unit + _ -> Nothing + +-------------------------------------------------------------------------------- + +data TxOutState + = Spent TxId + | Unspent + +derive instance eqTxOutState :: Eq TxOutState + +instance showTxOutState :: Show TxOutState where + show a = genericShow a + +instance encodeJsonTxOutState :: EncodeJson TxOutState where + encodeJson = defer \_ -> case _ of + Spent a -> E.encodeTagged "Spent" a E.value + Unspent -> encodeJson { tag: "Unspent", contents: jsonNull } + +instance decodeJsonTxOutState :: DecodeJson TxOutState where + decodeJson = defer \_ -> D.decode + $ D.sumType "TxOutState" + $ Map.fromFoldable + [ "Spent" /\ D.content (Spent <$> D.value) + , "Unspent" /\ pure Unspent + ] + +derive instance genericTxOutState :: Generic TxOutState _ + +-------------------------------------------------------------------------------- + +_Spent :: Prism' TxOutState TxId +_Spent = prism' Spent case _ of + (Spent a) -> Just a + _ -> Nothing + +_Unspent :: Prism' TxOutState Unit +_Unspent = prism' (const Unspent) case _ of + Unspent -> Just unit + _ -> Nothing + +-------------------------------------------------------------------------------- + +data RollbackState a + = Unknown + | TentativelyConfirmed Depth TxValidity a + | Committed TxValidity a + +derive instance eqRollbackState :: (Eq a) => Eq (RollbackState a) + +instance showRollbackState :: (Show a) => Show (RollbackState a) where + show a = genericShow a + +instance encodeJsonRollbackState :: + ( EncodeJson a + ) => + EncodeJson (RollbackState a) where + encodeJson = defer \_ -> case _ of + Unknown -> encodeJson { tag: "Unknown", contents: jsonNull } + TentativelyConfirmed a b c -> E.encodeTagged "TentativelyConfirmed" + (a /\ b /\ c) + (E.tuple (E.value >/\< E.value >/\< E.value)) + Committed a b -> E.encodeTagged "Committed" (a /\ b) + (E.tuple (E.value >/\< E.value)) + +instance decodeJsonRollbackState :: + ( DecodeJson a + ) => + DecodeJson (RollbackState a) where + decodeJson = defer \_ -> D.decode + $ D.sumType "RollbackState" + $ Map.fromFoldable + [ "Unknown" /\ pure Unknown + , "TentativelyConfirmed" /\ D.content + ( D.tuple $ TentativelyConfirmed D.value D.value + D.value + ) + , "Committed" /\ D.content + (D.tuple $ Committed D.value D.value) + ] + +derive instance genericRollbackState :: Generic (RollbackState a) _ + +-------------------------------------------------------------------------------- + +_Unknown :: forall a. Prism' (RollbackState a) Unit +_Unknown = prism' (const Unknown) case _ of + Unknown -> Just unit + _ -> Nothing + +_TentativelyConfirmed + :: forall a. Prism' (RollbackState a) { a :: Depth, b :: TxValidity, c :: a } +_TentativelyConfirmed = prism' (\{ a, b, c } -> (TentativelyConfirmed a b c)) + case _ of + (TentativelyConfirmed a b c) -> Just { a, b, c } + _ -> Nothing + +_Committed :: forall a. Prism' (RollbackState a) { a :: TxValidity, b :: a } +_Committed = prism' (\{ a, b } -> (Committed a b)) case _ of + (Committed a b) -> Just { a, b } + _ -> Nothing + +-------------------------------------------------------------------------------- + +newtype BlockNumber = BlockNumber { unBlockNumber :: BigInt } + +derive instance eqBlockNumber :: Eq BlockNumber + +instance showBlockNumber :: Show BlockNumber where + show a = genericShow a + +instance encodeJsonBlockNumber :: EncodeJson BlockNumber where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { unBlockNumber: E.value :: _ BigInt } + ) + +instance decodeJsonBlockNumber :: DecodeJson BlockNumber where + decodeJson = defer \_ -> D.decode $ + ( BlockNumber <$> D.record "BlockNumber" + { unBlockNumber: D.value :: _ BigInt } + ) + +derive instance genericBlockNumber :: Generic BlockNumber _ + +derive instance newtypeBlockNumber :: Newtype BlockNumber _ + +-------------------------------------------------------------------------------- + +_BlockNumber :: Iso' BlockNumber { unBlockNumber :: BigInt } +_BlockNumber = _Newtype + +-------------------------------------------------------------------------------- + +newtype Depth = Depth { unDepth :: Int } + +derive instance eqDepth :: Eq Depth + +instance showDepth :: Show Depth where + show a = genericShow a + +instance encodeJsonDepth :: EncodeJson Depth where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { unDepth: E.value :: _ Int } + ) + +instance decodeJsonDepth :: DecodeJson Depth where + decodeJson = defer \_ -> D.decode $ + (Depth <$> D.record "Depth" { unDepth: D.value :: _ Int }) + +derive instance genericDepth :: Generic Depth _ + +derive instance newtypeDepth :: Newtype Depth _ + +-------------------------------------------------------------------------------- + +_Depth :: Iso' Depth { unDepth :: Int } +_Depth = _Newtype \ No newline at end of file diff --git a/marlowe-playground-client/generated/Plutus/Contract/Checkpoint.purs b/marlowe-playground-client/generated/Plutus/Contract/Checkpoint.purs new file mode 100644 index 0000000000..57b3bef016 --- /dev/null +++ b/marlowe-playground-client/generated/Plutus/Contract/Checkpoint.purs @@ -0,0 +1,45 @@ +-- File auto generated by purescript-bridge! -- +module Plutus.Contract.Checkpoint where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Type.Proxy (Proxy(Proxy)) + +newtype CheckpointError = JSONDecodeError String + +derive instance eqCheckpointError :: Eq CheckpointError + +instance showCheckpointError :: Show CheckpointError where + show a = genericShow a + +instance encodeJsonCheckpointError :: EncodeJson CheckpointError where + encodeJson = defer \_ -> E.encode $ unwrap >$< E.value + +instance decodeJsonCheckpointError :: DecodeJson CheckpointError where + decodeJson = defer \_ -> D.decode $ (JSONDecodeError <$> D.value) + +derive instance genericCheckpointError :: Generic CheckpointError _ + +derive instance newtypeCheckpointError :: Newtype CheckpointError _ + +-------------------------------------------------------------------------------- + +_JSONDecodeError :: Iso' CheckpointError String +_JSONDecodeError = _Newtype \ No newline at end of file diff --git a/marlowe-playground-client/generated/Plutus/Contract/Effects.purs b/marlowe-playground-client/generated/Plutus/Contract/Effects.purs new file mode 100644 index 0000000000..cc397082a3 --- /dev/null +++ b/marlowe-playground-client/generated/Plutus/Contract/Effects.purs @@ -0,0 +1,744 @@ +-- File auto generated by purescript-bridge! -- +module Plutus.Contract.Effects where + +import Prelude + +import Control.Lazy (defer) +import Control.Monad.Freer.Extras.Pagination (Page, PageQuery) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Either (Either) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.List.Types (NonEmptyList) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.RawJson (RawJson) +import Data.Show.Generic (genericShow) +import Data.Tuple (Tuple) +import Data.Tuple.Nested ((/\)) +import Ledger.Constraints.OffChain (UnbalancedTx) +import Ledger.TimeSlot (SlotConversionError) +import Ledger.Tx (ChainIndexTxOut) +import Plutus.ChainIndex.Tx (ChainIndexTx) +import Plutus.ChainIndex.Types (RollbackState, Tip, TxOutState) +import Plutus.V1.Ledger.Address (Address) +import Plutus.V1.Ledger.Credential (Credential) +import Plutus.V1.Ledger.Crypto (PubKeyHash) +import Plutus.V1.Ledger.Interval (Interval) +import Plutus.V1.Ledger.Scripts + ( DatumHash + , MintingPolicy + , StakeValidator + , Validator + ) +import Plutus.V1.Ledger.Slot (Slot) +import Plutus.V1.Ledger.Time (POSIXTime) +import Plutus.V1.Ledger.Tx (Tx, TxOutRef) +import Plutus.V1.Ledger.TxId (TxId) +import Plutus.V1.Ledger.Value (AssetClass) +import Type.Proxy (Proxy(Proxy)) +import Wallet.Emulator.Error (WalletAPIError) +import Wallet.Types (ContractInstanceId, EndpointDescription, EndpointValue) + +data PABReq + = AwaitSlotReq Slot + | AwaitTimeReq POSIXTime + | AwaitUtxoSpentReq TxOutRef + | AwaitUtxoProducedReq Address + | AwaitTxStatusChangeReq TxId + | AwaitTxOutStatusChangeReq TxOutRef + | CurrentSlotReq + | CurrentTimeReq + | OwnContractInstanceIdReq + | OwnPublicKeyHashReq + | ChainIndexQueryReq ChainIndexQuery + | BalanceTxReq UnbalancedTx + | WriteBalancedTxReq (Either RawJson Tx) + | ExposeEndpointReq ActiveEndpoint + | PosixTimeRangeToContainedSlotRangeReq (Interval POSIXTime) + +derive instance eqPABReq :: Eq PABReq + +instance showPABReq :: Show PABReq where + show a = genericShow a + +instance encodeJsonPABReq :: EncodeJson PABReq where + encodeJson = defer \_ -> case _ of + AwaitSlotReq a -> E.encodeTagged "AwaitSlotReq" a E.value + AwaitTimeReq a -> E.encodeTagged "AwaitTimeReq" a E.value + AwaitUtxoSpentReq a -> E.encodeTagged "AwaitUtxoSpentReq" a E.value + AwaitUtxoProducedReq a -> E.encodeTagged "AwaitUtxoProducedReq" a E.value + AwaitTxStatusChangeReq a -> E.encodeTagged "AwaitTxStatusChangeReq" a + E.value + AwaitTxOutStatusChangeReq a -> E.encodeTagged "AwaitTxOutStatusChangeReq" a + E.value + CurrentSlotReq -> encodeJson { tag: "CurrentSlotReq", contents: jsonNull } + CurrentTimeReq -> encodeJson { tag: "CurrentTimeReq", contents: jsonNull } + OwnContractInstanceIdReq -> encodeJson + { tag: "OwnContractInstanceIdReq", contents: jsonNull } + OwnPublicKeyHashReq -> encodeJson + { tag: "OwnPublicKeyHashReq", contents: jsonNull } + ChainIndexQueryReq a -> E.encodeTagged "ChainIndexQueryReq" a E.value + BalanceTxReq a -> E.encodeTagged "BalanceTxReq" a E.value + WriteBalancedTxReq a -> E.encodeTagged "WriteBalancedTxReq" a + (E.either E.value E.value) + ExposeEndpointReq a -> E.encodeTagged "ExposeEndpointReq" a E.value + PosixTimeRangeToContainedSlotRangeReq a -> E.encodeTagged + "PosixTimeRangeToContainedSlotRangeReq" + a + E.value + +instance decodeJsonPABReq :: DecodeJson PABReq where + decodeJson = defer \_ -> D.decode + $ D.sumType "PABReq" + $ Map.fromFoldable + [ "AwaitSlotReq" /\ D.content (AwaitSlotReq <$> D.value) + , "AwaitTimeReq" /\ D.content (AwaitTimeReq <$> D.value) + , "AwaitUtxoSpentReq" /\ D.content (AwaitUtxoSpentReq <$> D.value) + , "AwaitUtxoProducedReq" /\ D.content (AwaitUtxoProducedReq <$> D.value) + , "AwaitTxStatusChangeReq" /\ D.content + (AwaitTxStatusChangeReq <$> D.value) + , "AwaitTxOutStatusChangeReq" /\ D.content + (AwaitTxOutStatusChangeReq <$> D.value) + , "CurrentSlotReq" /\ pure CurrentSlotReq + , "CurrentTimeReq" /\ pure CurrentTimeReq + , "OwnContractInstanceIdReq" /\ pure OwnContractInstanceIdReq + , "OwnPublicKeyHashReq" /\ pure OwnPublicKeyHashReq + , "ChainIndexQueryReq" /\ D.content (ChainIndexQueryReq <$> D.value) + , "BalanceTxReq" /\ D.content (BalanceTxReq <$> D.value) + , "WriteBalancedTxReq" /\ D.content + (WriteBalancedTxReq <$> (D.either D.value D.value)) + , "ExposeEndpointReq" /\ D.content (ExposeEndpointReq <$> D.value) + , "PosixTimeRangeToContainedSlotRangeReq" /\ D.content + (PosixTimeRangeToContainedSlotRangeReq <$> D.value) + ] + +derive instance genericPABReq :: Generic PABReq _ + +-------------------------------------------------------------------------------- + +_AwaitSlotReq :: Prism' PABReq Slot +_AwaitSlotReq = prism' AwaitSlotReq case _ of + (AwaitSlotReq a) -> Just a + _ -> Nothing + +_AwaitTimeReq :: Prism' PABReq POSIXTime +_AwaitTimeReq = prism' AwaitTimeReq case _ of + (AwaitTimeReq a) -> Just a + _ -> Nothing + +_AwaitUtxoSpentReq :: Prism' PABReq TxOutRef +_AwaitUtxoSpentReq = prism' AwaitUtxoSpentReq case _ of + (AwaitUtxoSpentReq a) -> Just a + _ -> Nothing + +_AwaitUtxoProducedReq :: Prism' PABReq Address +_AwaitUtxoProducedReq = prism' AwaitUtxoProducedReq case _ of + (AwaitUtxoProducedReq a) -> Just a + _ -> Nothing + +_AwaitTxStatusChangeReq :: Prism' PABReq TxId +_AwaitTxStatusChangeReq = prism' AwaitTxStatusChangeReq case _ of + (AwaitTxStatusChangeReq a) -> Just a + _ -> Nothing + +_AwaitTxOutStatusChangeReq :: Prism' PABReq TxOutRef +_AwaitTxOutStatusChangeReq = prism' AwaitTxOutStatusChangeReq case _ of + (AwaitTxOutStatusChangeReq a) -> Just a + _ -> Nothing + +_CurrentSlotReq :: Prism' PABReq Unit +_CurrentSlotReq = prism' (const CurrentSlotReq) case _ of + CurrentSlotReq -> Just unit + _ -> Nothing + +_CurrentTimeReq :: Prism' PABReq Unit +_CurrentTimeReq = prism' (const CurrentTimeReq) case _ of + CurrentTimeReq -> Just unit + _ -> Nothing + +_OwnContractInstanceIdReq :: Prism' PABReq Unit +_OwnContractInstanceIdReq = prism' (const OwnContractInstanceIdReq) case _ of + OwnContractInstanceIdReq -> Just unit + _ -> Nothing + +_OwnPublicKeyHashReq :: Prism' PABReq Unit +_OwnPublicKeyHashReq = prism' (const OwnPublicKeyHashReq) case _ of + OwnPublicKeyHashReq -> Just unit + _ -> Nothing + +_ChainIndexQueryReq :: Prism' PABReq ChainIndexQuery +_ChainIndexQueryReq = prism' ChainIndexQueryReq case _ of + (ChainIndexQueryReq a) -> Just a + _ -> Nothing + +_BalanceTxReq :: Prism' PABReq UnbalancedTx +_BalanceTxReq = prism' BalanceTxReq case _ of + (BalanceTxReq a) -> Just a + _ -> Nothing + +_WriteBalancedTxReq :: Prism' PABReq (Either RawJson Tx) +_WriteBalancedTxReq = prism' WriteBalancedTxReq case _ of + (WriteBalancedTxReq a) -> Just a + _ -> Nothing + +_ExposeEndpointReq :: Prism' PABReq ActiveEndpoint +_ExposeEndpointReq = prism' ExposeEndpointReq case _ of + (ExposeEndpointReq a) -> Just a + _ -> Nothing + +_PosixTimeRangeToContainedSlotRangeReq :: Prism' PABReq (Interval POSIXTime) +_PosixTimeRangeToContainedSlotRangeReq = prism' + PosixTimeRangeToContainedSlotRangeReq + case _ of + (PosixTimeRangeToContainedSlotRangeReq a) -> Just a + _ -> Nothing + +-------------------------------------------------------------------------------- + +data PABResp + = AwaitSlotResp Slot + | AwaitTimeResp POSIXTime + | AwaitUtxoSpentResp ChainIndexTx + | AwaitUtxoProducedResp (NonEmptyList ChainIndexTx) + | AwaitTxStatusChangeResp TxId (RollbackState Unit) + | AwaitTxOutStatusChangeResp TxOutRef (RollbackState TxOutState) + | CurrentSlotResp Slot + | CurrentTimeResp POSIXTime + | OwnContractInstanceIdResp ContractInstanceId + | OwnPublicKeyHashResp PubKeyHash + | ChainIndexQueryResp ChainIndexResponse + | BalanceTxResp BalanceTxResponse + | WriteBalancedTxResp WriteBalancedTxResponse + | ExposeEndpointResp EndpointDescription (EndpointValue RawJson) + | PosixTimeRangeToContainedSlotRangeResp + (Either SlotConversionError (Interval Slot)) + +derive instance eqPABResp :: Eq PABResp + +instance showPABResp :: Show PABResp where + show a = genericShow a + +instance encodeJsonPABResp :: EncodeJson PABResp where + encodeJson = defer \_ -> case _ of + AwaitSlotResp a -> E.encodeTagged "AwaitSlotResp" a E.value + AwaitTimeResp a -> E.encodeTagged "AwaitTimeResp" a E.value + AwaitUtxoSpentResp a -> E.encodeTagged "AwaitUtxoSpentResp" a E.value + AwaitUtxoProducedResp a -> E.encodeTagged "AwaitUtxoProducedResp" a E.value + AwaitTxStatusChangeResp a b -> E.encodeTagged "AwaitTxStatusChangeResp" + (a /\ b) + (E.tuple (E.value >/\< E.value)) + AwaitTxOutStatusChangeResp a b -> E.encodeTagged + "AwaitTxOutStatusChangeResp" + (a /\ b) + (E.tuple (E.value >/\< E.value)) + CurrentSlotResp a -> E.encodeTagged "CurrentSlotResp" a E.value + CurrentTimeResp a -> E.encodeTagged "CurrentTimeResp" a E.value + OwnContractInstanceIdResp a -> E.encodeTagged "OwnContractInstanceIdResp" a + E.value + OwnPublicKeyHashResp a -> E.encodeTagged "OwnPublicKeyHashResp" a E.value + ChainIndexQueryResp a -> E.encodeTagged "ChainIndexQueryResp" a E.value + BalanceTxResp a -> E.encodeTagged "BalanceTxResp" a E.value + WriteBalancedTxResp a -> E.encodeTagged "WriteBalancedTxResp" a E.value + ExposeEndpointResp a b -> E.encodeTagged "ExposeEndpointResp" (a /\ b) + (E.tuple (E.value >/\< E.value)) + PosixTimeRangeToContainedSlotRangeResp a -> E.encodeTagged + "PosixTimeRangeToContainedSlotRangeResp" + a + (E.either E.value E.value) + +instance decodeJsonPABResp :: DecodeJson PABResp where + decodeJson = defer \_ -> D.decode + $ D.sumType "PABResp" + $ Map.fromFoldable + [ "AwaitSlotResp" /\ D.content (AwaitSlotResp <$> D.value) + , "AwaitTimeResp" /\ D.content (AwaitTimeResp <$> D.value) + , "AwaitUtxoSpentResp" /\ D.content (AwaitUtxoSpentResp <$> D.value) + , "AwaitUtxoProducedResp" /\ D.content + (AwaitUtxoProducedResp <$> D.value) + , "AwaitTxStatusChangeResp" /\ D.content + (D.tuple $ AwaitTxStatusChangeResp D.value D.value) + , "AwaitTxOutStatusChangeResp" /\ D.content + (D.tuple $ AwaitTxOutStatusChangeResp D.value D.value) + , "CurrentSlotResp" /\ D.content (CurrentSlotResp <$> D.value) + , "CurrentTimeResp" /\ D.content (CurrentTimeResp <$> D.value) + , "OwnContractInstanceIdResp" /\ D.content + (OwnContractInstanceIdResp <$> D.value) + , "OwnPublicKeyHashResp" /\ D.content (OwnPublicKeyHashResp <$> D.value) + , "ChainIndexQueryResp" /\ D.content (ChainIndexQueryResp <$> D.value) + , "BalanceTxResp" /\ D.content (BalanceTxResp <$> D.value) + , "WriteBalancedTxResp" /\ D.content (WriteBalancedTxResp <$> D.value) + , "ExposeEndpointResp" /\ D.content + (D.tuple $ ExposeEndpointResp D.value D.value) + , "PosixTimeRangeToContainedSlotRangeResp" /\ D.content + ( PosixTimeRangeToContainedSlotRangeResp <$> + (D.either D.value D.value) + ) + ] + +derive instance genericPABResp :: Generic PABResp _ + +-------------------------------------------------------------------------------- + +_AwaitSlotResp :: Prism' PABResp Slot +_AwaitSlotResp = prism' AwaitSlotResp case _ of + (AwaitSlotResp a) -> Just a + _ -> Nothing + +_AwaitTimeResp :: Prism' PABResp POSIXTime +_AwaitTimeResp = prism' AwaitTimeResp case _ of + (AwaitTimeResp a) -> Just a + _ -> Nothing + +_AwaitUtxoSpentResp :: Prism' PABResp ChainIndexTx +_AwaitUtxoSpentResp = prism' AwaitUtxoSpentResp case _ of + (AwaitUtxoSpentResp a) -> Just a + _ -> Nothing + +_AwaitUtxoProducedResp :: Prism' PABResp (NonEmptyList ChainIndexTx) +_AwaitUtxoProducedResp = prism' AwaitUtxoProducedResp case _ of + (AwaitUtxoProducedResp a) -> Just a + _ -> Nothing + +_AwaitTxStatusChangeResp :: Prism' PABResp + { a :: TxId, b :: RollbackState Unit } +_AwaitTxStatusChangeResp = prism' (\{ a, b } -> (AwaitTxStatusChangeResp a b)) + case _ of + (AwaitTxStatusChangeResp a b) -> Just { a, b } + _ -> Nothing + +_AwaitTxOutStatusChangeResp :: Prism' PABResp + { a :: TxOutRef, b :: RollbackState TxOutState } +_AwaitTxOutStatusChangeResp = prism' + (\{ a, b } -> (AwaitTxOutStatusChangeResp a b)) + case _ of + (AwaitTxOutStatusChangeResp a b) -> Just { a, b } + _ -> Nothing + +_CurrentSlotResp :: Prism' PABResp Slot +_CurrentSlotResp = prism' CurrentSlotResp case _ of + (CurrentSlotResp a) -> Just a + _ -> Nothing + +_CurrentTimeResp :: Prism' PABResp POSIXTime +_CurrentTimeResp = prism' CurrentTimeResp case _ of + (CurrentTimeResp a) -> Just a + _ -> Nothing + +_OwnContractInstanceIdResp :: Prism' PABResp ContractInstanceId +_OwnContractInstanceIdResp = prism' OwnContractInstanceIdResp case _ of + (OwnContractInstanceIdResp a) -> Just a + _ -> Nothing + +_OwnPublicKeyHashResp :: Prism' PABResp PubKeyHash +_OwnPublicKeyHashResp = prism' OwnPublicKeyHashResp case _ of + (OwnPublicKeyHashResp a) -> Just a + _ -> Nothing + +_ChainIndexQueryResp :: Prism' PABResp ChainIndexResponse +_ChainIndexQueryResp = prism' ChainIndexQueryResp case _ of + (ChainIndexQueryResp a) -> Just a + _ -> Nothing + +_BalanceTxResp :: Prism' PABResp BalanceTxResponse +_BalanceTxResp = prism' BalanceTxResp case _ of + (BalanceTxResp a) -> Just a + _ -> Nothing + +_WriteBalancedTxResp :: Prism' PABResp WriteBalancedTxResponse +_WriteBalancedTxResp = prism' WriteBalancedTxResp case _ of + (WriteBalancedTxResp a) -> Just a + _ -> Nothing + +_ExposeEndpointResp :: Prism' PABResp + { a :: EndpointDescription, b :: EndpointValue RawJson } +_ExposeEndpointResp = prism' (\{ a, b } -> (ExposeEndpointResp a b)) case _ of + (ExposeEndpointResp a b) -> Just { a, b } + _ -> Nothing + +_PosixTimeRangeToContainedSlotRangeResp :: Prism' PABResp + (Either SlotConversionError (Interval Slot)) +_PosixTimeRangeToContainedSlotRangeResp = prism' + PosixTimeRangeToContainedSlotRangeResp + case _ of + (PosixTimeRangeToContainedSlotRangeResp a) -> Just a + _ -> Nothing + +-------------------------------------------------------------------------------- + +data ChainIndexQuery + = DatumFromHash DatumHash + | ValidatorFromHash String + | MintingPolicyFromHash String + | StakeValidatorFromHash String + | RedeemerFromHash String + | TxOutFromRef TxOutRef + | TxFromTxId TxId + | UtxoSetMembership TxOutRef + | UtxoSetAtAddress (PageQuery TxOutRef) Credential + | UtxoSetWithCurrency (PageQuery TxOutRef) AssetClass + | GetTip + +derive instance eqChainIndexQuery :: Eq ChainIndexQuery + +instance showChainIndexQuery :: Show ChainIndexQuery where + show a = genericShow a + +instance encodeJsonChainIndexQuery :: EncodeJson ChainIndexQuery where + encodeJson = defer \_ -> case _ of + DatumFromHash a -> E.encodeTagged "DatumFromHash" a E.value + ValidatorFromHash a -> E.encodeTagged "ValidatorFromHash" a E.value + MintingPolicyFromHash a -> E.encodeTagged "MintingPolicyFromHash" a E.value + StakeValidatorFromHash a -> E.encodeTagged "StakeValidatorFromHash" a + E.value + RedeemerFromHash a -> E.encodeTagged "RedeemerFromHash" a E.value + TxOutFromRef a -> E.encodeTagged "TxOutFromRef" a E.value + TxFromTxId a -> E.encodeTagged "TxFromTxId" a E.value + UtxoSetMembership a -> E.encodeTagged "UtxoSetMembership" a E.value + UtxoSetAtAddress a b -> E.encodeTagged "UtxoSetAtAddress" (a /\ b) + (E.tuple (E.value >/\< E.value)) + UtxoSetWithCurrency a b -> E.encodeTagged "UtxoSetWithCurrency" (a /\ b) + (E.tuple (E.value >/\< E.value)) + GetTip -> encodeJson { tag: "GetTip", contents: jsonNull } + +instance decodeJsonChainIndexQuery :: DecodeJson ChainIndexQuery where + decodeJson = defer \_ -> D.decode + $ D.sumType "ChainIndexQuery" + $ Map.fromFoldable + [ "DatumFromHash" /\ D.content (DatumFromHash <$> D.value) + , "ValidatorFromHash" /\ D.content (ValidatorFromHash <$> D.value) + , "MintingPolicyFromHash" /\ D.content + (MintingPolicyFromHash <$> D.value) + , "StakeValidatorFromHash" /\ D.content + (StakeValidatorFromHash <$> D.value) + , "RedeemerFromHash" /\ D.content (RedeemerFromHash <$> D.value) + , "TxOutFromRef" /\ D.content (TxOutFromRef <$> D.value) + , "TxFromTxId" /\ D.content (TxFromTxId <$> D.value) + , "UtxoSetMembership" /\ D.content (UtxoSetMembership <$> D.value) + , "UtxoSetAtAddress" /\ D.content + (D.tuple $ UtxoSetAtAddress D.value D.value) + , "UtxoSetWithCurrency" /\ D.content + (D.tuple $ UtxoSetWithCurrency D.value D.value) + , "GetTip" /\ pure GetTip + ] + +derive instance genericChainIndexQuery :: Generic ChainIndexQuery _ + +-------------------------------------------------------------------------------- + +_DatumFromHash :: Prism' ChainIndexQuery DatumHash +_DatumFromHash = prism' DatumFromHash case _ of + (DatumFromHash a) -> Just a + _ -> Nothing + +_ValidatorFromHash :: Prism' ChainIndexQuery String +_ValidatorFromHash = prism' ValidatorFromHash case _ of + (ValidatorFromHash a) -> Just a + _ -> Nothing + +_MintingPolicyFromHash :: Prism' ChainIndexQuery String +_MintingPolicyFromHash = prism' MintingPolicyFromHash case _ of + (MintingPolicyFromHash a) -> Just a + _ -> Nothing + +_StakeValidatorFromHash :: Prism' ChainIndexQuery String +_StakeValidatorFromHash = prism' StakeValidatorFromHash case _ of + (StakeValidatorFromHash a) -> Just a + _ -> Nothing + +_RedeemerFromHash :: Prism' ChainIndexQuery String +_RedeemerFromHash = prism' RedeemerFromHash case _ of + (RedeemerFromHash a) -> Just a + _ -> Nothing + +_TxOutFromRef :: Prism' ChainIndexQuery TxOutRef +_TxOutFromRef = prism' TxOutFromRef case _ of + (TxOutFromRef a) -> Just a + _ -> Nothing + +_TxFromTxId :: Prism' ChainIndexQuery TxId +_TxFromTxId = prism' TxFromTxId case _ of + (TxFromTxId a) -> Just a + _ -> Nothing + +_UtxoSetMembership :: Prism' ChainIndexQuery TxOutRef +_UtxoSetMembership = prism' UtxoSetMembership case _ of + (UtxoSetMembership a) -> Just a + _ -> Nothing + +_UtxoSetAtAddress :: Prism' ChainIndexQuery + { a :: PageQuery TxOutRef, b :: Credential } +_UtxoSetAtAddress = prism' (\{ a, b } -> (UtxoSetAtAddress a b)) case _ of + (UtxoSetAtAddress a b) -> Just { a, b } + _ -> Nothing + +_UtxoSetWithCurrency :: Prism' ChainIndexQuery + { a :: PageQuery TxOutRef, b :: AssetClass } +_UtxoSetWithCurrency = prism' (\{ a, b } -> (UtxoSetWithCurrency a b)) case _ of + (UtxoSetWithCurrency a b) -> Just { a, b } + _ -> Nothing + +_GetTip :: Prism' ChainIndexQuery Unit +_GetTip = prism' (const GetTip) case _ of + GetTip -> Just unit + _ -> Nothing + +-------------------------------------------------------------------------------- + +data ChainIndexResponse + = DatumHashResponse (Maybe String) + | ValidatorHashResponse (Maybe Validator) + | MintingPolicyHashResponse (Maybe MintingPolicy) + | StakeValidatorHashResponse (Maybe StakeValidator) + | TxOutRefResponse (Maybe ChainIndexTxOut) + | RedeemerHashResponse (Maybe String) + | TxIdResponse (Maybe ChainIndexTx) + | UtxoSetMembershipResponse (Tuple Tip Boolean) + | UtxoSetAtResponse (Tuple Tip (Page TxOutRef)) + | UtxoSetWithCurrencyResponse (Tuple Tip (Page TxOutRef)) + | GetTipResponse Tip + +derive instance eqChainIndexResponse :: Eq ChainIndexResponse + +instance showChainIndexResponse :: Show ChainIndexResponse where + show a = genericShow a + +instance encodeJsonChainIndexResponse :: EncodeJson ChainIndexResponse where + encodeJson = defer \_ -> case _ of + DatumHashResponse a -> E.encodeTagged "DatumHashResponse" a + (E.maybe E.value) + ValidatorHashResponse a -> E.encodeTagged "ValidatorHashResponse" a + (E.maybe E.value) + MintingPolicyHashResponse a -> E.encodeTagged "MintingPolicyHashResponse" a + (E.maybe E.value) + StakeValidatorHashResponse a -> E.encodeTagged "StakeValidatorHashResponse" + a + (E.maybe E.value) + TxOutRefResponse a -> E.encodeTagged "TxOutRefResponse" a (E.maybe E.value) + RedeemerHashResponse a -> E.encodeTagged "RedeemerHashResponse" a + (E.maybe E.value) + TxIdResponse a -> E.encodeTagged "TxIdResponse" a (E.maybe E.value) + UtxoSetMembershipResponse a -> E.encodeTagged "UtxoSetMembershipResponse" a + (E.tuple (E.value >/\< E.value)) + UtxoSetAtResponse a -> E.encodeTagged "UtxoSetAtResponse" a + (E.tuple (E.value >/\< E.value)) + UtxoSetWithCurrencyResponse a -> E.encodeTagged + "UtxoSetWithCurrencyResponse" + a + (E.tuple (E.value >/\< E.value)) + GetTipResponse a -> E.encodeTagged "GetTipResponse" a E.value + +instance decodeJsonChainIndexResponse :: DecodeJson ChainIndexResponse where + decodeJson = defer \_ -> D.decode + $ D.sumType "ChainIndexResponse" + $ Map.fromFoldable + [ "DatumHashResponse" /\ D.content + (DatumHashResponse <$> (D.maybe D.value)) + , "ValidatorHashResponse" /\ D.content + (ValidatorHashResponse <$> (D.maybe D.value)) + , "MintingPolicyHashResponse" /\ D.content + (MintingPolicyHashResponse <$> (D.maybe D.value)) + , "StakeValidatorHashResponse" /\ D.content + (StakeValidatorHashResponse <$> (D.maybe D.value)) + , "TxOutRefResponse" /\ D.content + (TxOutRefResponse <$> (D.maybe D.value)) + , "RedeemerHashResponse" /\ D.content + (RedeemerHashResponse <$> (D.maybe D.value)) + , "TxIdResponse" /\ D.content (TxIdResponse <$> (D.maybe D.value)) + , "UtxoSetMembershipResponse" /\ D.content + (UtxoSetMembershipResponse <$> (D.tuple (D.value D.value))) + , "UtxoSetAtResponse" /\ D.content + (UtxoSetAtResponse <$> (D.tuple (D.value D.value))) + , "UtxoSetWithCurrencyResponse" /\ D.content + (UtxoSetWithCurrencyResponse <$> (D.tuple (D.value D.value))) + , "GetTipResponse" /\ D.content (GetTipResponse <$> D.value) + ] + +derive instance genericChainIndexResponse :: Generic ChainIndexResponse _ + +-------------------------------------------------------------------------------- + +_DatumHashResponse :: Prism' ChainIndexResponse (Maybe String) +_DatumHashResponse = prism' DatumHashResponse case _ of + (DatumHashResponse a) -> Just a + _ -> Nothing + +_ValidatorHashResponse :: Prism' ChainIndexResponse (Maybe Validator) +_ValidatorHashResponse = prism' ValidatorHashResponse case _ of + (ValidatorHashResponse a) -> Just a + _ -> Nothing + +_MintingPolicyHashResponse :: Prism' ChainIndexResponse (Maybe MintingPolicy) +_MintingPolicyHashResponse = prism' MintingPolicyHashResponse case _ of + (MintingPolicyHashResponse a) -> Just a + _ -> Nothing + +_StakeValidatorHashResponse :: Prism' ChainIndexResponse (Maybe StakeValidator) +_StakeValidatorHashResponse = prism' StakeValidatorHashResponse case _ of + (StakeValidatorHashResponse a) -> Just a + _ -> Nothing + +_TxOutRefResponse :: Prism' ChainIndexResponse (Maybe ChainIndexTxOut) +_TxOutRefResponse = prism' TxOutRefResponse case _ of + (TxOutRefResponse a) -> Just a + _ -> Nothing + +_RedeemerHashResponse :: Prism' ChainIndexResponse (Maybe String) +_RedeemerHashResponse = prism' RedeemerHashResponse case _ of + (RedeemerHashResponse a) -> Just a + _ -> Nothing + +_TxIdResponse :: Prism' ChainIndexResponse (Maybe ChainIndexTx) +_TxIdResponse = prism' TxIdResponse case _ of + (TxIdResponse a) -> Just a + _ -> Nothing + +_UtxoSetMembershipResponse :: Prism' ChainIndexResponse (Tuple Tip Boolean) +_UtxoSetMembershipResponse = prism' UtxoSetMembershipResponse case _ of + (UtxoSetMembershipResponse a) -> Just a + _ -> Nothing + +_UtxoSetAtResponse :: Prism' ChainIndexResponse (Tuple Tip (Page TxOutRef)) +_UtxoSetAtResponse = prism' UtxoSetAtResponse case _ of + (UtxoSetAtResponse a) -> Just a + _ -> Nothing + +_UtxoSetWithCurrencyResponse :: Prism' ChainIndexResponse + (Tuple Tip (Page TxOutRef)) +_UtxoSetWithCurrencyResponse = prism' UtxoSetWithCurrencyResponse case _ of + (UtxoSetWithCurrencyResponse a) -> Just a + _ -> Nothing + +_GetTipResponse :: Prism' ChainIndexResponse Tip +_GetTipResponse = prism' GetTipResponse case _ of + (GetTipResponse a) -> Just a + _ -> Nothing + +-------------------------------------------------------------------------------- + +data BalanceTxResponse + = BalanceTxFailed WalletAPIError + | BalanceTxSuccess (Either RawJson Tx) + +derive instance eqBalanceTxResponse :: Eq BalanceTxResponse + +instance showBalanceTxResponse :: Show BalanceTxResponse where + show a = genericShow a + +instance encodeJsonBalanceTxResponse :: EncodeJson BalanceTxResponse where + encodeJson = defer \_ -> case _ of + BalanceTxFailed a -> E.encodeTagged "BalanceTxFailed" a E.value + BalanceTxSuccess a -> E.encodeTagged "BalanceTxSuccess" a + (E.either E.value E.value) + +instance decodeJsonBalanceTxResponse :: DecodeJson BalanceTxResponse where + decodeJson = defer \_ -> D.decode + $ D.sumType "BalanceTxResponse" + $ Map.fromFoldable + [ "BalanceTxFailed" /\ D.content (BalanceTxFailed <$> D.value) + , "BalanceTxSuccess" /\ D.content + (BalanceTxSuccess <$> (D.either D.value D.value)) + ] + +derive instance genericBalanceTxResponse :: Generic BalanceTxResponse _ + +-------------------------------------------------------------------------------- + +_BalanceTxFailed :: Prism' BalanceTxResponse WalletAPIError +_BalanceTxFailed = prism' BalanceTxFailed case _ of + (BalanceTxFailed a) -> Just a + _ -> Nothing + +_BalanceTxSuccess :: Prism' BalanceTxResponse (Either RawJson Tx) +_BalanceTxSuccess = prism' BalanceTxSuccess case _ of + (BalanceTxSuccess a) -> Just a + _ -> Nothing + +-------------------------------------------------------------------------------- + +data WriteBalancedTxResponse + = WriteBalancedTxFailed WalletAPIError + | WriteBalancedTxSuccess (Either RawJson Tx) + +derive instance eqWriteBalancedTxResponse :: Eq WriteBalancedTxResponse + +instance showWriteBalancedTxResponse :: Show WriteBalancedTxResponse where + show a = genericShow a + +instance encodeJsonWriteBalancedTxResponse :: EncodeJson WriteBalancedTxResponse where + encodeJson = defer \_ -> case _ of + WriteBalancedTxFailed a -> E.encodeTagged "WriteBalancedTxFailed" a E.value + WriteBalancedTxSuccess a -> E.encodeTagged "WriteBalancedTxSuccess" a + (E.either E.value E.value) + +instance decodeJsonWriteBalancedTxResponse :: DecodeJson WriteBalancedTxResponse where + decodeJson = defer \_ -> D.decode + $ D.sumType "WriteBalancedTxResponse" + $ Map.fromFoldable + [ "WriteBalancedTxFailed" /\ D.content + (WriteBalancedTxFailed <$> D.value) + , "WriteBalancedTxSuccess" /\ D.content + (WriteBalancedTxSuccess <$> (D.either D.value D.value)) + ] + +derive instance genericWriteBalancedTxResponse :: + Generic WriteBalancedTxResponse _ + +-------------------------------------------------------------------------------- + +_WriteBalancedTxFailed :: Prism' WriteBalancedTxResponse WalletAPIError +_WriteBalancedTxFailed = prism' WriteBalancedTxFailed case _ of + (WriteBalancedTxFailed a) -> Just a + _ -> Nothing + +_WriteBalancedTxSuccess :: Prism' WriteBalancedTxResponse (Either RawJson Tx) +_WriteBalancedTxSuccess = prism' WriteBalancedTxSuccess case _ of + (WriteBalancedTxSuccess a) -> Just a + _ -> Nothing + +-------------------------------------------------------------------------------- + +newtype ActiveEndpoint = ActiveEndpoint + { aeDescription :: EndpointDescription + , aeMetadata :: Maybe RawJson + } + +derive instance eqActiveEndpoint :: Eq ActiveEndpoint + +instance showActiveEndpoint :: Show ActiveEndpoint where + show a = genericShow a + +instance encodeJsonActiveEndpoint :: EncodeJson ActiveEndpoint where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { aeDescription: E.value :: _ EndpointDescription + , aeMetadata: (E.maybe E.value) :: _ (Maybe RawJson) + } + ) + +instance decodeJsonActiveEndpoint :: DecodeJson ActiveEndpoint where + decodeJson = defer \_ -> D.decode $ + ( ActiveEndpoint <$> D.record "ActiveEndpoint" + { aeDescription: D.value :: _ EndpointDescription + , aeMetadata: (D.maybe D.value) :: _ (Maybe RawJson) + } + ) + +derive instance genericActiveEndpoint :: Generic ActiveEndpoint _ + +derive instance newtypeActiveEndpoint :: Newtype ActiveEndpoint _ + +-------------------------------------------------------------------------------- + +_ActiveEndpoint :: Iso' ActiveEndpoint + { aeDescription :: EndpointDescription, aeMetadata :: Maybe RawJson } +_ActiveEndpoint = _Newtype \ No newline at end of file diff --git a/marlowe-playground-client/generated/Plutus/Contract/Resumable.purs b/marlowe-playground-client/generated/Plutus/Contract/Resumable.purs new file mode 100644 index 0000000000..43a2f7cbcc --- /dev/null +++ b/marlowe-playground-client/generated/Plutus/Contract/Resumable.purs @@ -0,0 +1,158 @@ +-- File auto generated by purescript-bridge! -- +module Plutus.Contract.Resumable where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Type.Proxy (Proxy(Proxy)) + +newtype Request a = Request + { rqID :: RequestID + , itID :: IterationID + , rqRequest :: a + } + +derive instance eqRequest :: (Eq a) => Eq (Request a) + +instance showRequest :: (Show a) => Show (Request a) where + show a = genericShow a + +instance encodeJsonRequest :: (EncodeJson a) => EncodeJson (Request a) where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { rqID: E.value :: _ RequestID + , itID: E.value :: _ IterationID + , rqRequest: E.value :: _ a + } + ) + +instance decodeJsonRequest :: (DecodeJson a) => DecodeJson (Request a) where + decodeJson = defer \_ -> D.decode $ + ( Request <$> D.record "Request" + { rqID: D.value :: _ RequestID + , itID: D.value :: _ IterationID + , rqRequest: D.value :: _ a + } + ) + +derive instance genericRequest :: Generic (Request a) _ + +derive instance newtypeRequest :: Newtype (Request a) _ + +-------------------------------------------------------------------------------- + +_Request + :: forall a + . Iso' (Request a) { rqID :: RequestID, itID :: IterationID, rqRequest :: a } +_Request = _Newtype + +-------------------------------------------------------------------------------- + +newtype Response a = Response + { rspRqID :: RequestID + , rspItID :: IterationID + , rspResponse :: a + } + +derive instance eqResponse :: (Eq a) => Eq (Response a) + +instance showResponse :: (Show a) => Show (Response a) where + show a = genericShow a + +instance encodeJsonResponse :: (EncodeJson a) => EncodeJson (Response a) where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { rspRqID: E.value :: _ RequestID + , rspItID: E.value :: _ IterationID + , rspResponse: E.value :: _ a + } + ) + +instance decodeJsonResponse :: (DecodeJson a) => DecodeJson (Response a) where + decodeJson = defer \_ -> D.decode $ + ( Response <$> D.record "Response" + { rspRqID: D.value :: _ RequestID + , rspItID: D.value :: _ IterationID + , rspResponse: D.value :: _ a + } + ) + +derive instance genericResponse :: Generic (Response a) _ + +derive instance newtypeResponse :: Newtype (Response a) _ + +-------------------------------------------------------------------------------- + +_Response + :: forall a + . Iso' (Response a) + { rspRqID :: RequestID, rspItID :: IterationID, rspResponse :: a } +_Response = _Newtype + +-------------------------------------------------------------------------------- + +newtype RequestID = RequestID Int + +derive instance eqRequestID :: Eq RequestID + +derive instance ordRequestID :: Ord RequestID + +instance showRequestID :: Show RequestID where + show a = genericShow a + +instance encodeJsonRequestID :: EncodeJson RequestID where + encodeJson = defer \_ -> E.encode $ unwrap >$< E.value + +instance decodeJsonRequestID :: DecodeJson RequestID where + decodeJson = defer \_ -> D.decode $ (RequestID <$> D.value) + +derive instance genericRequestID :: Generic RequestID _ + +derive instance newtypeRequestID :: Newtype RequestID _ + +-------------------------------------------------------------------------------- + +_RequestID :: Iso' RequestID Int +_RequestID = _Newtype + +-------------------------------------------------------------------------------- + +newtype IterationID = IterationID Int + +derive instance eqIterationID :: Eq IterationID + +derive instance ordIterationID :: Ord IterationID + +instance showIterationID :: Show IterationID where + show a = genericShow a + +instance encodeJsonIterationID :: EncodeJson IterationID where + encodeJson = defer \_ -> E.encode $ unwrap >$< E.value + +instance decodeJsonIterationID :: DecodeJson IterationID where + decodeJson = defer \_ -> D.decode $ (IterationID <$> D.value) + +derive instance genericIterationID :: Generic IterationID _ + +derive instance newtypeIterationID :: Newtype IterationID _ + +-------------------------------------------------------------------------------- + +_IterationID :: Iso' IterationID Int +_IterationID = _Newtype \ No newline at end of file diff --git a/marlowe-playground-client/generated/Plutus/Trace/Emulator/Types.purs b/marlowe-playground-client/generated/Plutus/Trace/Emulator/Types.purs new file mode 100644 index 0000000000..1203295477 --- /dev/null +++ b/marlowe-playground-client/generated/Plutus/Trace/Emulator/Types.purs @@ -0,0 +1,390 @@ +-- File auto generated by purescript-bridge! -- +module Plutus.Trace.Emulator.Types where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.RawJson (RawJson) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Plutus.Contract.Resumable (Request, Response) +import Plutus.Trace.Scheduler (ThreadId) +import Type.Proxy (Proxy(Proxy)) +import Wallet.Emulator.Error (WalletAPIError) +import Wallet.Emulator.Wallet (Wallet) +import Wallet.Types + ( ContractInstanceId + , EndpointDescription + , Notification + , NotificationError + ) + +newtype ContractInstanceLog = ContractInstanceLog + { _cilMessage :: ContractInstanceMsg + , _cilId :: ContractInstanceId + , _cilTag :: ContractInstanceTag + } + +derive instance eqContractInstanceLog :: Eq ContractInstanceLog + +instance showContractInstanceLog :: Show ContractInstanceLog where + show a = genericShow a + +instance encodeJsonContractInstanceLog :: EncodeJson ContractInstanceLog where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { _cilMessage: E.value :: _ ContractInstanceMsg + , _cilId: E.value :: _ ContractInstanceId + , _cilTag: E.value :: _ ContractInstanceTag + } + ) + +instance decodeJsonContractInstanceLog :: DecodeJson ContractInstanceLog where + decodeJson = defer \_ -> D.decode $ + ( ContractInstanceLog <$> D.record "ContractInstanceLog" + { _cilMessage: D.value :: _ ContractInstanceMsg + , _cilId: D.value :: _ ContractInstanceId + , _cilTag: D.value :: _ ContractInstanceTag + } + ) + +derive instance genericContractInstanceLog :: Generic ContractInstanceLog _ + +derive instance newtypeContractInstanceLog :: Newtype ContractInstanceLog _ + +-------------------------------------------------------------------------------- + +_ContractInstanceLog :: Iso' ContractInstanceLog + { _cilMessage :: ContractInstanceMsg + , _cilId :: ContractInstanceId + , _cilTag :: ContractInstanceTag + } +_ContractInstanceLog = _Newtype + +cilMessage :: Lens' ContractInstanceLog ContractInstanceMsg +cilMessage = _Newtype <<< prop (Proxy :: _ "_cilMessage") + +cilId :: Lens' ContractInstanceLog ContractInstanceId +cilId = _Newtype <<< prop (Proxy :: _ "_cilId") + +cilTag :: Lens' ContractInstanceLog ContractInstanceTag +cilTag = _Newtype <<< prop (Proxy :: _ "_cilTag") + +-------------------------------------------------------------------------------- + +data UserThreadMsg + = UserThreadErr EmulatorRuntimeError + | UserLog String + +derive instance eqUserThreadMsg :: Eq UserThreadMsg + +instance showUserThreadMsg :: Show UserThreadMsg where + show a = genericShow a + +instance encodeJsonUserThreadMsg :: EncodeJson UserThreadMsg where + encodeJson = defer \_ -> case _ of + UserThreadErr a -> E.encodeTagged "UserThreadErr" a E.value + UserLog a -> E.encodeTagged "UserLog" a E.value + +instance decodeJsonUserThreadMsg :: DecodeJson UserThreadMsg where + decodeJson = defer \_ -> D.decode + $ D.sumType "UserThreadMsg" + $ Map.fromFoldable + [ "UserThreadErr" /\ D.content (UserThreadErr <$> D.value) + , "UserLog" /\ D.content (UserLog <$> D.value) + ] + +derive instance genericUserThreadMsg :: Generic UserThreadMsg _ + +-------------------------------------------------------------------------------- + +_UserThreadErr :: Prism' UserThreadMsg EmulatorRuntimeError +_UserThreadErr = prism' UserThreadErr case _ of + (UserThreadErr a) -> Just a + _ -> Nothing + +_UserLog :: Prism' UserThreadMsg String +_UserLog = prism' UserLog case _ of + (UserLog a) -> Just a + _ -> Nothing + +-------------------------------------------------------------------------------- + +data ContractInstanceMsg + = Started + | StoppedNoError + | StoppedWithError String + | ReceiveEndpointCall EndpointDescription RawJson + | ReceiveEndpointCallSuccess + | ReceiveEndpointCallFailure NotificationError + | NoRequestsHandled + | HandledRequest (Response RawJson) + | CurrentRequests (Array (Request RawJson)) + | InstErr EmulatorRuntimeError + | ContractLog RawJson + | SendingNotification Notification + | NotificationSuccess Notification + | NotificationFailure NotificationError + | SendingContractState ThreadId + | Freezing + +derive instance eqContractInstanceMsg :: Eq ContractInstanceMsg + +instance showContractInstanceMsg :: Show ContractInstanceMsg where + show a = genericShow a + +instance encodeJsonContractInstanceMsg :: EncodeJson ContractInstanceMsg where + encodeJson = defer \_ -> case _ of + Started -> encodeJson { tag: "Started", contents: jsonNull } + StoppedNoError -> encodeJson { tag: "StoppedNoError", contents: jsonNull } + StoppedWithError a -> E.encodeTagged "StoppedWithError" a E.value + ReceiveEndpointCall a b -> E.encodeTagged "ReceiveEndpointCall" (a /\ b) + (E.tuple (E.value >/\< E.value)) + ReceiveEndpointCallSuccess -> encodeJson + { tag: "ReceiveEndpointCallSuccess", contents: jsonNull } + ReceiveEndpointCallFailure a -> E.encodeTagged "ReceiveEndpointCallFailure" + a + E.value + NoRequestsHandled -> encodeJson + { tag: "NoRequestsHandled", contents: jsonNull } + HandledRequest a -> E.encodeTagged "HandledRequest" a E.value + CurrentRequests a -> E.encodeTagged "CurrentRequests" a E.value + InstErr a -> E.encodeTagged "InstErr" a E.value + ContractLog a -> E.encodeTagged "ContractLog" a E.value + SendingNotification a -> E.encodeTagged "SendingNotification" a E.value + NotificationSuccess a -> E.encodeTagged "NotificationSuccess" a E.value + NotificationFailure a -> E.encodeTagged "NotificationFailure" a E.value + SendingContractState a -> E.encodeTagged "SendingContractState" a E.value + Freezing -> encodeJson { tag: "Freezing", contents: jsonNull } + +instance decodeJsonContractInstanceMsg :: DecodeJson ContractInstanceMsg where + decodeJson = defer \_ -> D.decode + $ D.sumType "ContractInstanceMsg" + $ Map.fromFoldable + [ "Started" /\ pure Started + , "StoppedNoError" /\ pure StoppedNoError + , "StoppedWithError" /\ D.content (StoppedWithError <$> D.value) + , "ReceiveEndpointCall" /\ D.content + (D.tuple $ ReceiveEndpointCall D.value D.value) + , "ReceiveEndpointCallSuccess" /\ pure ReceiveEndpointCallSuccess + , "ReceiveEndpointCallFailure" /\ D.content + (ReceiveEndpointCallFailure <$> D.value) + , "NoRequestsHandled" /\ pure NoRequestsHandled + , "HandledRequest" /\ D.content (HandledRequest <$> D.value) + , "CurrentRequests" /\ D.content (CurrentRequests <$> D.value) + , "InstErr" /\ D.content (InstErr <$> D.value) + , "ContractLog" /\ D.content (ContractLog <$> D.value) + , "SendingNotification" /\ D.content (SendingNotification <$> D.value) + , "NotificationSuccess" /\ D.content (NotificationSuccess <$> D.value) + , "NotificationFailure" /\ D.content (NotificationFailure <$> D.value) + , "SendingContractState" /\ D.content (SendingContractState <$> D.value) + , "Freezing" /\ pure Freezing + ] + +derive instance genericContractInstanceMsg :: Generic ContractInstanceMsg _ + +-------------------------------------------------------------------------------- + +_Started :: Prism' ContractInstanceMsg Unit +_Started = prism' (const Started) case _ of + Started -> Just unit + _ -> Nothing + +_StoppedNoError :: Prism' ContractInstanceMsg Unit +_StoppedNoError = prism' (const StoppedNoError) case _ of + StoppedNoError -> Just unit + _ -> Nothing + +_StoppedWithError :: Prism' ContractInstanceMsg String +_StoppedWithError = prism' StoppedWithError case _ of + (StoppedWithError a) -> Just a + _ -> Nothing + +_ReceiveEndpointCall :: Prism' ContractInstanceMsg + { a :: EndpointDescription, b :: RawJson } +_ReceiveEndpointCall = prism' (\{ a, b } -> (ReceiveEndpointCall a b)) case _ of + (ReceiveEndpointCall a b) -> Just { a, b } + _ -> Nothing + +_ReceiveEndpointCallSuccess :: Prism' ContractInstanceMsg Unit +_ReceiveEndpointCallSuccess = prism' (const ReceiveEndpointCallSuccess) + case _ of + ReceiveEndpointCallSuccess -> Just unit + _ -> Nothing + +_ReceiveEndpointCallFailure :: Prism' ContractInstanceMsg NotificationError +_ReceiveEndpointCallFailure = prism' ReceiveEndpointCallFailure case _ of + (ReceiveEndpointCallFailure a) -> Just a + _ -> Nothing + +_NoRequestsHandled :: Prism' ContractInstanceMsg Unit +_NoRequestsHandled = prism' (const NoRequestsHandled) case _ of + NoRequestsHandled -> Just unit + _ -> Nothing + +_HandledRequest :: Prism' ContractInstanceMsg (Response RawJson) +_HandledRequest = prism' HandledRequest case _ of + (HandledRequest a) -> Just a + _ -> Nothing + +_CurrentRequests :: Prism' ContractInstanceMsg (Array (Request RawJson)) +_CurrentRequests = prism' CurrentRequests case _ of + (CurrentRequests a) -> Just a + _ -> Nothing + +_InstErr :: Prism' ContractInstanceMsg EmulatorRuntimeError +_InstErr = prism' InstErr case _ of + (InstErr a) -> Just a + _ -> Nothing + +_ContractLog :: Prism' ContractInstanceMsg RawJson +_ContractLog = prism' ContractLog case _ of + (ContractLog a) -> Just a + _ -> Nothing + +_SendingNotification :: Prism' ContractInstanceMsg Notification +_SendingNotification = prism' SendingNotification case _ of + (SendingNotification a) -> Just a + _ -> Nothing + +_NotificationSuccess :: Prism' ContractInstanceMsg Notification +_NotificationSuccess = prism' NotificationSuccess case _ of + (NotificationSuccess a) -> Just a + _ -> Nothing + +_NotificationFailure :: Prism' ContractInstanceMsg NotificationError +_NotificationFailure = prism' NotificationFailure case _ of + (NotificationFailure a) -> Just a + _ -> Nothing + +_SendingContractState :: Prism' ContractInstanceMsg ThreadId +_SendingContractState = prism' SendingContractState case _ of + (SendingContractState a) -> Just a + _ -> Nothing + +_Freezing :: Prism' ContractInstanceMsg Unit +_Freezing = prism' (const Freezing) case _ of + Freezing -> Just unit + _ -> Nothing + +-------------------------------------------------------------------------------- + +newtype ContractInstanceTag = ContractInstanceTag + { unContractInstanceTag :: String } + +derive instance eqContractInstanceTag :: Eq ContractInstanceTag + +instance showContractInstanceTag :: Show ContractInstanceTag where + show a = genericShow a + +instance encodeJsonContractInstanceTag :: EncodeJson ContractInstanceTag where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { unContractInstanceTag: E.value :: _ String } + ) + +instance decodeJsonContractInstanceTag :: DecodeJson ContractInstanceTag where + decodeJson = defer \_ -> D.decode $ + ( ContractInstanceTag <$> D.record "ContractInstanceTag" + { unContractInstanceTag: D.value :: _ String } + ) + +derive instance genericContractInstanceTag :: Generic ContractInstanceTag _ + +derive instance newtypeContractInstanceTag :: Newtype ContractInstanceTag _ + +-------------------------------------------------------------------------------- + +_ContractInstanceTag :: Iso' ContractInstanceTag + { unContractInstanceTag :: String } +_ContractInstanceTag = _Newtype + +-------------------------------------------------------------------------------- + +data EmulatorRuntimeError + = ThreadIdNotFound ContractInstanceId + | InstanceIdNotFound Wallet + | EmulatorJSONDecodingError String RawJson + | GenericError String + | EmulatedWalletError WalletAPIError + | AssertionError String + +derive instance eqEmulatorRuntimeError :: Eq EmulatorRuntimeError + +instance showEmulatorRuntimeError :: Show EmulatorRuntimeError where + show a = genericShow a + +instance encodeJsonEmulatorRuntimeError :: EncodeJson EmulatorRuntimeError where + encodeJson = defer \_ -> case _ of + ThreadIdNotFound a -> E.encodeTagged "ThreadIdNotFound" a E.value + InstanceIdNotFound a -> E.encodeTagged "InstanceIdNotFound" a E.value + EmulatorJSONDecodingError a b -> E.encodeTagged "EmulatorJSONDecodingError" + (a /\ b) + (E.tuple (E.value >/\< E.value)) + GenericError a -> E.encodeTagged "GenericError" a E.value + EmulatedWalletError a -> E.encodeTagged "EmulatedWalletError" a E.value + AssertionError a -> E.encodeTagged "AssertionError" a E.value + +instance decodeJsonEmulatorRuntimeError :: DecodeJson EmulatorRuntimeError where + decodeJson = defer \_ -> D.decode + $ D.sumType "EmulatorRuntimeError" + $ Map.fromFoldable + [ "ThreadIdNotFound" /\ D.content (ThreadIdNotFound <$> D.value) + , "InstanceIdNotFound" /\ D.content (InstanceIdNotFound <$> D.value) + , "EmulatorJSONDecodingError" /\ D.content + (D.tuple $ EmulatorJSONDecodingError D.value D.value) + , "GenericError" /\ D.content (GenericError <$> D.value) + , "EmulatedWalletError" /\ D.content (EmulatedWalletError <$> D.value) + , "AssertionError" /\ D.content (AssertionError <$> D.value) + ] + +derive instance genericEmulatorRuntimeError :: Generic EmulatorRuntimeError _ + +-------------------------------------------------------------------------------- + +_ThreadIdNotFound :: Prism' EmulatorRuntimeError ContractInstanceId +_ThreadIdNotFound = prism' ThreadIdNotFound case _ of + (ThreadIdNotFound a) -> Just a + _ -> Nothing + +_InstanceIdNotFound :: Prism' EmulatorRuntimeError Wallet +_InstanceIdNotFound = prism' InstanceIdNotFound case _ of + (InstanceIdNotFound a) -> Just a + _ -> Nothing + +_EmulatorJSONDecodingError :: Prism' EmulatorRuntimeError + { a :: String, b :: RawJson } +_EmulatorJSONDecodingError = prism' + (\{ a, b } -> (EmulatorJSONDecodingError a b)) + case _ of + (EmulatorJSONDecodingError a b) -> Just { a, b } + _ -> Nothing + +_GenericError :: Prism' EmulatorRuntimeError String +_GenericError = prism' GenericError case _ of + (GenericError a) -> Just a + _ -> Nothing + +_EmulatedWalletError :: Prism' EmulatorRuntimeError WalletAPIError +_EmulatedWalletError = prism' EmulatedWalletError case _ of + (EmulatedWalletError a) -> Just a + _ -> Nothing + +_AssertionError :: Prism' EmulatorRuntimeError String +_AssertionError = prism' AssertionError case _ of + (AssertionError a) -> Just a + _ -> Nothing \ No newline at end of file diff --git a/marlowe-playground-client/generated/Plutus/Trace/Scheduler.purs b/marlowe-playground-client/generated/Plutus/Trace/Scheduler.purs new file mode 100644 index 0000000000..b8d8985414 --- /dev/null +++ b/marlowe-playground-client/generated/Plutus/Trace/Scheduler.purs @@ -0,0 +1,251 @@ +-- File auto generated by purescript-bridge! -- +module Plutus.Trace.Scheduler where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Bounded.Generic (genericBottom, genericTop) +import Data.Enum (class Enum) +import Data.Enum.Generic (genericPred, genericSucc) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Plutus.Trace.Tag (Tag) +import Type.Proxy (Proxy(Proxy)) + +newtype SchedulerLog = SchedulerLog + { slEvent :: ThreadEvent + , slThread :: ThreadId + , slTag :: Tag + , slPrio :: Priority + } + +derive instance eqSchedulerLog :: Eq SchedulerLog + +instance showSchedulerLog :: Show SchedulerLog where + show a = genericShow a + +instance encodeJsonSchedulerLog :: EncodeJson SchedulerLog where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { slEvent: E.value :: _ ThreadEvent + , slThread: E.value :: _ ThreadId + , slTag: E.value :: _ Tag + , slPrio: E.value :: _ Priority + } + ) + +instance decodeJsonSchedulerLog :: DecodeJson SchedulerLog where + decodeJson = defer \_ -> D.decode $ + ( SchedulerLog <$> D.record "SchedulerLog" + { slEvent: D.value :: _ ThreadEvent + , slThread: D.value :: _ ThreadId + , slTag: D.value :: _ Tag + , slPrio: D.value :: _ Priority + } + ) + +derive instance genericSchedulerLog :: Generic SchedulerLog _ + +derive instance newtypeSchedulerLog :: Newtype SchedulerLog _ + +-------------------------------------------------------------------------------- + +_SchedulerLog :: Iso' SchedulerLog + { slEvent :: ThreadEvent + , slThread :: ThreadId + , slTag :: Tag + , slPrio :: Priority + } +_SchedulerLog = _Newtype + +-------------------------------------------------------------------------------- + +data ThreadEvent + = Stopped StopReason + | Resumed + | Suspended + | Started + | Thawed + +derive instance eqThreadEvent :: Eq ThreadEvent + +instance showThreadEvent :: Show ThreadEvent where + show a = genericShow a + +instance encodeJsonThreadEvent :: EncodeJson ThreadEvent where + encodeJson = defer \_ -> case _ of + Stopped a -> E.encodeTagged "Stopped" a E.value + Resumed -> encodeJson { tag: "Resumed", contents: jsonNull } + Suspended -> encodeJson { tag: "Suspended", contents: jsonNull } + Started -> encodeJson { tag: "Started", contents: jsonNull } + Thawed -> encodeJson { tag: "Thawed", contents: jsonNull } + +instance decodeJsonThreadEvent :: DecodeJson ThreadEvent where + decodeJson = defer \_ -> D.decode + $ D.sumType "ThreadEvent" + $ Map.fromFoldable + [ "Stopped" /\ D.content (Stopped <$> D.value) + , "Resumed" /\ pure Resumed + , "Suspended" /\ pure Suspended + , "Started" /\ pure Started + , "Thawed" /\ pure Thawed + ] + +derive instance genericThreadEvent :: Generic ThreadEvent _ + +-------------------------------------------------------------------------------- + +_Stopped :: Prism' ThreadEvent StopReason +_Stopped = prism' Stopped case _ of + (Stopped a) -> Just a + _ -> Nothing + +_Resumed :: Prism' ThreadEvent Unit +_Resumed = prism' (const Resumed) case _ of + Resumed -> Just unit + _ -> Nothing + +_Suspended :: Prism' ThreadEvent Unit +_Suspended = prism' (const Suspended) case _ of + Suspended -> Just unit + _ -> Nothing + +_Started :: Prism' ThreadEvent Unit +_Started = prism' (const Started) case _ of + Started -> Just unit + _ -> Nothing + +_Thawed :: Prism' ThreadEvent Unit +_Thawed = prism' (const Thawed) case _ of + Thawed -> Just unit + _ -> Nothing + +-------------------------------------------------------------------------------- + +newtype ThreadId = ThreadId { unThreadId :: Int } + +derive instance eqThreadId :: Eq ThreadId + +instance showThreadId :: Show ThreadId where + show a = genericShow a + +instance encodeJsonThreadId :: EncodeJson ThreadId where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { unThreadId: E.value :: _ Int } + ) + +instance decodeJsonThreadId :: DecodeJson ThreadId where + decodeJson = defer \_ -> D.decode $ + (ThreadId <$> D.record "ThreadId" { unThreadId: D.value :: _ Int }) + +derive instance genericThreadId :: Generic ThreadId _ + +derive instance newtypeThreadId :: Newtype ThreadId _ + +-------------------------------------------------------------------------------- + +_ThreadId :: Iso' ThreadId { unThreadId :: Int } +_ThreadId = _Newtype + +-------------------------------------------------------------------------------- + +data Priority + = Normal + | Sleeping + | Frozen + +derive instance eqPriority :: Eq Priority + +derive instance ordPriority :: Ord Priority + +instance showPriority :: Show Priority where + show a = genericShow a + +instance encodeJsonPriority :: EncodeJson Priority where + encodeJson = defer \_ -> E.encode E.enum + +instance decodeJsonPriority :: DecodeJson Priority where + decodeJson = defer \_ -> D.decode D.enum + +derive instance genericPriority :: Generic Priority _ + +instance enumPriority :: Enum Priority where + succ = genericSucc + pred = genericPred + +instance boundedPriority :: Bounded Priority where + bottom = genericBottom + top = genericTop + +-------------------------------------------------------------------------------- + +_Normal :: Prism' Priority Unit +_Normal = prism' (const Normal) case _ of + Normal -> Just unit + _ -> Nothing + +_Sleeping :: Prism' Priority Unit +_Sleeping = prism' (const Sleeping) case _ of + Sleeping -> Just unit + _ -> Nothing + +_Frozen :: Prism' Priority Unit +_Frozen = prism' (const Frozen) case _ of + Frozen -> Just unit + _ -> Nothing + +-------------------------------------------------------------------------------- + +data StopReason + = ThreadDone + | ThreadExit + +derive instance eqStopReason :: Eq StopReason + +derive instance ordStopReason :: Ord StopReason + +instance showStopReason :: Show StopReason where + show a = genericShow a + +instance encodeJsonStopReason :: EncodeJson StopReason where + encodeJson = defer \_ -> E.encode E.enum + +instance decodeJsonStopReason :: DecodeJson StopReason where + decodeJson = defer \_ -> D.decode D.enum + +derive instance genericStopReason :: Generic StopReason _ + +instance enumStopReason :: Enum StopReason where + succ = genericSucc + pred = genericPred + +instance boundedStopReason :: Bounded StopReason where + bottom = genericBottom + top = genericTop + +-------------------------------------------------------------------------------- + +_ThreadDone :: Prism' StopReason Unit +_ThreadDone = prism' (const ThreadDone) case _ of + ThreadDone -> Just unit + _ -> Nothing + +_ThreadExit :: Prism' StopReason Unit +_ThreadExit = prism' (const ThreadExit) case _ of + ThreadExit -> Just unit + _ -> Nothing \ No newline at end of file diff --git a/marlowe-playground-client/generated/Plutus/Trace/Tag.purs b/marlowe-playground-client/generated/Plutus/Trace/Tag.purs new file mode 100644 index 0000000000..dc26d9e3a9 --- /dev/null +++ b/marlowe-playground-client/generated/Plutus/Trace/Tag.purs @@ -0,0 +1,49 @@ +-- File auto generated by purescript-bridge! -- +module Plutus.Trace.Tag where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Type.Proxy (Proxy(Proxy)) + +newtype Tag = Tag { unTag :: String } + +derive instance eqTag :: Eq Tag + +instance showTag :: Show Tag where + show a = genericShow a + +instance encodeJsonTag :: EncodeJson Tag where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { unTag: E.value :: _ String } + ) + +instance decodeJsonTag :: DecodeJson Tag where + decodeJson = defer \_ -> D.decode $ + (Tag <$> D.record "Tag" { unTag: D.value :: _ String }) + +derive instance genericTag :: Generic Tag _ + +derive instance newtypeTag :: Newtype Tag _ + +-------------------------------------------------------------------------------- + +_Tag :: Iso' Tag { unTag :: String } +_Tag = _Newtype \ No newline at end of file diff --git a/marlowe-playground-client/generated/Plutus/V1/Ledger/Ada.purs b/marlowe-playground-client/generated/Plutus/V1/Ledger/Ada.purs new file mode 100644 index 0000000000..42e7714417 --- /dev/null +++ b/marlowe-playground-client/generated/Plutus/V1/Ledger/Ada.purs @@ -0,0 +1,50 @@ +-- File auto generated by purescript-bridge! -- +module Plutus.V1.Ledger.Ada where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.BigInt.Argonaut (BigInt) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Type.Proxy (Proxy(Proxy)) + +newtype Ada = Lovelace { getLovelace :: BigInt } + +derive instance eqAda :: Eq Ada + +instance showAda :: Show Ada where + show a = genericShow a + +instance encodeJsonAda :: EncodeJson Ada where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { getLovelace: E.value :: _ BigInt } + ) + +instance decodeJsonAda :: DecodeJson Ada where + decodeJson = defer \_ -> D.decode $ + (Lovelace <$> D.record "Lovelace" { getLovelace: D.value :: _ BigInt }) + +derive instance genericAda :: Generic Ada _ + +derive instance newtypeAda :: Newtype Ada _ + +-------------------------------------------------------------------------------- + +_Lovelace :: Iso' Ada { getLovelace :: BigInt } +_Lovelace = _Newtype \ No newline at end of file diff --git a/marlowe-playground-client/generated/Plutus/V1/Ledger/Address.purs b/marlowe-playground-client/generated/Plutus/V1/Ledger/Address.purs new file mode 100644 index 0000000000..6fac16888d --- /dev/null +++ b/marlowe-playground-client/generated/Plutus/V1/Ledger/Address.purs @@ -0,0 +1,66 @@ +-- File auto generated by purescript-bridge! -- +module Plutus.V1.Ledger.Address where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Plutus.V1.Ledger.Credential (Credential, StakingCredential) +import Type.Proxy (Proxy(Proxy)) + +newtype Address = Address + { addressCredential :: Credential + , addressStakingCredential :: Maybe StakingCredential + } + +derive instance eqAddress :: Eq Address + +derive instance ordAddress :: Ord Address + +instance showAddress :: Show Address where + show a = genericShow a + +instance encodeJsonAddress :: EncodeJson Address where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { addressCredential: E.value :: _ Credential + , addressStakingCredential: + (E.maybe E.value) :: _ (Maybe StakingCredential) + } + ) + +instance decodeJsonAddress :: DecodeJson Address where + decodeJson = defer \_ -> D.decode $ + ( Address <$> D.record "Address" + { addressCredential: D.value :: _ Credential + , addressStakingCredential: + (D.maybe D.value) :: _ (Maybe StakingCredential) + } + ) + +derive instance genericAddress :: Generic Address _ + +derive instance newtypeAddress :: Newtype Address _ + +-------------------------------------------------------------------------------- + +_Address :: Iso' Address + { addressCredential :: Credential + , addressStakingCredential :: Maybe StakingCredential + } +_Address = _Newtype \ No newline at end of file diff --git a/marlowe-playground-client/generated/Plutus/V1/Ledger/Credential.purs b/marlowe-playground-client/generated/Plutus/V1/Ledger/Credential.purs new file mode 100644 index 0000000000..c19b3e3c7e --- /dev/null +++ b/marlowe-playground-client/generated/Plutus/V1/Ledger/Credential.purs @@ -0,0 +1,106 @@ +-- File auto generated by purescript-bridge! -- +module Plutus.V1.Ledger.Credential where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.BigInt.Argonaut (BigInt) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Plutus.V1.Ledger.Crypto (PubKeyHash) +import Type.Proxy (Proxy(Proxy)) + +data Credential + = PubKeyCredential PubKeyHash + | ScriptCredential String + +derive instance eqCredential :: Eq Credential + +derive instance ordCredential :: Ord Credential + +instance showCredential :: Show Credential where + show a = genericShow a + +instance encodeJsonCredential :: EncodeJson Credential where + encodeJson = defer \_ -> case _ of + PubKeyCredential a -> E.encodeTagged "PubKeyCredential" a E.value + ScriptCredential a -> E.encodeTagged "ScriptCredential" a E.value + +instance decodeJsonCredential :: DecodeJson Credential where + decodeJson = defer \_ -> D.decode + $ D.sumType "Credential" + $ Map.fromFoldable + [ "PubKeyCredential" /\ D.content (PubKeyCredential <$> D.value) + , "ScriptCredential" /\ D.content (ScriptCredential <$> D.value) + ] + +derive instance genericCredential :: Generic Credential _ + +-------------------------------------------------------------------------------- + +_PubKeyCredential :: Prism' Credential PubKeyHash +_PubKeyCredential = prism' PubKeyCredential case _ of + (PubKeyCredential a) -> Just a + _ -> Nothing + +_ScriptCredential :: Prism' Credential String +_ScriptCredential = prism' ScriptCredential case _ of + (ScriptCredential a) -> Just a + _ -> Nothing + +-------------------------------------------------------------------------------- + +data StakingCredential + = StakingHash Credential + | StakingPtr BigInt BigInt BigInt + +derive instance eqStakingCredential :: Eq StakingCredential + +derive instance ordStakingCredential :: Ord StakingCredential + +instance showStakingCredential :: Show StakingCredential where + show a = genericShow a + +instance encodeJsonStakingCredential :: EncodeJson StakingCredential where + encodeJson = defer \_ -> case _ of + StakingHash a -> E.encodeTagged "StakingHash" a E.value + StakingPtr a b c -> E.encodeTagged "StakingPtr" (a /\ b /\ c) + (E.tuple (E.value >/\< E.value >/\< E.value)) + +instance decodeJsonStakingCredential :: DecodeJson StakingCredential where + decodeJson = defer \_ -> D.decode + $ D.sumType "StakingCredential" + $ Map.fromFoldable + [ "StakingHash" /\ D.content (StakingHash <$> D.value) + , "StakingPtr" /\ D.content + (D.tuple $ StakingPtr D.value D.value D.value) + ] + +derive instance genericStakingCredential :: Generic StakingCredential _ + +-------------------------------------------------------------------------------- + +_StakingHash :: Prism' StakingCredential Credential +_StakingHash = prism' StakingHash case _ of + (StakingHash a) -> Just a + _ -> Nothing + +_StakingPtr :: Prism' StakingCredential + { a :: BigInt, b :: BigInt, c :: BigInt } +_StakingPtr = prism' (\{ a, b, c } -> (StakingPtr a b c)) case _ of + (StakingPtr a b c) -> Just { a, b, c } + _ -> Nothing \ No newline at end of file diff --git a/marlowe-playground-client/generated/Plutus/V1/Ledger/Crypto.purs b/marlowe-playground-client/generated/Plutus/V1/Ledger/Crypto.purs new file mode 100644 index 0000000000..529e3bc054 --- /dev/null +++ b/marlowe-playground-client/generated/Plutus/V1/Ledger/Crypto.purs @@ -0,0 +1,113 @@ +-- File auto generated by purescript-bridge! -- +module Plutus.V1.Ledger.Crypto where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Type.Proxy (Proxy(Proxy)) + +newtype Signature = Signature { getSignature :: String } + +instance showSignature :: Show Signature where + show a = genericShow a + +derive instance eqSignature :: Eq Signature + +derive instance ordSignature :: Ord Signature + +instance encodeJsonSignature :: EncodeJson Signature where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { getSignature: E.value :: _ String } + ) + +instance decodeJsonSignature :: DecodeJson Signature where + decodeJson = defer \_ -> D.decode $ + (Signature <$> D.record "Signature" { getSignature: D.value :: _ String }) + +derive instance genericSignature :: Generic Signature _ + +derive instance newtypeSignature :: Newtype Signature _ + +-------------------------------------------------------------------------------- + +_Signature :: Iso' Signature { getSignature :: String } +_Signature = _Newtype + +-------------------------------------------------------------------------------- + +newtype PubKey = PubKey { getPubKey :: String } + +derive instance eqPubKey :: Eq PubKey + +derive instance ordPubKey :: Ord PubKey + +instance showPubKey :: Show PubKey where + show a = genericShow a + +instance encodeJsonPubKey :: EncodeJson PubKey where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { getPubKey: E.value :: _ String } + ) + +instance decodeJsonPubKey :: DecodeJson PubKey where + decodeJson = defer \_ -> D.decode $ + (PubKey <$> D.record "PubKey" { getPubKey: D.value :: _ String }) + +derive instance genericPubKey :: Generic PubKey _ + +derive instance newtypePubKey :: Newtype PubKey _ + +-------------------------------------------------------------------------------- + +_PubKey :: Iso' PubKey { getPubKey :: String } +_PubKey = _Newtype + +-------------------------------------------------------------------------------- + +newtype PubKeyHash = PubKeyHash { getPubKeyHash :: String } + +derive instance eqPubKeyHash :: Eq PubKeyHash + +derive instance ordPubKeyHash :: Ord PubKeyHash + +instance showPubKeyHash :: Show PubKeyHash where + show a = genericShow a + +instance encodeJsonPubKeyHash :: EncodeJson PubKeyHash where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { getPubKeyHash: E.value :: _ String } + ) + +instance decodeJsonPubKeyHash :: DecodeJson PubKeyHash where + decodeJson = defer \_ -> D.decode $ + ( PubKeyHash <$> D.record "PubKeyHash" + { getPubKeyHash: D.value :: _ String } + ) + +derive instance genericPubKeyHash :: Generic PubKeyHash _ + +derive instance newtypePubKeyHash :: Newtype PubKeyHash _ + +-------------------------------------------------------------------------------- + +_PubKeyHash :: Iso' PubKeyHash { getPubKeyHash :: String } +_PubKeyHash = _Newtype \ No newline at end of file diff --git a/marlowe-playground-client/generated/Plutus/V1/Ledger/DCert.purs b/marlowe-playground-client/generated/Plutus/V1/Ledger/DCert.purs new file mode 100644 index 0000000000..4fdc57cf12 --- /dev/null +++ b/marlowe-playground-client/generated/Plutus/V1/Ledger/DCert.purs @@ -0,0 +1,110 @@ +-- File auto generated by purescript-bridge! -- +module Plutus.V1.Ledger.DCert where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.BigInt.Argonaut (BigInt) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Plutus.V1.Ledger.Credential (StakingCredential) +import Plutus.V1.Ledger.Crypto (PubKeyHash) +import Type.Proxy (Proxy(Proxy)) + +data DCert + = DCertDelegRegKey StakingCredential + | DCertDelegDeRegKey StakingCredential + | DCertDelegDelegate StakingCredential PubKeyHash + | DCertPoolRegister PubKeyHash PubKeyHash + | DCertPoolRetire PubKeyHash BigInt + | DCertGenesis + | DCertMir + +derive instance eqDCert :: Eq DCert + +derive instance ordDCert :: Ord DCert + +instance showDCert :: Show DCert where + show a = genericShow a + +instance encodeJsonDCert :: EncodeJson DCert where + encodeJson = defer \_ -> case _ of + DCertDelegRegKey a -> E.encodeTagged "DCertDelegRegKey" a E.value + DCertDelegDeRegKey a -> E.encodeTagged "DCertDelegDeRegKey" a E.value + DCertDelegDelegate a b -> E.encodeTagged "DCertDelegDelegate" (a /\ b) + (E.tuple (E.value >/\< E.value)) + DCertPoolRegister a b -> E.encodeTagged "DCertPoolRegister" (a /\ b) + (E.tuple (E.value >/\< E.value)) + DCertPoolRetire a b -> E.encodeTagged "DCertPoolRetire" (a /\ b) + (E.tuple (E.value >/\< E.value)) + DCertGenesis -> encodeJson { tag: "DCertGenesis", contents: jsonNull } + DCertMir -> encodeJson { tag: "DCertMir", contents: jsonNull } + +instance decodeJsonDCert :: DecodeJson DCert where + decodeJson = defer \_ -> D.decode + $ D.sumType "DCert" + $ Map.fromFoldable + [ "DCertDelegRegKey" /\ D.content (DCertDelegRegKey <$> D.value) + , "DCertDelegDeRegKey" /\ D.content (DCertDelegDeRegKey <$> D.value) + , "DCertDelegDelegate" /\ D.content + (D.tuple $ DCertDelegDelegate D.value D.value) + , "DCertPoolRegister" /\ D.content + (D.tuple $ DCertPoolRegister D.value D.value) + , "DCertPoolRetire" /\ D.content + (D.tuple $ DCertPoolRetire D.value D.value) + , "DCertGenesis" /\ pure DCertGenesis + , "DCertMir" /\ pure DCertMir + ] + +derive instance genericDCert :: Generic DCert _ + +-------------------------------------------------------------------------------- + +_DCertDelegRegKey :: Prism' DCert StakingCredential +_DCertDelegRegKey = prism' DCertDelegRegKey case _ of + (DCertDelegRegKey a) -> Just a + _ -> Nothing + +_DCertDelegDeRegKey :: Prism' DCert StakingCredential +_DCertDelegDeRegKey = prism' DCertDelegDeRegKey case _ of + (DCertDelegDeRegKey a) -> Just a + _ -> Nothing + +_DCertDelegDelegate :: Prism' DCert { a :: StakingCredential, b :: PubKeyHash } +_DCertDelegDelegate = prism' (\{ a, b } -> (DCertDelegDelegate a b)) case _ of + (DCertDelegDelegate a b) -> Just { a, b } + _ -> Nothing + +_DCertPoolRegister :: Prism' DCert { a :: PubKeyHash, b :: PubKeyHash } +_DCertPoolRegister = prism' (\{ a, b } -> (DCertPoolRegister a b)) case _ of + (DCertPoolRegister a b) -> Just { a, b } + _ -> Nothing + +_DCertPoolRetire :: Prism' DCert { a :: PubKeyHash, b :: BigInt } +_DCertPoolRetire = prism' (\{ a, b } -> (DCertPoolRetire a b)) case _ of + (DCertPoolRetire a b) -> Just { a, b } + _ -> Nothing + +_DCertGenesis :: Prism' DCert Unit +_DCertGenesis = prism' (const DCertGenesis) case _ of + DCertGenesis -> Just unit + _ -> Nothing + +_DCertMir :: Prism' DCert Unit +_DCertMir = prism' (const DCertMir) case _ of + DCertMir -> Just unit + _ -> Nothing \ No newline at end of file diff --git a/marlowe-playground-client/generated/Plutus/V1/Ledger/Interval.purs b/marlowe-playground-client/generated/Plutus/V1/Ledger/Interval.purs new file mode 100644 index 0000000000..80192b7db1 --- /dev/null +++ b/marlowe-playground-client/generated/Plutus/V1/Ledger/Interval.purs @@ -0,0 +1,164 @@ +-- File auto generated by purescript-bridge! -- +module Plutus.V1.Ledger.Interval where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Type.Proxy (Proxy(Proxy)) + +data Extended a + = NegInf + | Finite a + | PosInf + +derive instance functorExtended :: Functor Extended + +derive instance eqExtended :: (Eq a) => Eq (Extended a) + +instance showExtended :: (Show a) => Show (Extended a) where + show a = genericShow a + +instance encodeJsonExtended :: (EncodeJson a) => EncodeJson (Extended a) where + encodeJson = defer \_ -> case _ of + NegInf -> encodeJson { tag: "NegInf", contents: jsonNull } + Finite a -> E.encodeTagged "Finite" a E.value + PosInf -> encodeJson { tag: "PosInf", contents: jsonNull } + +instance decodeJsonExtended :: (DecodeJson a) => DecodeJson (Extended a) where + decodeJson = defer \_ -> D.decode + $ D.sumType "Extended" + $ Map.fromFoldable + [ "NegInf" /\ pure NegInf + , "Finite" /\ D.content (Finite <$> D.value) + , "PosInf" /\ pure PosInf + ] + +derive instance genericExtended :: Generic (Extended a) _ + +-------------------------------------------------------------------------------- + +_NegInf :: forall a. Prism' (Extended a) Unit +_NegInf = prism' (const NegInf) case _ of + NegInf -> Just unit + _ -> Nothing + +_Finite :: forall a. Prism' (Extended a) a +_Finite = prism' Finite case _ of + (Finite a) -> Just a + _ -> Nothing + +_PosInf :: forall a. Prism' (Extended a) Unit +_PosInf = prism' (const PosInf) case _ of + PosInf -> Just unit + _ -> Nothing + +-------------------------------------------------------------------------------- + +newtype Interval a = Interval + { ivFrom :: LowerBound a + , ivTo :: UpperBound a + } + +derive instance functorInterval :: Functor Interval + +derive instance eqInterval :: (Eq a) => Eq (Interval a) + +instance showInterval :: (Show a) => Show (Interval a) where + show a = genericShow a + +instance encodeJsonInterval :: (EncodeJson a) => EncodeJson (Interval a) where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { ivFrom: E.value :: _ (LowerBound a) + , ivTo: E.value :: _ (UpperBound a) + } + ) + +instance decodeJsonInterval :: (DecodeJson a) => DecodeJson (Interval a) where + decodeJson = defer \_ -> D.decode $ + ( Interval <$> D.record "Interval" + { ivFrom: D.value :: _ (LowerBound a) + , ivTo: D.value :: _ (UpperBound a) + } + ) + +derive instance genericInterval :: Generic (Interval a) _ + +derive instance newtypeInterval :: Newtype (Interval a) _ + +-------------------------------------------------------------------------------- + +_Interval + :: forall a + . Iso' (Interval a) { ivFrom :: LowerBound a, ivTo :: UpperBound a } +_Interval = _Newtype + +-------------------------------------------------------------------------------- + +data LowerBound a = LowerBound (Extended a) Boolean + +derive instance functorLowerBound :: Functor LowerBound + +derive instance eqLowerBound :: (Eq a) => Eq (LowerBound a) + +instance showLowerBound :: (Show a) => Show (LowerBound a) where + show a = genericShow a + +instance encodeJsonLowerBound :: (EncodeJson a) => EncodeJson (LowerBound a) where + encodeJson = defer \_ -> E.encode $ (case _ of LowerBound a b -> (a /\ b)) >$< + (E.tuple (E.value >/\< E.value)) + +instance decodeJsonLowerBound :: (DecodeJson a) => DecodeJson (LowerBound a) where + decodeJson = defer \_ -> D.decode $ + (D.tuple $ LowerBound D.value D.value) + +derive instance genericLowerBound :: Generic (LowerBound a) _ + +-------------------------------------------------------------------------------- + +_LowerBound :: forall a. Iso' (LowerBound a) { a :: Extended a, b :: Boolean } +_LowerBound = iso (\(LowerBound a b) -> { a, b }) + (\{ a, b } -> (LowerBound a b)) + +-------------------------------------------------------------------------------- + +data UpperBound a = UpperBound (Extended a) Boolean + +derive instance functorUpperBound :: Functor UpperBound + +derive instance eqUpperBound :: (Eq a) => Eq (UpperBound a) + +instance showUpperBound :: (Show a) => Show (UpperBound a) where + show a = genericShow a + +instance encodeJsonUpperBound :: (EncodeJson a) => EncodeJson (UpperBound a) where + encodeJson = defer \_ -> E.encode $ (case _ of UpperBound a b -> (a /\ b)) >$< + (E.tuple (E.value >/\< E.value)) + +instance decodeJsonUpperBound :: (DecodeJson a) => DecodeJson (UpperBound a) where + decodeJson = defer \_ -> D.decode $ + (D.tuple $ UpperBound D.value D.value) + +derive instance genericUpperBound :: Generic (UpperBound a) _ + +-------------------------------------------------------------------------------- + +_UpperBound :: forall a. Iso' (UpperBound a) { a :: Extended a, b :: Boolean } +_UpperBound = iso (\(UpperBound a b) -> { a, b }) + (\{ a, b } -> (UpperBound a b)) \ No newline at end of file diff --git a/marlowe-playground-client/generated/Plutus/V1/Ledger/Scripts.purs b/marlowe-playground-client/generated/Plutus/V1/Ledger/Scripts.purs new file mode 100644 index 0000000000..78cee06917 --- /dev/null +++ b/marlowe-playground-client/generated/Plutus/V1/Ledger/Scripts.purs @@ -0,0 +1,191 @@ +-- File auto generated by purescript-bridge! -- +module Plutus.V1.Ledger.Scripts where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Type.Proxy (Proxy(Proxy)) + +newtype MintingPolicy = MintingPolicy { getMintingPolicy :: String } + +instance showMintingPolicy :: Show MintingPolicy where + show a = genericShow a + +derive instance eqMintingPolicy :: Eq MintingPolicy + +derive instance ordMintingPolicy :: Ord MintingPolicy + +instance encodeJsonMintingPolicy :: EncodeJson MintingPolicy where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { getMintingPolicy: E.value :: _ String } + ) + +instance decodeJsonMintingPolicy :: DecodeJson MintingPolicy where + decodeJson = defer \_ -> D.decode $ + ( MintingPolicy <$> D.record "MintingPolicy" + { getMintingPolicy: D.value :: _ String } + ) + +derive instance genericMintingPolicy :: Generic MintingPolicy _ + +derive instance newtypeMintingPolicy :: Newtype MintingPolicy _ + +-------------------------------------------------------------------------------- + +_MintingPolicy :: Iso' MintingPolicy { getMintingPolicy :: String } +_MintingPolicy = _Newtype + +-------------------------------------------------------------------------------- + +newtype StakeValidator = StakeValidator { getStakeValidator :: String } + +instance showStakeValidator :: Show StakeValidator where + show a = genericShow a + +derive instance eqStakeValidator :: Eq StakeValidator + +derive instance ordStakeValidator :: Ord StakeValidator + +instance encodeJsonStakeValidator :: EncodeJson StakeValidator where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { getStakeValidator: E.value :: _ String } + ) + +instance decodeJsonStakeValidator :: DecodeJson StakeValidator where + decodeJson = defer \_ -> D.decode $ + ( StakeValidator <$> D.record "StakeValidator" + { getStakeValidator: D.value :: _ String } + ) + +derive instance genericStakeValidator :: Generic StakeValidator _ + +derive instance newtypeStakeValidator :: Newtype StakeValidator _ + +-------------------------------------------------------------------------------- + +_StakeValidator :: Iso' StakeValidator { getStakeValidator :: String } +_StakeValidator = _Newtype + +-------------------------------------------------------------------------------- + +newtype Validator = Validator { getValidator :: String } + +instance showValidator :: Show Validator where + show a = genericShow a + +derive instance eqValidator :: Eq Validator + +derive instance ordValidator :: Ord Validator + +instance encodeJsonValidator :: EncodeJson Validator where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { getValidator: E.value :: _ String } + ) + +instance decodeJsonValidator :: DecodeJson Validator where + decodeJson = defer \_ -> D.decode $ + (Validator <$> D.record "Validator" { getValidator: D.value :: _ String }) + +derive instance genericValidator :: Generic Validator _ + +derive instance newtypeValidator :: Newtype Validator _ + +-------------------------------------------------------------------------------- + +_Validator :: Iso' Validator { getValidator :: String } +_Validator = _Newtype + +-------------------------------------------------------------------------------- + +data ScriptError + = EvaluationError (Array String) String + | EvaluationException String String + | MalformedScript String + +derive instance eqScriptError :: Eq ScriptError + +instance showScriptError :: Show ScriptError where + show a = genericShow a + +instance encodeJsonScriptError :: EncodeJson ScriptError where + encodeJson = defer \_ -> case _ of + EvaluationError a b -> E.encodeTagged "EvaluationError" (a /\ b) + (E.tuple (E.value >/\< E.value)) + EvaluationException a b -> E.encodeTagged "EvaluationException" (a /\ b) + (E.tuple (E.value >/\< E.value)) + MalformedScript a -> E.encodeTagged "MalformedScript" a E.value + +instance decodeJsonScriptError :: DecodeJson ScriptError where + decodeJson = defer \_ -> D.decode + $ D.sumType "ScriptError" + $ Map.fromFoldable + [ "EvaluationError" /\ D.content + (D.tuple $ EvaluationError D.value D.value) + , "EvaluationException" /\ D.content + (D.tuple $ EvaluationException D.value D.value) + , "MalformedScript" /\ D.content (MalformedScript <$> D.value) + ] + +derive instance genericScriptError :: Generic ScriptError _ + +-------------------------------------------------------------------------------- + +_EvaluationError :: Prism' ScriptError { a :: Array String, b :: String } +_EvaluationError = prism' (\{ a, b } -> (EvaluationError a b)) case _ of + (EvaluationError a b) -> Just { a, b } + _ -> Nothing + +_EvaluationException :: Prism' ScriptError { a :: String, b :: String } +_EvaluationException = prism' (\{ a, b } -> (EvaluationException a b)) case _ of + (EvaluationException a b) -> Just { a, b } + _ -> Nothing + +_MalformedScript :: Prism' ScriptError String +_MalformedScript = prism' MalformedScript case _ of + (MalformedScript a) -> Just a + _ -> Nothing + +-------------------------------------------------------------------------------- + +newtype DatumHash = DatumHash String + +derive instance eqDatumHash :: Eq DatumHash + +derive instance ordDatumHash :: Ord DatumHash + +instance showDatumHash :: Show DatumHash where + show a = genericShow a + +instance encodeJsonDatumHash :: EncodeJson DatumHash where + encodeJson = defer \_ -> E.encode $ unwrap >$< E.value + +instance decodeJsonDatumHash :: DecodeJson DatumHash where + decodeJson = defer \_ -> D.decode $ (DatumHash <$> D.value) + +derive instance genericDatumHash :: Generic DatumHash _ + +derive instance newtypeDatumHash :: Newtype DatumHash _ + +-------------------------------------------------------------------------------- + +_DatumHash :: Iso' DatumHash String +_DatumHash = _Newtype \ No newline at end of file diff --git a/marlowe-playground-client/generated/Plutus/V1/Ledger/Slot.purs b/marlowe-playground-client/generated/Plutus/V1/Ledger/Slot.purs new file mode 100644 index 0000000000..027ebb5130 --- /dev/null +++ b/marlowe-playground-client/generated/Plutus/V1/Ledger/Slot.purs @@ -0,0 +1,50 @@ +-- File auto generated by purescript-bridge! -- +module Plutus.V1.Ledger.Slot where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.BigInt.Argonaut (BigInt) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Type.Proxy (Proxy(Proxy)) + +newtype Slot = Slot { getSlot :: BigInt } + +derive instance eqSlot :: Eq Slot + +instance showSlot :: Show Slot where + show a = genericShow a + +instance encodeJsonSlot :: EncodeJson Slot where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { getSlot: E.value :: _ BigInt } + ) + +instance decodeJsonSlot :: DecodeJson Slot where + decodeJson = defer \_ -> D.decode $ + (Slot <$> D.record "Slot" { getSlot: D.value :: _ BigInt }) + +derive instance genericSlot :: Generic Slot _ + +derive instance newtypeSlot :: Newtype Slot _ + +-------------------------------------------------------------------------------- + +_Slot :: Iso' Slot { getSlot :: BigInt } +_Slot = _Newtype \ No newline at end of file diff --git a/marlowe-playground-client/generated/Plutus/V1/Ledger/Tx.purs b/marlowe-playground-client/generated/Plutus/V1/Ledger/Tx.purs new file mode 100644 index 0000000000..b1cfb3ac9a --- /dev/null +++ b/marlowe-playground-client/generated/Plutus/V1/Ledger/Tx.purs @@ -0,0 +1,407 @@ +-- File auto generated by purescript-bridge! -- +module Plutus.V1.Ledger.Tx where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.BigInt.Argonaut (BigInt) +import Data.Bounded.Generic (genericBottom, genericTop) +import Data.Enum (class Enum) +import Data.Enum.Generic (genericPred, genericSucc) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map (Map) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Set (Set) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Plutus.V1.Ledger.Address (Address) +import Plutus.V1.Ledger.Crypto (PubKey, Signature) +import Plutus.V1.Ledger.Interval (Interval) +import Plutus.V1.Ledger.Scripts (DatumHash, MintingPolicy, Validator) +import Plutus.V1.Ledger.Slot (Slot) +import Plutus.V1.Ledger.TxId (TxId) +import Plutus.V1.Ledger.Value (Value) +import Type.Proxy (Proxy(Proxy)) + +newtype Tx = Tx + { txInputs :: Set TxIn + , txCollateral :: Set TxIn + , txOutputs :: Array TxOut + , txMint :: Value + , txFee :: Value + , txValidRange :: Interval Slot + , txMintScripts :: Set MintingPolicy + , txSignatures :: Map PubKey Signature + , txRedeemers :: Map RedeemerPtr String + , txData :: Map DatumHash String + } + +derive instance eqTx :: Eq Tx + +instance showTx :: Show Tx where + show a = genericShow a + +instance encodeJsonTx :: EncodeJson Tx where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { txInputs: E.value :: _ (Set TxIn) + , txCollateral: E.value :: _ (Set TxIn) + , txOutputs: E.value :: _ (Array TxOut) + , txMint: E.value :: _ Value + , txFee: E.value :: _ Value + , txValidRange: E.value :: _ (Interval Slot) + , txMintScripts: E.value :: _ (Set MintingPolicy) + , txSignatures: + (E.dictionary E.value E.value) :: _ (Map PubKey Signature) + , txRedeemers: + (E.dictionary E.value E.value) :: _ (Map RedeemerPtr String) + , txData: (E.dictionary E.value E.value) :: _ (Map DatumHash String) + } + ) + +instance decodeJsonTx :: DecodeJson Tx where + decodeJson = defer \_ -> D.decode $ + ( Tx <$> D.record "Tx" + { txInputs: D.value :: _ (Set TxIn) + , txCollateral: D.value :: _ (Set TxIn) + , txOutputs: D.value :: _ (Array TxOut) + , txMint: D.value :: _ Value + , txFee: D.value :: _ Value + , txValidRange: D.value :: _ (Interval Slot) + , txMintScripts: D.value :: _ (Set MintingPolicy) + , txSignatures: + (D.dictionary D.value D.value) :: _ (Map PubKey Signature) + , txRedeemers: + (D.dictionary D.value D.value) :: _ (Map RedeemerPtr String) + , txData: (D.dictionary D.value D.value) :: _ (Map DatumHash String) + } + ) + +derive instance genericTx :: Generic Tx _ + +derive instance newtypeTx :: Newtype Tx _ + +-------------------------------------------------------------------------------- + +_Tx :: Iso' Tx + { txInputs :: Set TxIn + , txCollateral :: Set TxIn + , txOutputs :: Array TxOut + , txMint :: Value + , txFee :: Value + , txValidRange :: Interval Slot + , txMintScripts :: Set MintingPolicy + , txSignatures :: Map PubKey Signature + , txRedeemers :: Map RedeemerPtr String + , txData :: Map DatumHash String + } +_Tx = _Newtype + +-------------------------------------------------------------------------------- + +newtype TxIn = TxIn + { txInRef :: TxOutRef + , txInType :: Maybe TxInType + } + +derive instance eqTxIn :: Eq TxIn + +derive instance ordTxIn :: Ord TxIn + +instance showTxIn :: Show TxIn where + show a = genericShow a + +instance encodeJsonTxIn :: EncodeJson TxIn where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { txInRef: E.value :: _ TxOutRef + , txInType: (E.maybe E.value) :: _ (Maybe TxInType) + } + ) + +instance decodeJsonTxIn :: DecodeJson TxIn where + decodeJson = defer \_ -> D.decode $ + ( TxIn <$> D.record "TxIn" + { txInRef: D.value :: _ TxOutRef + , txInType: (D.maybe D.value) :: _ (Maybe TxInType) + } + ) + +derive instance genericTxIn :: Generic TxIn _ + +derive instance newtypeTxIn :: Newtype TxIn _ + +-------------------------------------------------------------------------------- + +_TxIn :: Iso' TxIn { txInRef :: TxOutRef, txInType :: Maybe TxInType } +_TxIn = _Newtype + +-------------------------------------------------------------------------------- + +newtype TxOut = TxOut + { txOutAddress :: Address + , txOutValue :: Value + , txOutDatumHash :: Maybe DatumHash + } + +derive instance eqTxOut :: Eq TxOut + +instance showTxOut :: Show TxOut where + show a = genericShow a + +instance encodeJsonTxOut :: EncodeJson TxOut where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { txOutAddress: E.value :: _ Address + , txOutValue: E.value :: _ Value + , txOutDatumHash: (E.maybe E.value) :: _ (Maybe DatumHash) + } + ) + +instance decodeJsonTxOut :: DecodeJson TxOut where + decodeJson = defer \_ -> D.decode $ + ( TxOut <$> D.record "TxOut" + { txOutAddress: D.value :: _ Address + , txOutValue: D.value :: _ Value + , txOutDatumHash: (D.maybe D.value) :: _ (Maybe DatumHash) + } + ) + +derive instance genericTxOut :: Generic TxOut _ + +derive instance newtypeTxOut :: Newtype TxOut _ + +-------------------------------------------------------------------------------- + +_TxOut :: Iso' TxOut + { txOutAddress :: Address + , txOutValue :: Value + , txOutDatumHash :: Maybe DatumHash + } +_TxOut = _Newtype + +-------------------------------------------------------------------------------- + +newtype TxOutTx = TxOutTx + { txOutTxTx :: Tx + , txOutTxOut :: TxOut + } + +derive instance eqTxOutTx :: Eq TxOutTx + +instance showTxOutTx :: Show TxOutTx where + show a = genericShow a + +instance encodeJsonTxOutTx :: EncodeJson TxOutTx where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { txOutTxTx: E.value :: _ Tx + , txOutTxOut: E.value :: _ TxOut + } + ) + +instance decodeJsonTxOutTx :: DecodeJson TxOutTx where + decodeJson = defer \_ -> D.decode $ + ( TxOutTx <$> D.record "TxOutTx" + { txOutTxTx: D.value :: _ Tx + , txOutTxOut: D.value :: _ TxOut + } + ) + +derive instance genericTxOutTx :: Generic TxOutTx _ + +derive instance newtypeTxOutTx :: Newtype TxOutTx _ + +-------------------------------------------------------------------------------- + +_TxOutTx :: Iso' TxOutTx { txOutTxTx :: Tx, txOutTxOut :: TxOut } +_TxOutTx = _Newtype + +-------------------------------------------------------------------------------- + +newtype TxOutRef = TxOutRef + { txOutRefId :: TxId + , txOutRefIdx :: BigInt + } + +derive instance eqTxOutRef :: Eq TxOutRef + +derive instance ordTxOutRef :: Ord TxOutRef + +instance showTxOutRef :: Show TxOutRef where + show a = genericShow a + +instance encodeJsonTxOutRef :: EncodeJson TxOutRef where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { txOutRefId: E.value :: _ TxId + , txOutRefIdx: E.value :: _ BigInt + } + ) + +instance decodeJsonTxOutRef :: DecodeJson TxOutRef where + decodeJson = defer \_ -> D.decode $ + ( TxOutRef <$> D.record "TxOutRef" + { txOutRefId: D.value :: _ TxId + , txOutRefIdx: D.value :: _ BigInt + } + ) + +derive instance genericTxOutRef :: Generic TxOutRef _ + +derive instance newtypeTxOutRef :: Newtype TxOutRef _ + +-------------------------------------------------------------------------------- + +_TxOutRef :: Iso' TxOutRef { txOutRefId :: TxId, txOutRefIdx :: BigInt } +_TxOutRef = _Newtype + +-------------------------------------------------------------------------------- + +data RedeemerPtr = RedeemerPtr ScriptTag BigInt + +instance showRedeemerPtr :: Show RedeemerPtr where + show a = genericShow a + +derive instance eqRedeemerPtr :: Eq RedeemerPtr + +derive instance ordRedeemerPtr :: Ord RedeemerPtr + +instance encodeJsonRedeemerPtr :: EncodeJson RedeemerPtr where + encodeJson = defer \_ -> E.encode $ (case _ of RedeemerPtr a b -> (a /\ b)) + >$< (E.tuple (E.value >/\< E.value)) + +instance decodeJsonRedeemerPtr :: DecodeJson RedeemerPtr where + decodeJson = defer \_ -> D.decode $ + (D.tuple $ RedeemerPtr D.value D.value) + +derive instance genericRedeemerPtr :: Generic RedeemerPtr _ + +-------------------------------------------------------------------------------- + +_RedeemerPtr :: Iso' RedeemerPtr { a :: ScriptTag, b :: BigInt } +_RedeemerPtr = iso (\(RedeemerPtr a b) -> { a, b }) + (\{ a, b } -> (RedeemerPtr a b)) + +-------------------------------------------------------------------------------- + +data ScriptTag + = Spend + | Mint + | Cert + | Reward + +instance showScriptTag :: Show ScriptTag where + show a = genericShow a + +derive instance eqScriptTag :: Eq ScriptTag + +derive instance ordScriptTag :: Ord ScriptTag + +instance encodeJsonScriptTag :: EncodeJson ScriptTag where + encodeJson = defer \_ -> E.encode E.enum + +instance decodeJsonScriptTag :: DecodeJson ScriptTag where + decodeJson = defer \_ -> D.decode D.enum + +derive instance genericScriptTag :: Generic ScriptTag _ + +instance enumScriptTag :: Enum ScriptTag where + succ = genericSucc + pred = genericPred + +instance boundedScriptTag :: Bounded ScriptTag where + bottom = genericBottom + top = genericTop + +-------------------------------------------------------------------------------- + +_Spend :: Prism' ScriptTag Unit +_Spend = prism' (const Spend) case _ of + Spend -> Just unit + _ -> Nothing + +_Mint :: Prism' ScriptTag Unit +_Mint = prism' (const Mint) case _ of + Mint -> Just unit + _ -> Nothing + +_Cert :: Prism' ScriptTag Unit +_Cert = prism' (const Cert) case _ of + Cert -> Just unit + _ -> Nothing + +_Reward :: Prism' ScriptTag Unit +_Reward = prism' (const Reward) case _ of + Reward -> Just unit + _ -> Nothing + +-------------------------------------------------------------------------------- + +data TxInType + = ConsumeScriptAddress Validator String String + | ConsumePublicKeyAddress + | ConsumeSimpleScriptAddress + +instance showTxInType :: Show TxInType where + show a = genericShow a + +derive instance eqTxInType :: Eq TxInType + +derive instance ordTxInType :: Ord TxInType + +instance encodeJsonTxInType :: EncodeJson TxInType where + encodeJson = defer \_ -> case _ of + ConsumeScriptAddress a b c -> E.encodeTagged "ConsumeScriptAddress" + (a /\ b /\ c) + (E.tuple (E.value >/\< E.value >/\< E.value)) + ConsumePublicKeyAddress -> encodeJson + { tag: "ConsumePublicKeyAddress", contents: jsonNull } + ConsumeSimpleScriptAddress -> encodeJson + { tag: "ConsumeSimpleScriptAddress", contents: jsonNull } + +instance decodeJsonTxInType :: DecodeJson TxInType where + decodeJson = defer \_ -> D.decode + $ D.sumType "TxInType" + $ Map.fromFoldable + [ "ConsumeScriptAddress" /\ D.content + ( D.tuple $ ConsumeScriptAddress D.value D.value + D.value + ) + , "ConsumePublicKeyAddress" /\ pure ConsumePublicKeyAddress + , "ConsumeSimpleScriptAddress" /\ pure ConsumeSimpleScriptAddress + ] + +derive instance genericTxInType :: Generic TxInType _ + +-------------------------------------------------------------------------------- + +_ConsumeScriptAddress :: Prism' TxInType + { a :: Validator, b :: String, c :: String } +_ConsumeScriptAddress = prism' (\{ a, b, c } -> (ConsumeScriptAddress a b c)) + case _ of + (ConsumeScriptAddress a b c) -> Just { a, b, c } + _ -> Nothing + +_ConsumePublicKeyAddress :: Prism' TxInType Unit +_ConsumePublicKeyAddress = prism' (const ConsumePublicKeyAddress) case _ of + ConsumePublicKeyAddress -> Just unit + _ -> Nothing + +_ConsumeSimpleScriptAddress :: Prism' TxInType Unit +_ConsumeSimpleScriptAddress = prism' (const ConsumeSimpleScriptAddress) + case _ of + ConsumeSimpleScriptAddress -> Just unit + _ -> Nothing \ No newline at end of file diff --git a/marlowe-playground-client/generated/Plutus/V1/Ledger/TxId.purs b/marlowe-playground-client/generated/Plutus/V1/Ledger/TxId.purs new file mode 100644 index 0000000000..a3c13bc8c8 --- /dev/null +++ b/marlowe-playground-client/generated/Plutus/V1/Ledger/TxId.purs @@ -0,0 +1,51 @@ +-- File auto generated by purescript-bridge! -- +module Plutus.V1.Ledger.TxId where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Type.Proxy (Proxy(Proxy)) + +newtype TxId = TxId { getTxId :: String } + +derive instance eqTxId :: Eq TxId + +derive instance ordTxId :: Ord TxId + +instance showTxId :: Show TxId where + show a = genericShow a + +instance encodeJsonTxId :: EncodeJson TxId where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { getTxId: E.value :: _ String } + ) + +instance decodeJsonTxId :: DecodeJson TxId where + decodeJson = defer \_ -> D.decode $ + (TxId <$> D.record "TxId" { getTxId: D.value :: _ String }) + +derive instance genericTxId :: Generic TxId _ + +derive instance newtypeTxId :: Newtype TxId _ + +-------------------------------------------------------------------------------- + +_TxId :: Iso' TxId { getTxId :: String } +_TxId = _Newtype \ No newline at end of file diff --git a/marlowe-playground-client/generated/Plutus/V1/Ledger/Value.purs b/marlowe-playground-client/generated/Plutus/V1/Ledger/Value.purs new file mode 100644 index 0000000000..67761c77a7 --- /dev/null +++ b/marlowe-playground-client/generated/Plutus/V1/Ledger/Value.purs @@ -0,0 +1,156 @@ +-- File auto generated by purescript-bridge! -- +module Plutus.V1.Ledger.Value where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.BigInt.Argonaut (BigInt) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple (Tuple) +import Data.Tuple.Nested ((/\)) +import PlutusTx.AssocMap (Map) +import Type.Proxy (Proxy(Proxy)) + +newtype Value = Value { getValue :: Map CurrencySymbol (Map TokenName BigInt) } + +derive instance eqValue :: Eq Value + +instance showValue :: Show Value where + show a = genericShow a + +instance encodeJsonValue :: EncodeJson Value where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { getValue: E.value :: _ (Map CurrencySymbol (Map TokenName BigInt)) } + ) + +instance decodeJsonValue :: DecodeJson Value where + decodeJson = defer \_ -> D.decode $ + ( Value <$> D.record "Value" + { getValue: D.value :: _ (Map CurrencySymbol (Map TokenName BigInt)) } + ) + +derive instance genericValue :: Generic Value _ + +derive instance newtypeValue :: Newtype Value _ + +-------------------------------------------------------------------------------- + +_Value :: Iso' Value { getValue :: Map CurrencySymbol (Map TokenName BigInt) } +_Value = _Newtype + +-------------------------------------------------------------------------------- + +newtype CurrencySymbol = CurrencySymbol { unCurrencySymbol :: String } + +instance showCurrencySymbol :: Show CurrencySymbol where + show a = genericShow a + +derive instance eqCurrencySymbol :: Eq CurrencySymbol + +derive instance ordCurrencySymbol :: Ord CurrencySymbol + +instance encodeJsonCurrencySymbol :: EncodeJson CurrencySymbol where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { unCurrencySymbol: E.value :: _ String } + ) + +instance decodeJsonCurrencySymbol :: DecodeJson CurrencySymbol where + decodeJson = defer \_ -> D.decode $ + ( CurrencySymbol <$> D.record "CurrencySymbol" + { unCurrencySymbol: D.value :: _ String } + ) + +derive instance genericCurrencySymbol :: Generic CurrencySymbol _ + +derive instance newtypeCurrencySymbol :: Newtype CurrencySymbol _ + +-------------------------------------------------------------------------------- + +_CurrencySymbol :: Iso' CurrencySymbol { unCurrencySymbol :: String } +_CurrencySymbol = _Newtype + +-------------------------------------------------------------------------------- + +newtype AssetClass = AssetClass + { unAssetClass :: Tuple CurrencySymbol TokenName } + +instance showAssetClass :: Show AssetClass where + show a = genericShow a + +derive instance eqAssetClass :: Eq AssetClass + +derive instance ordAssetClass :: Ord AssetClass + +instance encodeJsonAssetClass :: EncodeJson AssetClass where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { unAssetClass: + (E.tuple (E.value >/\< E.value)) :: _ + (Tuple CurrencySymbol TokenName) + } + ) + +instance decodeJsonAssetClass :: DecodeJson AssetClass where + decodeJson = defer \_ -> D.decode $ + ( AssetClass <$> D.record "AssetClass" + { unAssetClass: + (D.tuple (D.value D.value)) :: _ + (Tuple CurrencySymbol TokenName) + } + ) + +derive instance genericAssetClass :: Generic AssetClass _ + +derive instance newtypeAssetClass :: Newtype AssetClass _ + +-------------------------------------------------------------------------------- + +_AssetClass :: Iso' AssetClass + { unAssetClass :: Tuple CurrencySymbol TokenName } +_AssetClass = _Newtype + +-------------------------------------------------------------------------------- + +newtype TokenName = TokenName { unTokenName :: String } + +instance showTokenName :: Show TokenName where + show a = genericShow a + +derive instance eqTokenName :: Eq TokenName + +derive instance ordTokenName :: Ord TokenName + +instance encodeJsonTokenName :: EncodeJson TokenName where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { unTokenName: E.value :: _ String } + ) + +instance decodeJsonTokenName :: DecodeJson TokenName where + decodeJson = defer \_ -> D.decode $ + (TokenName <$> D.record "TokenName" { unTokenName: D.value :: _ String }) + +derive instance genericTokenName :: Generic TokenName _ + +derive instance newtypeTokenName :: Newtype TokenName _ + +-------------------------------------------------------------------------------- + +_TokenName :: Iso' TokenName { unTokenName :: String } +_TokenName = _Newtype \ No newline at end of file diff --git a/marlowe-playground-client/generated/PlutusCore/Evaluation/Machine/ExMemory.purs b/marlowe-playground-client/generated/PlutusCore/Evaluation/Machine/ExMemory.purs new file mode 100644 index 0000000000..d21990fdef --- /dev/null +++ b/marlowe-playground-client/generated/PlutusCore/Evaluation/Machine/ExMemory.purs @@ -0,0 +1,69 @@ +-- File auto generated by purescript-bridge! -- +module PlutusCore.Evaluation.Machine.ExMemory where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Type.Proxy (Proxy(Proxy)) + +newtype ExCPU = ExCPU Int + +derive instance eqExCPU :: Eq ExCPU + +instance showExCPU :: Show ExCPU where + show a = genericShow a + +instance encodeJsonExCPU :: EncodeJson ExCPU where + encodeJson = defer \_ -> E.encode $ unwrap >$< E.value + +instance decodeJsonExCPU :: DecodeJson ExCPU where + decodeJson = defer \_ -> D.decode $ (ExCPU <$> D.value) + +derive instance genericExCPU :: Generic ExCPU _ + +derive instance newtypeExCPU :: Newtype ExCPU _ + +-------------------------------------------------------------------------------- + +_ExCPU :: Iso' ExCPU Int +_ExCPU = _Newtype + +-------------------------------------------------------------------------------- + +newtype ExMemory = ExMemory Int + +derive instance eqExMemory :: Eq ExMemory + +instance showExMemory :: Show ExMemory where + show a = genericShow a + +instance encodeJsonExMemory :: EncodeJson ExMemory where + encodeJson = defer \_ -> E.encode $ unwrap >$< E.value + +instance decodeJsonExMemory :: DecodeJson ExMemory where + decodeJson = defer \_ -> D.decode $ (ExMemory <$> D.value) + +derive instance genericExMemory :: Generic ExMemory _ + +derive instance newtypeExMemory :: Newtype ExMemory _ + +-------------------------------------------------------------------------------- + +_ExMemory :: Iso' ExMemory Int +_ExMemory = _Newtype \ No newline at end of file diff --git a/marlowe-playground-client/generated/Schema.purs b/marlowe-playground-client/generated/Schema.purs new file mode 100644 index 0000000000..25533752d9 --- /dev/null +++ b/marlowe-playground-client/generated/Schema.purs @@ -0,0 +1,322 @@ +-- File auto generated by purescript-bridge! -- +module Schema where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.BigInt.Argonaut (BigInt) +import Data.Eq (class Eq1) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple (Tuple) +import Data.Tuple.Nested ((/\)) +import Plutus.V1.Ledger.Interval (Interval) +import Plutus.V1.Ledger.Time (POSIXTime) +import Plutus.V1.Ledger.Value (Value) +import Type.Proxy (Proxy(Proxy)) + +data FormSchema + = FormSchemaUnit + | FormSchemaBool + | FormSchemaInt + | FormSchemaInteger + | FormSchemaString + | FormSchemaHex + | FormSchemaArray FormSchema + | FormSchemaMaybe FormSchema + | FormSchemaRadio (Array String) + | FormSchemaTuple FormSchema FormSchema + | FormSchemaObject (Array (Tuple String FormSchema)) + | FormSchemaValue + | FormSchemaPOSIXTimeRange + | FormSchemaUnsupported String + +instance showFormSchema :: Show FormSchema where + show a = genericShow a + +derive instance eqFormSchema :: Eq FormSchema + +instance encodeJsonFormSchema :: EncodeJson FormSchema where + encodeJson = defer \_ -> case _ of + FormSchemaUnit -> encodeJson { tag: "FormSchemaUnit", contents: jsonNull } + FormSchemaBool -> encodeJson { tag: "FormSchemaBool", contents: jsonNull } + FormSchemaInt -> encodeJson { tag: "FormSchemaInt", contents: jsonNull } + FormSchemaInteger -> encodeJson + { tag: "FormSchemaInteger", contents: jsonNull } + FormSchemaString -> encodeJson + { tag: "FormSchemaString", contents: jsonNull } + FormSchemaHex -> encodeJson { tag: "FormSchemaHex", contents: jsonNull } + FormSchemaArray a -> E.encodeTagged "FormSchemaArray" a E.value + FormSchemaMaybe a -> E.encodeTagged "FormSchemaMaybe" a E.value + FormSchemaRadio a -> E.encodeTagged "FormSchemaRadio" a E.value + FormSchemaTuple a b -> E.encodeTagged "FormSchemaTuple" (a /\ b) + (E.tuple (E.value >/\< E.value)) + FormSchemaObject a -> E.encodeTagged "FormSchemaObject" a E.value + FormSchemaValue -> encodeJson { tag: "FormSchemaValue", contents: jsonNull } + FormSchemaPOSIXTimeRange -> encodeJson + { tag: "FormSchemaPOSIXTimeRange", contents: jsonNull } + FormSchemaUnsupported a -> E.encodeTagged "FormSchemaUnsupported" a E.value + +instance decodeJsonFormSchema :: DecodeJson FormSchema where + decodeJson = defer \_ -> D.decode + $ D.sumType "FormSchema" + $ Map.fromFoldable + [ "FormSchemaUnit" /\ pure FormSchemaUnit + , "FormSchemaBool" /\ pure FormSchemaBool + , "FormSchemaInt" /\ pure FormSchemaInt + , "FormSchemaInteger" /\ pure FormSchemaInteger + , "FormSchemaString" /\ pure FormSchemaString + , "FormSchemaHex" /\ pure FormSchemaHex + , "FormSchemaArray" /\ D.content (FormSchemaArray <$> D.value) + , "FormSchemaMaybe" /\ D.content (FormSchemaMaybe <$> D.value) + , "FormSchemaRadio" /\ D.content (FormSchemaRadio <$> D.value) + , "FormSchemaTuple" /\ D.content + (D.tuple $ FormSchemaTuple D.value D.value) + , "FormSchemaObject" /\ D.content (FormSchemaObject <$> D.value) + , "FormSchemaValue" /\ pure FormSchemaValue + , "FormSchemaPOSIXTimeRange" /\ pure FormSchemaPOSIXTimeRange + , "FormSchemaUnsupported" /\ D.content + (FormSchemaUnsupported <$> D.value) + ] + +derive instance genericFormSchema :: Generic FormSchema _ + +-------------------------------------------------------------------------------- + +_FormSchemaUnit :: Prism' FormSchema Unit +_FormSchemaUnit = prism' (const FormSchemaUnit) case _ of + FormSchemaUnit -> Just unit + _ -> Nothing + +_FormSchemaBool :: Prism' FormSchema Unit +_FormSchemaBool = prism' (const FormSchemaBool) case _ of + FormSchemaBool -> Just unit + _ -> Nothing + +_FormSchemaInt :: Prism' FormSchema Unit +_FormSchemaInt = prism' (const FormSchemaInt) case _ of + FormSchemaInt -> Just unit + _ -> Nothing + +_FormSchemaInteger :: Prism' FormSchema Unit +_FormSchemaInteger = prism' (const FormSchemaInteger) case _ of + FormSchemaInteger -> Just unit + _ -> Nothing + +_FormSchemaString :: Prism' FormSchema Unit +_FormSchemaString = prism' (const FormSchemaString) case _ of + FormSchemaString -> Just unit + _ -> Nothing + +_FormSchemaHex :: Prism' FormSchema Unit +_FormSchemaHex = prism' (const FormSchemaHex) case _ of + FormSchemaHex -> Just unit + _ -> Nothing + +_FormSchemaArray :: Prism' FormSchema FormSchema +_FormSchemaArray = prism' FormSchemaArray case _ of + (FormSchemaArray a) -> Just a + _ -> Nothing + +_FormSchemaMaybe :: Prism' FormSchema FormSchema +_FormSchemaMaybe = prism' FormSchemaMaybe case _ of + (FormSchemaMaybe a) -> Just a + _ -> Nothing + +_FormSchemaRadio :: Prism' FormSchema (Array String) +_FormSchemaRadio = prism' FormSchemaRadio case _ of + (FormSchemaRadio a) -> Just a + _ -> Nothing + +_FormSchemaTuple :: Prism' FormSchema { a :: FormSchema, b :: FormSchema } +_FormSchemaTuple = prism' (\{ a, b } -> (FormSchemaTuple a b)) case _ of + (FormSchemaTuple a b) -> Just { a, b } + _ -> Nothing + +_FormSchemaObject :: Prism' FormSchema (Array (Tuple String FormSchema)) +_FormSchemaObject = prism' FormSchemaObject case _ of + (FormSchemaObject a) -> Just a + _ -> Nothing + +_FormSchemaValue :: Prism' FormSchema Unit +_FormSchemaValue = prism' (const FormSchemaValue) case _ of + FormSchemaValue -> Just unit + _ -> Nothing + +_FormSchemaPOSIXTimeRange :: Prism' FormSchema Unit +_FormSchemaPOSIXTimeRange = prism' (const FormSchemaPOSIXTimeRange) case _ of + FormSchemaPOSIXTimeRange -> Just unit + _ -> Nothing + +_FormSchemaUnsupported :: Prism' FormSchema String +_FormSchemaUnsupported = prism' FormSchemaUnsupported case _ of + (FormSchemaUnsupported a) -> Just a + _ -> Nothing + +-------------------------------------------------------------------------------- + +data FormArgumentF a + = FormUnitF + | FormBoolF Boolean + | FormIntF (Maybe Int) + | FormIntegerF (Maybe BigInt) + | FormStringF (Maybe String) + | FormHexF (Maybe String) + | FormRadioF (Array String) (Maybe String) + | FormArrayF FormSchema (Array a) + | FormMaybeF FormSchema (Maybe a) + | FormTupleF a a + | FormObjectF (Array (Tuple String a)) + | FormValueF Value + | FormPOSIXTimeRangeF (Interval POSIXTime) + | FormUnsupportedF String + +derive instance functorFormArgumentF :: Functor FormArgumentF + +derive instance eqFormArgumentF :: (Eq a) => Eq (FormArgumentF a) + +derive instance eq1FormArgumentF :: Eq1 FormArgumentF + +instance showFormArgumentF :: (Show a) => Show (FormArgumentF a) where + show a = genericShow a + +instance encodeJsonFormArgumentF :: + ( EncodeJson a + ) => + EncodeJson (FormArgumentF a) where + encodeJson = defer \_ -> case _ of + FormUnitF -> encodeJson { tag: "FormUnitF", contents: jsonNull } + FormBoolF a -> E.encodeTagged "FormBoolF" a E.value + FormIntF a -> E.encodeTagged "FormIntF" a (E.maybe E.value) + FormIntegerF a -> E.encodeTagged "FormIntegerF" a (E.maybe E.value) + FormStringF a -> E.encodeTagged "FormStringF" a (E.maybe E.value) + FormHexF a -> E.encodeTagged "FormHexF" a (E.maybe E.value) + FormRadioF a b -> E.encodeTagged "FormRadioF" (a /\ b) + (E.tuple (E.value >/\< (E.maybe E.value))) + FormArrayF a b -> E.encodeTagged "FormArrayF" (a /\ b) + (E.tuple (E.value >/\< E.value)) + FormMaybeF a b -> E.encodeTagged "FormMaybeF" (a /\ b) + (E.tuple (E.value >/\< (E.maybe E.value))) + FormTupleF a b -> E.encodeTagged "FormTupleF" (a /\ b) + (E.tuple (E.value >/\< E.value)) + FormObjectF a -> E.encodeTagged "FormObjectF" a E.value + FormValueF a -> E.encodeTagged "FormValueF" a E.value + FormPOSIXTimeRangeF a -> E.encodeTagged "FormPOSIXTimeRangeF" a E.value + FormUnsupportedF a -> E.encodeTagged "FormUnsupportedF" a E.value + +instance decodeJsonFormArgumentF :: + ( DecodeJson a + ) => + DecodeJson (FormArgumentF a) where + decodeJson = defer \_ -> D.decode + $ D.sumType "FormArgumentF" + $ Map.fromFoldable + [ "FormUnitF" /\ pure FormUnitF + , "FormBoolF" /\ D.content (FormBoolF <$> D.value) + , "FormIntF" /\ D.content (FormIntF <$> (D.maybe D.value)) + , "FormIntegerF" /\ D.content (FormIntegerF <$> (D.maybe D.value)) + , "FormStringF" /\ D.content (FormStringF <$> (D.maybe D.value)) + , "FormHexF" /\ D.content (FormHexF <$> (D.maybe D.value)) + , "FormRadioF" /\ D.content + (D.tuple $ FormRadioF D.value (D.maybe D.value)) + , "FormArrayF" /\ D.content + (D.tuple $ FormArrayF D.value D.value) + , "FormMaybeF" /\ D.content + (D.tuple $ FormMaybeF D.value (D.maybe D.value)) + , "FormTupleF" /\ D.content + (D.tuple $ FormTupleF D.value D.value) + , "FormObjectF" /\ D.content (FormObjectF <$> D.value) + , "FormValueF" /\ D.content (FormValueF <$> D.value) + , "FormPOSIXTimeRangeF" /\ D.content (FormPOSIXTimeRangeF <$> D.value) + , "FormUnsupportedF" /\ D.content (FormUnsupportedF <$> D.value) + ] + +derive instance genericFormArgumentF :: Generic (FormArgumentF a) _ + +-------------------------------------------------------------------------------- + +_FormUnitF :: forall a. Prism' (FormArgumentF a) Unit +_FormUnitF = prism' (const FormUnitF) case _ of + FormUnitF -> Just unit + _ -> Nothing + +_FormBoolF :: forall a. Prism' (FormArgumentF a) Boolean +_FormBoolF = prism' FormBoolF case _ of + (FormBoolF a) -> Just a + _ -> Nothing + +_FormIntF :: forall a. Prism' (FormArgumentF a) (Maybe Int) +_FormIntF = prism' FormIntF case _ of + (FormIntF a) -> Just a + _ -> Nothing + +_FormIntegerF :: forall a. Prism' (FormArgumentF a) (Maybe BigInt) +_FormIntegerF = prism' FormIntegerF case _ of + (FormIntegerF a) -> Just a + _ -> Nothing + +_FormStringF :: forall a. Prism' (FormArgumentF a) (Maybe String) +_FormStringF = prism' FormStringF case _ of + (FormStringF a) -> Just a + _ -> Nothing + +_FormHexF :: forall a. Prism' (FormArgumentF a) (Maybe String) +_FormHexF = prism' FormHexF case _ of + (FormHexF a) -> Just a + _ -> Nothing + +_FormRadioF + :: forall a. Prism' (FormArgumentF a) { a :: Array String, b :: Maybe String } +_FormRadioF = prism' (\{ a, b } -> (FormRadioF a b)) case _ of + (FormRadioF a b) -> Just { a, b } + _ -> Nothing + +_FormArrayF + :: forall a. Prism' (FormArgumentF a) { a :: FormSchema, b :: Array a } +_FormArrayF = prism' (\{ a, b } -> (FormArrayF a b)) case _ of + (FormArrayF a b) -> Just { a, b } + _ -> Nothing + +_FormMaybeF + :: forall a. Prism' (FormArgumentF a) { a :: FormSchema, b :: Maybe a } +_FormMaybeF = prism' (\{ a, b } -> (FormMaybeF a b)) case _ of + (FormMaybeF a b) -> Just { a, b } + _ -> Nothing + +_FormTupleF :: forall a. Prism' (FormArgumentF a) { a :: a, b :: a } +_FormTupleF = prism' (\{ a, b } -> (FormTupleF a b)) case _ of + (FormTupleF a b) -> Just { a, b } + _ -> Nothing + +_FormObjectF :: forall a. Prism' (FormArgumentF a) (Array (Tuple String a)) +_FormObjectF = prism' FormObjectF case _ of + (FormObjectF a) -> Just a + _ -> Nothing + +_FormValueF :: forall a. Prism' (FormArgumentF a) Value +_FormValueF = prism' FormValueF case _ of + (FormValueF a) -> Just a + _ -> Nothing + +_FormPOSIXTimeRangeF :: forall a. Prism' (FormArgumentF a) (Interval POSIXTime) +_FormPOSIXTimeRangeF = prism' FormPOSIXTimeRangeF case _ of + (FormPOSIXTimeRangeF a) -> Just a + _ -> Nothing + +_FormUnsupportedF :: forall a. Prism' (FormArgumentF a) String +_FormUnsupportedF = prism' FormUnsupportedF case _ of + (FormUnsupportedF a) -> Just a + _ -> Nothing \ No newline at end of file diff --git a/marlowe-playground-client/generated/Wallet/Emulator/Error.purs b/marlowe-playground-client/generated/Wallet/Emulator/Error.purs new file mode 100644 index 0000000000..f5b7d5068a --- /dev/null +++ b/marlowe-playground-client/generated/Wallet/Emulator/Error.purs @@ -0,0 +1,86 @@ +-- File auto generated by purescript-bridge! -- +module Wallet.Emulator.Error where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Ledger.Index (ValidationError) +import Ledger.Tx.CardanoAPI (ToCardanoError) +import Plutus.V1.Ledger.Crypto (PubKeyHash) +import Type.Proxy (Proxy(Proxy)) + +data WalletAPIError + = InsufficientFunds String + | PrivateKeyNotFound PubKeyHash + | ValidationError ValidationError + | ToCardanoError ToCardanoError + | OtherError String + +derive instance eqWalletAPIError :: Eq WalletAPIError + +instance showWalletAPIError :: Show WalletAPIError where + show a = genericShow a + +instance encodeJsonWalletAPIError :: EncodeJson WalletAPIError where + encodeJson = defer \_ -> case _ of + InsufficientFunds a -> E.encodeTagged "InsufficientFunds" a E.value + PrivateKeyNotFound a -> E.encodeTagged "PrivateKeyNotFound" a E.value + ValidationError a -> E.encodeTagged "ValidationError" a E.value + ToCardanoError a -> E.encodeTagged "ToCardanoError" a E.value + OtherError a -> E.encodeTagged "OtherError" a E.value + +instance decodeJsonWalletAPIError :: DecodeJson WalletAPIError where + decodeJson = defer \_ -> D.decode + $ D.sumType "WalletAPIError" + $ Map.fromFoldable + [ "InsufficientFunds" /\ D.content (InsufficientFunds <$> D.value) + , "PrivateKeyNotFound" /\ D.content (PrivateKeyNotFound <$> D.value) + , "ValidationError" /\ D.content (ValidationError <$> D.value) + , "ToCardanoError" /\ D.content (ToCardanoError <$> D.value) + , "OtherError" /\ D.content (OtherError <$> D.value) + ] + +derive instance genericWalletAPIError :: Generic WalletAPIError _ + +-------------------------------------------------------------------------------- + +_InsufficientFunds :: Prism' WalletAPIError String +_InsufficientFunds = prism' InsufficientFunds case _ of + (InsufficientFunds a) -> Just a + _ -> Nothing + +_PrivateKeyNotFound :: Prism' WalletAPIError PubKeyHash +_PrivateKeyNotFound = prism' PrivateKeyNotFound case _ of + (PrivateKeyNotFound a) -> Just a + _ -> Nothing + +_ValidationError :: Prism' WalletAPIError ValidationError +_ValidationError = prism' ValidationError case _ of + (ValidationError a) -> Just a + _ -> Nothing + +_ToCardanoError :: Prism' WalletAPIError ToCardanoError +_ToCardanoError = prism' ToCardanoError case _ of + (ToCardanoError a) -> Just a + _ -> Nothing + +_OtherError :: Prism' WalletAPIError String +_OtherError = prism' OtherError case _ of + (OtherError a) -> Just a + _ -> Nothing \ No newline at end of file diff --git a/marlowe-playground-client/generated/Wallet/Emulator/Wallet.purs b/marlowe-playground-client/generated/Wallet/Emulator/Wallet.purs new file mode 100644 index 0000000000..f8d4180c50 --- /dev/null +++ b/marlowe-playground-client/generated/Wallet/Emulator/Wallet.purs @@ -0,0 +1,49 @@ +-- File auto generated by purescript-bridge! -- +module Wallet.Emulator.Wallet where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Type.Proxy (Proxy(Proxy)) + +newtype Wallet = Wallet { getWalletId :: String } + +derive instance eqWallet :: Eq Wallet + +instance showWallet :: Show Wallet where + show a = genericShow a + +instance encodeJsonWallet :: EncodeJson Wallet where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { getWalletId: E.value :: _ String } + ) + +instance decodeJsonWallet :: DecodeJson Wallet where + decodeJson = defer \_ -> D.decode $ + (Wallet <$> D.record "Wallet" { getWalletId: D.value :: _ String }) + +derive instance genericWallet :: Generic Wallet _ + +derive instance newtypeWallet :: Newtype Wallet _ + +-------------------------------------------------------------------------------- + +_Wallet :: Iso' Wallet { getWalletId :: String } +_Wallet = _Newtype \ No newline at end of file diff --git a/marlowe-playground-client/generated/Wallet/Rollup/Types.purs b/marlowe-playground-client/generated/Wallet/Rollup/Types.purs new file mode 100644 index 0000000000..3536dca020 --- /dev/null +++ b/marlowe-playground-client/generated/Wallet/Rollup/Types.purs @@ -0,0 +1,260 @@ +-- File auto generated by purescript-bridge! -- +module Wallet.Rollup.Types where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.BigInt.Argonaut (BigInt) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map (Map) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Plutus.V1.Ledger.Crypto (PubKeyHash) +import Plutus.V1.Ledger.Tx (Tx, TxIn, TxOut) +import Plutus.V1.Ledger.TxId (TxId) +import Plutus.V1.Ledger.Value (Value) +import Type.Proxy (Proxy(Proxy)) + +newtype AnnotatedTx = AnnotatedTx + { sequenceId :: SequenceId + , txId :: TxId + , tx :: Tx + , dereferencedInputs :: Array DereferencedInput + , balances :: Map BeneficialOwner Value + , valid :: Boolean + } + +derive instance eqAnnotatedTx :: Eq AnnotatedTx + +instance showAnnotatedTx :: Show AnnotatedTx where + show a = genericShow a + +instance encodeJsonAnnotatedTx :: EncodeJson AnnotatedTx where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { sequenceId: E.value :: _ SequenceId + , txId: E.value :: _ TxId + , tx: E.value :: _ Tx + , dereferencedInputs: E.value :: _ (Array DereferencedInput) + , balances: + (E.dictionary E.value E.value) :: _ (Map BeneficialOwner Value) + , valid: E.value :: _ Boolean + } + ) + +instance decodeJsonAnnotatedTx :: DecodeJson AnnotatedTx where + decodeJson = defer \_ -> D.decode $ + ( AnnotatedTx <$> D.record "AnnotatedTx" + { sequenceId: D.value :: _ SequenceId + , txId: D.value :: _ TxId + , tx: D.value :: _ Tx + , dereferencedInputs: D.value :: _ (Array DereferencedInput) + , balances: + (D.dictionary D.value D.value) :: _ (Map BeneficialOwner Value) + , valid: D.value :: _ Boolean + } + ) + +derive instance genericAnnotatedTx :: Generic AnnotatedTx _ + +derive instance newtypeAnnotatedTx :: Newtype AnnotatedTx _ + +-------------------------------------------------------------------------------- + +_AnnotatedTx :: Iso' AnnotatedTx + { sequenceId :: SequenceId + , txId :: TxId + , tx :: Tx + , dereferencedInputs :: Array DereferencedInput + , balances :: Map BeneficialOwner Value + , valid :: Boolean + } +_AnnotatedTx = _Newtype + +-------------------------------------------------------------------------------- + +data DereferencedInput + = DereferencedInput + { originalInput :: TxIn + , refersTo :: TxOut + } + | InputNotFound TxKey + +derive instance eqDereferencedInput :: Eq DereferencedInput + +instance showDereferencedInput :: Show DereferencedInput where + show a = genericShow a + +instance encodeJsonDereferencedInput :: EncodeJson DereferencedInput where + encodeJson = defer \_ -> case _ of + DereferencedInput { originalInput, refersTo } -> encodeJson + { tag: "DereferencedInput" + , originalInput: flip E.encode originalInput E.value + , refersTo: flip E.encode refersTo E.value + } + InputNotFound a -> E.encodeTagged "InputNotFound" a E.value + +instance decodeJsonDereferencedInput :: DecodeJson DereferencedInput where + decodeJson = defer \_ -> D.decode + $ D.sumType "DereferencedInput" + $ Map.fromFoldable + [ "DereferencedInput" /\ + ( DereferencedInput <$> D.object "DereferencedInput" + { originalInput: D.value :: _ TxIn + , refersTo: D.value :: _ TxOut + } + ) + , "InputNotFound" /\ D.content (InputNotFound <$> D.value) + ] + +derive instance genericDereferencedInput :: Generic DereferencedInput _ + +-------------------------------------------------------------------------------- + +_DereferencedInput :: Prism' DereferencedInput + { originalInput :: TxIn, refersTo :: TxOut } +_DereferencedInput = prism' DereferencedInput case _ of + (DereferencedInput a) -> Just a + _ -> Nothing + +_InputNotFound :: Prism' DereferencedInput TxKey +_InputNotFound = prism' InputNotFound case _ of + (InputNotFound a) -> Just a + _ -> Nothing + +-------------------------------------------------------------------------------- + +data BeneficialOwner + = OwnedByPubKey PubKeyHash + | OwnedByScript String + +derive instance eqBeneficialOwner :: Eq BeneficialOwner + +derive instance ordBeneficialOwner :: Ord BeneficialOwner + +instance showBeneficialOwner :: Show BeneficialOwner where + show a = genericShow a + +instance encodeJsonBeneficialOwner :: EncodeJson BeneficialOwner where + encodeJson = defer \_ -> case _ of + OwnedByPubKey a -> E.encodeTagged "OwnedByPubKey" a E.value + OwnedByScript a -> E.encodeTagged "OwnedByScript" a E.value + +instance decodeJsonBeneficialOwner :: DecodeJson BeneficialOwner where + decodeJson = defer \_ -> D.decode + $ D.sumType "BeneficialOwner" + $ Map.fromFoldable + [ "OwnedByPubKey" /\ D.content (OwnedByPubKey <$> D.value) + , "OwnedByScript" /\ D.content (OwnedByScript <$> D.value) + ] + +derive instance genericBeneficialOwner :: Generic BeneficialOwner _ + +-------------------------------------------------------------------------------- + +_OwnedByPubKey :: Prism' BeneficialOwner PubKeyHash +_OwnedByPubKey = prism' OwnedByPubKey case _ of + (OwnedByPubKey a) -> Just a + _ -> Nothing + +_OwnedByScript :: Prism' BeneficialOwner String +_OwnedByScript = prism' OwnedByScript case _ of + (OwnedByScript a) -> Just a + _ -> Nothing + +-------------------------------------------------------------------------------- + +newtype SequenceId = SequenceId + { slotIndex :: Int + , txIndex :: Int + } + +derive instance eqSequenceId :: Eq SequenceId + +derive instance ordSequenceId :: Ord SequenceId + +instance showSequenceId :: Show SequenceId where + show a = genericShow a + +instance encodeJsonSequenceId :: EncodeJson SequenceId where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { slotIndex: E.value :: _ Int + , txIndex: E.value :: _ Int + } + ) + +instance decodeJsonSequenceId :: DecodeJson SequenceId where + decodeJson = defer \_ -> D.decode $ + ( SequenceId <$> D.record "SequenceId" + { slotIndex: D.value :: _ Int + , txIndex: D.value :: _ Int + } + ) + +derive instance genericSequenceId :: Generic SequenceId _ + +derive instance newtypeSequenceId :: Newtype SequenceId _ + +-------------------------------------------------------------------------------- + +_SequenceId :: Iso' SequenceId { slotIndex :: Int, txIndex :: Int } +_SequenceId = _Newtype + +-------------------------------------------------------------------------------- + +newtype TxKey = TxKey + { _txKeyTxId :: TxId + , _txKeyTxOutRefIdx :: BigInt + } + +derive instance eqTxKey :: Eq TxKey + +derive instance ordTxKey :: Ord TxKey + +instance showTxKey :: Show TxKey where + show a = genericShow a + +instance encodeJsonTxKey :: EncodeJson TxKey where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { _txKeyTxId: E.value :: _ TxId + , _txKeyTxOutRefIdx: E.value :: _ BigInt + } + ) + +instance decodeJsonTxKey :: DecodeJson TxKey where + decodeJson = defer \_ -> D.decode $ + ( TxKey <$> D.record "TxKey" + { _txKeyTxId: D.value :: _ TxId + , _txKeyTxOutRefIdx: D.value :: _ BigInt + } + ) + +derive instance genericTxKey :: Generic TxKey _ + +derive instance newtypeTxKey :: Newtype TxKey _ + +-------------------------------------------------------------------------------- + +_TxKey :: Iso' TxKey { _txKeyTxId :: TxId, _txKeyTxOutRefIdx :: BigInt } +_TxKey = _Newtype + +txKeyTxId :: Lens' TxKey TxId +txKeyTxId = _Newtype <<< prop (Proxy :: _ "_txKeyTxId") + +txKeyTxOutRefIdx :: Lens' TxKey BigInt +txKeyTxOutRefIdx = _Newtype <<< prop (Proxy :: _ "_txKeyTxOutRefIdx") \ No newline at end of file diff --git a/marlowe-playground-client/generated/Wallet/Types.purs b/marlowe-playground-client/generated/Wallet/Types.purs new file mode 100644 index 0000000000..c6cb8d53be --- /dev/null +++ b/marlowe-playground-client/generated/Wallet/Types.purs @@ -0,0 +1,441 @@ +-- File auto generated by purescript-bridge! -- +module Wallet.Types where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Bounded.Generic (genericBottom, genericTop) +import Data.Enum (class Enum) +import Data.Enum.Generic (genericPred, genericSucc) +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.RawJson (RawJson) +import Data.Show.Generic (genericShow) +import Data.Tuple.Nested ((/\)) +import Data.UUID.Argonaut (UUID) +import Ledger.Constraints.OffChain (MkTxError) +import Plutus.Contract.Checkpoint (CheckpointError) +import Type.Proxy (Proxy(Proxy)) +import Wallet.Emulator.Error (WalletAPIError) + +data ContractError + = WalletError WalletAPIError + | EmulatorAssertionError AssertionError + | OtherError String + | ConstraintResolutionError MkTxError + | ResumableError MatchingError + | CCheckpointError CheckpointError + +derive instance eqContractError :: Eq ContractError + +instance showContractError :: Show ContractError where + show a = genericShow a + +instance encodeJsonContractError :: EncodeJson ContractError where + encodeJson = defer \_ -> case _ of + WalletError a -> E.encodeTagged "WalletError" a E.value + EmulatorAssertionError a -> E.encodeTagged "EmulatorAssertionError" a + E.value + OtherError a -> E.encodeTagged "OtherError" a E.value + ConstraintResolutionError a -> E.encodeTagged "ConstraintResolutionError" a + E.value + ResumableError a -> E.encodeTagged "ResumableError" a E.value + CCheckpointError a -> E.encodeTagged "CCheckpointError" a E.value + +instance decodeJsonContractError :: DecodeJson ContractError where + decodeJson = defer \_ -> D.decode + $ D.sumType "ContractError" + $ Map.fromFoldable + [ "WalletError" /\ D.content (WalletError <$> D.value) + , "EmulatorAssertionError" /\ D.content + (EmulatorAssertionError <$> D.value) + , "OtherError" /\ D.content (OtherError <$> D.value) + , "ConstraintResolutionError" /\ D.content + (ConstraintResolutionError <$> D.value) + , "ResumableError" /\ D.content (ResumableError <$> D.value) + , "CCheckpointError" /\ D.content (CCheckpointError <$> D.value) + ] + +derive instance genericContractError :: Generic ContractError _ + +-------------------------------------------------------------------------------- + +_WalletError :: Prism' ContractError WalletAPIError +_WalletError = prism' WalletError case _ of + (WalletError a) -> Just a + _ -> Nothing + +_EmulatorAssertionError :: Prism' ContractError AssertionError +_EmulatorAssertionError = prism' EmulatorAssertionError case _ of + (EmulatorAssertionError a) -> Just a + _ -> Nothing + +_OtherError :: Prism' ContractError String +_OtherError = prism' OtherError case _ of + (OtherError a) -> Just a + _ -> Nothing + +_ConstraintResolutionError :: Prism' ContractError MkTxError +_ConstraintResolutionError = prism' ConstraintResolutionError case _ of + (ConstraintResolutionError a) -> Just a + _ -> Nothing + +_ResumableError :: Prism' ContractError MatchingError +_ResumableError = prism' ResumableError case _ of + (ResumableError a) -> Just a + _ -> Nothing + +_CCheckpointError :: Prism' ContractError CheckpointError +_CCheckpointError = prism' CCheckpointError case _ of + (CCheckpointError a) -> Just a + _ -> Nothing + +-------------------------------------------------------------------------------- + +newtype Notification = Notification + { notificationContractID :: ContractInstanceId + , notificationContractEndpoint :: EndpointDescription + , notificationContractArg :: RawJson + } + +derive instance eqNotification :: Eq Notification + +instance showNotification :: Show Notification where + show a = genericShow a + +instance encodeJsonNotification :: EncodeJson Notification where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { notificationContractID: E.value :: _ ContractInstanceId + , notificationContractEndpoint: E.value :: _ EndpointDescription + , notificationContractArg: E.value :: _ RawJson + } + ) + +instance decodeJsonNotification :: DecodeJson Notification where + decodeJson = defer \_ -> D.decode $ + ( Notification <$> D.record "Notification" + { notificationContractID: D.value :: _ ContractInstanceId + , notificationContractEndpoint: D.value :: _ EndpointDescription + , notificationContractArg: D.value :: _ RawJson + } + ) + +derive instance genericNotification :: Generic Notification _ + +derive instance newtypeNotification :: Newtype Notification _ + +-------------------------------------------------------------------------------- + +_Notification :: Iso' Notification + { notificationContractID :: ContractInstanceId + , notificationContractEndpoint :: EndpointDescription + , notificationContractArg :: RawJson + } +_Notification = _Newtype + +-------------------------------------------------------------------------------- + +data NotificationError + = EndpointNotAvailable ContractInstanceId EndpointDescription + | MoreThanOneEndpointAvailable ContractInstanceId EndpointDescription + | InstanceDoesNotExist ContractInstanceId + | OtherNotificationError ContractError + | NotificationJSONDecodeError EndpointDescription RawJson String + +derive instance eqNotificationError :: Eq NotificationError + +instance showNotificationError :: Show NotificationError where + show a = genericShow a + +instance encodeJsonNotificationError :: EncodeJson NotificationError where + encodeJson = defer \_ -> case _ of + EndpointNotAvailable a b -> E.encodeTagged "EndpointNotAvailable" (a /\ b) + (E.tuple (E.value >/\< E.value)) + MoreThanOneEndpointAvailable a b -> E.encodeTagged + "MoreThanOneEndpointAvailable" + (a /\ b) + (E.tuple (E.value >/\< E.value)) + InstanceDoesNotExist a -> E.encodeTagged "InstanceDoesNotExist" a E.value + OtherNotificationError a -> E.encodeTagged "OtherNotificationError" a + E.value + NotificationJSONDecodeError a b c -> E.encodeTagged + "NotificationJSONDecodeError" + (a /\ b /\ c) + (E.tuple (E.value >/\< E.value >/\< E.value)) + +instance decodeJsonNotificationError :: DecodeJson NotificationError where + decodeJson = defer \_ -> D.decode + $ D.sumType "NotificationError" + $ Map.fromFoldable + [ "EndpointNotAvailable" /\ D.content + (D.tuple $ EndpointNotAvailable D.value D.value) + , "MoreThanOneEndpointAvailable" /\ D.content + (D.tuple $ MoreThanOneEndpointAvailable D.value D.value) + , "InstanceDoesNotExist" /\ D.content (InstanceDoesNotExist <$> D.value) + , "OtherNotificationError" /\ D.content + (OtherNotificationError <$> D.value) + , "NotificationJSONDecodeError" /\ D.content + ( D.tuple $ NotificationJSONDecodeError D.value D.value + D.value + ) + ] + +derive instance genericNotificationError :: Generic NotificationError _ + +-------------------------------------------------------------------------------- + +_EndpointNotAvailable :: Prism' NotificationError + { a :: ContractInstanceId, b :: EndpointDescription } +_EndpointNotAvailable = prism' (\{ a, b } -> (EndpointNotAvailable a b)) + case _ of + (EndpointNotAvailable a b) -> Just { a, b } + _ -> Nothing + +_MoreThanOneEndpointAvailable :: Prism' NotificationError + { a :: ContractInstanceId, b :: EndpointDescription } +_MoreThanOneEndpointAvailable = prism' + (\{ a, b } -> (MoreThanOneEndpointAvailable a b)) + case _ of + (MoreThanOneEndpointAvailable a b) -> Just { a, b } + _ -> Nothing + +_InstanceDoesNotExist :: Prism' NotificationError ContractInstanceId +_InstanceDoesNotExist = prism' InstanceDoesNotExist case _ of + (InstanceDoesNotExist a) -> Just a + _ -> Nothing + +_OtherNotificationError :: Prism' NotificationError ContractError +_OtherNotificationError = prism' OtherNotificationError case _ of + (OtherNotificationError a) -> Just a + _ -> Nothing + +_NotificationJSONDecodeError :: Prism' NotificationError + { a :: EndpointDescription, b :: RawJson, c :: String } +_NotificationJSONDecodeError = prism' + (\{ a, b, c } -> (NotificationJSONDecodeError a b c)) + case _ of + (NotificationJSONDecodeError a b c) -> Just { a, b, c } + _ -> Nothing + +-------------------------------------------------------------------------------- + +newtype MatchingError = WrongVariantError { unWrongVariantError :: String } + +derive instance eqMatchingError :: Eq MatchingError + +instance showMatchingError :: Show MatchingError where + show a = genericShow a + +instance encodeJsonMatchingError :: EncodeJson MatchingError where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { unWrongVariantError: E.value :: _ String } + ) + +instance decodeJsonMatchingError :: DecodeJson MatchingError where + decodeJson = defer \_ -> D.decode $ + ( WrongVariantError <$> D.record "WrongVariantError" + { unWrongVariantError: D.value :: _ String } + ) + +derive instance genericMatchingError :: Generic MatchingError _ + +derive instance newtypeMatchingError :: Newtype MatchingError _ + +-------------------------------------------------------------------------------- + +_WrongVariantError :: Iso' MatchingError { unWrongVariantError :: String } +_WrongVariantError = _Newtype + +-------------------------------------------------------------------------------- + +newtype AssertionError = GenericAssertion { unAssertionError :: String } + +derive instance eqAssertionError :: Eq AssertionError + +instance showAssertionError :: Show AssertionError where + show a = genericShow a + +instance encodeJsonAssertionError :: EncodeJson AssertionError where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { unAssertionError: E.value :: _ String } + ) + +instance decodeJsonAssertionError :: DecodeJson AssertionError where + decodeJson = defer \_ -> D.decode $ + ( GenericAssertion <$> D.record "GenericAssertion" + { unAssertionError: D.value :: _ String } + ) + +derive instance genericAssertionError :: Generic AssertionError _ + +derive instance newtypeAssertionError :: Newtype AssertionError _ + +-------------------------------------------------------------------------------- + +_GenericAssertion :: Iso' AssertionError { unAssertionError :: String } +_GenericAssertion = _Newtype + +-------------------------------------------------------------------------------- + +newtype ContractInstanceId = ContractInstanceId { unContractInstanceId :: UUID } + +derive instance eqContractInstanceId :: Eq ContractInstanceId + +derive instance ordContractInstanceId :: Ord ContractInstanceId + +instance showContractInstanceId :: Show ContractInstanceId where + show a = genericShow a + +instance encodeJsonContractInstanceId :: EncodeJson ContractInstanceId where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { unContractInstanceId: E.value :: _ UUID } + ) + +instance decodeJsonContractInstanceId :: DecodeJson ContractInstanceId where + decodeJson = defer \_ -> D.decode $ + ( ContractInstanceId <$> D.record "ContractInstanceId" + { unContractInstanceId: D.value :: _ UUID } + ) + +derive instance genericContractInstanceId :: Generic ContractInstanceId _ + +derive instance newtypeContractInstanceId :: Newtype ContractInstanceId _ + +-------------------------------------------------------------------------------- + +_ContractInstanceId :: Iso' ContractInstanceId { unContractInstanceId :: UUID } +_ContractInstanceId = _Newtype + +-------------------------------------------------------------------------------- + +data ContractActivityStatus + = Active + | Stopped + | Done + +derive instance eqContractActivityStatus :: Eq ContractActivityStatus + +derive instance ordContractActivityStatus :: Ord ContractActivityStatus + +instance showContractActivityStatus :: Show ContractActivityStatus where + show a = genericShow a + +instance encodeJsonContractActivityStatus :: EncodeJson ContractActivityStatus where + encodeJson = defer \_ -> E.encode E.enum + +instance decodeJsonContractActivityStatus :: DecodeJson ContractActivityStatus where + decodeJson = defer \_ -> D.decode D.enum + +derive instance genericContractActivityStatus :: + Generic ContractActivityStatus _ + +instance enumContractActivityStatus :: Enum ContractActivityStatus where + succ = genericSucc + pred = genericPred + +instance boundedContractActivityStatus :: Bounded ContractActivityStatus where + bottom = genericBottom + top = genericTop + +-------------------------------------------------------------------------------- + +_Active :: Prism' ContractActivityStatus Unit +_Active = prism' (const Active) case _ of + Active -> Just unit + _ -> Nothing + +_Stopped :: Prism' ContractActivityStatus Unit +_Stopped = prism' (const Stopped) case _ of + Stopped -> Just unit + _ -> Nothing + +_Done :: Prism' ContractActivityStatus Unit +_Done = prism' (const Done) case _ of + Done -> Just unit + _ -> Nothing + +-------------------------------------------------------------------------------- + +newtype EndpointValue a = EndpointValue { unEndpointValue :: a } + +derive instance eqEndpointValue :: (Eq a) => Eq (EndpointValue a) + +instance showEndpointValue :: (Show a) => Show (EndpointValue a) where + show a = genericShow a + +instance encodeJsonEndpointValue :: + ( EncodeJson a + ) => + EncodeJson (EndpointValue a) where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { unEndpointValue: E.value :: _ a } + ) + +instance decodeJsonEndpointValue :: + ( DecodeJson a + ) => + DecodeJson (EndpointValue a) where + decodeJson = defer \_ -> D.decode $ + ( EndpointValue <$> D.record "EndpointValue" + { unEndpointValue: D.value :: _ a } + ) + +derive instance genericEndpointValue :: Generic (EndpointValue a) _ + +derive instance newtypeEndpointValue :: Newtype (EndpointValue a) _ + +-------------------------------------------------------------------------------- + +_EndpointValue :: forall a. Iso' (EndpointValue a) { unEndpointValue :: a } +_EndpointValue = _Newtype + +-------------------------------------------------------------------------------- + +newtype EndpointDescription = EndpointDescription + { getEndpointDescription :: String } + +instance showEndpointDescription :: Show EndpointDescription where + show a = genericShow a + +derive instance eqEndpointDescription :: Eq EndpointDescription + +derive instance ordEndpointDescription :: Ord EndpointDescription + +instance encodeJsonEndpointDescription :: EncodeJson EndpointDescription where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { getEndpointDescription: E.value :: _ String } + ) + +instance decodeJsonEndpointDescription :: DecodeJson EndpointDescription where + decodeJson = defer \_ -> D.decode $ + ( EndpointDescription <$> D.record "EndpointDescription" + { getEndpointDescription: D.value :: _ String } + ) + +derive instance genericEndpointDescription :: Generic EndpointDescription _ + +derive instance newtypeEndpointDescription :: Newtype EndpointDescription _ + +-------------------------------------------------------------------------------- + +_EndpointDescription :: Iso' EndpointDescription + { getEndpointDescription :: String } +_EndpointDescription = _Newtype \ No newline at end of file diff --git a/marlowe-playground-client/generated/Webghc/Server.purs b/marlowe-playground-client/generated/Webghc/Server.purs new file mode 100644 index 0000000000..3f0959da43 --- /dev/null +++ b/marlowe-playground-client/generated/Webghc/Server.purs @@ -0,0 +1,53 @@ +-- File auto generated by purescript-bridge! -- +module Webghc.Server where + +import Prelude + +import Control.Lazy (defer) +import Data.Argonaut.Core (jsonNull) +import Data.Argonaut.Decode (class DecodeJson) +import Data.Argonaut.Decode.Aeson ((), (), ()) +import Data.Argonaut.Decode.Aeson as D +import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Argonaut.Encode.Aeson ((>$<), (>/\<)) +import Data.Argonaut.Encode.Aeson as E +import Data.Generic.Rep (class Generic) +import Data.Lens (Iso', Lens', Prism', iso, prism') +import Data.Lens.Iso.Newtype (_Newtype) +import Data.Lens.Record (prop) +import Data.Map as Map +import Data.Maybe (Maybe(..)) +import Data.Newtype (class Newtype, unwrap) +import Data.Tuple.Nested ((/\)) +import Type.Proxy (Proxy(Proxy)) + +newtype CompileRequest = CompileRequest + { code :: String + , implicitPrelude :: Boolean + } + +instance encodeJsonCompileRequest :: EncodeJson CompileRequest where + encodeJson = defer \_ -> E.encode $ unwrap >$< + ( E.record + { code: E.value :: _ String + , implicitPrelude: E.value :: _ Boolean + } + ) + +instance decodeJsonCompileRequest :: DecodeJson CompileRequest where + decodeJson = defer \_ -> D.decode $ + ( CompileRequest <$> D.record "CompileRequest" + { code: D.value :: _ String + , implicitPrelude: D.value :: _ Boolean + } + ) + +derive instance genericCompileRequest :: Generic CompileRequest _ + +derive instance newtypeCompileRequest :: Newtype CompileRequest _ + +-------------------------------------------------------------------------------- + +_CompileRequest :: Iso' CompileRequest + { code :: String, implicitPrelude :: Boolean } +_CompileRequest = _Newtype \ No newline at end of file