[web3]: toWei does not accept number

This commit is contained in:
Alex Kvak
2019-01-24 15:19:59 +03:00
parent 600f91ec2b
commit d914ecdc89
3 changed files with 5 additions and 1 deletions
+1
View File
@@ -19,6 +19,7 @@
// Donam Kim <https://github.com/donamk>
// Doug Kent <https://github.com/dkent600>
// Daniel Zhou <https://github.com/nerddan>
// Alex Kvak <https://github.com/alexkvak>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
+1 -1
View File
@@ -89,7 +89,7 @@ export default interface Utils {
toDecimal(val: any): number;
toHex(val: any): string;
toUtf8(val: any): string;
toWei(val: string | number, unit?: Unit): string;
toWei(val: string, unit?: Unit): string;
toWei(val: BigNumber, unit?: Unit): BigNumber;
unitMap: any;
}
+3
View File
@@ -163,6 +163,9 @@ const shhPromise: Promise<string> = web3.shh.generateSymKeyFromPassword("xyz");
// --------------------------------------------------------------------------
const weiStr: string = web3.utils.toWei("100", "gwei");
const weiBn: BigNumber = web3.utils.toWei(web3.utils.toBN("1"));
// $ExpectError
const weiNumber = web3.utils.toWei(100);
const rndHex: string = Web3.utils.randomHex(10);
const sha3: string = web3.utils.soliditySha3(0, 1, "abc");
const fromWei1: BigNumber = web3.utils.fromWei(new BigNumber(1));