Copyright | (c) 2023 GYELD GMBH |
---|---|
License | Apache 2.0 |
Maintainer | [email protected] |
Stability | develop |
Safe Haskell | Safe-Inferred |
Language | GHC2021 |
Synopsis
- type GYLookupDatum = GYDatumHash → IO (Maybe GYDatum)
- type GYSubmitTx = GYTx → IO GYTxId
- type GYAwaitTx = GYAwaitTxParameters → GYTxId → IO ()
- data GYAwaitTxParameters = GYAwaitTxParameters {}
- newtype GYAwaitTxException = GYAwaitTxException GYAwaitTxParameters
- data GYSlotActions = GYSlotActions {
- gyGetSlotOfCurrentBlock' ∷ !(IO GYSlot)
- gyWaitForNextBlock' ∷ !(IO GYSlot)
- gyWaitUntilSlot' ∷ !(GYSlot → IO GYSlot)
- gyGetSlotOfCurrentBlock ∷ GYProviders → IO GYSlot
- gyWaitForNextBlock ∷ GYProviders → IO GYSlot
- gyWaitForNextBlock_ ∷ GYProviders → IO ()
- gyWaitForNextBlockDefault ∷ IO GYSlot → IO GYSlot
- gyWaitUntilSlot ∷ GYProviders → GYSlot → IO GYSlot
- gyWaitUntilSlotDefault ∷ IO GYSlot → GYSlot → IO GYSlot
- makeSlotActions ∷ NominalDiffTime → IO GYSlot → IO GYSlotActions
- data GYGetParameters = GYGetParameters {}
- gyGetProtocolParameters ∷ GYProviders → IO ApiProtocolParameters
- gyGetSystemStart ∷ GYProviders → IO SystemStart
- gyGetEraHistory ∷ GYProviders → IO EraHistory
- gyGetSlotConfig ∷ GYProviders → IO GYSlotConfig
- makeGetParameters ∷ IO ApiProtocolParameters → IO SystemStart → IO EraHistory → IO GYSlot → IO GYGetParameters
- gyQueryUtxosAtAddressWithDatumsDefault ∷ Monad m ⇒ (GYAddress → Maybe GYAssetClass → m GYUTxOs) → (GYDatumHash → m (Maybe GYDatum)) → GYAddress → Maybe GYAssetClass → m [(GYUTxO, Maybe GYDatum)]
- gyQueryUtxosAtAddressesWithDatumsDefault ∷ Monad m ⇒ ([GYAddress] → m GYUTxOs) → (GYDatumHash → m (Maybe GYDatum)) → [GYAddress] → m [(GYUTxO, Maybe GYDatum)]
- gyQueryUtxosAtPaymentCredsWithDatumsDefault ∷ Monad m ⇒ ([GYPaymentCredential] → m GYUTxOs) → (GYDatumHash → m (Maybe GYDatum)) → [GYPaymentCredential] → m [(GYUTxO, Maybe GYDatum)]
- gyQueryUtxosAtPaymentCredWithDatumsDefault ∷ Monad m ⇒ (GYPaymentCredential → Maybe GYAssetClass → m GYUTxOs) → (GYDatumHash → m (Maybe GYDatum)) → GYPaymentCredential → Maybe GYAssetClass → m [(GYUTxO, Maybe GYDatum)]
- gyQueryUtxosAtTxOutRefsWithDatumsDefault ∷ Monad m ⇒ ([GYTxOutRef] → m GYUTxOs) → (GYDatumHash → m (Maybe GYDatum)) → [GYTxOutRef] → m [(GYUTxO, Maybe GYDatum)]
- data GYQueryUTxO = GYQueryUTxO {
- gyQueryUtxosAtTxOutRefs' ∷ !([GYTxOutRef] → IO GYUTxOs)
- gyQueryUtxosAtTxOutRefsWithDatums' ∷ !(Maybe ([GYTxOutRef] → IO [(GYUTxO, Maybe GYDatum)]))
- gyQueryUtxoAtTxOutRef' ∷ !(GYTxOutRef → IO (Maybe GYUTxO))
- gyQueryUtxoRefsAtAddress' ∷ !(GYAddress → IO [GYTxOutRef])
- gyQueryUtxosAtAddress' ∷ !(GYAddress → Maybe GYAssetClass → IO GYUTxOs)
- gyQueryUtxosAtAddressWithDatums' ∷ !(Maybe (GYAddress → Maybe GYAssetClass → IO [(GYUTxO, Maybe GYDatum)]))
- gyQueryUtxosAtAddresses' ∷ !([GYAddress] → IO GYUTxOs)
- gyQueryUtxosAtAddressesWithDatums' ∷ !(Maybe ([GYAddress] → IO [(GYUTxO, Maybe GYDatum)]))
- gyQueryUtxosAtPaymentCredential' ∷ !(GYPaymentCredential → Maybe GYAssetClass → IO GYUTxOs)
- gyQueryUtxosAtPaymentCredWithDatums' ∷ !(Maybe (GYPaymentCredential → Maybe GYAssetClass → IO [(GYUTxO, Maybe GYDatum)]))
- gyQueryUtxosAtPaymentCredentials' ∷ !([GYPaymentCredential] → IO GYUTxOs)
- gyQueryUtxosAtPaymentCredsWithDatums' ∷ !(Maybe ([GYPaymentCredential] → IO [(GYUTxO, Maybe GYDatum)]))
- gyQueryUtxosAtAddresses ∷ GYProviders → [GYAddress] → IO GYUTxOs
- gyQueryUtxosAtAddressWithDatums ∷ GYProviders → GYAddress → Maybe GYAssetClass → IO [(GYUTxO, Maybe GYDatum)]
- gyQueryUtxosAtAddressesWithDatums ∷ GYProviders → [GYAddress] → IO [(GYUTxO, Maybe GYDatum)]
- gyQueryUtxosAtPaymentCredWithDatums ∷ GYProviders → GYPaymentCredential → Maybe GYAssetClass → IO [(GYUTxO, Maybe GYDatum)]
- gyQueryUtxosAtPaymentCredsWithDatums ∷ GYProviders → [GYPaymentCredential] → IO [(GYUTxO, Maybe GYDatum)]
- gyQueryUtxosAtAddress ∷ GYProviders → GYAddress → Maybe GYAssetClass → IO GYUTxOs
- gyQueryUtxosAtPaymentCredential ∷ GYProviders → GYPaymentCredential → Maybe GYAssetClass → IO GYUTxOs
- gyQueryUtxosAtPaymentCredentials ∷ GYProviders → [GYPaymentCredential] → IO GYUTxOs
- gyQueryUtxosAtTxOutRefs ∷ GYProviders → [GYTxOutRef] → IO GYUTxOs
- gyQueryUtxosAtTxOutRefsWithDatums ∷ GYProviders → [GYTxOutRef] → IO [(GYUTxO, Maybe GYDatum)]
- gyQueryUtxoAtTxOutRef ∷ GYProviders → GYTxOutRef → IO (Maybe GYUTxO)
- gyQueryUtxoRefsAtAddress ∷ GYProviders → GYAddress → IO [GYTxOutRef]
- gyQueryUtxoRefsAtAddressDefault ∷ (GYAddress → Maybe GYAssetClass → IO GYUTxOs) → GYAddress → IO [GYTxOutRef]
- gyQueryUtxoAtAddressesDefault ∷ (GYAddress → Maybe GYAssetClass → IO GYUTxOs) → [GYAddress] → IO GYUTxOs
- gyQueryUtxoAtPaymentCredentialsDefault ∷ (GYPaymentCredential → Maybe GYAssetClass → IO GYUTxOs) → [GYPaymentCredential] → IO GYUTxOs
- gyQueryUtxosAtTxOutRefsDefault ∷ (GYTxOutRef → IO (Maybe GYUTxO)) → [GYTxOutRef] → IO GYUTxOs
- gyLog ∷ (HasCallStack, MonadIO m) ⇒ GYProviders → GYLogNamespace → GYLogSeverity → String → m ()
- gyLogDebug ∷ (HasCallStack, MonadIO m) ⇒ GYProviders → GYLogNamespace → String → m ()
- gyLogInfo ∷ (HasCallStack, MonadIO m) ⇒ GYProviders → GYLogNamespace → String → m ()
- gyLogWarning ∷ (HasCallStack, MonadIO m) ⇒ GYProviders → GYLogNamespace → String → m ()
- gyLogError ∷ (HasCallStack, MonadIO m) ⇒ GYProviders → GYLogNamespace → String → m ()
- noLogging ∷ GYLogConfiguration
- simpleLogging ∷ GYLogSeverity → (Text → IO ()) → GYLogConfiguration
- data GYProviders = GYProviders {
- gyLookupDatum ∷ !GYLookupDatum
- gySubmitTx ∷ !GYSubmitTx
- gyAwaitTxConfirmed ∷ !GYAwaitTx
- gySlotActions ∷ !GYSlotActions
- gyGetParameters ∷ !GYGetParameters
- gyQueryUTxO ∷ !GYQueryUTxO
- gyGetStakeAddressInfo ∷ !(GYStakeAddress → IO (Maybe GYStakeAddressInfo))
- gyGetDRepState ∷ !(GYCredential 'GYKeyRoleDRep → IO (Maybe GYDRepState))
- gyGetDRepsState ∷ !(Set (GYCredential 'GYKeyRoleDRep) → IO (Map (GYCredential 'GYKeyRoleDRep) (Maybe GYDRepState)))
- gyLog' ∷ !GYLogConfiguration
- gyGetStakePools ∷ !(IO (Set PoolId))
Lookup Datum
type GYLookupDatum = GYDatumHash → IO (Maybe GYDatum) #
How to query a datum by its hash?
Submit Tx
type GYSubmitTx = GYTx → IO GYTxId #
How to submit a transaction?
Await Tx Confirmed
type GYAwaitTx = GYAwaitTxParameters → GYTxId → IO () #
How to await for a transaction confirmation?
data GYAwaitTxParameters #
Await transaction parameters.
GYAwaitTxParameters | |
|
Instances
Show GYAwaitTxParameters # | |
Defined in GeniusYield.Types.Providers showsPrec ∷ Int → GYAwaitTxParameters → ShowS # show ∷ GYAwaitTxParameters → String # showList ∷ [GYAwaitTxParameters] → ShowS # | |
Default GYAwaitTxParameters # | |
Defined in GeniusYield.Types.Providers |
newtype GYAwaitTxException #
Instances
Exception GYAwaitTxException # | |
Show GYAwaitTxException # | |
Defined in GeniusYield.Types.Providers showsPrec ∷ Int → GYAwaitTxException → ShowS # show ∷ GYAwaitTxException → String # showList ∷ [GYAwaitTxException] → ShowS # |
Get current slot
data GYSlotActions #
How to get current slot?
GYSlotActions | |
|
gyWaitForNextBlock_ ∷ GYProviders → IO () #
gyWaitForNextBlock
variant which doesn't return current slot.
gyWaitForNextBlockDefault ∷ IO GYSlot → IO GYSlot #
Wait for the next block.
threadDelay
until current slot getter returns another value.
gyWaitUntilSlot ∷ GYProviders → GYSlot → IO GYSlot #
gyWaitUntilSlotDefault ∷ IO GYSlot → GYSlot → IO GYSlot #
Wait until slot.
Returns the new current slot, which might be larger.
∷ NominalDiffTime | The time to cache current slots for. |
→ IO GYSlot | Getting current slot directly from the provider |
→ IO GYSlotActions |
Construct efficient GYSlotActions
methods by ensuring the supplied getSlotOfCurrentBlock is only made after
a given duration of time has passed.
This uses IO to set up some mutable references used for caching.
Get network parameters
data GYGetParameters #
How to get protocol parameters? ... and other data to do balancing.
∷ IO ApiProtocolParameters | Getting protocol parameters |
→ IO SystemStart | Getting system start |
→ IO EraHistory | Getting era history |
→ IO GYSlot | Getting slot of current block (to know for epoch) |
→ IO GYGetParameters |
Construct efficient GYGetParameters
methods by ensuring the supplied IO queries are only made when necessary.
In particular era histories and system start are cached throughout the run of the program whereas protocol parameters are cached only for a single epoch.
This uses IO to set up some mutable references used for caching.
Query UTxO
gyQueryUtxosAtAddressWithDatumsDefault ∷ Monad m ⇒ (GYAddress → Maybe GYAssetClass → m GYUTxOs) → (GYDatumHash → m (Maybe GYDatum)) → GYAddress → Maybe GYAssetClass → m [(GYUTxO, Maybe GYDatum)] #
Lookup UTxOs at given GYAddress
with their datums. This is a default implementation using utxosAtAddress
and lookupDatum
.
gyQueryUtxosAtAddressesWithDatumsDefault ∷ Monad m ⇒ ([GYAddress] → m GYUTxOs) → (GYDatumHash → m (Maybe GYDatum)) → [GYAddress] → m [(GYUTxO, Maybe GYDatum)] #
Lookup UTxOs at zero or more GYAddress
with their datums. This is a default implementation using utxosAtAddresses
and lookupDatum
.
gyQueryUtxosAtPaymentCredsWithDatumsDefault ∷ Monad m ⇒ ([GYPaymentCredential] → m GYUTxOs) → (GYDatumHash → m (Maybe GYDatum)) → [GYPaymentCredential] → m [(GYUTxO, Maybe GYDatum)] #
Lookup UTxOs at zero or more GYPaymentCredential
with their datums. This is a default implementation using utxosAtPaymentCredentials
and lookupDatum
.
gyQueryUtxosAtPaymentCredWithDatumsDefault ∷ Monad m ⇒ (GYPaymentCredential → Maybe GYAssetClass → m GYUTxOs) → (GYDatumHash → m (Maybe GYDatum)) → GYPaymentCredential → Maybe GYAssetClass → m [(GYUTxO, Maybe GYDatum)] #
Lookup UTxOs at given GYPaymentCredential
with their datums. This is a default implementation using utxosAtPaymentCredential
and lookupDatum
.
gyQueryUtxosAtTxOutRefsWithDatumsDefault ∷ Monad m ⇒ ([GYTxOutRef] → m GYUTxOs) → (GYDatumHash → m (Maybe GYDatum)) → [GYTxOutRef] → m [(GYUTxO, Maybe GYDatum)] #
Lookup UTxOs at zero or more GYTxOutRef
with their datums. This is a default implementation using utxosAtTxOutRefs
and lookupDatum
.
data GYQueryUTxO #
How to query utxos?
gyQueryUtxosAtAddressWithDatums ∷ GYProviders → GYAddress → Maybe GYAssetClass → IO [(GYUTxO, Maybe GYDatum)] #
gyQueryUtxosAtAddressesWithDatums ∷ GYProviders → [GYAddress] → IO [(GYUTxO, Maybe GYDatum)] #
gyQueryUtxosAtPaymentCredWithDatums ∷ GYProviders → GYPaymentCredential → Maybe GYAssetClass → IO [(GYUTxO, Maybe GYDatum)] #
gyQueryUtxosAtPaymentCredsWithDatums ∷ GYProviders → [GYPaymentCredential] → IO [(GYUTxO, Maybe GYDatum)] #
gyQueryUtxosAtPaymentCredential ∷ GYProviders → GYPaymentCredential → Maybe GYAssetClass → IO GYUTxOs #
gyQueryUtxosAtTxOutRefsWithDatums ∷ GYProviders → [GYTxOutRef] → IO [(GYUTxO, Maybe GYDatum)] #
gyQueryUtxoAtTxOutRef ∷ GYProviders → GYTxOutRef → IO (Maybe GYUTxO) #
gyQueryUtxoRefsAtAddressDefault ∷ (GYAddress → Maybe GYAssetClass → IO GYUTxOs) → GYAddress → IO [GYTxOutRef] #
Query Utxo Refs at address (default implementation)
gyQueryUtxoAtAddressesDefault ∷ (GYAddress → Maybe GYAssetClass → IO GYUTxOs) → [GYAddress] → IO GYUTxOs #
Query Utxo for addresses (default implementation)
gyQueryUtxoAtPaymentCredentialsDefault ∷ (GYPaymentCredential → Maybe GYAssetClass → IO GYUTxOs) → [GYPaymentCredential] → IO GYUTxOs #
Query Utxo for payment credentials (default implementation)
gyQueryUtxosAtTxOutRefsDefault ∷ (GYTxOutRef → IO (Maybe GYUTxO)) → [GYTxOutRef] → IO GYUTxOs #
Query Utxos at output refs (default implementation).
Logging
gyLog ∷ (HasCallStack, MonadIO m) ⇒ GYProviders → GYLogNamespace → GYLogSeverity → String → m () #
gyLogDebug ∷ (HasCallStack, MonadIO m) ⇒ GYProviders → GYLogNamespace → String → m () #
gyLogInfo ∷ (HasCallStack, MonadIO m) ⇒ GYProviders → GYLogNamespace → String → m () #
gyLogWarning ∷ (HasCallStack, MonadIO m) ⇒ GYProviders → GYLogNamespace → String → m () #
gyLogError ∷ (HasCallStack, MonadIO m) ⇒ GYProviders → GYLogNamespace → String → m () #
simpleLogging ∷ GYLogSeverity → (Text → IO ()) → GYLogConfiguration #
Logging messages using the given severity filter with given IO action.
Providers
data GYProviders #
GYProviders | |
|