So I am working on a NFT marketplace type app, where users can buy and sell nfts to each other. When one user wants to sell an nft, how can I make it so that it will execute an an unknown future date (when the buyer eventually purchases it), while still having the seller sign the transaction right now, when they decide to sell the nft?
Nowadays, the recommended solution is to create an application (aka smart contract).
Applications on Algorand have an associated “application account” that they control.
You can see those as an escrow account.
So the seller can send the NFT to the escrow account (in a group transaction with an application call to make the application aware that this happened and to allow the application to make its application account opt in to the NFT).
When a buyer is ready, they will send a payment transaction grouped with an application call that will trigger the transfer of the NFT (as an inner transaction).
You may allow the seller to cancel the sale at any time and to withdraw the NFT from the escrow using another application call.
I would recommend to have a look at Beaker. It makes coding smart contracts even simpler. However, note that this is experimental and may change. beaker/examples at master · algorand-devrel/beaker · GitHub