Add web3Wrapper.callAsync and remove web3Wrapper.getContractInstance

This commit is contained in:
Leonid Logvinov 2018-02-23 10:50:41 -08:00
parent 2da7f82171
commit 0b326a8bbe
No known key found for this signature in database
GPG Key ID: 0DD294BFDE8C95D4
3 changed files with 12 additions and 10 deletions

View File

@ -1,5 +1,4 @@
lib lib
generated
.nyc_output .nyc_output
/packages/contracts/src/artifacts /packages/contracts/src/artifacts
package.json package.json

View File

@ -1,9 +1,12 @@
# CHANGELOG # 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) * Fix publishing issue where .npmignore was not properly excluding undesired content (#389)

View File

@ -128,14 +128,14 @@ export class Web3Wrapper {
const web3Contract = this._web3.eth.contract(abi); const web3Contract = this._web3.eth.contract(abi);
return web3Contract; return web3Contract;
} }
public getContractInstance(abi: Web3.ContractAbi, address: string): Web3.ContractInstance { public async estimateGasAsync(txData: Partial<Web3.TxData>): Promise<number> {
const web3ContractInstance = this.getContractFromAbi(abi).at(address); const gas = await promisify<number>(this._web3.eth.estimateGas)(txData);
return web3ContractInstance;
}
public async estimateGasAsync(data: string): Promise<number> {
const gas = await promisify<number>(this._web3.eth.estimateGas)({ data });
return gas; 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> { public async sendTransactionAsync(txData: Web3.TxData): Promise<string> {
const txHash = await promisify<string>(this._web3.eth.sendTransaction)(txData); const txHash = await promisify<string>(this._web3.eth.sendTransaction)(txData);
return txHash; return txHash;