Moralis.Units.FromWei undefined on cloud function

Hi guys, Moralis.Units.FromWei undefined on cloud function, is it right?

how to use Moralis.Units.FromWei undefined on cloud function?

thanks

2 Likes

Hi @khiemtranvan

Currently this function is not available on cloud code. You can use it in the SDK only

Can you please put this in the documentation. It would save me 1-2 hours of debugging.

Also, do you have any alternative ways how it should be calculated in the cloud functions?

You can enable web3 in cloud function and use

web3.utils to format from and to Wei unit

Check here on how to enable web3 in CF

https://docs.moralis.io/moralis-server/cloud-code/cloud-functions#web3

2 Likes