{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TemplateHaskell #-}
module Plutus.ChainIndex.Effects(
ChainIndexQueryEffect(..)
, datumFromHash
, validatorFromHash
, mintingPolicyFromHash
, stakeValidatorFromHash
, redeemerFromHash
, txOutFromRef
, unspentTxOutFromRef
, txFromTxId
, utxoSetMembership
, utxoSetAtAddress
, unspentTxOutSetAtAddress
, datumsAtAddress
, utxoSetWithCurrency
, txoSetAtAddress
, txsFromTxIds
, getTip
, ChainIndexControlEffect(..)
, appendBlocks
, rollback
, resumeSync
, collectGarbage
, getDiagnostics
) where
import Control.Monad.Freer.Extras.Pagination (PageQuery)
import Control.Monad.Freer.TH (makeEffect)
import Ledger.Address (CardanoAddress)
import Ledger.Tx (DecoratedTxOut, TxOutRef, Versioned)
import Plutus.ChainIndex.Api (IsUtxoResponse, QueryResponse, TxosResponse, UtxosResponse)
import Plutus.ChainIndex.Tx (ChainIndexTx)
import Plutus.ChainIndex.Types (ChainSyncBlock, Diagnostics, Point, Tip)
import Plutus.V1.Ledger.Api (Datum, DatumHash, MintingPolicy, MintingPolicyHash, Redeemer, RedeemerHash, StakeValidator,
StakeValidatorHash, TxId, Validator, ValidatorHash)
import Plutus.V1.Ledger.Value (AssetClass)
data ChainIndexQueryEffect r where
DatumFromHash :: DatumHash -> ChainIndexQueryEffect (Maybe Datum)
ValidatorFromHash :: ValidatorHash -> ChainIndexQueryEffect (Maybe (Versioned Validator))
MintingPolicyFromHash :: MintingPolicyHash -> ChainIndexQueryEffect (Maybe (Versioned MintingPolicy))
RedeemerFromHash :: RedeemerHash -> ChainIndexQueryEffect (Maybe Redeemer)
StakeValidatorFromHash :: StakeValidatorHash -> ChainIndexQueryEffect (Maybe (Versioned StakeValidator))
UnspentTxOutFromRef :: TxOutRef -> ChainIndexQueryEffect (Maybe DecoratedTxOut)
TxOutFromRef :: TxOutRef -> ChainIndexQueryEffect (Maybe DecoratedTxOut)
TxFromTxId :: TxId -> ChainIndexQueryEffect (Maybe ChainIndexTx)
UtxoSetMembership :: TxOutRef -> ChainIndexQueryEffect IsUtxoResponse
UtxoSetAtAddress :: PageQuery TxOutRef -> CardanoAddress -> ChainIndexQueryEffect UtxosResponse
UnspentTxOutSetAtAddress :: PageQuery TxOutRef -> CardanoAddress -> ChainIndexQueryEffect (QueryResponse [(TxOutRef, DecoratedTxOut)])
DatumsAtAddress :: PageQuery TxOutRef -> CardanoAddress -> ChainIndexQueryEffect (QueryResponse [Datum])
UtxoSetWithCurrency :: PageQuery TxOutRef -> AssetClass -> ChainIndexQueryEffect UtxosResponse
TxsFromTxIds :: [TxId] -> ChainIndexQueryEffect [ChainIndexTx]
TxoSetAtAddress :: PageQuery TxOutRef -> CardanoAddress -> ChainIndexQueryEffect TxosResponse
GetTip :: ChainIndexQueryEffect Tip
makeEffect ''ChainIndexQueryEffect
data ChainIndexControlEffect r where
AppendBlocks :: [ChainSyncBlock] -> ChainIndexControlEffect ()
Rollback :: Point -> ChainIndexControlEffect ()
ResumeSync :: Point -> ChainIndexControlEffect ()
CollectGarbage :: ChainIndexControlEffect ()
GetDiagnostics :: ChainIndexControlEffect Diagnostics
makeEffect ''ChainIndexControlEffect