How to handle Blockchain times?


i’m creating a NFT Marketplace where users can create their NFTs and sold them.
I’m having some issues with the transaction times from the blockchaing.

For example, when a NFT is listed for sale and someone buys it - the transaction is not immediate, and while the transaction isnt verified/written to blockchain the NFT is still listed in the for sale list.

What is the best approach to handle this ? (how can the NFT be"hidden" while the transaction is being processed?)
What is the best approach to handle for example if the user closes the browser ?

Can someone give some advice regarding this topic.


You can process the data that is on chain, even if the user closes the browser, if the transaction was sent on chain, if it is executed successfully then you will find that transaction on chain.
For the part when an item is added to the marketplace, you can read the timestamp from when it was added to marketplace, maybe an event that gets triggered in a function, or maybe the event when approve was called to be able to transfer that NFT


thanks for the reply…and how about to handle the sale proccess ? (if an item is being bought it should not be listed…if the transaction fails it should be back on the list)


I think that you should wait until the transaction is confirmed and until that time you could say that it is pending