Course lesson

Open and Close an NFT Sale From a React dApp

We need to give the owner of the smart contract the ability to open and close an NFT sale in the React dApp UI.

Duration
7 min
Access
Included
Transcript
Retained from source evidence

We need to give the owner of the smart contract the ability to open and close an NFT sale in the React dApp UI.

We’ll use the .openSale and .closeSale methods off of the connectedContract stored in React state. Then for the best possible experience we’ll create a pending state while the sale is opening or closing. During the pending state the buttons will be disabled.

Then we’ll bring in useToast from chakra-ui to give a message depending on if the opening/closing of the sale was successful or not.