@@ -5,7 +5,7 @@ module Seabug.Contract.MarketPlaceFetchNft
55
66import Contract.Prelude
77
8- import Contract.Monad (Contract , liftContractM , liftedE , liftedM )
8+ import Contract.Monad (Contract , liftContractM , liftedE , liftedM , logWarn' )
99import Contract.PlutusData (fromData , getDatumByHash )
1010import Contract.Transaction (TransactionInput , TransactionOutput (..))
1111import Contract.Utxos (getUtxo )
@@ -14,14 +14,17 @@ import Seabug.Contract.Common (NftResult)
1414import Seabug.Metadata (getFullSeabugMetadataWithBackoff )
1515import Seabug.Types (MarketplaceDatum (..))
1616
17+ -- | Fetch the info for a single NFT identified by a utxo
18+ -- | (`TransactionInput`). Returns `Nothing` if the given transaction
19+ -- | input has been spent (for example if the NFT has been bought).
1720marketPlaceFetchNft
1821 :: forall (r :: Row Type )
1922 . TransactionInput
2023 -> Contract (projectId :: String | r ) (Maybe NftResult )
2124marketPlaceFetchNft ref = do
2225 getUtxo ref >>= case _ of
2326 Nothing -> do
24- log " Could not find NFT utxo, it may have been spent"
27+ logWarn' " Could not find NFT utxo, it may have been spent"
2528 pure Nothing
2629 Just output@(TransactionOutput nftTxOut) -> do
2730 datumHash <- liftContractM " Datum hash not available for NFT"
0 commit comments