diff options
Diffstat (limited to 'packages/contract_templates/partials')
-rw-r--r-- | packages/contract_templates/partials/callAsync.handlebars | 6 | ||||
-rw-r--r-- | packages/contract_templates/partials/tx.handlebars | 14 |
2 files changed, 13 insertions, 7 deletions
diff --git a/packages/contract_templates/partials/callAsync.handlebars b/packages/contract_templates/partials/callAsync.handlebars index 58fb2f09c..99fda80e1 100644 --- a/packages/contract_templates/partials/callAsync.handlebars +++ b/packages/contract_templates/partials/callAsync.handlebars @@ -12,10 +12,12 @@ async callAsync( {{> params inputs=inputs}} ) as ethers.CallDescription; const encodedData = ethersFunction.data; - const callDataWithDefaults = await self._applyDefaultsToTxDataAsync( + const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { + to: self.address, data: encodedData, - } + }, + self._web3Wrapper.getContractDefaults(), ) const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); let resultArray = ethersFunction.parse(rawCallResult); diff --git a/packages/contract_templates/partials/tx.handlebars b/packages/contract_templates/partials/tx.handlebars index 1bdf80c42..e297d05e6 100644 --- a/packages/contract_templates/partials/tx.handlebars +++ b/packages/contract_templates/partials/tx.handlebars @@ -14,11 +14,13 @@ public {{this.tsName}} = { const encodedData = self._lookupEthersInterface('{{this.functionSignature}}').functions.{{this.name}}( {{> params inputs=inputs}} ).data; - const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { + to: self.address, ...txData, data: encodedData, }, + self._web3Wrapper.getContractDefaults(), self.{{this.tsName}}.estimateGasAsync.bind( self, {{> params inputs=inputs}} @@ -33,15 +35,17 @@ public {{this.tsName}} = { ): Promise<number> { const self = this as any as {{contractName}}Contract; const inputAbi = self._lookupAbi('{{this.functionSignature}}').inputs; - [{{> params inputs=inputs}}] = BaseContract._formatABIDataItemList(inputAbi, [{{> params inputs=inputs}}], BaseContract._bigNumberToString.bind(this)); + [{{> params inputs=inputs}}] = BaseContract._formatABIDataItemList(inputAbi, [{{> params inputs=inputs}}], BaseContract._bigNumberToString); const encodedData = self._lookupEthersInterface('{{this.functionSignature}}').functions.{{this.name}}( {{> params inputs=inputs}} ).data; - const txDataWithDefaults = await self._applyDefaultsToTxDataAsync( + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { + to: self.address, ...txData, data: encodedData, - } + }, + self._web3Wrapper.getContractDefaults(), ); const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; @@ -51,7 +55,7 @@ public {{this.tsName}} = { ): string { const self = this as any as {{contractName}}Contract; const inputAbi = self._lookupAbi('{{this.functionSignature}}').inputs; - [{{> params inputs=inputs}}] = BaseContract._formatABIDataItemList(inputAbi, [{{> params inputs=inputs}}], BaseContract._bigNumberToString.bind(self)); + [{{> params inputs=inputs}}] = BaseContract._formatABIDataItemList(inputAbi, [{{> params inputs=inputs}}], BaseContract._bigNumberToString); const abiEncodedTransactionData = self._lookupEthersInterface('{{this.functionSignature}}').functions.{{this.name}}( {{> params inputs=inputs}} ).data; |