diff options
Diffstat (limited to 'packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts')
-rw-r--r-- | packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts | 384 |
1 files changed, 79 insertions, 305 deletions
diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts index 251dfa5f9..aaae2ab76 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts @@ -52,15 +52,7 @@ export class ERC721TokenContract extends BaseContract { ): Promise<string > { const self = this as any as ERC721TokenContract; - const functionSignature = 'getApproved(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_tokenId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getApproved; - const encodedData = ethersFunction.encode([_tokenId + const encodedData = self._strictEncodeArguments('getApproved(uint256)', [_tokenId ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -72,11 +64,12 @@ export class ERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getApproved'}) 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('getApproved(uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<string + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public approve = { @@ -86,16 +79,7 @@ export class ERC721TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as ERC721TokenContract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [_approved, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_approved, - _tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_approved, - _tokenId - ]); - const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_approved, + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_approved, _tokenId ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -120,13 +104,7 @@ export class ERC721TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ERC721TokenContract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [_approved, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_approved, - _tokenId - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_approved, + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_approved, _tokenId ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -145,13 +123,7 @@ export class ERC721TokenContract extends BaseContract { _tokenId: BigNumber, ): string { const self = this as any as ERC721TokenContract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [_approved, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_approved, - _tokenId - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_approved, + const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_approved, _tokenId ]); return abiEncodedTransactionData; @@ -164,18 +136,7 @@ export class ERC721TokenContract extends BaseContract { ): Promise<void > { const self = this as any as ERC721TokenContract; - const functionSignature = 'approve(address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_approved, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_approved, - _tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_approved, - _tokenId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.approve; - const encodedData = ethersFunction.encode([_approved, + const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_approved, _tokenId ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -188,11 +149,12 @@ export class ERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'approve'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; + const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<void + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public transferFrom = { @@ -203,19 +165,7 @@ export class ERC721TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as ERC721TokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _tokenId - ]); - const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from, + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from, _to, _tokenId ]); @@ -243,15 +193,7 @@ export class ERC721TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ERC721TokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from, + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from, _to, _tokenId ]); @@ -272,15 +214,7 @@ export class ERC721TokenContract extends BaseContract { _tokenId: BigNumber, ): string { const self = this as any as ERC721TokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from, + const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from, _to, _tokenId ]); @@ -295,21 +229,7 @@ export class ERC721TokenContract extends BaseContract { ): Promise<void > { const self = this as any as ERC721TokenContract; - const functionSignature = 'transferFrom(address,address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_from, - _to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _tokenId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferFrom; - const encodedData = ethersFunction.encode([_from, + const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from, _to, _tokenId ]); @@ -323,11 +243,12 @@ export class ERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transferFrom'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; + const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<void + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public safeTransferFrom1 = { @@ -338,19 +259,7 @@ export class ERC721TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as ERC721TokenContract; - const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256)').inputs; - [_from, - _to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _tokenId - ]); - const encodedData = self._lookupEthersInterface('safeTransferFrom(address,address,uint256)').functions.safeTransferFrom.encode([_from, + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from, _to, _tokenId ]); @@ -378,15 +287,7 @@ export class ERC721TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ERC721TokenContract; - const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256)').inputs; - [_from, - _to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('safeTransferFrom(address,address,uint256)').functions.safeTransferFrom.encode([_from, + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from, _to, _tokenId ]); @@ -407,15 +308,7 @@ export class ERC721TokenContract extends BaseContract { _tokenId: BigNumber, ): string { const self = this as any as ERC721TokenContract; - const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256)').inputs; - [_from, - _to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('safeTransferFrom(address,address,uint256)').functions.safeTransferFrom.encode([_from, + const abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from, _to, _tokenId ]); @@ -430,21 +323,7 @@ export class ERC721TokenContract extends BaseContract { ): Promise<void > { const self = this as any as ERC721TokenContract; - const functionSignature = 'safeTransferFrom(address,address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_from, - _to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _tokenId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.safeTransferFrom; - const encodedData = ethersFunction.encode([_from, + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from, _to, _tokenId ]); @@ -458,11 +337,12 @@ export class ERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'safeTransferFrom'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; + const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<void + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public ownerOf = { @@ -473,15 +353,7 @@ export class ERC721TokenContract extends BaseContract { ): Promise<string > { const self = this as any as ERC721TokenContract; - const functionSignature = 'ownerOf(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_tokenId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.ownerOf; - const encodedData = ethersFunction.encode([_tokenId + const encodedData = self._strictEncodeArguments('ownerOf(uint256)', [_tokenId ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -493,11 +365,12 @@ export class ERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'ownerOf'}) 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('ownerOf(uint256)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<string + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public balanceOf = { @@ -508,15 +381,7 @@ export class ERC721TokenContract extends BaseContract { ): Promise<BigNumber > { const self = this as any as ERC721TokenContract; - const functionSignature = 'balanceOf(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_owner - ] = BaseContract._formatABIDataItemList(inputAbi, [_owner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.balanceOf; - const encodedData = ethersFunction.encode([_owner + const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -528,11 +393,12 @@ export class ERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'balanceOf'}) 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('balanceOf(address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<BigNumber + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public setApprovalForAll = { @@ -542,16 +408,7 @@ export class ERC721TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as ERC721TokenContract; - const inputAbi = self._lookupAbi('setApprovalForAll(address,bool)').inputs; - [_operator, - _approved - ] = BaseContract._formatABIDataItemList(inputAbi, [_operator, - _approved - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_operator, - _approved - ]); - const encodedData = self._lookupEthersInterface('setApprovalForAll(address,bool)').functions.setApprovalForAll.encode([_operator, + const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator, _approved ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -576,13 +433,7 @@ export class ERC721TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ERC721TokenContract; - const inputAbi = self._lookupAbi('setApprovalForAll(address,bool)').inputs; - [_operator, - _approved - ] = BaseContract._formatABIDataItemList(inputAbi, [_operator, - _approved - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('setApprovalForAll(address,bool)').functions.setApprovalForAll.encode([_operator, + const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator, _approved ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -601,13 +452,7 @@ export class ERC721TokenContract extends BaseContract { _approved: boolean, ): string { const self = this as any as ERC721TokenContract; - const inputAbi = self._lookupAbi('setApprovalForAll(address,bool)').inputs; - [_operator, - _approved - ] = BaseContract._formatABIDataItemList(inputAbi, [_operator, - _approved - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('setApprovalForAll(address,bool)').functions.setApprovalForAll.encode([_operator, + const abiEncodedTransactionData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator, _approved ]); return abiEncodedTransactionData; @@ -620,18 +465,7 @@ export class ERC721TokenContract extends BaseContract { ): Promise<void > { const self = this as any as ERC721TokenContract; - const functionSignature = 'setApprovalForAll(address,bool)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_operator, - _approved - ] = BaseContract._formatABIDataItemList(inputAbi, [_operator, - _approved - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_operator, - _approved - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.setApprovalForAll; - const encodedData = ethersFunction.encode([_operator, + const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator, _approved ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -644,11 +478,12 @@ export class ERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'setApprovalForAll'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; + const abiEncoder = self._lookupAbiEncoder('setApprovalForAll(address,bool)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<void + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public safeTransferFrom2 = { @@ -660,22 +495,7 @@ export class ERC721TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as ERC721TokenContract; - const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256,bytes)').inputs; - [_from, - _to, - _tokenId, - _data - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId, - _data - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _tokenId, - _data - ]); - const encodedData = self._lookupEthersInterface('safeTransferFrom(address,address,uint256,bytes)').functions.safeTransferFrom.encode([_from, + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from, _to, _tokenId, _data @@ -706,17 +526,7 @@ export class ERC721TokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ERC721TokenContract; - const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256,bytes)').inputs; - [_from, - _to, - _tokenId, - _data - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId, - _data - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('safeTransferFrom(address,address,uint256,bytes)').functions.safeTransferFrom.encode([_from, + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from, _to, _tokenId, _data @@ -739,17 +549,7 @@ export class ERC721TokenContract extends BaseContract { _data: string, ): string { const self = this as any as ERC721TokenContract; - const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256,bytes)').inputs; - [_from, - _to, - _tokenId, - _data - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId, - _data - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('safeTransferFrom(address,address,uint256,bytes)').functions.safeTransferFrom.encode([_from, + const abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from, _to, _tokenId, _data @@ -766,24 +566,7 @@ export class ERC721TokenContract extends BaseContract { ): Promise<void > { const self = this as any as ERC721TokenContract; - const functionSignature = 'safeTransferFrom(address,address,uint256,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_from, - _to, - _tokenId, - _data - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId, - _data - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _tokenId, - _data - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.safeTransferFrom; - const encodedData = ethersFunction.encode([_from, + const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from, _to, _tokenId, _data @@ -798,11 +581,12 @@ export class ERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'safeTransferFrom'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; + const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256,bytes)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<void + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public isApprovedForAll = { @@ -814,18 +598,7 @@ export class ERC721TokenContract extends BaseContract { ): Promise<boolean > { const self = this as any as ERC721TokenContract; - const functionSignature = 'isApprovedForAll(address,address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_owner, - _operator - ] = BaseContract._formatABIDataItemList(inputAbi, [_owner, - _operator - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner, - _operator - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isApprovedForAll; - const encodedData = ethersFunction.encode([_owner, + const encodedData = self._strictEncodeArguments('isApprovedForAll(address,address)', [_owner, _operator ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -838,11 +611,12 @@ export class ERC721TokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'isApprovedForAll'}) 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('isApprovedForAll(address,address)'); + // tslint:disable boolean-naming + const result = abiEncoder.strictDecodeReturnValue<boolean + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; public static async deployFrom0xArtifactAsync( @@ -888,7 +662,7 @@ export class ERC721TokenContract extends BaseContract { } constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { super('ERC721Token', 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 |