diff --git a/types/web3/eth/index.d.ts b/types/web3/eth/index.d.ts index d69b561a63..d31c334598 100644 --- a/types/web3/eth/index.d.ts +++ b/types/web3/eth/index.d.ts @@ -125,6 +125,7 @@ export default interface Eth { getProtocolVersion(cb?: Callback): Promise; getStorageAt( address: string, + position: number | BigNumber, defaultBlock?: BlockType, cb?: Callback ): Promise; diff --git a/types/web3/utils.d.ts b/types/web3/utils.d.ts index 659110faa6..a10ca39e01 100644 --- a/types/web3/utils.d.ts +++ b/types/web3/utils.d.ts @@ -29,6 +29,20 @@ type Unit = | "mether" | "gether" | "tether"; + +type Mixed = + | string + | number + | BigNumber + | { + type: string; + value: string; + } + | { + t: string; + v: string; + }; + export default interface Utils { BN: BigNumber; // TODO only static-definition isBN(any: any): boolean; @@ -62,7 +76,7 @@ export default interface Utils { val4?: string, val5?: string ): string; - soliditySha3(val: string): string; + soliditySha3(...val: Mixed[]): string; randomHex(bytes: number): string; stringToHex(val: string): string; toAscii(hex: string): string; diff --git a/types/web3/web3-tests.ts b/types/web3/web3-tests.ts index 7df8b53820..9498f8df69 100644 --- a/types/web3/web3-tests.ts +++ b/types/web3/web3-tests.ts @@ -5,9 +5,11 @@ const myProvider = new web3.providers.HttpProvider("http://localhost:5454"); web3.setProvider(myProvider); web3.eth.setProvider(myProvider); +const contractAddress = "0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe"; + const myContract = new web3.eth.Contract( [], - "0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe", + contractAddress, { from: "0x1234567890123456789012345678901234567891", gasPrice: "20000000000" @@ -22,3 +24,5 @@ const weiStr: string = web3.utils.toWei("100", "gwei"); const weiBn: BigNumber = web3.utils.toWei(web3.utils.toBN("1")); const rndHex: string = Web3.utils.randomHex(10); const shhPromise: Promise = web3.shh.generateSymKeyFromPassword("xyz"); +const storage: Promise = web3.eth.getStorageAt(contractAddress, 0); +const sha3: string = web3.utils.soliditySha3(0, 1, "abc");