You may need to put this onto a repo so we can test. I canât immediately see where the issue is if youâre getting valid state values on disconnect yet theyâre disappearing. You are doing a lot of transformations to supply
for instance, see what happens if you just render it as is in your component.
well thatâs definitely the problem, and now I remember how hard it was to get that number to display properly it didnât like parseInt(JSON.parse(JSON.stringify(supply)).hex, 16) / Math.pow(10, 18)
but it also doesnât like the standalone variable , console fills with bignumber errors. the parsing for the price isnât much different than the supply but it always displays.
Code to display Circ Supply:
{
supply && (
<div>
{(
parseInt(JSON.parse(JSON.stringify(supply)).hex, 16) /
Math.pow(10, 18)
)
.toFixed()
.replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,")}{" "}
</div>
)
}
Code to display Price:
{
token && (
<div>
$
{parseFloat(
JSON.parse(JSON.stringify(token?.data?.price))
).toFixed(6)}
</div>
)
}
Iâm getting the supply with
const { data: supply, fetch: fetchsupply } = useWeb3ExecuteFunction();
and in my main async function
let res1 = await fetchsupply({ params: optionsSupply });
and displayed in the return like the above post.
now looking at it I realize I shouldnât have to do / Math.pow(10, 18)
must have copied that without thinking , should just be an int. Canât seem to get it to work.
Can you not use the Moralisâs formatting functions? Moralis Units - Moralis
Otherwise what is the original format/example of supply and what are you trying to render it as?