@@ -28,8 +28,6 @@ module Plutus.PAB.Core.ContractInstance.STM(
2828 , waitForUtxoSpent
2929 , addUtxoProducedReq
3030 , waitForUtxoProduced
31- , addAddress
32- , addTransaction
3331 , setActivity
3432 , setObservableState
3533 , openEndpoints
@@ -40,8 +38,6 @@ module Plutus.PAB.Core.ContractInstance.STM(
4038 , InstancesState
4139 , emptyInstancesState
4240 , insertInstance
43- , watchedAddresses
44- , watchedTransactions
4541 , callEndpointOnInstance
4642 , callEndpointOnInstanceTimeout
4743 , observableContractState
@@ -65,7 +61,6 @@ import Data.List.NonEmpty (NonEmpty)
6561import Data.Map (Map )
6662import qualified Data.Map as Map
6763import Data.Set (Set )
68- import qualified Data.Set as Set
6964import Ledger (Address , Slot , TxId , TxOutRef , txOutTxOut , txOutValue )
7065import Ledger.AddressMap (AddressMap )
7166import qualified Ledger.AddressMap as AM
@@ -205,8 +200,6 @@ data Activity =
205200data InstanceState =
206201 InstanceState
207202 { issEndpoints :: TVar (Map (RequestID , IterationID ) OpenEndpoint ) -- ^ Open endpoints that can be responded to.
208- , issAddresses :: TVar (Set Address ) -- ^ Addresses that the contract wants to watch -- FIXME: Delete?
209- , issTransactions :: TVar (Set TxId ) -- ^ Transactions whose status the contract is interested in
210203 , issStatus :: TVar Activity -- ^ Whether the instance is still running.
211204 , issObservableState :: TVar (Maybe Value ) -- ^ Serialised observable state of the contract instance (if available)
212205 , issStop :: TMVar () -- ^ Stop the instance if a value is written into the TMVar.
@@ -219,8 +212,6 @@ emptyInstanceState :: STM InstanceState
219212emptyInstanceState =
220213 InstanceState
221214 <$> STM. newTVar mempty
222- <*> STM. newTVar mempty
223- <*> STM. newTVar mempty
224215 <*> STM. newTVar Active
225216 <*> STM. newTVar Nothing
226217 <*> STM. newEmptyTMVar
@@ -255,15 +246,6 @@ instanceClientEnv InstanceState{issTxOutRefs, issAddressRefs} =
255246 <$> (Map. fromList . fmap ((\ r@ OpenTxOutSpentRequest {osrOutRef} -> (osrOutRef, [r])) . snd ) . Map. toList <$> STM. readTVar issTxOutRefs)
256247 <*> (Map. fromList . fmap ((\ r@ OpenTxOutProducedRequest {otxAddress} -> (otxAddress, [r])) . snd ) . Map. toList <$> STM. readTVar issAddressRefs)
257248
258- -- | Add an address to the set of addresses that the instance is watching
259- addAddress :: Address -> InstanceState -> STM ()
260- addAddress addr InstanceState {issAddresses} = STM. modifyTVar issAddresses (Set. insert addr)
261-
262- -- | Add a transaction hash to the set of transactions that the instance is
263- -- interested in
264- addTransaction :: TxId -> InstanceState -> STM ()
265- addTransaction txid InstanceState {issTransactions} = STM. modifyTVar issTransactions (Set. insert txid)
266-
267249-- | Set the 'Activity' of the instance
268250setActivity :: Activity -> InstanceState -> STM ()
269251setActivity a InstanceState {issStatus} = STM. writeTVar issStatus a
@@ -404,20 +386,6 @@ finalResult instanceId m = do
404386insertInstance :: ContractInstanceId -> InstanceState -> InstancesState -> STM ()
405387insertInstance instanceID state (InstancesState m) = STM. modifyTVar m (Map. insert instanceID state)
406388
407- -- | The addresses that are currently watched by the contract instances
408- watchedAddresses :: InstancesState -> STM (Set Address )
409- watchedAddresses (InstancesState m) = do
410- mp <- STM. readTVar m
411- allSets <- traverse (STM. readTVar . issAddresses) (snd <$> Map. toList mp)
412- pure $ fold allSets
413-
414- -- | The transactions that are currently watched by the contract instances
415- watchedTransactions :: InstancesState -> STM (Set TxId )
416- watchedTransactions (InstancesState m) = do
417- mp <- STM. readTVar m
418- allSets <- traverse (STM. readTVar . issTransactions) (snd <$> Map. toList mp)
419- pure $ fold allSets
420-
421389-- | Wait for the status of a transaction to change.
422390waitForTxStatusChange :: TxStatus -> TxId -> BlockchainEnv -> STM TxStatus
423391waitForTxStatusChange oldStatus tx BlockchainEnv {beTxChanges, beCurrentBlock} = do
0 commit comments