lfglabs-dev / api.starknet.quest

starknet.quest rust backend
2 stars 17 forks source link

feat: removed claimed status from boost query #190

Closed ayushtom closed 7 months ago

ayushtom commented 7 months ago

This PR makes the following changes -

Earlier approach -

but now - the winner per boost is multiple, so the searching query doesn't function the same way. To tackle this, i unwind in the first step to make it similar to how the query used to run and then check for equality in the following steps on the following fields - claim boost id to the matching boost id , winner (the winner address) to the claiming winner address and _cursor.to to null.

the flow for the product looks something like this -

1) User comes on the claim page 2) We fetch the boost information (check if user is winner) 3) We check in localstorage if boost is claimed(we save in localstorage in FE if the user has already claimed/opened the reward) 4)if nothing on localstorage , then we check from pending claims(this takes data from indexer and finds if user has claimed anything from contract for this boost id) 3) Check from the information above a) if winner -> show a disabled/enabled claim button depending on steps 3 and 4 b) if not winner -> show the better luck next time image

The checks we make for enabled and disabled claim button -

Enabled (these both are AND conditions)