diff options
author | Greg Hysen <hysz@users.noreply.github.com> | 2019-01-15 03:48:17 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-15 03:48:17 +0800 |
commit | 1c25d8e997456c248470d925cf6702e46d959a62 (patch) | |
tree | 4e2c77924445247b2916d7713e058ba3466b70a5 /packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts | |
parent | fc89b97818eda9c7447273b5728c1ba8fbb5cdf5 (diff) | |
parent | b0817854e81512ad95cca4d842a671304ae3b94a (diff) | |
download | dexon-sol-tools-1c25d8e997456c248470d925cf6702e46d959a62.tar dexon-sol-tools-1c25d8e997456c248470d925cf6702e46d959a62.tar.gz dexon-sol-tools-1c25d8e997456c248470d925cf6702e46d959a62.tar.bz2 dexon-sol-tools-1c25d8e997456c248470d925cf6702e46d959a62.tar.lz dexon-sol-tools-1c25d8e997456c248470d925cf6702e46d959a62.tar.xz dexon-sol-tools-1c25d8e997456c248470d925cf6702e46d959a62.tar.zst dexon-sol-tools-1c25d8e997456c248470d925cf6702e46d959a62.zip |
Merge pull request #1475 from 0xProject/feature/monorepo/useNewAbiEncoder
Use Compressed Calldata in Contract Wrappers
Diffstat (limited to 'packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts')
-rw-r--r-- | packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts b/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts index 5f38ffdac..6cb9f64fb 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts @@ -25,21 +25,7 @@ export class IValidatorContract extends BaseContract { ): Promise<boolean > { const self = this as any as IValidatorContract; - const functionSignature = 'isValidSignature(bytes32,address,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [hash, - signerAddress, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [hash, - signerAddress, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [hash, - signerAddress, - signature - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isValidSignature; - const encodedData = ethersFunction.encode([hash, + const encodedData = self._strictEncodeArguments('isValidSignature(bytes32,address,bytes)', [hash, signerAddress, signature ]); @@ -53,11 +39,12 @@ export class IValidatorContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'isValidSignature'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; + const abiEncoder = self._lookupAbiEncoder('isValidSignature(bytes32,address,bytes)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<boolean + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public static async deployFrom0xArtifactAsync( @@ -103,7 +90,7 @@ export class IValidatorContract extends BaseContract { } constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { super('IValidator', 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 |