aboutsummaryrefslogtreecommitdiffstats
path: root/src/contract.ts
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-09-05 19:43:46 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-09-05 19:43:46 +0800
commit9f12ef61b0cc8bb295b4a2bbfdf24b41c1584da2 (patch)
tree1bcb6a3c80c15ea7bfe6755a97ac9fb8760da953 /src/contract.ts
parente05dfab1fca9eb108848c98da9dbf671a59d17f3 (diff)
downloaddexon-sol-tools-9f12ef61b0cc8bb295b4a2bbfdf24b41c1584da2.tar
dexon-sol-tools-9f12ef61b0cc8bb295b4a2bbfdf24b41c1584da2.tar.gz
dexon-sol-tools-9f12ef61b0cc8bb295b4a2bbfdf24b41c1584da2.tar.bz2
dexon-sol-tools-9f12ef61b0cc8bb295b4a2bbfdf24b41c1584da2.tar.lz
dexon-sol-tools-9f12ef61b0cc8bb295b4a2bbfdf24b41c1584da2.tar.xz
dexon-sol-tools-9f12ef61b0cc8bb295b4a2bbfdf24b41c1584da2.tar.zst
dexon-sol-tools-9f12ef61b0cc8bb295b4a2bbfdf24b41c1584da2.zip
Rename x.call -> x.callAsync x() -> x.sendTransactionAsync() x.estimateGas() -> x.estimateGasAsync()
Diffstat (limited to 'src/contract.ts')
-rw-r--r--src/contract.ts14
1 files changed, 8 insertions, 6 deletions
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),
+ };
}
});
}