Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: stacks ft fiat values from alex-sdk #5151

Merged
merged 1 commit into from
Apr 4, 2024
Merged

Conversation

fbwoolf
Copy link
Contributor

@fbwoolf fbwoolf commented Apr 1, 2024

Try out Leather build aa1f38bExtension build, Test report, Storybook, Chromatic

This PR adds fiat balances for supported currencies from the alex-sdk. If no data is known, then the fiat balance will still show nothing. We should address hiding many of these airdropped tokens soon bc our asset list is getting quite long.

Also, I encountered some unnecessary code for the Fund page that I have refactored here.

Screenshot 2024-04-01 at 10 11 40 AM

@fbwoolf fbwoolf force-pushed the feat/stacks-ft-fiat-values branch from 2880d0a to e82f052 Compare April 1, 2024 16:46
@fbwoolf fbwoolf force-pushed the feat/stacks-ft-fiat-values branch from e82f052 to 3b72cbb Compare April 1, 2024 16:47
@fbwoolf fbwoolf linked an issue Apr 1, 2024 that may be closed by this pull request
@markmhendrickson
Copy link
Collaborator

It looks like we need to add these fiat values to the total account balance?

image

@markmhendrickson
Copy link
Collaborator

Also, only partially related, but how are we sorting tokens at the moment? I presume best to sort by total fiat value descending, then alphabetically ascending. cc @fabric-8

@pete-watters
Copy link
Contributor

Nice work, this LGTM, I just added some suggestions but nothing critical

src/app/common/hooks/use-alex-sdk.ts Outdated Show resolved Hide resolved
src/app/pages/fund/fiat-providers-list.tsx Outdated Show resolved Hide resolved
src/app/pages/fund/fund.tsx Outdated Show resolved Hide resolved
src/app/query/common/alex-sdk/alex-sdk.hooks.ts Outdated Show resolved Hide resolved
src/app/query/common/alex-sdk/alex-sdk.hooks.ts Outdated Show resolved Hide resolved
@fbwoolf
Copy link
Contributor Author

fbwoolf commented Apr 2, 2024

It looks like we need to add these fiat values to the total account balance?

I don't think the intention was to add all to the total balance, was it? I believe it is just Bitcoin and Stacks in that total? I think that would be an enhancement issue?

@markmhendrickson
Copy link
Collaborator

I don't think the intention was to add all to the total balance, was it?

We can tackle in a separate issue / PR if preferred, though it seems like an expected enhancement to me if we show fiat per Stacks FT. Otherwise we'll have an incongruence.

@fbwoolf
Copy link
Contributor Author

fbwoolf commented Apr 2, 2024

We can tackle in a separate issue / PR if preferred, though it seems like an expected enhancement to me if we show fiat per Stacks FT. Otherwise we'll have an incongruence.

I was more questioning, is that really what the total balance is supposed to mean? It isn't really set up in our code that way. Isn't that misleading when other tokens have value we just don't have market data for them? There will always be an incongruence unless we have market data for all the tokens we are showing?

@markmhendrickson
Copy link
Collaborator

I was more questioning, is that really what the total balance is supposed to mean?

Got it – perhaps @fabric-8 should chime in here. My sense is that it's best to optimistically include all known fiat values into the total account value, since it at least provides a floor value for the entire account.

If we detect there's one or missing fiat values, we could theoretically enhance this approach by indicating the total account value with a lower-range e.g. $120+ or >=$120 though I'm not sure it's necessary per se.

If I see a smaller account total than the sum of the token values as listed, it's just going to seem broken (esp. since here's no way to understand as a user why only BTC and STX are included?).

@fabric-8
Copy link
Contributor

fabric-8 commented Apr 2, 2024

I generally agree with @markmhendrickson — If we display a fiat value for any given token, that value should also contribute to the total balance.

Regarding sorting: +1 for sorting by fiat value in descending order as a default

@kyranjamie
Copy link
Collaborator

Agree that the total should sum all known balances, but @fbwoolf is right the code isn't really set up well for this.

Suggest doing as a separate job, and rethinking the whole balance architecture.

@fbwoolf
Copy link
Contributor Author

fbwoolf commented Apr 3, 2024

Suggest doing as a separate job, and rethinking the whole balance architecture.

Made a new issue here: #5159

@fbwoolf fbwoolf force-pushed the feat/stacks-ft-fiat-values branch 2 times, most recently from 1917bb5 to b1e0ab9 Compare April 4, 2024 15:42
@fbwoolf fbwoolf force-pushed the feat/stacks-ft-fiat-values branch from b1e0ab9 to aa1f38b Compare April 4, 2024 15:49
@fbwoolf fbwoolf added this pull request to the merge queue Apr 4, 2024
Merged via the queue into dev with commit 0f7e44e Apr 4, 2024
28 checks passed
@fbwoolf fbwoolf deleted the feat/stacks-ft-fiat-values branch April 4, 2024 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show USD values for Stacks FTs
5 participants