Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data RunContract r where
- CallEndpointP :: forall l ep w s e. (ContractConstraints s, HasEndpoint l ep s, ToJSON ep) => Proxy l -> ContractHandle w s e -> ep -> RunContract ()
- GetContractState :: forall w s e. (ContractConstraints s, FromJSON e, FromJSON w, ToJSON w) => ContractHandle w s e -> RunContract (ContractInstanceState w s e ())
- data StartContract r where
- ActivateContract :: (IsContract contract, ContractConstraints s, Show e, FromJSON e, ToJSON e, ToJSON w, Monoid w, FromJSON w) => Wallet -> contract w s e a -> ContractInstanceTag -> StartContract (ContractHandle w s e)
- type ContractConstraints s = (Forall (Output s) Unconstrained1, Forall (Input s) Unconstrained1, AllUniqueLabels (Input s), AllUniqueLabels (Output s), Forall (Input s) FromJSON, Forall (Input s) ToJSON, Forall (Output s) FromJSON, Forall (Output s) ToJSON)
- data ContractInstanceTag
- activateContract :: forall (contract :: Type -> Row Type -> Type -> Type -> Type) (s :: Row Type) e w a. (IsContract contract, ContractConstraints s, Show e, FromJSON e, ToJSON e, ToJSON w, Monoid w, FromJSON w) => forall effs. Member StartContract effs => Wallet -> contract w s e a -> ContractInstanceTag -> Eff effs (ContractHandle w s e)
- activateContractWallet :: forall contract w s e effs. (IsContract contract, ContractConstraints s, Show e, ToJSON e, FromJSON e, ToJSON w, FromJSON w, Member StartContract effs, Monoid w) => Wallet -> contract w s e () -> Eff effs (ContractHandle w s e)
- callEndpoint :: forall l ep w s e effs. (ToJSON ep, ContractConstraints s, HasEndpoint l ep s, Member RunContract effs) => ContractHandle w s e -> ep -> Eff effs ()
- getContractState :: forall w (s :: Row Type) e. (ContractConstraints s, FromJSON e, FromJSON w, ToJSON w) => forall effs. Member RunContract effs => ContractHandle w s e -> Eff effs (ContractInstanceState w s e ())
- activeEndpoints :: forall w s e effs. (Member RunContract effs, ContractConstraints s, FromJSON e, FromJSON w, ToJSON w) => ContractHandle w s e -> Eff effs [ActiveEndpoint]
- observableState :: forall w s e effs. (Member RunContract effs, ContractConstraints s, FromJSON e, FromJSON w, ToJSON w) => ContractHandle w s e -> Eff effs w
- walletInstanceTag :: Wallet -> ContractInstanceTag
- handleRunContract :: forall effs effs2 a. (Member (State EmulatorThreads) effs2, Member (Error EmulatorRuntimeError) effs2, Member (Error EmulatorRuntimeError) effs, Member (LogMsg EmulatorEvent') effs, Member (State EmulatorThreads) effs, Member (Reader ThreadId) effs, Member (Yield (EmSystemCall effs2 EmulatorMessage a) (Maybe EmulatorMessage)) effs) => RunContract ~> Eff effs
- handleStartContract :: forall effs effs2 a. (Member (State EmulatorThreads) effs2, Member (Error EmulatorRuntimeError) effs2, Member MultiAgentEffect effs2, Member (LogMsg EmulatorEvent') effs2, Member ContractInstanceIdEff effs, Member (Yield (EmSystemCall effs2 EmulatorMessage a) (Maybe EmulatorMessage)) effs) => NetworkId -> StartContract ~> Eff effs
- startContractThread :: forall w s e effs effs2 a. (Member (Yield (EmSystemCall effs2 EmulatorMessage a) (Maybe EmulatorMessage)) effs, Member (State EmulatorThreads) effs2, Member MultiAgentEffect effs2, Member (Error EmulatorRuntimeError) effs2, Member (LogMsg EmulatorEvent') effs2, ContractConstraints s, Show e, ToJSON e, ToJSON w, Monoid w) => Wallet -> ContractHandle w s e -> Eff effs (Maybe EmulatorMessage)
Documentation
data RunContract r where Source #
Run a Plutus contract (client side)
CallEndpointP :: forall l ep w s e. (ContractConstraints s, HasEndpoint l ep s, ToJSON ep) => Proxy l -> ContractHandle w s e -> ep -> RunContract () | |
GetContractState :: forall w s e. (ContractConstraints s, FromJSON e, FromJSON w, ToJSON w) => ContractHandle w s e -> RunContract (ContractInstanceState w s e ()) |
data StartContract r where Source #
Start a Plutus contract (client side)
ActivateContract :: (IsContract contract, ContractConstraints s, Show e, FromJSON e, ToJSON e, ToJSON w, Monoid w, FromJSON w) => Wallet -> contract w s e a -> ContractInstanceTag -> StartContract (ContractHandle w s e) |
type ContractConstraints s = (Forall (Output s) Unconstrained1, Forall (Input s) Unconstrained1, AllUniqueLabels (Input s), AllUniqueLabels (Output s), Forall (Input s) FromJSON, Forall (Input s) ToJSON, Forall (Output s) FromJSON, Forall (Output s) ToJSON) Source #
data ContractInstanceTag Source #
A user-defined tag for a contract instance. Used to find the instance's log messages in the emulator log.
Instances
activateContract :: forall (contract :: Type -> Row Type -> Type -> Type -> Type) (s :: Row Type) e w a. (IsContract contract, ContractConstraints s, Show e, FromJSON e, ToJSON e, ToJSON w, Monoid w, FromJSON w) => forall effs. Member StartContract effs => Wallet -> contract w s e a -> ContractInstanceTag -> Eff effs (ContractHandle w s e) Source #
activateContractWallet :: forall contract w s e effs. (IsContract contract, ContractConstraints s, Show e, ToJSON e, FromJSON e, ToJSON w, FromJSON w, Member StartContract effs, Monoid w) => Wallet -> contract w s e () -> Eff effs (ContractHandle w s e) Source #
Like activateContract
, but using walletInstanceTag
for the tag.
callEndpoint :: forall l ep w s e effs. (ToJSON ep, ContractConstraints s, HasEndpoint l ep s, Member RunContract effs) => ContractHandle w s e -> ep -> Eff effs () Source #
Call an endpoint on a contract instance.
getContractState :: forall w (s :: Row Type) e. (ContractConstraints s, FromJSON e, FromJSON w, ToJSON w) => forall effs. Member RunContract effs => ContractHandle w s e -> Eff effs (ContractInstanceState w s e ()) Source #
activeEndpoints :: forall w s e effs. (Member RunContract effs, ContractConstraints s, FromJSON e, FromJSON w, ToJSON w) => ContractHandle w s e -> Eff effs [ActiveEndpoint] Source #
Get the active endpoints of a contract instance.
observableState :: forall w s e effs. (Member RunContract effs, ContractConstraints s, FromJSON e, FromJSON w, ToJSON w) => ContractHandle w s e -> Eff effs w Source #
Get the observable state w
of a contract instance.
walletInstanceTag :: Wallet -> ContractInstanceTag Source #
The ContractInstanceTag
for the contract instance of a wallet. See note
[Wallet contract instances]
handleRunContract :: forall effs effs2 a. (Member (State EmulatorThreads) effs2, Member (Error EmulatorRuntimeError) effs2, Member (Error EmulatorRuntimeError) effs, Member (LogMsg EmulatorEvent') effs, Member (State EmulatorThreads) effs, Member (Reader ThreadId) effs, Member (Yield (EmSystemCall effs2 EmulatorMessage a) (Maybe EmulatorMessage)) effs) => RunContract ~> Eff effs Source #
Handle the RunContract
effect by running each contract instance in an
emulator thread.
handleStartContract :: forall effs effs2 a. (Member (State EmulatorThreads) effs2, Member (Error EmulatorRuntimeError) effs2, Member MultiAgentEffect effs2, Member (LogMsg EmulatorEvent') effs2, Member ContractInstanceIdEff effs, Member (Yield (EmSystemCall effs2 EmulatorMessage a) (Maybe EmulatorMessage)) effs) => NetworkId -> StartContract ~> Eff effs Source #
Handle the StartContract
effect by starting each contract instance in an
emulator thread.
startContractThread :: forall w s e effs effs2 a. (Member (Yield (EmSystemCall effs2 EmulatorMessage a) (Maybe EmulatorMessage)) effs, Member (State EmulatorThreads) effs2, Member MultiAgentEffect effs2, Member (Error EmulatorRuntimeError) effs2, Member (LogMsg EmulatorEvent') effs2, ContractConstraints s, Show e, ToJSON e, ToJSON w, Monoid w) => Wallet -> ContractHandle w s e -> Eff effs (Maybe EmulatorMessage) Source #
Start a new thread for a contract instance (given by the handle). The thread runs in the context of the wallet.