| Safe Haskell | Safe-Inferred |
|---|---|
| Language | GHC2021 |
Hydra.Chain.Blockfrost
Contents
Synopsis
- newtype BlockfrostBackend a = BlockfrostBackend (ReaderT BlockfrostEnv IO a)
- data BlockfrostEnv = BlockfrostEnv {}
- newBlockfrostEnv :: BlockfrostOptions -> IO BlockfrostEnv
- runBlockfrostBackend :: BlockfrostOptions -> BlockfrostBackend a -> IO a
- runBlockfrostBackendWith :: BlockfrostEnv -> BlockfrostBackend a -> IO a
- memoizeIO :: TVar IO (Maybe a) -> IO a -> IO a
- cachedGenesis :: BlockfrostBackend Genesis
- runQuery :: BlockfrostClientT IO a -> BlockfrostBackend a
- withNetworkId :: (NetworkId -> BlockfrostClientT IO a) -> BlockfrostBackend a
- withBlockfrostChain :: BlockfrostEnv -> Tracer IO CardanoChainLog -> CardanoChainConfig -> ChainContext -> TinyWallet IO -> ChainStateHistory Tx -> ChainComponent Tx IO a
- newtype BlockfrostConnectException = BlockfrostConnectException {}
- blockfrostChain :: (MonadIO m, MonadFail m, MonadCatch m, MonadAsync m, MonadDelay m, MonadLabelledSTM m, MonadMask m) => Tracer m CardanoChainLog -> TQueue m (Tx, TMVar m (Maybe (PostTxError Tx))) -> Project -> m Genesis -> NonEmpty ChainPoint -> ChainSyncHandler m -> TinyWallet m -> m ()
- blockfrostChainFollow :: forall m. (MonadIO m, MonadFail m, MonadCatch m, MonadDelay m, MonadLabelledSTM m, MonadMask m) => Tracer m CardanoChainLog -> Project -> m Genesis -> NonEmpty ChainPoint -> ChainSyncHandler m -> TinyWallet m -> m ()
- processBlock :: (MonadIO m, MonadThrow m) => Tracer m CardanoChainLog -> Project -> ChainSyncHandler m -> TinyWallet m -> Block -> m ()
- blockfrostSubmissionClient :: forall m. MonadSTM m => Tracer m CardanoChainLog -> (Tx -> m (Either Text TxHash)) -> TQueue m (Tx, TMVar m (Maybe (PostTxError Tx))) -> m ()
- submitViaBlockfrost :: MonadIO m => Project -> Tx -> m (Either Text TxHash)
- toChainPoint :: Block -> ChainPoint
- maxBlockBatch :: Int
- retryOnBlockfrostError :: (MonadIO m, MonadMask m) => Tracer m CardanoChainLog -> RetryPolicyM m -> (RetryStatus -> m a) -> m a
- toTx :: MonadThrow m => TransactionCBOR -> m Tx
Documentation
newtype BlockfrostBackend a Source #
Constructors
| BlockfrostBackend (ReaderT BlockfrostEnv IO a) |
Instances
data BlockfrostEnv Source #
Constructors
| BlockfrostEnv | |
runBlockfrostBackend :: BlockfrostOptions -> BlockfrostBackend a -> IO a Source #
runBlockfrostBackendWith :: BlockfrostEnv -> BlockfrostBackend a -> IO a Source #
memoizeIO :: TVar IO (Maybe a) -> IO a -> IO a Source #
Return the cached value or run the action once and store its result. Concurrent callers may run the action more than once (last write wins), which is safe for immutable values.
runQuery :: BlockfrostClientT IO a -> BlockfrostBackend a Source #
Run a Blockfrost client action with the backend's project.
withNetworkId :: (NetworkId -> BlockfrostClientT IO a) -> BlockfrostBackend a Source #
Run a Blockfrost client action that needs the (cached) network id.
Arguments
| :: BlockfrostEnv | |
| -> Tracer IO CardanoChainLog | |
| -> CardanoChainConfig | |
| -> ChainContext | |
| -> TinyWallet IO | |
| -> ChainStateHistory Tx | Chain state loaded from persistence. |
| -> ChainComponent Tx IO a |
newtype BlockfrostConnectException Source #
Constructors
| BlockfrostConnectException | |
Fields | |
Instances
| Exception BlockfrostConnectException Source # | |
Defined in Hydra.Chain.Blockfrost | |
| Show BlockfrostConnectException Source # | |
Defined in Hydra.Chain.Blockfrost | |
blockfrostChain :: (MonadIO m, MonadFail m, MonadCatch m, MonadAsync m, MonadDelay m, MonadLabelledSTM m, MonadMask m) => Tracer m CardanoChainLog -> TQueue m (Tx, TMVar m (Maybe (PostTxError Tx))) -> Project -> m Genesis -> NonEmpty ChainPoint -> ChainSyncHandler m -> TinyWallet m -> m () Source #
blockfrostChainFollow :: forall m. (MonadIO m, MonadFail m, MonadCatch m, MonadDelay m, MonadLabelledSTM m, MonadMask m) => Tracer m CardanoChainLog -> Project -> m Genesis -> NonEmpty ChainPoint -> ChainSyncHandler m -> TinyWallet m -> m () Source #
processBlock :: (MonadIO m, MonadThrow m) => Tracer m CardanoChainLog -> Project -> ChainSyncHandler m -> TinyWallet m -> Block -> m () Source #
blockfrostSubmissionClient Source #
Arguments
| :: forall m. MonadSTM m | |
| => Tracer m CardanoChainLog | |
| -> (Tx -> m (Either Text TxHash)) | How to submit a transaction, yielding a rendered failure reason or the transaction hash. Must not throw. |
| -> TQueue m (Tx, TMVar m (Maybe (PostTxError Tx))) | |
| -> m () |
submitViaBlockfrost :: MonadIO m => Project -> Tx -> m (Either Text TxHash) Source #
Submit a transaction via Blockfrost, rendering both transport and API level failures into a reason.
toChainPoint :: Block -> ChainPoint Source #
maxBlockBatch :: Int Source #
Maximum number of blocks fetched per poll iteration (the Blockfrost page size limit).
retryOnBlockfrostError :: (MonadIO m, MonadMask m) => Tracer m CardanoChainLog -> RetryPolicyM m -> (RetryStatus -> m a) -> m a Source #
Helpers
toTx :: MonadThrow m => TransactionCBOR -> m Tx Source #