BootNodeDev / dAppBooster

A modern blockchain boilerplate built to quickly get you started with your next project.
https://dappbooster.dev
MIT License
5 stars 1 forks source link

feat: tokens balances #174

Closed fernandomg closed 4 months ago

fernandomg commented 4 months ago

Closes #156

Description:

A refactor around useTokens hooks was made.

In fact, useTokens was moved to useTokenLists, and useTokens has a new API and logic. It will load balances into the tokens lists (that list generated by useTokenLists) if it's possible and required.

Components to display the balance were updated, and TokenBalance was created to reflect the current loading state of the balances which takes time to resolve the whole list of balances and prices for the tokens provided.

To gather balances and prices a new dependency was added: @lifi/sdk and the useTokens hook is tied to its interfaces and types; so, in the case of needing a new source of prices/balances, we'll need to refactor it.

The architectural decision behind this:

Steps:

(Required steps to reproduce or test the fix / feature)

Type of change:

How Has This Been Tested?

Remember to check that:

Screenshots

https://github.com/user-attachments/assets/7f2718a7-5e25-48da-afb2-90f0cfe86637

vercel[bot] commented 4 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
dappbooster ✅ Ready (Inspect) Visit Preview Jul 22, 2024 4:10pm
fernandomg commented 4 months ago

Holy f*ck, that spinner looks terrible there (I'll fix it later...).

haha, some skeleton would look better. But it is what it is by default 😁

I'm not getting my ETH balances, it's always 0.00 (I tried with a wallet with 0.05 ETH and another one with 0.0001 ETH, maybe it's a rounding problem?).

The same happens with MATIC, so maybe your code hates my native tokens IDK.

hmmm!!! So despite having support for 0xe and 0x0 as representation for native tokens, it only works with the ZeroAddress.

I'll update the code and env var values.

fernandomg commented 4 months ago

@gabitoesmiapodo, please check if the balance is properly displayed now.

To me, it's working on the 4 chains.