This commit is contained in:
owen05
2021-02-03 00:05:45 +08:00
parent f0ec1fa756
commit 4e29555f68
5 changed files with 177 additions and 80 deletions

View File

@@ -1,4 +1,6 @@
import BigNumber from "bignumber.js";
import { getDefaultWeb3 } from './EVM';
export const MAX_UINT256 = "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
@@ -12,4 +14,9 @@ export function gweiStr(gwei: string): string {
export function mweiStr(gwei: string): string {
return new BigNumber(gwei).multipliedBy(10 ** 6).toFixed(0, BigNumber.ROUND_DOWN)
}
export function fromWei(value: string, unit: any): string {
var web3 = getDefaultWeb3();
return web3.utils.fromWei(value, unit);
}