Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
-
data
ContractInstanceMsg
t
- = ProcessFirstInboxMessage ContractInstanceId (Response PABResp)
- | SendingContractStateMessages ContractInstanceId IterationID [Request PABReq]
- | LookingUpStateOfContractInstance
- | CurrentIteration IterationID
- | InboxMessageDoesntMatchIteration IterationID IterationID
- | InboxMessageMatchesIteration
- | InvokingContractUpdate
- | ObtainedNewState
- | ContractLog ContractInstanceId Value
- | UpdatedContract ContractInstanceId IterationID
- | LookingUpContract ( ContractDef t)
- | InitialisingContract ( ContractDef t) ContractInstanceId
- | InitialPABResp ( PartiallyDecodedResponse PABReq)
- | ActivatedContractInstance ( ContractDef t) Wallet ContractInstanceId
- | RunRequestHandler ContractInstanceId Int
- | RunRequestHandlerDidNotHandleAnyEvents
- | StoringSignedTx CardanoTx
- | CallingEndpoint String ContractInstanceId Value
- | ProcessContractInbox ContractInstanceId
- | HandlingRequest RequestHandlerLogMsg
- | HandlingRequests ContractInstanceId [Request PABReq]
- | BalancingTx TxBalanceMsg
- | NotificationFailed NotificationError
- activateContractSTM :: forall t m appBackend effs. ( Member ( LogMsg ( ContractInstanceMsg t)) effs, Member UUIDEffect effs, Member ( ContractEffect t) effs, Member ( ContractStore t) effs, Member ( Reader InstancesState ) effs, PABContract t, AppBackendConstraints t m appBackend, LastMember m ( Reader ContractInstanceId ': appBackend), LastMember m effs) => ( ContractInstanceId -> Eff appBackend ~> IO ) -> ContractActivationArgs ( ContractDef t) -> Eff effs ContractInstanceId
- activateContractSTM' :: forall t m appBackend effs. ( Member ( LogMsg ( ContractInstanceMsg t)) effs, Member ( ContractStore t) effs, Member ( Reader InstancesState ) effs, PABContract t, AppBackendConstraints t m appBackend, LastMember m ( Reader ContractInstanceId ': appBackend), LastMember m effs) => ContractInstanceState t -> ContractInstanceId -> ( ContractInstanceId -> Eff appBackend ~> IO ) -> ContractActivationArgs ( ContractDef t) -> Eff effs ContractInstanceId
- initContractInstanceState :: forall t effs. ( Member UUIDEffect effs, Member ( ContractEffect t) effs, PABContract t) => ContractActivationArgs ( ContractDef t) -> Eff effs ( ContractInstanceId , ContractInstanceState t)
-
data
ContractInstanceState
t =
ContractInstanceState
{
- contractState :: State t
- stmState :: STM InstanceState
- updateState :: forall m effs. ( LastMember m effs, MonadIO m, Member ( Reader InstanceState ) effs) => ContractResponse Value Value PABResp PABReq -> Eff effs ()
- startSTMInstanceThread :: forall t m appBackend effs. ( LastMember m effs, PABContract t, AppBackendConstraints t m appBackend, LastMember m ( Reader InstanceState ': ( Reader ContractInstanceId ': appBackend))) => ( ContractInstanceId -> Eff appBackend ~> IO ) -> ContractActivationArgs ( ContractDef t) -> ContractInstanceId -> Eff effs InstanceState
- startContractInstanceThread' :: forall t m appBackend effs. ( Member ( Reader InstancesState ) effs, PABContract t, AppBackendConstraints t m appBackend, LastMember m ( Reader ContractInstanceId ': appBackend), LastMember m effs) => ContractInstanceState t -> ContractInstanceId -> ( ContractInstanceId -> Eff appBackend ~> IO ) -> ContractActivationArgs ( ContractDef t) -> Eff effs ContractInstanceId
- type AppBackendConstraints t m effs = ( LastMember m effs, MonadIO m, Member ( Error PABError ) effs, Member ( LogMsg ( ContractInstanceMsg t)) effs, Member ChainIndexQueryEffect effs, Member WalletEffect effs, Member NodeClientEffect effs, Member ( LogMsg RequestHandlerLogMsg) effs, Member ( LogObserve ( LogMessage Text )) effs, Member ( LogMsg TxBalanceMsg) effs, Member ( Reader BlockchainEnv ) effs, Member ( ContractEffect t) effs, Member ( ContractStore t) effs)
- callEndpointOnInstance :: InstancesState -> EndpointDescription -> Value -> ContractInstanceId -> IO ( STM ( Maybe NotificationError))
Documentation
data ContractInstanceMsg t Source #
Log messages about the contract instance
Instances
activateContractSTM :: forall t m appBackend effs. ( Member ( LogMsg ( ContractInstanceMsg t)) effs, Member UUIDEffect effs, Member ( ContractEffect t) effs, Member ( ContractStore t) effs, Member ( Reader InstancesState ) effs, PABContract t, AppBackendConstraints t m appBackend, LastMember m ( Reader ContractInstanceId ': appBackend), LastMember m effs) => ( ContractInstanceId -> Eff appBackend ~> IO ) -> ContractActivationArgs ( ContractDef t) -> Eff effs ContractInstanceId Source #
Create a new instance of the contract
activateContractSTM' :: forall t m appBackend effs. ( Member ( LogMsg ( ContractInstanceMsg t)) effs, Member ( ContractStore t) effs, Member ( Reader InstancesState ) effs, PABContract t, AppBackendConstraints t m appBackend, LastMember m ( Reader ContractInstanceId ': appBackend), LastMember m effs) => ContractInstanceState t -> ContractInstanceId -> ( ContractInstanceId -> Eff appBackend ~> IO ) -> ContractActivationArgs ( ContractDef t) -> Eff effs ContractInstanceId Source #
Create a new instance of the contract, but where the activeContractInstanceId and the initial state are provided.
initContractInstanceState :: forall t effs. ( Member UUIDEffect effs, Member ( ContractEffect t) effs, PABContract t) => ContractActivationArgs ( ContractDef t) -> Eff effs ( ContractInstanceId , ContractInstanceState t) Source #
Build a new ContractInstanceState and return it, along with the corresponding new intsance id.
data ContractInstanceState t Source #
Container for holding a few bits of state related to the contract instance that we may want to pass in.
updateState :: forall m effs. ( LastMember m effs, MonadIO m, Member ( Reader InstanceState ) effs) => ContractResponse Value Value PABResp PABReq -> Eff effs () Source #
Update the TVars in the
InstanceState
with data from the list
of requests.
STM instances
startSTMInstanceThread :: forall t m appBackend effs. ( LastMember m effs, PABContract t, AppBackendConstraints t m appBackend, LastMember m ( Reader InstanceState ': ( Reader ContractInstanceId ': appBackend))) => ( ContractInstanceId -> Eff appBackend ~> IO ) -> ContractActivationArgs ( ContractDef t) -> ContractInstanceId -> Eff effs InstanceState Source #
Start the thread for the contract instance
startContractInstanceThread' :: forall t m appBackend effs. ( Member ( Reader InstancesState ) effs, PABContract t, AppBackendConstraints t m appBackend, LastMember m ( Reader ContractInstanceId ': appBackend), LastMember m effs) => ContractInstanceState t -> ContractInstanceId -> ( ContractInstanceId -> Eff appBackend ~> IO ) -> ContractActivationArgs ( ContractDef t) -> Eff effs ContractInstanceId Source #
Spin up the STM Instance thread for the provided contract and add it to the STM instance state.
type AppBackendConstraints t m effs = ( LastMember m effs, MonadIO m, Member ( Error PABError ) effs, Member ( LogMsg ( ContractInstanceMsg t)) effs, Member ChainIndexQueryEffect effs, Member WalletEffect effs, Member NodeClientEffect effs, Member ( LogMsg RequestHandlerLogMsg) effs, Member ( LogObserve ( LogMessage Text )) effs, Member ( LogMsg TxBalanceMsg) effs, Member ( Reader BlockchainEnv ) effs, Member ( ContractEffect t) effs, Member ( ContractStore t) effs) Source #
Calling endpoints
callEndpointOnInstance :: InstancesState -> EndpointDescription -> Value -> ContractInstanceId -> IO ( STM ( Maybe NotificationError)) Source #
Call an endpoint on a contract instance. Fail immediately if the endpoint is not active.