Format numbers correct from a smart contract

hi so im calling a rewards made smart contract fuction which works perfects trouble i have is the number it shows is in wei not bnb which i want i need to add 9 decimals from the start i can do it at the end but cant work out from the start

Wei? Bnb?

Okay I think I’ve managed to locate what you’re talking about… Unit Converter | BscScan

Store your data as data type number in unit Wei. When you display it somewhere, just add an expression that is Data Type’s Wei * 10^-18 and that will give you the number in BNB. Then if you want to round it to decimal places, just append :formatted-as with the number of decimal places you want…

https://manual.bubble.io/core-resources/data/operations-and-comparisons#number-type

1 Like

that is what i want to do but i dont understand what you are asking me to do this is the call dispalying as a text element i see the data type wei but dont understand what you mean buy display it somewhere

Screenshot 2023-05-23 at 21.25.18

Screenshot 2023-05-23 at 21.29.43
and this is how it display on the app the reward is 13.07

If you can put it in laymon terms for me that would be great I’m new to the bubble UI builder so I know a few things but not stuff like this I went to the data tab and I see the wei option

Try the Bubble bootcamp to learn the basics

1 Like

I will thank you but please just help me with this I have been trying for two days to get the number to populate correct tried every Google search and YouTube video this is the closest I have ever came

This topic was automatically closed after 70 days. New replies are no longer allowed.