citycoins / ui

Basic UI components for interacting with the CityCoin contract. Requires Stacks Wallet for Web.
https://minecitycoins.com
GNU General Public License v3.0
28 stars 13 forks source link

Implement transaction storage #139

Open whoabuddy opened 2 years ago

whoabuddy commented 2 years ago

Is your feature request related to a problem? Please describe.

Some data requires looking at a user's transaction history, e.g. which blocks were mined, and while this information is available from the API it doesn't need to be queried multiple times.

All queries are throttled now, so requesting transactions 50 at a time for large accounts could incur a long load time unless some of the data is stored somewhere.

Describe the solution you'd like

Option 1 - use localStorage, some atoms are doing this now, it's simple and straight-forward

Option 2 - use Gaia, some hooks are already provided and are just unused now

Option 3 - use Cloudflare KV, requires defining a namespace but all tx could be stored using the stx address as a key

This would require creating a storage method that can evaluate and store only what's new, ideally reducing the number of requests based on the data already stored.

Describe alternatives you've considered

Querying the data every time is too expensive. Not querying the data makes it difficult to provide good UX.

Additional context

I'm leaning toward Option 2, but since Option 1 is very simple with atoms, it might be easier in the meantime to use it and develop the "fetch and update" structure first.

Option 3 is also interesting because the methods could be reapplied to certain API queries that return immutable contract data.

Curious to hear if anyone has any input!

Note: review against #35 and #39 for overlap.