By icrc1_balance_of
getting the icp balance, I now need to convert it to u128. This is very helpful for calculating the token price in dex, but candid::Nat does not provide a method to convert it to u128.
You can use u128::try_from(nat.0)?
. Or you can directly say the Rust type of icrc1_balance_of
is u128
, instead of Nat
.