Copyright | (c) 2023 GYELD GMBH |
---|---|
License | Apache 2.0 |
Maintainer | [email protected] |
Stability | develop |
Safe Haskell | Safe-Inferred |
Language | GHC2021 |
Synopsis
- class MonadError GYTxMonadException m ⇒ GYTxQueryMonad m where
- networkId ∷ m GYNetworkId
- lookupDatum ∷ GYDatumHash → m (Maybe GYDatum)
- utxoAtTxOutRef ∷ GYTxOutRef → m (Maybe GYUTxO)
- utxoAtTxOutRefWithDatum ∷ GYTxOutRef → m (Maybe (GYUTxO, Maybe GYDatum))
- utxosAtTxOutRefs ∷ [GYTxOutRef] → m GYUTxOs
- utxosAtTxOutRefsWithDatums ∷ [GYTxOutRef] → m [(GYUTxO, Maybe GYDatum)]
- utxosAtAddress ∷ GYAddress → Maybe GYAssetClass → m GYUTxOs
- utxosAtAddressWithDatums ∷ GYAddress → Maybe GYAssetClass → m [(GYUTxO, Maybe GYDatum)]
- utxosAtAddresses ∷ [GYAddress] → m GYUTxOs
- utxosAtAddressesWithDatums ∷ [GYAddress] → m [(GYUTxO, Maybe GYDatum)]
- utxoRefsAtAddress ∷ GYAddress → m [GYTxOutRef]
- utxosAtPaymentCredential ∷ GYPaymentCredential → Maybe GYAssetClass → m GYUTxOs
- utxosAtPaymentCredentialWithDatums ∷ GYPaymentCredential → Maybe GYAssetClass → m [(GYUTxO, Maybe GYDatum)]
- utxosAtPaymentCredentials ∷ [GYPaymentCredential] → m GYUTxOs
- utxosAtPaymentCredentialsWithDatums ∷ [GYPaymentCredential] → m [(GYUTxO, Maybe GYDatum)]
- stakeAddressInfo ∷ GYStakeAddress → m (Maybe GYStakeAddressInfo)
- slotConfig ∷ m GYSlotConfig
- slotOfCurrentBlock ∷ m GYSlot
- logMsg ∷ HasCallStack ⇒ GYLogNamespace → GYLogSeverity → String → m ()
- waitUntilSlot ∷ GYSlot → m GYSlot
- waitForNextBlock ∷ m GYSlot
- class GYTxQueryMonad m ⇒ GYTxSpecialQueryMonad m where
- class GYTxQueryMonad m ⇒ GYTxUserQueryMonad m where
- ownAddresses ∷ m [GYAddress]
- ownChangeAddress ∷ m GYAddress
- ownCollateral ∷ m (Maybe GYUTxO)
- availableUTxOs ∷ m GYUTxOs
- someUTxO ∷ PlutusVersion → m GYTxOutRef
Documentation
class MonadError GYTxMonadException m ⇒ GYTxQueryMonad m where #
Class of monads for querying chain data.
networkId, lookupDatum, (utxoAtTxOutRef | utxosAtTxOutRefs), utxosAtAddress, utxosAtPaymentCredential, stakeAddressInfo, slotConfig, slotOfCurrentBlock, logMsg, waitUntilSlot, waitForNextBlock
networkId ∷ m GYNetworkId #
Get the network id
lookupDatum ∷ GYDatumHash → m (Maybe GYDatum) #
Lookup datum by its hash.
utxoAtTxOutRef ∷ GYTxOutRef → m (Maybe GYUTxO) #
Lookup GYUTxO
at GYTxOutRef
.
utxoAtTxOutRefWithDatum ∷ GYTxOutRef → m (Maybe (GYUTxO, Maybe GYDatum)) #
Lookup UTxO at GYTxOutRef
with an attempt to resolve for datum.
utxosAtTxOutRefs ∷ [GYTxOutRef] → m GYUTxOs #
Lookup GYUTxOs
at multiple GYTxOutRef
s at once
utxosAtTxOutRefsWithDatums ∷ [GYTxOutRef] → m [(GYUTxO, Maybe GYDatum)] #
Lookup UTxOs at zero or more GYTxOutRef
with their datums. This has a default implementation using utxosAtTxOutRefs
and lookupDatum
but should be overridden for efficiency if provider provides suitable option.
utxosAtAddress ∷ GYAddress → Maybe GYAssetClass → m GYUTxOs #
utxosAtAddressWithDatums ∷ GYAddress → Maybe GYAssetClass → m [(GYUTxO, Maybe GYDatum)] #
Lookup GYUTxO
at given GYAddress
with their datums. This has a default implementation using utxosAtAddress
and lookupDatum
but should be overridden for efficiency if provider provides suitable option.
utxosAtAddresses ∷ [GYAddress] → m GYUTxOs #
utxosAtAddressesWithDatums ∷ [GYAddress] → m [(GYUTxO, Maybe GYDatum)] #
Lookup UTxOs at zero or more GYAddress
with their datums. This has a default implementation using utxosAtAddresses
and lookupDatum
but should be overridden for efficiency if provider provides suitable option.
utxoRefsAtAddress ∷ GYAddress → m [GYTxOutRef] #
Lookup the `[GYTxOutRef]`s at a GYAddress
utxosAtPaymentCredential ∷ GYPaymentCredential → Maybe GYAssetClass → m GYUTxOs #
Lookup GYUTxOs
at GYPaymentCredential
.
utxosAtPaymentCredentialWithDatums ∷ GYPaymentCredential → Maybe GYAssetClass → m [(GYUTxO, Maybe GYDatum)] #
Lookup UTxOs at given GYPaymentCredential
with their datums. This has a default implementation using utxosAtPaymentCredential
and lookupDatum
but should be overridden for efficiency if provider provides suitable option.
utxosAtPaymentCredentials ∷ [GYPaymentCredential] → m GYUTxOs #
Lookup GYUTxOs
at zero or more GYPaymentCredential
.
utxosAtPaymentCredentialsWithDatums ∷ [GYPaymentCredential] → m [(GYUTxO, Maybe GYDatum)] #
Lookup UTxOs at zero or more GYPaymentCredential
with their datums. This has a default implementation using utxosAtPaymentCredentials
and lookupDatum
but should be overridden for efficiency if provider provides suitable option.
stakeAddressInfo ∷ GYStakeAddress → m (Maybe GYStakeAddressInfo) #
Obtain delegation information for a stake address. Note that in case stake address is not registered, this function should return Nothing
.
slotConfig ∷ m GYSlotConfig #
Obtain the slot config for the network.
Implementations using era history to create slot config may raise GYEraSummariesToSlotConfigError
.
slotOfCurrentBlock ∷ m GYSlot #
This is expected to give the slot of the latest block. We say "expected" as we cache the result for 5 seconds, that is to say, suppose slot was cached at time T
, now if query for current block's slot comes within time duration (T, T + 5)
, then we'll return the cached slot but if say, query happened at time (T + 5, T + 21)
where 21
was taken as an arbitrary number above 5, then we'll query the chain tip and get the slot of the latest block seen by the provider and then store it in our cache, thus new cached value would be served for requests coming within time interval of (T + 21, T + 26)
.
NOTE: It's behaviour is slightly different, solely for our plutus simple model provider where it actually returns the value of the currentSlot
variable maintained inside plutus simple model library.
logMsg ∷ HasCallStack ⇒ GYLogNamespace → GYLogSeverity → String → m () #
Log a message with specified namespace and severity.
waitUntilSlot ∷ GYSlot → m GYSlot #
Wait until the chain tip is at least the given slot number, returning it's slot.
waitForNextBlock ∷ m GYSlot #
Wait until the chain tip is at the next block, return it's slot.
Instances
class GYTxQueryMonad m ⇒ GYTxSpecialQueryMonad m where #
Class of monads for querying special chain data.
systemStart ∷ m SystemStart #
eraHistory ∷ m EraHistory #
protocolParams ∷ m ApiProtocolParameters #
stakePools ∷ m (Set PoolId) #
Instances
class GYTxQueryMonad m ⇒ GYTxUserQueryMonad m where #
Class of monads for querying as a user.
ownAddresses ∷ m [GYAddress] #
Get your own address(es).
ownChangeAddress ∷ m GYAddress #
Get own change address.
ownCollateral ∷ m (Maybe GYUTxO) #
Get own collateral utxo.
availableUTxOs ∷ m GYUTxOs #
Get available own UTxOs that can be operated upon.
someUTxO ∷ PlutusVersion → m GYTxOutRef #
Return some unspent transaction output translatable to the given language corresponding to the script in question.
Law: Must return the different values.