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

show wallet balance #2

Open
ralyodio opened this issue Mar 2, 2024 · 4 comments
Open

show wallet balance #2

ralyodio opened this issue Mar 2, 2024 · 4 comments

Comments

@ralyodio
Copy link

ralyodio commented Mar 2, 2024

is it possible to show wallet balance?

@alucao
Copy link
Owner

alucao commented Mar 2, 2024

Is it is possible after the user connects its wallet, using cip30 api. It should be something like:

const cborBalance = await api.getBalance()
const balance = Cardano.Value.from_bytes(Buffer.from(cborBalance, "hex")).coin().to_str()

@ralyodio
Copy link
Author

ralyodio commented Mar 2, 2024

ok cool. maybe i'll work on that.

@ralyodio
Copy link
Author

ralyodio commented Mar 2, 2024

Neither Cardano nor api are exposed in the wallet button component.

@alucao
Copy link
Owner

alucao commented Mar 5, 2024

There are many ways to go around it, one could be adding a method that calculates the balance to cardano.tsx then in App.tsx when the wallet is updated (updateWallet) calculate the balance and store it in the App.tsx state. Then pass that state to the wallet component.

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

No branches or pull requests

2 participants