diff options
author | Greg Hysen <greg.hysen@gmail.com> | 2018-12-18 10:26:03 +0800 |
---|---|---|
committer | Greg Hysen <greg.hysen@gmail.com> | 2019-01-15 02:49:29 +0800 |
commit | 285fb3deadd0413bf993557575a3f96a840f0e10 (patch) | |
tree | 8970de6db324e3773146f61265e0b44d03976a60 /packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts | |
parent | 797d7c7878e33ce012259a6a5db5335e9dc838ba (diff) | |
download | dexon-0x-contracts-285fb3deadd0413bf993557575a3f96a840f0e10.tar.gz dexon-0x-contracts-285fb3deadd0413bf993557575a3f96a840f0e10.tar.zst dexon-0x-contracts-285fb3deadd0413bf993557575a3f96a840f0e10.zip |
Progress
Diffstat (limited to 'packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts')
-rw-r--r-- | packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts | 187 |
1 files changed, 58 insertions, 129 deletions
diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts b/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts index 877ffd12d..dd8c2041e 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts @@ -46,9 +46,8 @@ export class ZRXTokenContract extends BaseContract { const functionSignature = 'name()'; const inputAbi = self._lookupAbi(functionSignature).inputs; [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.name; - const encodedData = ethersFunction.encode([]); + const abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -59,7 +58,8 @@ export class ZRXTokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); const outputAbi = (_.find(self.abi, {name: 'name'}) as MethodAbi).outputs; resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); @@ -73,18 +73,10 @@ export class ZRXTokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as ZRXTokenContract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [_spender, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_spender, + const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); + const encodedData = abiEncoder.encode([_spender, _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_spender, - _value - ]); - const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender, - _value - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -107,13 +99,8 @@ export class ZRXTokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ZRXTokenContract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [_spender, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_spender, - _value - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender, + const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); + const encodedData = abiEncoder.encode([_spender, _value ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -132,13 +119,8 @@ export class ZRXTokenContract extends BaseContract { _value: BigNumber, ): string { const self = this as any as ZRXTokenContract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [_spender, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_spender, - _value - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender, + const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); + const abiEncodedTransactionData = abiEncoder.encode([_spender, _value ]); return abiEncodedTransactionData; @@ -158,11 +140,8 @@ export class ZRXTokenContract extends BaseContract { ] = BaseContract._formatABIDataItemList(inputAbi, [_spender, _value ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_spender, - _value - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.approve; - const encodedData = ethersFunction.encode([_spender, + const abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([_spender, _value ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -175,7 +154,8 @@ export class ZRXTokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -192,9 +172,8 @@ export class ZRXTokenContract extends BaseContract { const functionSignature = 'totalSupply()'; const inputAbi = self._lookupAbi(functionSignature).inputs; [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.totalSupply; - const encodedData = ethersFunction.encode([]); + const abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -205,7 +184,8 @@ export class ZRXTokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); const outputAbi = (_.find(self.abi, {name: 'totalSupply'}) as MethodAbi).outputs; resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); @@ -220,22 +200,11 @@ export class ZRXTokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as ZRXTokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, + const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); + const encodedData = abiEncoder.encode([_from, _to, _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _value - ]); - const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from, - _to, - _value - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -260,15 +229,8 @@ export class ZRXTokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ZRXTokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _value - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from, + const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); + const encodedData = abiEncoder.encode([_from, _to, _value ]); @@ -289,15 +251,8 @@ export class ZRXTokenContract extends BaseContract { _value: BigNumber, ): string { const self = this as any as ZRXTokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _value - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from, + const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); + const abiEncodedTransactionData = abiEncoder.encode([_from, _to, _value ]); @@ -321,12 +276,8 @@ export class ZRXTokenContract extends BaseContract { _to, _value ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _value - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferFrom; - const encodedData = ethersFunction.encode([_from, + const abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([_from, _to, _value ]); @@ -340,7 +291,8 @@ export class ZRXTokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -357,9 +309,8 @@ export class ZRXTokenContract extends BaseContract { const functionSignature = 'decimals()'; const inputAbi = self._lookupAbi(functionSignature).inputs; [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.decimals; - const encodedData = ethersFunction.encode([]); + const abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -370,7 +321,8 @@ export class ZRXTokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); const outputAbi = (_.find(self.abi, {name: 'decimals'}) as MethodAbi).outputs; resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); @@ -390,10 +342,8 @@ export class ZRXTokenContract extends BaseContract { [_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 abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([_owner ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { @@ -405,7 +355,8 @@ export class ZRXTokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); 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)); @@ -422,9 +373,8 @@ export class ZRXTokenContract extends BaseContract { const functionSignature = 'symbol()'; const inputAbi = self._lookupAbi(functionSignature).inputs; [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.symbol; - const encodedData = ethersFunction.encode([]); + const abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -435,7 +385,8 @@ export class ZRXTokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); const outputAbi = (_.find(self.abi, {name: 'symbol'}) as MethodAbi).outputs; resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); @@ -449,18 +400,10 @@ export class ZRXTokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<string> { const self = this as any as ZRXTokenContract; - const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs; - [_to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_to, + const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); + const encodedData = abiEncoder.encode([_to, _value - ]); - const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to, - _value - ]); + ], {optimize: false}); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { to: self.address, @@ -483,13 +426,8 @@ export class ZRXTokenContract extends BaseContract { txData: Partial<TxData> = {}, ): Promise<number> { const self = this as any as ZRXTokenContract; - const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs; - [_to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, - _value - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to, + const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); + const encodedData = abiEncoder.encode([_to, _value ]); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -508,13 +446,8 @@ export class ZRXTokenContract extends BaseContract { _value: BigNumber, ): string { const self = this as any as ZRXTokenContract; - const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs; - [_to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, - _value - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to, + const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); + const abiEncodedTransactionData = abiEncoder.encode([_to, _value ]); return abiEncodedTransactionData; @@ -534,11 +467,8 @@ export class ZRXTokenContract extends BaseContract { ] = BaseContract._formatABIDataItemList(inputAbi, [_to, _value ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_to, - _value - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transfer; - const encodedData = ethersFunction.encode([_to, + const abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([_to, _value ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -551,7 +481,8 @@ export class ZRXTokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); const outputAbi = (_.find(self.abi, {name: 'transfer'}) as MethodAbi).outputs; resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); @@ -574,11 +505,8 @@ export class ZRXTokenContract extends BaseContract { ] = BaseContract._formatABIDataItemList(inputAbi, [_owner, _spender ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner, - _spender - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.allowance; - const encodedData = ethersFunction.encode([_owner, + const abiEncoder = self._lookupAbiEncoder(functionSignature); + const encodedData = abiEncoder.encode([_owner, _spender ]); const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -591,7 +519,8 @@ export class ZRXTokenContract extends BaseContract { ); const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); + const decodingRules = {structsAsObjects: false}; + let resultArray = abiEncoder.decodeReturnValues(rawCallResult, decodingRules); const outputAbi = (_.find(self.abi, {name: 'allowance'}) as MethodAbi).outputs; resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); @@ -641,7 +570,7 @@ export class ZRXTokenContract extends BaseContract { } constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { super('ZRXToken', 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 |