@@ -31,7 +31,7 @@ import Ledger (POSIXTime)
3131import Ledger.Address (PaymentPubKeyHash (PaymentPubKeyHash ))
3232import Ledger.Constraints.OffChain (UnbalancedTx (.. ))
3333import Ledger.Slot (Slot (Slot ))
34- import Ledger.TimeSlot (slotToEndPOSIXTime )
34+ import Ledger.TimeSlot (posixTimeRangeToContainedSlotRange , slotToEndPOSIXTime )
3535import Ledger.Tx (CardanoTx )
3636import Ledger.Tx qualified as Tx
3737import Plutus.ChainIndex.Types (RollbackState (Committed ), TxValidity (.. ))
@@ -134,6 +134,11 @@ handlePABReq contractEnv req = do
134134 AwaitSlotReq s -> AwaitSlotResp <$> awaitSlot @ w contractEnv s
135135 CurrentSlotReq -> CurrentSlotResp <$> currentSlot @ w contractEnv
136136 CurrentTimeReq -> CurrentTimeResp <$> currentTime @ w contractEnv
137+ PosixTimeRangeToContainedSlotRangeReq posixTimeRange ->
138+ pure $
139+ PosixTimeRangeToContainedSlotRangeResp $
140+ Right $
141+ posixTimeRangeToContainedSlotRange contractEnv. cePABConfig. pcSlotConfig posixTimeRange
137142 ------------------------
138143 -- Unhandled requests --
139144 ------------------------
@@ -142,7 +147,6 @@ handlePABReq contractEnv req = do
142147 -- AwaitUtxoProducedReq Address -> pure $ AwaitUtxoProducedResp (NonEmpty ChainIndexTx)
143148 AwaitTxStatusChangeReq txId -> pure $ AwaitTxStatusChangeResp txId (Committed TxValid () )
144149 -- ExposeEndpointReq ActiveEndpoint -> ExposeEndpointResp EndpointDescription (EndpointValue JSON.Value)
145- -- PosixTimeRangeToContainedSlotRangeReq POSIXTimeRange -> PosixTimeRangeToContainedSlotRangeResp (Either SlotConversionError SlotRange)
146150 unsupported -> error (" Unsupported PAB effect: " ++ show unsupported)
147151
148152 printLog @ w Debug $ show resp
0 commit comments