diff options
author | Steve Klebanoff <steve.klebanoff@gmail.com> | 2019-01-16 02:38:23 +0800 |
---|---|---|
committer | Steve Klebanoff <steve.klebanoff@gmail.com> | 2019-01-16 02:38:23 +0800 |
commit | 7a2b312d64994f96db75864e9a61bb319efdda3a (patch) | |
tree | 6d7b030abe774c619067ae52e0ef1cf7ebdd0963 /packages/abi-gen-templates | |
parent | 64a78149aa4a35aa339fb9ef80faea613ebaeffd (diff) | |
parent | f570f80674c22f69712c45e8e3c48e948b51f357 (diff) | |
download | dexon-sol-tools-7a2b312d64994f96db75864e9a61bb319efdda3a.tar dexon-sol-tools-7a2b312d64994f96db75864e9a61bb319efdda3a.tar.gz dexon-sol-tools-7a2b312d64994f96db75864e9a61bb319efdda3a.tar.bz2 dexon-sol-tools-7a2b312d64994f96db75864e9a61bb319efdda3a.tar.lz dexon-sol-tools-7a2b312d64994f96db75864e9a61bb319efdda3a.tar.xz dexon-sol-tools-7a2b312d64994f96db75864e9a61bb319efdda3a.tar.zst dexon-sol-tools-7a2b312d64994f96db75864e9a61bb319efdda3a.zip |
Merge branch 'development' into fix/asset-buyer/zero-amount-available-test
Diffstat (limited to 'packages/abi-gen-templates')
-rw-r--r-- | packages/abi-gen-templates/CHANGELOG.json | 9 | ||||
-rw-r--r-- | packages/abi-gen-templates/CHANGELOG.md | 4 | ||||
-rw-r--r-- | packages/abi-gen-templates/contract.handlebars | 2 | ||||
-rw-r--r-- | packages/abi-gen-templates/package.json | 2 | ||||
-rw-r--r-- | packages/abi-gen-templates/partials/callAsync.handlebars | 17 | ||||
-rw-r--r-- | packages/abi-gen-templates/partials/tx.handlebars | 13 |
6 files changed, 24 insertions, 23 deletions
diff --git a/packages/abi-gen-templates/CHANGELOG.json b/packages/abi-gen-templates/CHANGELOG.json index baf852ad5..b825c4f1f 100644 --- a/packages/abi-gen-templates/CHANGELOG.json +++ b/packages/abi-gen-templates/CHANGELOG.json @@ -1,5 +1,14 @@ [ { + "timestamp": 1547561734, + "version": "1.0.2", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "timestamp": 1543401373, "version": "1.0.1", "changes": [ diff --git a/packages/abi-gen-templates/CHANGELOG.md b/packages/abi-gen-templates/CHANGELOG.md index 1c3f21c6c..5dd6d03e0 100644 --- a/packages/abi-gen-templates/CHANGELOG.md +++ b/packages/abi-gen-templates/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.2 - _January 15, 2019_ + + * Dependencies updated + ## v1.0.1 - _November 28, 2018_ * Dependencies updated diff --git a/packages/abi-gen-templates/contract.handlebars b/packages/abi-gen-templates/contract.handlebars index 9b2a2b336..7e7171c70 100644 --- a/packages/abi-gen-templates/contract.handlebars +++ b/packages/abi-gen-templates/contract.handlebars @@ -85,7 +85,7 @@ export class {{contractName}}Contract extends BaseContract { } constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { super('{{contractName}}', abi, address, provider, txDefaults); - classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']); + classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', 'abi', '_web3Wrapper']); } } // tslint:disable:max-file-line-count // tslint:enable:no-unbound-method diff --git a/packages/abi-gen-templates/package.json b/packages/abi-gen-templates/package.json index 09872ab49..af66aeba0 100644 --- a/packages/abi-gen-templates/package.json +++ b/packages/abi-gen-templates/package.json @@ -1,6 +1,6 @@ { "name": "@0x/abi-gen-templates", - "version": "1.0.1", + "version": "1.0.2", "engines": { "node": ">=6.12" }, diff --git a/packages/abi-gen-templates/partials/callAsync.handlebars b/packages/abi-gen-templates/partials/callAsync.handlebars index ddbbe7508..ab9f2c21c 100644 --- a/packages/abi-gen-templates/partials/callAsync.handlebars +++ b/packages/abi-gen-templates/partials/callAsync.handlebars @@ -4,12 +4,7 @@ async callAsync( defaultBlock?: BlockParam, ): Promise<{{> return_type outputs=outputs}}> { const self = this as any as {{contractName}}Contract; - const functionSignature = '{{this.functionSignature}}'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [{{> params inputs=inputs}}] = BaseContract._formatABIDataItemList(inputAbi, [{{> params inputs=inputs}}], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [{{> params inputs=inputs}}]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.{{this.name}}; - const encodedData = ethersFunction.encode([{{> params inputs=inputs}}]); + const encodedData = self._strictEncodeArguments('{{this.functionSignature}}', [{{> params inputs=inputs}}]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -20,9 +15,9 @@ async callAsync( ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: '{{this.name}}'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray{{#singleReturnValue}}[0]{{/singleReturnValue}}; + const abiEncoder = self._lookupAbiEncoder('{{this.functionSignature}}'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<{{> return_type outputs=outputs}}>(rawCallResult); + // tslint:enable boolean-naming + return result; }, diff --git a/packages/abi-gen-templates/partials/tx.handlebars b/packages/abi-gen-templates/partials/tx.handlebars index b39156583..0f1027fae 100644 --- a/packages/abi-gen-templates/partials/tx.handlebars +++ b/packages/abi-gen-templates/partials/tx.handlebars @@ -9,10 +9,7 @@ public {{this.tsName}} = { {{/this.payable}} ): Promise<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)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [{{> params inputs=inputs}}]); - const encodedData = self._lookupEthersInterface('{{this.functionSignature}}').functions.{{this.name}}.encode([{{> params inputs=inputs}}]); + const encodedData = self._strictEncodeArguments('{{this.functionSignature}}', [{{> params inputs=inputs}}]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -33,9 +30,7 @@ public {{this.tsName}} = { txData: Partial<TxData> = {}, ): 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); - const encodedData = self._lookupEthersInterface('{{this.functionSignature}}').functions.{{this.name}}.encode([{{> params inputs=inputs}}]); + const encodedData = self._strictEncodeArguments('{{this.functionSignature}}', [{{> params inputs=inputs}}]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -51,9 +46,7 @@ public {{this.tsName}} = { {{> typed_params inputs=inputs}} ): 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); - const abiEncodedTransactionData = self._lookupEthersInterface('{{this.functionSignature}}').functions.{{this.name}}.encode([{{> params inputs=inputs}}]); + const abiEncodedTransactionData = self._strictEncodeArguments('{{this.functionSignature}}', [{{> params inputs=inputs}}]); return abiEncodedTransactionData; }, {{> callAsync}} |