From 9f12ef61b0cc8bb295b4a2bbfdf24b41c1584da2 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 5 Sep 2017 13:43:46 +0200 Subject: Rename x.call -> x.callAsync x() -> x.sendTransactionAsync() x.estimateGas() -> x.estimateGasAsync() --- src/contract.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/contract.ts') diff --git a/src/contract.ts b/src/contract.ts index ebda31e65..9dfb04446 100644 --- a/src/contract.ts +++ b/src/contract.ts @@ -21,16 +21,18 @@ export class Contract implements Web3.ContractInstance { private populateFunctions(): void { const functionsAbi = _.filter(this.abi, abiPart => abiPart.type === 'function'); _.forEach(functionsAbi, (functionAbi: Web3.MethodAbi) => { - const cbStyleFunction = this.contract[functionAbi.name]; if (functionAbi.constant) { - this[functionAbi.name] = promisify(cbStyleFunction, this.contract); const cbStyleCallFunction = this.contract[functionAbi.name].call; - this[functionAbi.name].call = promisify(cbStyleCallFunction, this.contract); + this[functionAbi.name] = { + callAsync: promisify(cbStyleCallFunction, this.contract), + }; } else { - this[functionAbi.name] = this.promisifyWithDefaultParams(cbStyleFunction); + const cbStyleFunction = this.contract[functionAbi.name]; const cbStyleEstimateGasFunction = this.contract[functionAbi.name].estimateGas; - this[functionAbi.name].estimateGas = - promisify(cbStyleEstimateGasFunction, this.contract); + this[functionAbi.name] = { + estimateGasAsync: promisify(cbStyleEstimateGasFunction, this.contract), + sendTransactionAsync: this.promisifyWithDefaultParams(cbStyleFunction), + }; } }); } -- cgit v1.2.3