2aae2a8f90
Kredits are stored on the Token contract as uint256 / bignumbers with 18 decimal points. Just like Ether and required by the ERC20 standard. So we need to work with bignumbers and format a bignumber value here.
10 lines
237 B
JavaScript
10 lines
237 B
JavaScript
import ethers from 'npm:ethers';
|
|
|
|
export default function(value, options = {}) {
|
|
let etherValue = ethers.utils.formatEther(value);
|
|
if (!options.decimals) {
|
|
etherValue = parseInt(etherValue).toString();
|
|
}
|
|
return etherValue;
|
|
}
|