diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-02-24 02:50:41 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-02-28 04:05:22 +0800 |
commit | 0b326a8bbefd7efee4ebc8b56cbc3faab52e93d6 (patch) | |
tree | 7228fc326e63ceb0bbd47fb0e70581ad3fbdc99b /packages/web3-wrapper | |
parent | 2da7f82171be76b36bac0500fb6dd78ba1669603 (diff) | |
download | dexon-sol-tools-0b326a8bbefd7efee4ebc8b56cbc3faab52e93d6.tar dexon-sol-tools-0b326a8bbefd7efee4ebc8b56cbc3faab52e93d6.tar.gz dexon-sol-tools-0b326a8bbefd7efee4ebc8b56cbc3faab52e93d6.tar.bz2 dexon-sol-tools-0b326a8bbefd7efee4ebc8b56cbc3faab52e93d6.tar.lz dexon-sol-tools-0b326a8bbefd7efee4ebc8b56cbc3faab52e93d6.tar.xz dexon-sol-tools-0b326a8bbefd7efee4ebc8b56cbc3faab52e93d6.tar.zst dexon-sol-tools-0b326a8bbefd7efee4ebc8b56cbc3faab52e93d6.zip |
Add web3Wrapper.callAsync and remove web3Wrapper.getContractInstance
Diffstat (limited to 'packages/web3-wrapper')
-rw-r--r-- | packages/web3-wrapper/CHANGELOG.md | 9 | ||||
-rw-r--r-- | packages/web3-wrapper/src/index.ts | 12 |
2 files changed, 12 insertions, 9 deletions
diff --git a/packages/web3-wrapper/CHANGELOG.md b/packages/web3-wrapper/CHANGELOG.md index 387aafb3a..eef665d24 100644 --- a/packages/web3-wrapper/CHANGELOG.md +++ b/packages/web3-wrapper/CHANGELOG.md @@ -1,9 +1,12 @@ # CHANGELOG -## v0.2.XX - _TBD_ 2018 +## v0.2.0 _TBD, 2018_ - * Ensure all returned user addresses are lowercase (#373) + * Ensure all returned user addresses are lowercase (#373) + * Add `web3Wrapper.callAsync` (#413) + * Make `web3Wrapper.estimateGas` accept whole `txData` instead of `data` (#413) + * Remove `web3Wrapper.getContractInstance` (#413) -## v0.1.12 - _February 9, 2018_ +## v0.1.12 _February 9, 2018_ * Fix publishing issue where .npmignore was not properly excluding undesired content (#389) diff --git a/packages/web3-wrapper/src/index.ts b/packages/web3-wrapper/src/index.ts index 7f3452c98..e7c875430 100644 --- a/packages/web3-wrapper/src/index.ts +++ b/packages/web3-wrapper/src/index.ts @@ -128,14 +128,14 @@ export class Web3Wrapper { const web3Contract = this._web3.eth.contract(abi); return web3Contract; } - public getContractInstance(abi: Web3.ContractAbi, address: string): Web3.ContractInstance { - const web3ContractInstance = this.getContractFromAbi(abi).at(address); - return web3ContractInstance; - } - public async estimateGasAsync(data: string): Promise<number> { - const gas = await promisify<number>(this._web3.eth.estimateGas)({ data }); + public async estimateGasAsync(txData: Partial<Web3.TxData>): Promise<number> { + const gas = await promisify<number>(this._web3.eth.estimateGas)(txData); return gas; } + public async callAsync(callData: Web3.CallData): Promise<string> { + const rawCalllResult = await promisify<string>(this._web3.eth.call)(callData); + return rawCalllResult; + } public async sendTransactionAsync(txData: Web3.TxData): Promise<string> { const txHash = await promisify<string>(this._web3.eth.sendTransaction)(txData); return txHash; |