Implement changes to auction status as the user goes through different states of the auction
Current Behavior
Currently the auctio's statuses aren't changing and the UI isn't properly updated.
Possible Solution
A temporary endpoint for changing auction statuses has been implemented. It will be used until the scraper is ready. After the scraper is ready, changes to auction statuses will be received by web socket connections.
Statuses are available in every auction response object from the API.
This endpoints provides full configurability of the statuses so be careful not to put the auctions is a wrong status.
It's important to pass one of the following auction states to the endpoint:
initialised
depositedNfts
canceled
finalised
onChain
If you want to set the canceled status to true the pass {"name":"canceled", "value": true }
If you want to set the canceled status to false pass {"name":"canceled", "value": false }
Context
The following auction states have been configured:
Initialising (default) - Auction configuration has been completed but no NFTs have been deposited from the reward tiers
On chain (scraper) - Auction has been created on a smart contract level
Deposited (scraper) - At least 1 nft has been deposited to the auction smart contract
Canceled (scraper)- cancelAuction() has been called
User must withdraw all his NFTs before recreating the same auction
Started (FE computed) - Not canceled && deposited nfts > 0 && start time > now && end time < now
Finished (FE computed) - end time > now && not finalised
Finalised (scraper) - end time > now && finalizeAuction() has been called
Users are allowed to capture revenue
Owner is allowed to withdraw bids
Change already implemented
Initialised state is the default state when will be set to true when the auction is first created.
onChain status is set to true in the finalize auction page when the SC instance of the contract is canceled
onChain status is set to false in the finalize auction page when the SC instance of the contracted is canceled
Changes to be implemented (Probably I'm missing some)
Set canceled: true when auction is canceled in the finalize auction page
Disable editing reward tiers when auction.onChain === true
Disable creating new SC instance of the auction when canceled === true and user hasn't withdrawn all of his nfts
Set canceled to false when an auction is recreated on SC level
Filter active auctions by canceled === false && deposited nfts > 0
Set finalise to true when finaliseAuction() is called
Listen for web socket events and update react state accordingly
If you happen to know of some cases that need to be handled please put them as a comment below.
Your Environment
Use the dev api https://dev.api.universe.xyz.
It's recommended to start with a new auction setup, implement the happy flow state changes and then think about possible edge cases and how they should be handled
Application used:
Any branch that has setup auction flow, finalize auction and view auction landing page set up.
Expected Behavior
Implement changes to auction status as the user goes through different states of the auction
Current Behavior
Currently the auctio's statuses aren't changing and the UI isn't properly updated.
Possible Solution
A temporary endpoint for changing auction statuses has been implemented. It will be used until the scraper is ready. After the scraper is ready, changes to auction statuses will be received by web socket connections.
Statuses are available in every auction response object from the API.
This endpoints provides full configurability of the statuses so be careful not to put the auctions is a wrong status.
Endpoint: (PATCH) https://dev.api.universe.xyz/api/auction/status Example request body: (JSON)
{ "auctionId": 1, "statuses": [ {"name":"canceled", "value": true }, {"name":"initialised", "value": false } ] }
It's important to pass one of the following auction states to the endpoint:
canceled
status totrue
the pass{"name":"canceled", "value": true }
If you want to set thecanceled
status tofalse
pass{"name":"canceled", "value": false }
Context
The following auction states have been configured:
Change already implemented
true
when the auction is first created.Changes to be implemented (Probably I'm missing some)
auction.onChain === true
canceled === true
and user hasn't withdrawn all of his nftsIf you happen to know of some cases that need to be handled please put them as a comment below.
Your Environment
Use the dev api
https://dev.api.universe.xyz
. It's recommended to start with a new auction setup, implement the happy flow state changes and then think about possible edge cases and how they should be handled