UniverseXYZ / UniverseApp-Frontend

0 stars 1 forks source link

Implement auction status changes to the flow #911

Closed vikinatora closed 2 years ago

vikinatora commented 2 years ago

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:

Context

The following auction states have been configured:

Change already implemented

  1. Initialised state is the default state when will be set to true when the auction is first created.
  2. onChain status is set to true in the finalize auction page when the SC instance of the contract is canceled
  3. 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)

  1. Set canceled: true when auction is canceled in the finalize auction page
  2. Disable editing reward tiers when auction.onChain === true
  3. Disable creating new SC instance of the auction when canceled === true and user hasn't withdrawn all of his nfts
  4. Set canceled to false when an auction is recreated on SC level
  5. Filter active auctions by canceled === false && deposited nfts > 0
  6. Set finalise to true when finaliseAuction() is called
  7. 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

vikinatora commented 2 years ago

cc: @taskudis @ivostoynovski @ivanshterev18 @ilia-andr @strenev