mimblewimble / grin-gui

GUI for Grin Node + Wallet
GNU General Public License v3.0
20 stars 21 forks source link

Balance History Chart #29

Closed flomang closed 1 year ago

flomang commented 1 year ago

I figured that this is smooth enough now to share so the other devs can have a taste of something really sweet. This merge adds a historical balance chart to the wallet home screen.

You'll notice that I've started to construct a balance history of the grin wallet in wallet/operation/tx_list_display.rs - starting from line 140. The backdating of the first transaction to "2019-01-20T00:00:00Z" is only left in for dev purposes to provide us adequate data to populate the chart with. My first transaction in a recovered wallet was being set to the date that I restored the wallet. I'm not sure if that is how things are supposed to work?

Some work will be needed to identify what interval is best to populate the chart with - daily or hourly - contingent upon the oldest transaction of the wallet. The chart requires a certain number of data points to be populated with to be useful.

Historical prices are currently pulled from coingecko. I'm sure we could make this configurable one day so the user can choose where they want to source this information from. It's probably more than I want to deal with for version 1.0 though. This is currently handled in "wallet/operation/home.rs" - function update_prices.

Last but not least is the added config - Currency. This setting will change the user's home title balance as well as the chart historical prices. You'll noticed that the symbol is missing for "bitcoin" when you switch. I think we need to find a font that supports it or we explore other solutions to make that more obvious for the user.

As with most of the current code base this is not finished yet but it works well enough to play with.

yeastplume commented 1 year ago

This looks great! Really fills out the home screen in a very useful way.