feat: support to show fiat amounts #427
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #128
What is missing but will not be part of this PR:
Design reasoning:
When implementing, i played with several ideas how to best expose the rates to the app. The minimum that I need is:
With this we can detect if rates have been checked (
checkedAt
andrates
orerror
are defined/populated).1. [REJECTED] Making the rates part of
Token
interface inbalanceStore
This was rejected, because token balances are updated in the waku adapter and it already has a lot of things to do, it did not feel like this is the right place to add more responsibility. I played with the
TokenAmount
looking like this:2. [IMPLEMENTED] Exchange store with rates for all app tokens
Instead I opted to implement extra store, where the rates are in
Map<string, Rates>
.I considered writing a store function that fetches the appropriate rate, but that felt quite unnecessary and does not work in waku object where we are not trying to import the stores directly.