aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorGreg Hysen <hysz@users.noreply.github.com>2019-01-15 03:48:17 +0800
committerGitHub <noreply@github.com>2019-01-15 03:48:17 +0800
commit1c25d8e997456c248470d925cf6702e46d959a62 (patch)
tree4e2c77924445247b2916d7713e058ba3466b70a5 /packages
parentfc89b97818eda9c7447273b5728c1ba8fbb5cdf5 (diff)
parentb0817854e81512ad95cca4d842a671304ae3b94a (diff)
downloaddexon-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')
-rw-r--r--packages/abi-gen-templates/contract.handlebars2
-rw-r--r--packages/abi-gen-templates/partials/callAsync.handlebars17
-rw-r--r--packages/abi-gen-templates/partials/tx.handlebars13
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/asset_proxy_owner.ts829
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc20_token.ts451
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc721_token.ts581
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/dutch_auction.ts114
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts272
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts228
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts272
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts384
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts1407
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts304
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts29
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts26
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts170
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts354
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts282
-rw-r--r--packages/abi-gen/src/index.ts4
-rw-r--r--packages/base-contract/src/index.ts55
-rw-r--r--packages/utils/src/abi_encoder/abstract_data_types/data_type.ts20
-rw-r--r--packages/utils/src/abi_encoder/abstract_data_types/types/set.ts34
-rw-r--r--packages/utils/src/abi_encoder/evm_data_type_factory.ts33
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/address.ts5
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/array.ts24
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/bool.ts2
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/dynamic_bytes.ts2
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/int.ts8
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/method.ts15
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/pointer.ts8
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/static_bytes.ts2
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/string.ts2
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/tuple.ts20
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/uint.ts8
-rw-r--r--packages/utils/src/abi_encoder/index.ts2
-rw-r--r--packages/utils/src/abi_encoder/utils/constants.ts2
-rw-r--r--packages/utils/src/abi_encoder/utils/signature_parser.ts101
-rw-r--r--packages/utils/test/abi_encoder/evm_data_types_test.ts193
-rw-r--r--packages/utils/test/abi_encoder/methods_test.ts69
-rw-r--r--packages/utils/test/abi_encoder/optimizer_test.ts43
-rw-r--r--packages/utils/test/abi_encoder/return_values_test.ts22
-rw-r--r--packages/utils/test/abi_encoder/signature_tests.ts0
42 files changed, 1912 insertions, 4497 deletions
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/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}}
diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/asset_proxy_owner.ts b/packages/abi-gen-wrappers/src/generated-wrappers/asset_proxy_owner.ts
index 27f108ebc..cc42e7fb5 100644
--- a/packages/abi-gen-wrappers/src/generated-wrappers/asset_proxy_owner.ts
+++ b/packages/abi-gen-wrappers/src/generated-wrappers/asset_proxy_owner.ts
@@ -105,15 +105,7 @@ export class AssetProxyOwnerContract extends BaseContract {
): Promise<string
> {
const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'owners(uint256)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [index_0
- ] = BaseContract._formatABIDataItemList(inputAbi, [index_0
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.owners;
- const encodedData = ethersFunction.encode([index_0
+ const encodedData = self._strictEncodeArguments('owners(uint256)', [index_0
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -125,11 +117,12 @@ export class AssetProxyOwnerContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'owners'}) 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('owners(uint256)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<string
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public removeOwner = {
@@ -138,13 +131,7 @@ export class AssetProxyOwnerContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as AssetProxyOwnerContract;
- const inputAbi = self._lookupAbi('removeOwner(address)').inputs;
- [owner
- ] = BaseContract._formatABIDataItemList(inputAbi, [owner
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [owner
- ]);
- const encodedData = self._lookupEthersInterface('removeOwner(address)').functions.removeOwner.encode([owner
+ const encodedData = self._strictEncodeArguments('removeOwner(address)', [owner
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -166,11 +153,7 @@ export class AssetProxyOwnerContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as AssetProxyOwnerContract;
- const inputAbi = self._lookupAbi('removeOwner(address)').inputs;
- [owner
- ] = BaseContract._formatABIDataItemList(inputAbi, [owner
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('removeOwner(address)').functions.removeOwner.encode([owner
+ const encodedData = self._strictEncodeArguments('removeOwner(address)', [owner
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -187,11 +170,7 @@ export class AssetProxyOwnerContract extends BaseContract {
owner: string,
): string {
const self = this as any as AssetProxyOwnerContract;
- const inputAbi = self._lookupAbi('removeOwner(address)').inputs;
- [owner
- ] = BaseContract._formatABIDataItemList(inputAbi, [owner
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('removeOwner(address)').functions.removeOwner.encode([owner
+ const abiEncodedTransactionData = self._strictEncodeArguments('removeOwner(address)', [owner
]);
return abiEncodedTransactionData;
},
@@ -202,15 +181,7 @@ export class AssetProxyOwnerContract extends BaseContract {
): Promise<void
> {
const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'removeOwner(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.removeOwner;
- const encodedData = ethersFunction.encode([owner
+ const encodedData = self._strictEncodeArguments('removeOwner(address)', [owner
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -222,11 +193,12 @@ export class AssetProxyOwnerContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'removeOwner'}) 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('removeOwner(address)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<void
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public revokeConfirmation = {
@@ -235,13 +207,7 @@ export class AssetProxyOwnerContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as AssetProxyOwnerContract;
- const inputAbi = self._lookupAbi('revokeConfirmation(uint256)').inputs;
- [transactionId
- ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId
- ]);
- const encodedData = self._lookupEthersInterface('revokeConfirmation(uint256)').functions.revokeConfirmation.encode([transactionId
+ const encodedData = self._strictEncodeArguments('revokeConfirmation(uint256)', [transactionId
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -263,11 +229,7 @@ export class AssetProxyOwnerContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as AssetProxyOwnerContract;
- const inputAbi = self._lookupAbi('revokeConfirmation(uint256)').inputs;
- [transactionId
- ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('revokeConfirmation(uint256)').functions.revokeConfirmation.encode([transactionId
+ const encodedData = self._strictEncodeArguments('revokeConfirmation(uint256)', [transactionId
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -284,11 +246,7 @@ export class AssetProxyOwnerContract extends BaseContract {
transactionId: BigNumber,
): string {
const self = this as any as AssetProxyOwnerContract;
- const inputAbi = self._lookupAbi('revokeConfirmation(uint256)').inputs;
- [transactionId
- ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('revokeConfirmation(uint256)').functions.revokeConfirmation.encode([transactionId
+ const abiEncodedTransactionData = self._strictEncodeArguments('revokeConfirmation(uint256)', [transactionId
]);
return abiEncodedTransactionData;
},
@@ -299,15 +257,7 @@ export class AssetProxyOwnerContract extends BaseContract {
): Promise<void
> {
const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'revokeConfirmation(uint256)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [transactionId
- ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.revokeConfirmation;
- const encodedData = ethersFunction.encode([transactionId
+ const encodedData = self._strictEncodeArguments('revokeConfirmation(uint256)', [transactionId
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -319,11 +269,12 @@ export class AssetProxyOwnerContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'revokeConfirmation'}) 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('revokeConfirmation(uint256)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<void
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public isOwner = {
@@ -334,15 +285,7 @@ export class AssetProxyOwnerContract extends BaseContract {
): Promise<boolean
> {
const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'isOwner(address)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [index_0
- ] = BaseContract._formatABIDataItemList(inputAbi, [index_0
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isOwner;
- const encodedData = ethersFunction.encode([index_0
+ const encodedData = self._strictEncodeArguments('isOwner(address)', [index_0
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -354,11 +297,12 @@ export class AssetProxyOwnerContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'isOwner'}) 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('isOwner(address)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<boolean
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public confirmations = {
@@ -370,18 +314,7 @@ export class AssetProxyOwnerContract extends BaseContract {
): Promise<boolean
> {
const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'confirmations(uint256,address)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [index_0,
- index_1
- ] = BaseContract._formatABIDataItemList(inputAbi, [index_0,
- index_1
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0,
- index_1
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.confirmations;
- const encodedData = ethersFunction.encode([index_0,
+ const encodedData = self._strictEncodeArguments('confirmations(uint256,address)', [index_0,
index_1
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -394,11 +327,12 @@ export class AssetProxyOwnerContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'confirmations'}) 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('confirmations(uint256,address)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<boolean
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public executeRemoveAuthorizedAddressAtIndex = {
@@ -407,13 +341,7 @@ export class AssetProxyOwnerContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as AssetProxyOwnerContract;
- const inputAbi = self._lookupAbi('executeRemoveAuthorizedAddressAtIndex(uint256)').inputs;
- [transactionId
- ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId
- ]);
- const encodedData = self._lookupEthersInterface('executeRemoveAuthorizedAddressAtIndex(uint256)').functions.executeRemoveAuthorizedAddressAtIndex.encode([transactionId
+ const encodedData = self._strictEncodeArguments('executeRemoveAuthorizedAddressAtIndex(uint256)', [transactionId
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -435,11 +363,7 @@ export class AssetProxyOwnerContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as AssetProxyOwnerContract;
- const inputAbi = self._lookupAbi('executeRemoveAuthorizedAddressAtIndex(uint256)').inputs;
- [transactionId
- ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('executeRemoveAuthorizedAddressAtIndex(uint256)').functions.executeRemoveAuthorizedAddressAtIndex.encode([transactionId
+ const encodedData = self._strictEncodeArguments('executeRemoveAuthorizedAddressAtIndex(uint256)', [transactionId
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -456,11 +380,7 @@ export class AssetProxyOwnerContract extends BaseContract {
transactionId: BigNumber,
): string {
const self = this as any as AssetProxyOwnerContract;
- const inputAbi = self._lookupAbi('executeRemoveAuthorizedAddressAtIndex(uint256)').inputs;
- [transactionId
- ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('executeRemoveAuthorizedAddressAtIndex(uint256)').functions.executeRemoveAuthorizedAddressAtIndex.encode([transactionId
+ const abiEncodedTransactionData = self._strictEncodeArguments('executeRemoveAuthorizedAddressAtIndex(uint256)', [transactionId
]);
return abiEncodedTransactionData;
},
@@ -471,15 +391,7 @@ export class AssetProxyOwnerContract extends BaseContract {
): Promise<void
> {
const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'executeRemoveAuthorizedAddressAtIndex(uint256)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [transactionId
- ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.executeRemoveAuthorizedAddressAtIndex;
- const encodedData = ethersFunction.encode([transactionId
+ const encodedData = self._strictEncodeArguments('executeRemoveAuthorizedAddressAtIndex(uint256)', [transactionId
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -491,11 +403,12 @@ export class AssetProxyOwnerContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'executeRemoveAuthorizedAddressAtIndex'}) 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('executeRemoveAuthorizedAddressAtIndex(uint256)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<void
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public secondsTimeLocked = {
@@ -505,12 +418,7 @@ export class AssetProxyOwnerContract extends BaseContract {
): Promise<BigNumber
> {
const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'secondsTimeLocked()';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, []);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.secondsTimeLocked;
- const encodedData = ethersFunction.encode([]);
+ const encodedData = self._strictEncodeArguments('secondsTimeLocked()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
@@ -521,11 +429,12 @@ export class AssetProxyOwnerContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'secondsTimeLocked'}) 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('secondsTimeLocked()');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<BigNumber
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public getTransactionCount = {
@@ -537,18 +446,7 @@ export class AssetProxyOwnerContract extends BaseContract {
): Promise<BigNumber
> {
const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'getTransactionCount(bool,bool)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [pending,
- executed
- ] = BaseContract._formatABIDataItemList(inputAbi, [pending,
- executed
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [pending,
- executed
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getTransactionCount;
- const encodedData = ethersFunction.encode([pending,
+ const encodedData = self._strictEncodeArguments('getTransactionCount(bool,bool)', [pending,
executed
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -561,11 +459,12 @@ export class AssetProxyOwnerContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'getTransactionCount'}) 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('getTransactionCount(bool,bool)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<BigNumber
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public registerAssetProxy = {
@@ -575,16 +474,7 @@ export class AssetProxyOwnerContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as AssetProxyOwnerContract;
- const inputAbi = self._lookupAbi('registerAssetProxy(address,bool)').inputs;
- [assetProxyContract,
- isRegistered
- ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxyContract,
- isRegistered
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [assetProxyContract,
- isRegistered
- ]);
- const encodedData = self._lookupEthersInterface('registerAssetProxy(address,bool)').functions.registerAssetProxy.encode([assetProxyContract,
+ const encodedData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [assetProxyContract,
isRegistered
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -609,13 +499,7 @@ export class AssetProxyOwnerContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as AssetProxyOwnerContract;
- const inputAbi = self._lookupAbi('registerAssetProxy(address,bool)').inputs;
- [assetProxyContract,
- isRegistered
- ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxyContract,
- isRegistered
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('registerAssetProxy(address,bool)').functions.registerAssetProxy.encode([assetProxyContract,
+ const encodedData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [assetProxyContract,
isRegistered
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -634,13 +518,7 @@ export class AssetProxyOwnerContract extends BaseContract {
isRegistered: boolean,
): string {
const self = this as any as AssetProxyOwnerContract;
- const inputAbi = self._lookupAbi('registerAssetProxy(address,bool)').inputs;
- [assetProxyContract,
- isRegistered
- ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxyContract,
- isRegistered
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('registerAssetProxy(address,bool)').functions.registerAssetProxy.encode([assetProxyContract,
+ const abiEncodedTransactionData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [assetProxyContract,
isRegistered
]);
return abiEncodedTransactionData;
@@ -653,18 +531,7 @@ export class AssetProxyOwnerContract extends BaseContract {
): Promise<void
> {
const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'registerAssetProxy(address,bool)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [assetProxyContract,
- isRegistered
- ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxyContract,
- isRegistered
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [assetProxyContract,
- isRegistered
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.registerAssetProxy;
- const encodedData = ethersFunction.encode([assetProxyContract,
+ const encodedData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [assetProxyContract,
isRegistered
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -677,11 +544,12 @@ export class AssetProxyOwnerContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'registerAssetProxy'}) 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('registerAssetProxy(address,bool)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<void
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public addOwner = {
@@ -690,13 +558,7 @@ export class AssetProxyOwnerContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as AssetProxyOwnerContract;
- const inputAbi = self._lookupAbi('addOwner(address)').inputs;
- [owner
- ] = BaseContract._formatABIDataItemList(inputAbi, [owner
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [owner
- ]);
- const encodedData = self._lookupEthersInterface('addOwner(address)').functions.addOwner.encode([owner
+ const encodedData = self._strictEncodeArguments('addOwner(address)', [owner
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -718,11 +580,7 @@ export class AssetProxyOwnerContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as AssetProxyOwnerContract;
- const inputAbi = self._lookupAbi('addOwner(address)').inputs;
- [owner
- ] = BaseContract._formatABIDataItemList(inputAbi, [owner
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('addOwner(address)').functions.addOwner.encode([owner
+ const encodedData = self._strictEncodeArguments('addOwner(address)', [owner
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -739,11 +597,7 @@ export class AssetProxyOwnerContract extends BaseContract {
owner: string,
): string {
const self = this as any as AssetProxyOwnerContract;
- const inputAbi = self._lookupAbi('addOwner(address)').inputs;
- [owner
- ] = BaseContract._formatABIDataItemList(inputAbi, [owner
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('addOwner(address)').functions.addOwner.encode([owner
+ const abiEncodedTransactionData = self._strictEncodeArguments('addOwner(address)', [owner
]);
return abiEncodedTransactionData;
},
@@ -754,15 +608,7 @@ export class AssetProxyOwnerContract extends BaseContract {
): Promise<void
> {
const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'addOwner(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.addOwner;
- const encodedData = ethersFunction.encode([owner
+ const encodedData = self._strictEncodeArguments('addOwner(address)', [owner
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -774,11 +620,12 @@ export class AssetProxyOwnerContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'addOwner'}) 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('addOwner(address)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<void
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public isConfirmed = {
@@ -789,15 +636,7 @@ export class AssetProxyOwnerContract extends BaseContract {
): Promise<boolean
> {
const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'isConfirmed(uint256)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [transactionId
- ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isConfirmed;
- const encodedData = ethersFunction.encode([transactionId
+ const encodedData = self._strictEncodeArguments('isConfirmed(uint256)', [transactionId
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -809,11 +648,12 @@ export class AssetProxyOwnerContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'isConfirmed'}) 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('isConfirmed(uint256)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<boolean
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public changeTimeLock = {
@@ -822,13 +662,7 @@ export class AssetProxyOwnerContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as AssetProxyOwnerContract;
- const inputAbi = self._lookupAbi('changeTimeLock(uint256)').inputs;
- [_secondsTimeLocked
- ] = BaseContract._formatABIDataItemList(inputAbi, [_secondsTimeLocked
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [_secondsTimeLocked
- ]);
- const encodedData = self._lookupEthersInterface('changeTimeLock(uint256)').functions.changeTimeLock.encode([_secondsTimeLocked
+ const encodedData = self._strictEncodeArguments('changeTimeLock(uint256)', [_secondsTimeLocked
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -850,11 +684,7 @@ export class AssetProxyOwnerContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as AssetProxyOwnerContract;
- const inputAbi = self._lookupAbi('changeTimeLock(uint256)').inputs;
- [_secondsTimeLocked
- ] = BaseContract._formatABIDataItemList(inputAbi, [_secondsTimeLocked
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('changeTimeLock(uint256)').functions.changeTimeLock.encode([_secondsTimeLocked
+ const encodedData = self._strictEncodeArguments('changeTimeLock(uint256)', [_secondsTimeLocked
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -871,11 +701,7 @@ export class AssetProxyOwnerContract extends BaseContract {
_secondsTimeLocked: BigNumber,
): string {
const self = this as any as AssetProxyOwnerContract;
- const inputAbi = self._lookupAbi('changeTimeLock(uint256)').inputs;
- [_secondsTimeLocked
- ] = BaseContract._formatABIDataItemList(inputAbi, [_secondsTimeLocked
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('changeTimeLock(uint256)').functions.changeTimeLock.encode([_secondsTimeLocked
+ const abiEncodedTransactionData = self._strictEncodeArguments('changeTimeLock(uint256)', [_secondsTimeLocked
]);
return abiEncodedTransactionData;
},
@@ -886,15 +712,7 @@ export class AssetProxyOwnerContract extends BaseContract {
): Promise<void
> {
const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'changeTimeLock(uint256)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [_secondsTimeLocked
- ] = BaseContract._formatABIDataItemList(inputAbi, [_secondsTimeLocked
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [_secondsTimeLocked
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.changeTimeLock;
- const encodedData = ethersFunction.encode([_secondsTimeLocked
+ const encodedData = self._strictEncodeArguments('changeTimeLock(uint256)', [_secondsTimeLocked
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -906,11 +724,12 @@ export class AssetProxyOwnerContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'changeTimeLock'}) 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('changeTimeLock(uint256)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<void
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public isAssetProxyRegistered = {
@@ -921,15 +740,7 @@ export class AssetProxyOwnerContract extends BaseContract {
): Promise<boolean
> {
const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'isAssetProxyRegistered(address)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [index_0
- ] = BaseContract._formatABIDataItemList(inputAbi, [index_0
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isAssetProxyRegistered;
- const encodedData = ethersFunction.encode([index_0
+ const encodedData = self._strictEncodeArguments('isAssetProxyRegistered(address)', [index_0
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -941,11 +752,12 @@ export class AssetProxyOwnerContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'isAssetProxyRegistered'}) 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('isAssetProxyRegistered(address)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<boolean
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public getConfirmationCount = {
@@ -956,15 +768,7 @@ export class AssetProxyOwnerContract extends BaseContract {
): Promise<BigNumber
> {
const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'getConfirmationCount(uint256)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [transactionId
- ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getConfirmationCount;
- const encodedData = ethersFunction.encode([transactionId
+ const encodedData = self._strictEncodeArguments('getConfirmationCount(uint256)', [transactionId
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -976,11 +780,12 @@ export class AssetProxyOwnerContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'getConfirmationCount'}) 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('getConfirmationCount(uint256)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<BigNumber
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public transactions = {
@@ -991,15 +796,7 @@ export class AssetProxyOwnerContract extends BaseContract {
): Promise<[string, BigNumber, string, boolean]
> {
const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'transactions(uint256)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [index_0
- ] = BaseContract._formatABIDataItemList(inputAbi, [index_0
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transactions;
- const encodedData = ethersFunction.encode([index_0
+ const encodedData = self._strictEncodeArguments('transactions(uint256)', [index_0
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -1011,11 +808,12 @@ export class AssetProxyOwnerContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'transactions'}) 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('transactions(uint256)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<[string, BigNumber, string, boolean]
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public getOwners = {
@@ -1025,12 +823,7 @@ export class AssetProxyOwnerContract extends BaseContract {
): Promise<string[]
> {
const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'getOwners()';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, []);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getOwners;
- const encodedData = ethersFunction.encode([]);
+ const encodedData = self._strictEncodeArguments('getOwners()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
@@ -1041,11 +834,12 @@ export class AssetProxyOwnerContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'getOwners'}) 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('getOwners()');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<string[]
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public getTransactionIds = {
@@ -1059,24 +853,7 @@ export class AssetProxyOwnerContract extends BaseContract {
): Promise<BigNumber[]
> {
const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'getTransactionIds(uint256,uint256,bool,bool)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [from,
- to,
- pending,
- executed
- ] = BaseContract._formatABIDataItemList(inputAbi, [from,
- to,
- pending,
- executed
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [from,
- to,
- pending,
- executed
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getTransactionIds;
- const encodedData = ethersFunction.encode([from,
+ const encodedData = self._strictEncodeArguments('getTransactionIds(uint256,uint256,bool,bool)', [from,
to,
pending,
executed
@@ -1091,11 +868,12 @@ export class AssetProxyOwnerContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'getTransactionIds'}) 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('getTransactionIds(uint256,uint256,bool,bool)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<BigNumber[]
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public getConfirmations = {
@@ -1106,15 +884,7 @@ export class AssetProxyOwnerContract extends BaseContract {
): Promise<string[]
> {
const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'getConfirmations(uint256)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [transactionId
- ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getConfirmations;
- const encodedData = ethersFunction.encode([transactionId
+ const encodedData = self._strictEncodeArguments('getConfirmations(uint256)', [transactionId
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -1126,11 +896,12 @@ export class AssetProxyOwnerContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'getConfirmations'}) 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('getConfirmations(uint256)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<string[]
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public transactionCount = {
@@ -1140,12 +911,7 @@ export class AssetProxyOwnerContract extends BaseContract {
): Promise<BigNumber
> {
const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'transactionCount()';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, []);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transactionCount;
- const encodedData = ethersFunction.encode([]);
+ const encodedData = self._strictEncodeArguments('transactionCount()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
@@ -1156,11 +922,12 @@ export class AssetProxyOwnerContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'transactionCount'}) 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('transactionCount()');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<BigNumber
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public changeRequirement = {
@@ -1169,13 +936,7 @@ export class AssetProxyOwnerContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as AssetProxyOwnerContract;
- const inputAbi = self._lookupAbi('changeRequirement(uint256)').inputs;
- [_required
- ] = BaseContract._formatABIDataItemList(inputAbi, [_required
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [_required
- ]);
- const encodedData = self._lookupEthersInterface('changeRequirement(uint256)').functions.changeRequirement.encode([_required
+ const encodedData = self._strictEncodeArguments('changeRequirement(uint256)', [_required
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -1197,11 +958,7 @@ export class AssetProxyOwnerContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as AssetProxyOwnerContract;
- const inputAbi = self._lookupAbi('changeRequirement(uint256)').inputs;
- [_required
- ] = BaseContract._formatABIDataItemList(inputAbi, [_required
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('changeRequirement(uint256)').functions.changeRequirement.encode([_required
+ const encodedData = self._strictEncodeArguments('changeRequirement(uint256)', [_required
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -1218,11 +975,7 @@ export class AssetProxyOwnerContract extends BaseContract {
_required: BigNumber,
): string {
const self = this as any as AssetProxyOwnerContract;
- const inputAbi = self._lookupAbi('changeRequirement(uint256)').inputs;
- [_required
- ] = BaseContract._formatABIDataItemList(inputAbi, [_required
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('changeRequirement(uint256)').functions.changeRequirement.encode([_required
+ const abiEncodedTransactionData = self._strictEncodeArguments('changeRequirement(uint256)', [_required
]);
return abiEncodedTransactionData;
},
@@ -1233,15 +986,7 @@ export class AssetProxyOwnerContract extends BaseContract {
): Promise<void
> {
const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'changeRequirement(uint256)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [_required
- ] = BaseContract._formatABIDataItemList(inputAbi, [_required
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [_required
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.changeRequirement;
- const encodedData = ethersFunction.encode([_required
+ const encodedData = self._strictEncodeArguments('changeRequirement(uint256)', [_required
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -1253,11 +998,12 @@ export class AssetProxyOwnerContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'changeRequirement'}) 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('changeRequirement(uint256)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<void
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public confirmTransaction = {
@@ -1266,13 +1012,7 @@ export class AssetProxyOwnerContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as AssetProxyOwnerContract;
- const inputAbi = self._lookupAbi('confirmTransaction(uint256)').inputs;
- [transactionId
- ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId
- ]);
- const encodedData = self._lookupEthersInterface('confirmTransaction(uint256)').functions.confirmTransaction.encode([transactionId
+ const encodedData = self._strictEncodeArguments('confirmTransaction(uint256)', [transactionId
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -1294,11 +1034,7 @@ export class AssetProxyOwnerContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as AssetProxyOwnerContract;
- const inputAbi = self._lookupAbi('confirmTransaction(uint256)').inputs;
- [transactionId
- ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('confirmTransaction(uint256)').functions.confirmTransaction.encode([transactionId
+ const encodedData = self._strictEncodeArguments('confirmTransaction(uint256)', [transactionId
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -1315,11 +1051,7 @@ export class AssetProxyOwnerContract extends BaseContract {
transactionId: BigNumber,
): string {
const self = this as any as AssetProxyOwnerContract;
- const inputAbi = self._lookupAbi('confirmTransaction(uint256)').inputs;
- [transactionId
- ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('confirmTransaction(uint256)').functions.confirmTransaction.encode([transactionId
+ const abiEncodedTransactionData = self._strictEncodeArguments('confirmTransaction(uint256)', [transactionId
]);
return abiEncodedTransactionData;
},
@@ -1330,15 +1062,7 @@ export class AssetProxyOwnerContract extends BaseContract {
): Promise<void
> {
const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'confirmTransaction(uint256)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [transactionId
- ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.confirmTransaction;
- const encodedData = ethersFunction.encode([transactionId
+ const encodedData = self._strictEncodeArguments('confirmTransaction(uint256)', [transactionId
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -1350,11 +1074,12 @@ export class AssetProxyOwnerContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'confirmTransaction'}) 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('confirmTransaction(uint256)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<void
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public submitTransaction = {
@@ -1365,19 +1090,7 @@ export class AssetProxyOwnerContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as AssetProxyOwnerContract;
- const inputAbi = self._lookupAbi('submitTransaction(address,uint256,bytes)').inputs;
- [destination,
- value,
- data
- ] = BaseContract._formatABIDataItemList(inputAbi, [destination,
- value,
- data
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [destination,
- value,
- data
- ]);
- const encodedData = self._lookupEthersInterface('submitTransaction(address,uint256,bytes)').functions.submitTransaction.encode([destination,
+ const encodedData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [destination,
value,
data
]);
@@ -1405,15 +1118,7 @@ export class AssetProxyOwnerContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as AssetProxyOwnerContract;
- const inputAbi = self._lookupAbi('submitTransaction(address,uint256,bytes)').inputs;
- [destination,
- value,
- data
- ] = BaseContract._formatABIDataItemList(inputAbi, [destination,
- value,
- data
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('submitTransaction(address,uint256,bytes)').functions.submitTransaction.encode([destination,
+ const encodedData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [destination,
value,
data
]);
@@ -1434,15 +1139,7 @@ export class AssetProxyOwnerContract extends BaseContract {
data: string,
): string {
const self = this as any as AssetProxyOwnerContract;
- const inputAbi = self._lookupAbi('submitTransaction(address,uint256,bytes)').inputs;
- [destination,
- value,
- data
- ] = BaseContract._formatABIDataItemList(inputAbi, [destination,
- value,
- data
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('submitTransaction(address,uint256,bytes)').functions.submitTransaction.encode([destination,
+ const abiEncodedTransactionData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [destination,
value,
data
]);
@@ -1457,21 +1154,7 @@ export class AssetProxyOwnerContract extends BaseContract {
): Promise<BigNumber
> {
const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'submitTransaction(address,uint256,bytes)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [destination,
- value,
- data
- ] = BaseContract._formatABIDataItemList(inputAbi, [destination,
- value,
- data
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [destination,
- value,
- data
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.submitTransaction;
- const encodedData = ethersFunction.encode([destination,
+ const encodedData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [destination,
value,
data
]);
@@ -1485,11 +1168,12 @@ export class AssetProxyOwnerContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'submitTransaction'}) 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('submitTransaction(address,uint256,bytes)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<BigNumber
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public confirmationTimes = {
@@ -1500,15 +1184,7 @@ export class AssetProxyOwnerContract extends BaseContract {
): Promise<BigNumber
> {
const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'confirmationTimes(uint256)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [index_0
- ] = BaseContract._formatABIDataItemList(inputAbi, [index_0
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.confirmationTimes;
- const encodedData = ethersFunction.encode([index_0
+ const encodedData = self._strictEncodeArguments('confirmationTimes(uint256)', [index_0
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -1520,11 +1196,12 @@ export class AssetProxyOwnerContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'confirmationTimes'}) 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('confirmationTimes(uint256)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<BigNumber
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public MAX_OWNER_COUNT = {
@@ -1534,12 +1211,7 @@ export class AssetProxyOwnerContract extends BaseContract {
): Promise<BigNumber
> {
const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'MAX_OWNER_COUNT()';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, []);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.MAX_OWNER_COUNT;
- const encodedData = ethersFunction.encode([]);
+ const encodedData = self._strictEncodeArguments('MAX_OWNER_COUNT()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
@@ -1550,11 +1222,12 @@ export class AssetProxyOwnerContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'MAX_OWNER_COUNT'}) 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('MAX_OWNER_COUNT()');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<BigNumber
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public required = {
@@ -1564,12 +1237,7 @@ export class AssetProxyOwnerContract extends BaseContract {
): Promise<BigNumber
> {
const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'required()';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, []);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.required;
- const encodedData = ethersFunction.encode([]);
+ const encodedData = self._strictEncodeArguments('required()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
@@ -1580,11 +1248,12 @@ export class AssetProxyOwnerContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'required'}) 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('required()');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<BigNumber
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public replaceOwner = {
@@ -1594,16 +1263,7 @@ export class AssetProxyOwnerContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as AssetProxyOwnerContract;
- const inputAbi = self._lookupAbi('replaceOwner(address,address)').inputs;
- [owner,
- newOwner
- ] = BaseContract._formatABIDataItemList(inputAbi, [owner,
- newOwner
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [owner,
- newOwner
- ]);
- const encodedData = self._lookupEthersInterface('replaceOwner(address,address)').functions.replaceOwner.encode([owner,
+ const encodedData = self._strictEncodeArguments('replaceOwner(address,address)', [owner,
newOwner
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -1628,13 +1288,7 @@ export class AssetProxyOwnerContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as AssetProxyOwnerContract;
- const inputAbi = self._lookupAbi('replaceOwner(address,address)').inputs;
- [owner,
- newOwner
- ] = BaseContract._formatABIDataItemList(inputAbi, [owner,
- newOwner
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('replaceOwner(address,address)').functions.replaceOwner.encode([owner,
+ const encodedData = self._strictEncodeArguments('replaceOwner(address,address)', [owner,
newOwner
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -1653,13 +1307,7 @@ export class AssetProxyOwnerContract extends BaseContract {
newOwner: string,
): string {
const self = this as any as AssetProxyOwnerContract;
- const inputAbi = self._lookupAbi('replaceOwner(address,address)').inputs;
- [owner,
- newOwner
- ] = BaseContract._formatABIDataItemList(inputAbi, [owner,
- newOwner
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('replaceOwner(address,address)').functions.replaceOwner.encode([owner,
+ const abiEncodedTransactionData = self._strictEncodeArguments('replaceOwner(address,address)', [owner,
newOwner
]);
return abiEncodedTransactionData;
@@ -1672,18 +1320,7 @@ export class AssetProxyOwnerContract extends BaseContract {
): Promise<void
> {
const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'replaceOwner(address,address)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [owner,
- newOwner
- ] = BaseContract._formatABIDataItemList(inputAbi, [owner,
- newOwner
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [owner,
- newOwner
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.replaceOwner;
- const encodedData = ethersFunction.encode([owner,
+ const encodedData = self._strictEncodeArguments('replaceOwner(address,address)', [owner,
newOwner
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -1696,11 +1333,12 @@ export class AssetProxyOwnerContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'replaceOwner'}) 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('replaceOwner(address,address)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<void
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public executeTransaction = {
@@ -1709,13 +1347,7 @@ export class AssetProxyOwnerContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as AssetProxyOwnerContract;
- const inputAbi = self._lookupAbi('executeTransaction(uint256)').inputs;
- [transactionId
- ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId
- ]);
- const encodedData = self._lookupEthersInterface('executeTransaction(uint256)').functions.executeTransaction.encode([transactionId
+ const encodedData = self._strictEncodeArguments('executeTransaction(uint256)', [transactionId
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -1737,11 +1369,7 @@ export class AssetProxyOwnerContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as AssetProxyOwnerContract;
- const inputAbi = self._lookupAbi('executeTransaction(uint256)').inputs;
- [transactionId
- ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('executeTransaction(uint256)').functions.executeTransaction.encode([transactionId
+ const encodedData = self._strictEncodeArguments('executeTransaction(uint256)', [transactionId
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -1758,11 +1386,7 @@ export class AssetProxyOwnerContract extends BaseContract {
transactionId: BigNumber,
): string {
const self = this as any as AssetProxyOwnerContract;
- const inputAbi = self._lookupAbi('executeTransaction(uint256)').inputs;
- [transactionId
- ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('executeTransaction(uint256)').functions.executeTransaction.encode([transactionId
+ const abiEncodedTransactionData = self._strictEncodeArguments('executeTransaction(uint256)', [transactionId
]);
return abiEncodedTransactionData;
},
@@ -1773,15 +1397,7 @@ export class AssetProxyOwnerContract extends BaseContract {
): Promise<void
> {
const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'executeTransaction(uint256)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [transactionId
- ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.executeTransaction;
- const encodedData = ethersFunction.encode([transactionId
+ const encodedData = self._strictEncodeArguments('executeTransaction(uint256)', [transactionId
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -1793,11 +1409,12 @@ export class AssetProxyOwnerContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'executeTransaction'}) 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('executeTransaction(uint256)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<void
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public static async deployFrom0xArtifactAsync(
@@ -1871,7 +1488,7 @@ _secondsTimeLocked
}
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
super('AssetProxyOwner', 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-wrappers/src/generated-wrappers/dummy_erc20_token.ts b/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc20_token.ts
index 3995c6d87..cab09c4d2 100644
--- a/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc20_token.ts
+++ b/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc20_token.ts
@@ -43,12 +43,7 @@ export class DummyERC20TokenContract extends BaseContract {
): Promise<string
> {
const self = this as any as DummyERC20TokenContract;
- 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 encodedData = self._strictEncodeArguments('name()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
@@ -59,11 +54,12 @@ export class DummyERC20TokenContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- 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));
- return resultArray[0];
+ const abiEncoder = self._lookupAbiEncoder('name()');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<string
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public approve = {
@@ -73,16 +69,7 @@ export class DummyERC20TokenContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as DummyERC20TokenContract;
- const inputAbi = self._lookupAbi('approve(address,uint256)').inputs;
- [_spender,
- _value
- ] = BaseContract._formatABIDataItemList(inputAbi, [_spender,
- _value
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [_spender,
- _value
- ]);
- const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender,
+ const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender,
_value
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -107,13 +94,7 @@ export class DummyERC20TokenContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as DummyERC20TokenContract;
- 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 encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender,
_value
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -132,13 +113,7 @@ export class DummyERC20TokenContract extends BaseContract {
_value: BigNumber,
): string {
const self = this as any as DummyERC20TokenContract;
- 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 abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_spender,
_value
]);
return abiEncodedTransactionData;
@@ -151,18 +126,7 @@ export class DummyERC20TokenContract extends BaseContract {
): Promise<boolean
> {
const self = this as any as DummyERC20TokenContract;
- const functionSignature = 'approve(address,uint256)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [_spender,
- _value
- ] = 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 encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender,
_value
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -175,11 +139,12 @@ export class DummyERC20TokenContract 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[0];
+ const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<boolean
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public totalSupply = {
@@ -189,12 +154,7 @@ export class DummyERC20TokenContract extends BaseContract {
): Promise<BigNumber
> {
const self = this as any as DummyERC20TokenContract;
- 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 encodedData = self._strictEncodeArguments('totalSupply()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
@@ -205,11 +165,12 @@ export class DummyERC20TokenContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- 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));
- return resultArray[0];
+ const abiEncoder = self._lookupAbiEncoder('totalSupply()');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<BigNumber
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public transferFrom = {
@@ -220,19 +181,7 @@ export class DummyERC20TokenContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as DummyERC20TokenContract;
- const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs;
- [_from,
- _to,
- _value
- ] = BaseContract._formatABIDataItemList(inputAbi, [_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,
+ const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from,
_to,
_value
]);
@@ -260,15 +209,7 @@ export class DummyERC20TokenContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as DummyERC20TokenContract;
- 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 encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from,
_to,
_value
]);
@@ -289,15 +230,7 @@ export class DummyERC20TokenContract extends BaseContract {
_value: BigNumber,
): string {
const self = this as any as DummyERC20TokenContract;
- 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 abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from,
_to,
_value
]);
@@ -312,21 +245,7 @@ export class DummyERC20TokenContract extends BaseContract {
): Promise<boolean
> {
const self = this as any as DummyERC20TokenContract;
- const functionSignature = 'transferFrom(address,address,uint256)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [_from,
- _to,
- _value
- ] = BaseContract._formatABIDataItemList(inputAbi, [_from,
- _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 encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from,
_to,
_value
]);
@@ -340,11 +259,12 @@ export class DummyERC20TokenContract 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[0];
+ const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<boolean
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public decimals = {
@@ -354,12 +274,7 @@ export class DummyERC20TokenContract extends BaseContract {
): Promise<BigNumber
> {
const self = this as any as DummyERC20TokenContract;
- 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 encodedData = self._strictEncodeArguments('decimals()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
@@ -370,11 +285,12 @@ export class DummyERC20TokenContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- 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));
- return resultArray[0];
+ const abiEncoder = self._lookupAbiEncoder('decimals()');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<BigNumber
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public balanceOf = {
@@ -385,15 +301,7 @@ export class DummyERC20TokenContract extends BaseContract {
): Promise<BigNumber
> {
const self = this as any as DummyERC20TokenContract;
- 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(
{
@@ -405,11 +313,12 @@ export class DummyERC20TokenContract 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 owner = {
@@ -419,12 +328,7 @@ export class DummyERC20TokenContract extends BaseContract {
): Promise<string
> {
const self = this as any as DummyERC20TokenContract;
- const functionSignature = 'owner()';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, []);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.owner;
- const encodedData = ethersFunction.encode([]);
+ const encodedData = self._strictEncodeArguments('owner()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
@@ -435,11 +339,12 @@ export class DummyERC20TokenContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'owner'}) 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('owner()');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<string
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public symbol = {
@@ -449,12 +354,7 @@ export class DummyERC20TokenContract extends BaseContract {
): Promise<string
> {
const self = this as any as DummyERC20TokenContract;
- 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 encodedData = self._strictEncodeArguments('symbol()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
@@ -465,11 +365,12 @@ export class DummyERC20TokenContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- 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));
- return resultArray[0];
+ const abiEncoder = self._lookupAbiEncoder('symbol()');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<string
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public mint = {
@@ -478,13 +379,7 @@ export class DummyERC20TokenContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as DummyERC20TokenContract;
- const inputAbi = self._lookupAbi('mint(uint256)').inputs;
- [_value
- ] = BaseContract._formatABIDataItemList(inputAbi, [_value
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [_value
- ]);
- const encodedData = self._lookupEthersInterface('mint(uint256)').functions.mint.encode([_value
+ const encodedData = self._strictEncodeArguments('mint(uint256)', [_value
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -506,11 +401,7 @@ export class DummyERC20TokenContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as DummyERC20TokenContract;
- const inputAbi = self._lookupAbi('mint(uint256)').inputs;
- [_value
- ] = BaseContract._formatABIDataItemList(inputAbi, [_value
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('mint(uint256)').functions.mint.encode([_value
+ const encodedData = self._strictEncodeArguments('mint(uint256)', [_value
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -527,11 +418,7 @@ export class DummyERC20TokenContract extends BaseContract {
_value: BigNumber,
): string {
const self = this as any as DummyERC20TokenContract;
- const inputAbi = self._lookupAbi('mint(uint256)').inputs;
- [_value
- ] = BaseContract._formatABIDataItemList(inputAbi, [_value
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('mint(uint256)').functions.mint.encode([_value
+ const abiEncodedTransactionData = self._strictEncodeArguments('mint(uint256)', [_value
]);
return abiEncodedTransactionData;
},
@@ -542,15 +429,7 @@ export class DummyERC20TokenContract extends BaseContract {
): Promise<void
> {
const self = this as any as DummyERC20TokenContract;
- const functionSignature = 'mint(uint256)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [_value
- ] = BaseContract._formatABIDataItemList(inputAbi, [_value
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [_value
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.mint;
- const encodedData = ethersFunction.encode([_value
+ const encodedData = self._strictEncodeArguments('mint(uint256)', [_value
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -562,11 +441,12 @@ export class DummyERC20TokenContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'mint'}) 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('mint(uint256)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<void
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public transfer = {
@@ -576,16 +456,7 @@ export class DummyERC20TokenContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as DummyERC20TokenContract;
- const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs;
- [_to,
- _value
- ] = BaseContract._formatABIDataItemList(inputAbi, [_to,
- _value
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [_to,
- _value
- ]);
- const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to,
+ const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to,
_value
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -610,13 +481,7 @@ export class DummyERC20TokenContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as DummyERC20TokenContract;
- 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 encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to,
_value
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -635,13 +500,7 @@ export class DummyERC20TokenContract extends BaseContract {
_value: BigNumber,
): string {
const self = this as any as DummyERC20TokenContract;
- 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 abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [_to,
_value
]);
return abiEncodedTransactionData;
@@ -654,18 +513,7 @@ export class DummyERC20TokenContract extends BaseContract {
): Promise<boolean
> {
const self = this as any as DummyERC20TokenContract;
- const functionSignature = 'transfer(address,uint256)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [_to,
- _value
- ] = 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 encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to,
_value
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -678,11 +526,12 @@ export class DummyERC20TokenContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- 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));
- return resultArray[0];
+ const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<boolean
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public allowance = {
@@ -694,18 +543,7 @@ export class DummyERC20TokenContract extends BaseContract {
): Promise<BigNumber
> {
const self = this as any as DummyERC20TokenContract;
- const functionSignature = 'allowance(address,address)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [_owner,
- _spender
- ] = 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 encodedData = self._strictEncodeArguments('allowance(address,address)', [_owner,
_spender
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -718,11 +556,12 @@ export class DummyERC20TokenContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- 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));
- return resultArray[0];
+ const abiEncoder = self._lookupAbiEncoder('allowance(address,address)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<BigNumber
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public setBalance = {
@@ -732,16 +571,7 @@ export class DummyERC20TokenContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as DummyERC20TokenContract;
- const inputAbi = self._lookupAbi('setBalance(address,uint256)').inputs;
- [_target,
- _value
- ] = BaseContract._formatABIDataItemList(inputAbi, [_target,
- _value
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [_target,
- _value
- ]);
- const encodedData = self._lookupEthersInterface('setBalance(address,uint256)').functions.setBalance.encode([_target,
+ const encodedData = self._strictEncodeArguments('setBalance(address,uint256)', [_target,
_value
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -766,13 +596,7 @@ export class DummyERC20TokenContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as DummyERC20TokenContract;
- const inputAbi = self._lookupAbi('setBalance(address,uint256)').inputs;
- [_target,
- _value
- ] = BaseContract._formatABIDataItemList(inputAbi, [_target,
- _value
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('setBalance(address,uint256)').functions.setBalance.encode([_target,
+ const encodedData = self._strictEncodeArguments('setBalance(address,uint256)', [_target,
_value
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -791,13 +615,7 @@ export class DummyERC20TokenContract extends BaseContract {
_value: BigNumber,
): string {
const self = this as any as DummyERC20TokenContract;
- const inputAbi = self._lookupAbi('setBalance(address,uint256)').inputs;
- [_target,
- _value
- ] = BaseContract._formatABIDataItemList(inputAbi, [_target,
- _value
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('setBalance(address,uint256)').functions.setBalance.encode([_target,
+ const abiEncodedTransactionData = self._strictEncodeArguments('setBalance(address,uint256)', [_target,
_value
]);
return abiEncodedTransactionData;
@@ -810,18 +628,7 @@ export class DummyERC20TokenContract extends BaseContract {
): Promise<void
> {
const self = this as any as DummyERC20TokenContract;
- const functionSignature = 'setBalance(address,uint256)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [_target,
- _value
- ] = BaseContract._formatABIDataItemList(inputAbi, [_target,
- _value
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [_target,
- _value
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.setBalance;
- const encodedData = ethersFunction.encode([_target,
+ const encodedData = self._strictEncodeArguments('setBalance(address,uint256)', [_target,
_value
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -834,11 +641,12 @@ export class DummyERC20TokenContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'setBalance'}) 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('setBalance(address,uint256)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<void
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public transferOwnership = {
@@ -847,13 +655,7 @@ export class DummyERC20TokenContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as DummyERC20TokenContract;
- const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
- [newOwner
- ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner
- ]);
- const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
+ const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -875,11 +677,7 @@ export class DummyERC20TokenContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as DummyERC20TokenContract;
- const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
- [newOwner
- ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
+ const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -896,11 +694,7 @@ export class DummyERC20TokenContract extends BaseContract {
newOwner: string,
): string {
const self = this as any as DummyERC20TokenContract;
- const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
- [newOwner
- ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
+ const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
]);
return abiEncodedTransactionData;
},
@@ -911,15 +705,7 @@ export class DummyERC20TokenContract extends BaseContract {
): Promise<void
> {
const self = this as any as DummyERC20TokenContract;
- const functionSignature = 'transferOwnership(address)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [newOwner
- ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferOwnership;
- const encodedData = ethersFunction.encode([newOwner
+ const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -931,11 +717,12 @@ export class DummyERC20TokenContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'transferOwnership'}) 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('transferOwnership(address)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<void
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public MAX_MINT_AMOUNT = {
@@ -945,12 +732,7 @@ export class DummyERC20TokenContract extends BaseContract {
): Promise<BigNumber
> {
const self = this as any as DummyERC20TokenContract;
- const functionSignature = 'MAX_MINT_AMOUNT()';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, []);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.MAX_MINT_AMOUNT;
- const encodedData = ethersFunction.encode([]);
+ const encodedData = self._strictEncodeArguments('MAX_MINT_AMOUNT()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
@@ -961,11 +743,12 @@ export class DummyERC20TokenContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'MAX_MINT_AMOUNT'}) 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('MAX_MINT_AMOUNT()');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<BigNumber
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public static async deployFrom0xArtifactAsync(
@@ -1039,7 +822,7 @@ _totalSupply
}
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
super('DummyERC20Token', 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-wrappers/src/generated-wrappers/dummy_erc721_token.ts b/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc721_token.ts
index a7af2d158..9cb54442b 100644
--- a/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc721_token.ts
+++ b/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc721_token.ts
@@ -51,12 +51,7 @@ export class DummyERC721TokenContract extends BaseContract {
): Promise<string
> {
const self = this as any as DummyERC721TokenContract;
- 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 encodedData = self._strictEncodeArguments('name()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
@@ -67,11 +62,12 @@ export class DummyERC721TokenContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- 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));
- return resultArray[0];
+ const abiEncoder = self._lookupAbiEncoder('name()');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<string
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public getApproved = {
@@ -82,15 +78,7 @@ export class DummyERC721TokenContract extends BaseContract {
): Promise<string
> {
const self = this as any as DummyERC721TokenContract;
- 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(
{
@@ -102,11 +90,12 @@ export class DummyERC721TokenContract 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 = {
@@ -116,16 +105,7 @@ export class DummyERC721TokenContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as DummyERC721TokenContract;
- 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(
@@ -150,13 +130,7 @@ export class DummyERC721TokenContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as DummyERC721TokenContract;
- 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(
@@ -175,13 +149,7 @@ export class DummyERC721TokenContract extends BaseContract {
_tokenId: BigNumber,
): string {
const self = this as any as DummyERC721TokenContract;
- 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;
@@ -194,18 +162,7 @@ export class DummyERC721TokenContract extends BaseContract {
): Promise<void
> {
const self = this as any as DummyERC721TokenContract;
- 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(
@@ -218,11 +175,12 @@ export class DummyERC721TokenContract 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 = {
@@ -233,19 +191,7 @@ export class DummyERC721TokenContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as DummyERC721TokenContract;
- 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
]);
@@ -273,15 +219,7 @@ export class DummyERC721TokenContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as DummyERC721TokenContract;
- 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
]);
@@ -302,15 +240,7 @@ export class DummyERC721TokenContract extends BaseContract {
_tokenId: BigNumber,
): string {
const self = this as any as DummyERC721TokenContract;
- 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
]);
@@ -325,21 +255,7 @@ export class DummyERC721TokenContract extends BaseContract {
): Promise<void
> {
const self = this as any as DummyERC721TokenContract;
- 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
]);
@@ -353,11 +269,12 @@ export class DummyERC721TokenContract 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 mint = {
@@ -367,16 +284,7 @@ export class DummyERC721TokenContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as DummyERC721TokenContract;
- const inputAbi = self._lookupAbi('mint(address,uint256)').inputs;
- [_to,
- _tokenId
- ] = BaseContract._formatABIDataItemList(inputAbi, [_to,
- _tokenId
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [_to,
- _tokenId
- ]);
- const encodedData = self._lookupEthersInterface('mint(address,uint256)').functions.mint.encode([_to,
+ const encodedData = self._strictEncodeArguments('mint(address,uint256)', [_to,
_tokenId
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -401,13 +309,7 @@ export class DummyERC721TokenContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as DummyERC721TokenContract;
- const inputAbi = self._lookupAbi('mint(address,uint256)').inputs;
- [_to,
- _tokenId
- ] = BaseContract._formatABIDataItemList(inputAbi, [_to,
- _tokenId
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('mint(address,uint256)').functions.mint.encode([_to,
+ const encodedData = self._strictEncodeArguments('mint(address,uint256)', [_to,
_tokenId
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -426,13 +328,7 @@ export class DummyERC721TokenContract extends BaseContract {
_tokenId: BigNumber,
): string {
const self = this as any as DummyERC721TokenContract;
- const inputAbi = self._lookupAbi('mint(address,uint256)').inputs;
- [_to,
- _tokenId
- ] = BaseContract._formatABIDataItemList(inputAbi, [_to,
- _tokenId
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('mint(address,uint256)').functions.mint.encode([_to,
+ const abiEncodedTransactionData = self._strictEncodeArguments('mint(address,uint256)', [_to,
_tokenId
]);
return abiEncodedTransactionData;
@@ -445,18 +341,7 @@ export class DummyERC721TokenContract extends BaseContract {
): Promise<void
> {
const self = this as any as DummyERC721TokenContract;
- const functionSignature = 'mint(address,uint256)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [_to,
- _tokenId
- ] = BaseContract._formatABIDataItemList(inputAbi, [_to,
- _tokenId
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [_to,
- _tokenId
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.mint;
- const encodedData = ethersFunction.encode([_to,
+ const encodedData = self._strictEncodeArguments('mint(address,uint256)', [_to,
_tokenId
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -469,11 +354,12 @@ export class DummyERC721TokenContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'mint'}) 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('mint(address,uint256)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<void
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public safeTransferFrom1 = {
@@ -484,19 +370,7 @@ export class DummyERC721TokenContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as DummyERC721TokenContract;
- 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
]);
@@ -524,15 +398,7 @@ export class DummyERC721TokenContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as DummyERC721TokenContract;
- 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
]);
@@ -553,15 +419,7 @@ export class DummyERC721TokenContract extends BaseContract {
_tokenId: BigNumber,
): string {
const self = this as any as DummyERC721TokenContract;
- 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
]);
@@ -576,21 +434,7 @@ export class DummyERC721TokenContract extends BaseContract {
): Promise<void
> {
const self = this as any as DummyERC721TokenContract;
- 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
]);
@@ -604,11 +448,12 @@ export class DummyERC721TokenContract 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 = {
@@ -619,15 +464,7 @@ export class DummyERC721TokenContract extends BaseContract {
): Promise<string
> {
const self = this as any as DummyERC721TokenContract;
- 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(
{
@@ -639,11 +476,12 @@ export class DummyERC721TokenContract 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 = {
@@ -654,15 +492,7 @@ export class DummyERC721TokenContract extends BaseContract {
): Promise<BigNumber
> {
const self = this as any as DummyERC721TokenContract;
- 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(
{
@@ -674,11 +504,12 @@ export class DummyERC721TokenContract 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 owner = {
@@ -688,12 +519,7 @@ export class DummyERC721TokenContract extends BaseContract {
): Promise<string
> {
const self = this as any as DummyERC721TokenContract;
- const functionSignature = 'owner()';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, []);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.owner;
- const encodedData = ethersFunction.encode([]);
+ const encodedData = self._strictEncodeArguments('owner()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
@@ -704,11 +530,12 @@ export class DummyERC721TokenContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'owner'}) 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('owner()');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<string
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public symbol = {
@@ -718,12 +545,7 @@ export class DummyERC721TokenContract extends BaseContract {
): Promise<string
> {
const self = this as any as DummyERC721TokenContract;
- 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 encodedData = self._strictEncodeArguments('symbol()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
@@ -734,11 +556,12 @@ export class DummyERC721TokenContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- 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));
- return resultArray[0];
+ const abiEncoder = self._lookupAbiEncoder('symbol()');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<string
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public burn = {
@@ -748,16 +571,7 @@ export class DummyERC721TokenContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as DummyERC721TokenContract;
- const inputAbi = self._lookupAbi('burn(address,uint256)').inputs;
- [_owner,
- _tokenId
- ] = BaseContract._formatABIDataItemList(inputAbi, [_owner,
- _tokenId
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner,
- _tokenId
- ]);
- const encodedData = self._lookupEthersInterface('burn(address,uint256)').functions.burn.encode([_owner,
+ const encodedData = self._strictEncodeArguments('burn(address,uint256)', [_owner,
_tokenId
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -782,13 +596,7 @@ export class DummyERC721TokenContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as DummyERC721TokenContract;
- const inputAbi = self._lookupAbi('burn(address,uint256)').inputs;
- [_owner,
- _tokenId
- ] = BaseContract._formatABIDataItemList(inputAbi, [_owner,
- _tokenId
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('burn(address,uint256)').functions.burn.encode([_owner,
+ const encodedData = self._strictEncodeArguments('burn(address,uint256)', [_owner,
_tokenId
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -807,13 +615,7 @@ export class DummyERC721TokenContract extends BaseContract {
_tokenId: BigNumber,
): string {
const self = this as any as DummyERC721TokenContract;
- const inputAbi = self._lookupAbi('burn(address,uint256)').inputs;
- [_owner,
- _tokenId
- ] = BaseContract._formatABIDataItemList(inputAbi, [_owner,
- _tokenId
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('burn(address,uint256)').functions.burn.encode([_owner,
+ const abiEncodedTransactionData = self._strictEncodeArguments('burn(address,uint256)', [_owner,
_tokenId
]);
return abiEncodedTransactionData;
@@ -826,18 +628,7 @@ export class DummyERC721TokenContract extends BaseContract {
): Promise<void
> {
const self = this as any as DummyERC721TokenContract;
- const functionSignature = 'burn(address,uint256)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [_owner,
- _tokenId
- ] = BaseContract._formatABIDataItemList(inputAbi, [_owner,
- _tokenId
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner,
- _tokenId
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.burn;
- const encodedData = ethersFunction.encode([_owner,
+ const encodedData = self._strictEncodeArguments('burn(address,uint256)', [_owner,
_tokenId
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -850,11 +641,12 @@ export class DummyERC721TokenContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'burn'}) 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('burn(address,uint256)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<void
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public setApprovalForAll = {
@@ -864,16 +656,7 @@ export class DummyERC721TokenContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as DummyERC721TokenContract;
- 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(
@@ -898,13 +681,7 @@ export class DummyERC721TokenContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as DummyERC721TokenContract;
- 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(
@@ -923,13 +700,7 @@ export class DummyERC721TokenContract extends BaseContract {
_approved: boolean,
): string {
const self = this as any as DummyERC721TokenContract;
- 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;
@@ -942,18 +713,7 @@ export class DummyERC721TokenContract extends BaseContract {
): Promise<void
> {
const self = this as any as DummyERC721TokenContract;
- 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(
@@ -966,11 +726,12 @@ export class DummyERC721TokenContract 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 = {
@@ -982,22 +743,7 @@ export class DummyERC721TokenContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as DummyERC721TokenContract;
- 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
@@ -1028,17 +774,7 @@ export class DummyERC721TokenContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as DummyERC721TokenContract;
- 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
@@ -1061,17 +797,7 @@ export class DummyERC721TokenContract extends BaseContract {
_data: string,
): string {
const self = this as any as DummyERC721TokenContract;
- 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
@@ -1088,24 +814,7 @@ export class DummyERC721TokenContract extends BaseContract {
): Promise<void
> {
const self = this as any as DummyERC721TokenContract;
- 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
@@ -1120,11 +829,12 @@ export class DummyERC721TokenContract 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 = {
@@ -1136,18 +846,7 @@ export class DummyERC721TokenContract extends BaseContract {
): Promise<boolean
> {
const self = this as any as DummyERC721TokenContract;
- 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(
@@ -1160,11 +859,12 @@ export class DummyERC721TokenContract 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 transferOwnership = {
@@ -1173,13 +873,7 @@ export class DummyERC721TokenContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as DummyERC721TokenContract;
- const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
- [newOwner
- ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner
- ]);
- const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
+ const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -1201,11 +895,7 @@ export class DummyERC721TokenContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as DummyERC721TokenContract;
- const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
- [newOwner
- ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
+ const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -1222,11 +912,7 @@ export class DummyERC721TokenContract extends BaseContract {
newOwner: string,
): string {
const self = this as any as DummyERC721TokenContract;
- const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
- [newOwner
- ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
+ const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
]);
return abiEncodedTransactionData;
},
@@ -1237,15 +923,7 @@ export class DummyERC721TokenContract extends BaseContract {
): Promise<void
> {
const self = this as any as DummyERC721TokenContract;
- const functionSignature = 'transferOwnership(address)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [newOwner
- ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferOwnership;
- const encodedData = ethersFunction.encode([newOwner
+ const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -1257,11 +935,12 @@ export class DummyERC721TokenContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'transferOwnership'}) 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('transferOwnership(address)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<void
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public static async deployFrom0xArtifactAsync(
@@ -1321,7 +1000,7 @@ _symbol
}
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
super('DummyERC721Token', 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-wrappers/src/generated-wrappers/dutch_auction.ts b/packages/abi-gen-wrappers/src/generated-wrappers/dutch_auction.ts
index 90e233756..9be95af65 100644
--- a/packages/abi-gen-wrappers/src/generated-wrappers/dutch_auction.ts
+++ b/packages/abi-gen-wrappers/src/generated-wrappers/dutch_auction.ts
@@ -21,13 +21,7 @@ export class DutchAuctionContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as DutchAuctionContract;
- const inputAbi = self._lookupAbi('getAuctionDetails({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').inputs;
- [order
- ] = BaseContract._formatABIDataItemList(inputAbi, [order
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [order
- ]);
- const encodedData = self._lookupEthersInterface('getAuctionDetails({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').functions.getAuctionDetails.encode([order
+ const encodedData = self._strictEncodeArguments('getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -49,11 +43,7 @@ export class DutchAuctionContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as DutchAuctionContract;
- const inputAbi = self._lookupAbi('getAuctionDetails({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').inputs;
- [order
- ] = BaseContract._formatABIDataItemList(inputAbi, [order
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('getAuctionDetails({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').functions.getAuctionDetails.encode([order
+ const encodedData = self._strictEncodeArguments('getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -70,11 +60,7 @@ export class DutchAuctionContract extends BaseContract {
order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
): string {
const self = this as any as DutchAuctionContract;
- const inputAbi = self._lookupAbi('getAuctionDetails({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').inputs;
- [order
- ] = BaseContract._formatABIDataItemList(inputAbi, [order
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('getAuctionDetails({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').functions.getAuctionDetails.encode([order
+ const abiEncodedTransactionData = self._strictEncodeArguments('getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order
]);
return abiEncodedTransactionData;
},
@@ -85,15 +71,7 @@ export class DutchAuctionContract extends BaseContract {
): Promise<{beginTimeSeconds: BigNumber;endTimeSeconds: BigNumber;beginAmount: BigNumber;endAmount: BigNumber;currentAmount: BigNumber;currentTimeSeconds: BigNumber}
> {
const self = this as any as DutchAuctionContract;
- const functionSignature = 'getAuctionDetails({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [order
- ] = BaseContract._formatABIDataItemList(inputAbi, [order
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [order
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getAuctionDetails;
- const encodedData = ethersFunction.encode([order
+ const encodedData = self._strictEncodeArguments('getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -105,11 +83,12 @@ export class DutchAuctionContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'getAuctionDetails'}) 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('getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<{beginTimeSeconds: BigNumber;endTimeSeconds: BigNumber;beginAmount: BigNumber;endAmount: BigNumber;currentAmount: BigNumber;currentTimeSeconds: BigNumber}
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public matchOrders = {
@@ -121,22 +100,7 @@ export class DutchAuctionContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as DutchAuctionContract;
- const inputAbi = self._lookupAbi('matchOrders({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},{address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},bytes,bytes)').inputs;
- [buyOrder,
- sellOrder,
- buySignature,
- sellSignature
- ] = BaseContract._formatABIDataItemList(inputAbi, [buyOrder,
- sellOrder,
- buySignature,
- sellSignature
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [buyOrder,
- sellOrder,
- buySignature,
- sellSignature
- ]);
- const encodedData = self._lookupEthersInterface('matchOrders({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},{address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},bytes,bytes)').functions.matchOrders.encode([buyOrder,
+ const encodedData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [buyOrder,
sellOrder,
buySignature,
sellSignature
@@ -167,17 +131,7 @@ export class DutchAuctionContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as DutchAuctionContract;
- const inputAbi = self._lookupAbi('matchOrders({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},{address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},bytes,bytes)').inputs;
- [buyOrder,
- sellOrder,
- buySignature,
- sellSignature
- ] = BaseContract._formatABIDataItemList(inputAbi, [buyOrder,
- sellOrder,
- buySignature,
- sellSignature
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('matchOrders({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},{address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},bytes,bytes)').functions.matchOrders.encode([buyOrder,
+ const encodedData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [buyOrder,
sellOrder,
buySignature,
sellSignature
@@ -200,17 +154,7 @@ export class DutchAuctionContract extends BaseContract {
sellSignature: string,
): string {
const self = this as any as DutchAuctionContract;
- const inputAbi = self._lookupAbi('matchOrders({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},{address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},bytes,bytes)').inputs;
- [buyOrder,
- sellOrder,
- buySignature,
- sellSignature
- ] = BaseContract._formatABIDataItemList(inputAbi, [buyOrder,
- sellOrder,
- buySignature,
- sellSignature
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('matchOrders({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},{address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},bytes,bytes)').functions.matchOrders.encode([buyOrder,
+ const abiEncodedTransactionData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [buyOrder,
sellOrder,
buySignature,
sellSignature
@@ -227,24 +171,7 @@ export class DutchAuctionContract extends BaseContract {
): Promise<{left: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};right: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};leftMakerAssetSpreadAmount: BigNumber}
> {
const self = this as any as DutchAuctionContract;
- const functionSignature = 'matchOrders({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},{address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},bytes,bytes)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [buyOrder,
- sellOrder,
- buySignature,
- sellSignature
- ] = BaseContract._formatABIDataItemList(inputAbi, [buyOrder,
- sellOrder,
- buySignature,
- sellSignature
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [buyOrder,
- sellOrder,
- buySignature,
- sellSignature
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.matchOrders;
- const encodedData = ethersFunction.encode([buyOrder,
+ const encodedData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [buyOrder,
sellOrder,
buySignature,
sellSignature
@@ -259,11 +186,12 @@ export class DutchAuctionContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'matchOrders'}) 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('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<{left: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};right: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};leftMakerAssetSpreadAmount: BigNumber}
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public static async deployFrom0xArtifactAsync(
@@ -316,7 +244,7 @@ export class DutchAuctionContract extends BaseContract {
}
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
super('DutchAuction', 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-wrappers/src/generated-wrappers/erc20_proxy.ts b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts
index 474472e43..1d53df6b8 100644
--- a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts
+++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts
@@ -40,13 +40,7 @@ export class ERC20ProxyContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ERC20ProxyContract;
- const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs;
- [target
- ] = BaseContract._formatABIDataItemList(inputAbi, [target
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [target
- ]);
- const encodedData = self._lookupEthersInterface('addAuthorizedAddress(address)').functions.addAuthorizedAddress.encode([target
+ const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -68,11 +62,7 @@ export class ERC20ProxyContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as ERC20ProxyContract;
- const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs;
- [target
- ] = BaseContract._formatABIDataItemList(inputAbi, [target
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('addAuthorizedAddress(address)').functions.addAuthorizedAddress.encode([target
+ const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -89,11 +79,7 @@ export class ERC20ProxyContract extends BaseContract {
target: string,
): string {
const self = this as any as ERC20ProxyContract;
- const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs;
- [target
- ] = BaseContract._formatABIDataItemList(inputAbi, [target
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('addAuthorizedAddress(address)').functions.addAuthorizedAddress.encode([target
+ const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target
]);
return abiEncodedTransactionData;
},
@@ -104,15 +90,7 @@ export class ERC20ProxyContract extends BaseContract {
): Promise<void
> {
const self = this as any as ERC20ProxyContract;
- const functionSignature = 'addAuthorizedAddress(address)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [target
- ] = BaseContract._formatABIDataItemList(inputAbi, [target
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [target
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.addAuthorizedAddress;
- const encodedData = ethersFunction.encode([target
+ const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -124,11 +102,12 @@ export class ERC20ProxyContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'addAuthorizedAddress'}) 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('addAuthorizedAddress(address)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<void
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public authorities = {
@@ -139,15 +118,7 @@ export class ERC20ProxyContract extends BaseContract {
): Promise<string
> {
const self = this as any as ERC20ProxyContract;
- const functionSignature = 'authorities(uint256)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [index_0
- ] = BaseContract._formatABIDataItemList(inputAbi, [index_0
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.authorities;
- const encodedData = ethersFunction.encode([index_0
+ const encodedData = self._strictEncodeArguments('authorities(uint256)', [index_0
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -159,11 +130,12 @@ export class ERC20ProxyContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'authorities'}) 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('authorities(uint256)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<string
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public removeAuthorizedAddress = {
@@ -172,13 +144,7 @@ export class ERC20ProxyContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ERC20ProxyContract;
- const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs;
- [target
- ] = BaseContract._formatABIDataItemList(inputAbi, [target
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [target
- ]);
- const encodedData = self._lookupEthersInterface('removeAuthorizedAddress(address)').functions.removeAuthorizedAddress.encode([target
+ const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -200,11 +166,7 @@ export class ERC20ProxyContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as ERC20ProxyContract;
- const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs;
- [target
- ] = BaseContract._formatABIDataItemList(inputAbi, [target
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('removeAuthorizedAddress(address)').functions.removeAuthorizedAddress.encode([target
+ const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -221,11 +183,7 @@ export class ERC20ProxyContract extends BaseContract {
target: string,
): string {
const self = this as any as ERC20ProxyContract;
- const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs;
- [target
- ] = BaseContract._formatABIDataItemList(inputAbi, [target
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('removeAuthorizedAddress(address)').functions.removeAuthorizedAddress.encode([target
+ const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target
]);
return abiEncodedTransactionData;
},
@@ -236,15 +194,7 @@ export class ERC20ProxyContract extends BaseContract {
): Promise<void
> {
const self = this as any as ERC20ProxyContract;
- const functionSignature = 'removeAuthorizedAddress(address)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [target
- ] = BaseContract._formatABIDataItemList(inputAbi, [target
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [target
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.removeAuthorizedAddress;
- const encodedData = ethersFunction.encode([target
+ const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -256,11 +206,12 @@ export class ERC20ProxyContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'removeAuthorizedAddress'}) 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('removeAuthorizedAddress(address)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<void
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public owner = {
@@ -270,12 +221,7 @@ export class ERC20ProxyContract extends BaseContract {
): Promise<string
> {
const self = this as any as ERC20ProxyContract;
- const functionSignature = 'owner()';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, []);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.owner;
- const encodedData = ethersFunction.encode([]);
+ const encodedData = self._strictEncodeArguments('owner()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
@@ -286,11 +232,12 @@ export class ERC20ProxyContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'owner'}) 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('owner()');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<string
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public removeAuthorizedAddressAtIndex = {
@@ -300,16 +247,7 @@ export class ERC20ProxyContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ERC20ProxyContract;
- const inputAbi = self._lookupAbi('removeAuthorizedAddressAtIndex(address,uint256)').inputs;
- [target,
- index
- ] = BaseContract._formatABIDataItemList(inputAbi, [target,
- index
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [target,
- index
- ]);
- const encodedData = self._lookupEthersInterface('removeAuthorizedAddressAtIndex(address,uint256)').functions.removeAuthorizedAddressAtIndex.encode([target,
+ const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target,
index
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -334,13 +272,7 @@ export class ERC20ProxyContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as ERC20ProxyContract;
- const inputAbi = self._lookupAbi('removeAuthorizedAddressAtIndex(address,uint256)').inputs;
- [target,
- index
- ] = BaseContract._formatABIDataItemList(inputAbi, [target,
- index
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('removeAuthorizedAddressAtIndex(address,uint256)').functions.removeAuthorizedAddressAtIndex.encode([target,
+ const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target,
index
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -359,13 +291,7 @@ export class ERC20ProxyContract extends BaseContract {
index: BigNumber,
): string {
const self = this as any as ERC20ProxyContract;
- const inputAbi = self._lookupAbi('removeAuthorizedAddressAtIndex(address,uint256)').inputs;
- [target,
- index
- ] = BaseContract._formatABIDataItemList(inputAbi, [target,
- index
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('removeAuthorizedAddressAtIndex(address,uint256)').functions.removeAuthorizedAddressAtIndex.encode([target,
+ const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target,
index
]);
return abiEncodedTransactionData;
@@ -378,18 +304,7 @@ export class ERC20ProxyContract extends BaseContract {
): Promise<void
> {
const self = this as any as ERC20ProxyContract;
- const functionSignature = 'removeAuthorizedAddressAtIndex(address,uint256)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [target,
- index
- ] = BaseContract._formatABIDataItemList(inputAbi, [target,
- index
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [target,
- index
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.removeAuthorizedAddressAtIndex;
- const encodedData = ethersFunction.encode([target,
+ const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target,
index
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -402,11 +317,12 @@ export class ERC20ProxyContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'removeAuthorizedAddressAtIndex'}) 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('removeAuthorizedAddressAtIndex(address,uint256)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<void
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public getProxyId = {
@@ -416,12 +332,7 @@ export class ERC20ProxyContract extends BaseContract {
): Promise<string
> {
const self = this as any as ERC20ProxyContract;
- const functionSignature = 'getProxyId()';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, []);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getProxyId;
- const encodedData = ethersFunction.encode([]);
+ const encodedData = self._strictEncodeArguments('getProxyId()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
@@ -432,11 +343,12 @@ export class ERC20ProxyContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'getProxyId'}) 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('getProxyId()');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<string
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public authorized = {
@@ -447,15 +359,7 @@ export class ERC20ProxyContract extends BaseContract {
): Promise<boolean
> {
const self = this as any as ERC20ProxyContract;
- const functionSignature = 'authorized(address)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [index_0
- ] = BaseContract._formatABIDataItemList(inputAbi, [index_0
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.authorized;
- const encodedData = ethersFunction.encode([index_0
+ const encodedData = self._strictEncodeArguments('authorized(address)', [index_0
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -467,11 +371,12 @@ export class ERC20ProxyContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'authorized'}) 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('authorized(address)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<boolean
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public getAuthorizedAddresses = {
@@ -481,12 +386,7 @@ export class ERC20ProxyContract extends BaseContract {
): Promise<string[]
> {
const self = this as any as ERC20ProxyContract;
- const functionSignature = 'getAuthorizedAddresses()';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, []);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getAuthorizedAddresses;
- const encodedData = ethersFunction.encode([]);
+ const encodedData = self._strictEncodeArguments('getAuthorizedAddresses()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
@@ -497,11 +397,12 @@ export class ERC20ProxyContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'getAuthorizedAddresses'}) 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('getAuthorizedAddresses()');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<string[]
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public transferOwnership = {
@@ -510,13 +411,7 @@ export class ERC20ProxyContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ERC20ProxyContract;
- const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
- [newOwner
- ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner
- ]);
- const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
+ const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -538,11 +433,7 @@ export class ERC20ProxyContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as ERC20ProxyContract;
- const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
- [newOwner
- ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
+ const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -559,11 +450,7 @@ export class ERC20ProxyContract extends BaseContract {
newOwner: string,
): string {
const self = this as any as ERC20ProxyContract;
- const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
- [newOwner
- ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
+ const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
]);
return abiEncodedTransactionData;
},
@@ -574,15 +461,7 @@ export class ERC20ProxyContract extends BaseContract {
): Promise<void
> {
const self = this as any as ERC20ProxyContract;
- const functionSignature = 'transferOwnership(address)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [newOwner
- ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferOwnership;
- const encodedData = ethersFunction.encode([newOwner
+ const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -594,11 +473,12 @@ export class ERC20ProxyContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'transferOwnership'}) 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('transferOwnership(address)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<void
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public static async deployFrom0xArtifactAsync(
@@ -644,7 +524,7 @@ export class ERC20ProxyContract extends BaseContract {
}
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
super('ERC20Proxy', 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-wrappers/src/generated-wrappers/erc20_token.ts b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts
index ab208cbf5..5070111e1 100644
--- a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts
+++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts
@@ -43,16 +43,7 @@ export class ERC20TokenContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ERC20TokenContract;
- const inputAbi = self._lookupAbi('approve(address,uint256)').inputs;
- [_spender,
- _value
- ] = BaseContract._formatABIDataItemList(inputAbi, [_spender,
- _value
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [_spender,
- _value
- ]);
- const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender,
+ const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender,
_value
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -77,13 +68,7 @@ export class ERC20TokenContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as ERC20TokenContract;
- 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 encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender,
_value
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -102,13 +87,7 @@ export class ERC20TokenContract extends BaseContract {
_value: BigNumber,
): string {
const self = this as any as ERC20TokenContract;
- 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 abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_spender,
_value
]);
return abiEncodedTransactionData;
@@ -121,18 +100,7 @@ export class ERC20TokenContract extends BaseContract {
): Promise<boolean
> {
const self = this as any as ERC20TokenContract;
- const functionSignature = 'approve(address,uint256)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [_spender,
- _value
- ] = 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 encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender,
_value
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -145,11 +113,12 @@ export class ERC20TokenContract 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[0];
+ const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<boolean
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public totalSupply = {
@@ -159,12 +128,7 @@ export class ERC20TokenContract extends BaseContract {
): Promise<BigNumber
> {
const self = this as any as ERC20TokenContract;
- 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 encodedData = self._strictEncodeArguments('totalSupply()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
@@ -175,11 +139,12 @@ export class ERC20TokenContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- 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));
- return resultArray[0];
+ const abiEncoder = self._lookupAbiEncoder('totalSupply()');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<BigNumber
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public transferFrom = {
@@ -190,19 +155,7 @@ export class ERC20TokenContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ERC20TokenContract;
- const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs;
- [_from,
- _to,
- _value
- ] = BaseContract._formatABIDataItemList(inputAbi, [_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,
+ const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from,
_to,
_value
]);
@@ -230,15 +183,7 @@ export class ERC20TokenContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as ERC20TokenContract;
- 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 encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from,
_to,
_value
]);
@@ -259,15 +204,7 @@ export class ERC20TokenContract extends BaseContract {
_value: BigNumber,
): string {
const self = this as any as ERC20TokenContract;
- 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 abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from,
_to,
_value
]);
@@ -282,21 +219,7 @@ export class ERC20TokenContract extends BaseContract {
): Promise<boolean
> {
const self = this as any as ERC20TokenContract;
- const functionSignature = 'transferFrom(address,address,uint256)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [_from,
- _to,
- _value
- ] = BaseContract._formatABIDataItemList(inputAbi, [_from,
- _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 encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from,
_to,
_value
]);
@@ -310,11 +233,12 @@ export class ERC20TokenContract 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[0];
+ const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<boolean
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public balanceOf = {
@@ -325,15 +249,7 @@ export class ERC20TokenContract extends BaseContract {
): Promise<BigNumber
> {
const self = this as any as ERC20TokenContract;
- 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(
{
@@ -345,11 +261,12 @@ export class ERC20TokenContract 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 transfer = {
@@ -359,16 +276,7 @@ export class ERC20TokenContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ERC20TokenContract;
- const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs;
- [_to,
- _value
- ] = BaseContract._formatABIDataItemList(inputAbi, [_to,
- _value
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [_to,
- _value
- ]);
- const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to,
+ const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to,
_value
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -393,13 +301,7 @@ export class ERC20TokenContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as ERC20TokenContract;
- 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 encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to,
_value
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -418,13 +320,7 @@ export class ERC20TokenContract extends BaseContract {
_value: BigNumber,
): string {
const self = this as any as ERC20TokenContract;
- 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 abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [_to,
_value
]);
return abiEncodedTransactionData;
@@ -437,18 +333,7 @@ export class ERC20TokenContract extends BaseContract {
): Promise<boolean
> {
const self = this as any as ERC20TokenContract;
- const functionSignature = 'transfer(address,uint256)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [_to,
- _value
- ] = 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 encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to,
_value
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -461,11 +346,12 @@ export class ERC20TokenContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- 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));
- return resultArray[0];
+ const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<boolean
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public allowance = {
@@ -477,18 +363,7 @@ export class ERC20TokenContract extends BaseContract {
): Promise<BigNumber
> {
const self = this as any as ERC20TokenContract;
- const functionSignature = 'allowance(address,address)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [_owner,
- _spender
- ] = 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 encodedData = self._strictEncodeArguments('allowance(address,address)', [_owner,
_spender
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -501,11 +376,12 @@ export class ERC20TokenContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- 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));
- return resultArray[0];
+ const abiEncoder = self._lookupAbiEncoder('allowance(address,address)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<BigNumber
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public static async deployFrom0xArtifactAsync(
@@ -551,7 +427,7 @@ export class ERC20TokenContract extends BaseContract {
}
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
super('ERC20Token', 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-wrappers/src/generated-wrappers/erc721_proxy.ts b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts
index f9730a072..5a9fcc7d1 100644
--- a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts
+++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts
@@ -40,13 +40,7 @@ export class ERC721ProxyContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ERC721ProxyContract;
- const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs;
- [target
- ] = BaseContract._formatABIDataItemList(inputAbi, [target
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [target
- ]);
- const encodedData = self._lookupEthersInterface('addAuthorizedAddress(address)').functions.addAuthorizedAddress.encode([target
+ const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -68,11 +62,7 @@ export class ERC721ProxyContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as ERC721ProxyContract;
- const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs;
- [target
- ] = BaseContract._formatABIDataItemList(inputAbi, [target
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('addAuthorizedAddress(address)').functions.addAuthorizedAddress.encode([target
+ const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -89,11 +79,7 @@ export class ERC721ProxyContract extends BaseContract {
target: string,
): string {
const self = this as any as ERC721ProxyContract;
- const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs;
- [target
- ] = BaseContract._formatABIDataItemList(inputAbi, [target
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('addAuthorizedAddress(address)').functions.addAuthorizedAddress.encode([target
+ const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target
]);
return abiEncodedTransactionData;
},
@@ -104,15 +90,7 @@ export class ERC721ProxyContract extends BaseContract {
): Promise<void
> {
const self = this as any as ERC721ProxyContract;
- const functionSignature = 'addAuthorizedAddress(address)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [target
- ] = BaseContract._formatABIDataItemList(inputAbi, [target
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [target
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.addAuthorizedAddress;
- const encodedData = ethersFunction.encode([target
+ const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -124,11 +102,12 @@ export class ERC721ProxyContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'addAuthorizedAddress'}) 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('addAuthorizedAddress(address)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<void
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public authorities = {
@@ -139,15 +118,7 @@ export class ERC721ProxyContract extends BaseContract {
): Promise<string
> {
const self = this as any as ERC721ProxyContract;
- const functionSignature = 'authorities(uint256)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [index_0
- ] = BaseContract._formatABIDataItemList(inputAbi, [index_0
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.authorities;
- const encodedData = ethersFunction.encode([index_0
+ const encodedData = self._strictEncodeArguments('authorities(uint256)', [index_0
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -159,11 +130,12 @@ export class ERC721ProxyContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'authorities'}) 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('authorities(uint256)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<string
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public removeAuthorizedAddress = {
@@ -172,13 +144,7 @@ export class ERC721ProxyContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ERC721ProxyContract;
- const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs;
- [target
- ] = BaseContract._formatABIDataItemList(inputAbi, [target
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [target
- ]);
- const encodedData = self._lookupEthersInterface('removeAuthorizedAddress(address)').functions.removeAuthorizedAddress.encode([target
+ const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -200,11 +166,7 @@ export class ERC721ProxyContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as ERC721ProxyContract;
- const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs;
- [target
- ] = BaseContract._formatABIDataItemList(inputAbi, [target
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('removeAuthorizedAddress(address)').functions.removeAuthorizedAddress.encode([target
+ const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -221,11 +183,7 @@ export class ERC721ProxyContract extends BaseContract {
target: string,
): string {
const self = this as any as ERC721ProxyContract;
- const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs;
- [target
- ] = BaseContract._formatABIDataItemList(inputAbi, [target
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('removeAuthorizedAddress(address)').functions.removeAuthorizedAddress.encode([target
+ const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target
]);
return abiEncodedTransactionData;
},
@@ -236,15 +194,7 @@ export class ERC721ProxyContract extends BaseContract {
): Promise<void
> {
const self = this as any as ERC721ProxyContract;
- const functionSignature = 'removeAuthorizedAddress(address)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [target
- ] = BaseContract._formatABIDataItemList(inputAbi, [target
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [target
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.removeAuthorizedAddress;
- const encodedData = ethersFunction.encode([target
+ const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -256,11 +206,12 @@ export class ERC721ProxyContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'removeAuthorizedAddress'}) 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('removeAuthorizedAddress(address)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<void
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public owner = {
@@ -270,12 +221,7 @@ export class ERC721ProxyContract extends BaseContract {
): Promise<string
> {
const self = this as any as ERC721ProxyContract;
- const functionSignature = 'owner()';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, []);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.owner;
- const encodedData = ethersFunction.encode([]);
+ const encodedData = self._strictEncodeArguments('owner()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
@@ -286,11 +232,12 @@ export class ERC721ProxyContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'owner'}) 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('owner()');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<string
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public removeAuthorizedAddressAtIndex = {
@@ -300,16 +247,7 @@ export class ERC721ProxyContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ERC721ProxyContract;
- const inputAbi = self._lookupAbi('removeAuthorizedAddressAtIndex(address,uint256)').inputs;
- [target,
- index
- ] = BaseContract._formatABIDataItemList(inputAbi, [target,
- index
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [target,
- index
- ]);
- const encodedData = self._lookupEthersInterface('removeAuthorizedAddressAtIndex(address,uint256)').functions.removeAuthorizedAddressAtIndex.encode([target,
+ const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target,
index
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -334,13 +272,7 @@ export class ERC721ProxyContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as ERC721ProxyContract;
- const inputAbi = self._lookupAbi('removeAuthorizedAddressAtIndex(address,uint256)').inputs;
- [target,
- index
- ] = BaseContract._formatABIDataItemList(inputAbi, [target,
- index
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('removeAuthorizedAddressAtIndex(address,uint256)').functions.removeAuthorizedAddressAtIndex.encode([target,
+ const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target,
index
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -359,13 +291,7 @@ export class ERC721ProxyContract extends BaseContract {
index: BigNumber,
): string {
const self = this as any as ERC721ProxyContract;
- const inputAbi = self._lookupAbi('removeAuthorizedAddressAtIndex(address,uint256)').inputs;
- [target,
- index
- ] = BaseContract._formatABIDataItemList(inputAbi, [target,
- index
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('removeAuthorizedAddressAtIndex(address,uint256)').functions.removeAuthorizedAddressAtIndex.encode([target,
+ const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target,
index
]);
return abiEncodedTransactionData;
@@ -378,18 +304,7 @@ export class ERC721ProxyContract extends BaseContract {
): Promise<void
> {
const self = this as any as ERC721ProxyContract;
- const functionSignature = 'removeAuthorizedAddressAtIndex(address,uint256)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [target,
- index
- ] = BaseContract._formatABIDataItemList(inputAbi, [target,
- index
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [target,
- index
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.removeAuthorizedAddressAtIndex;
- const encodedData = ethersFunction.encode([target,
+ const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target,
index
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -402,11 +317,12 @@ export class ERC721ProxyContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'removeAuthorizedAddressAtIndex'}) 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('removeAuthorizedAddressAtIndex(address,uint256)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<void
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public getProxyId = {
@@ -416,12 +332,7 @@ export class ERC721ProxyContract extends BaseContract {
): Promise<string
> {
const self = this as any as ERC721ProxyContract;
- const functionSignature = 'getProxyId()';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, []);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getProxyId;
- const encodedData = ethersFunction.encode([]);
+ const encodedData = self._strictEncodeArguments('getProxyId()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
@@ -432,11 +343,12 @@ export class ERC721ProxyContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'getProxyId'}) 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('getProxyId()');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<string
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public authorized = {
@@ -447,15 +359,7 @@ export class ERC721ProxyContract extends BaseContract {
): Promise<boolean
> {
const self = this as any as ERC721ProxyContract;
- const functionSignature = 'authorized(address)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [index_0
- ] = BaseContract._formatABIDataItemList(inputAbi, [index_0
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.authorized;
- const encodedData = ethersFunction.encode([index_0
+ const encodedData = self._strictEncodeArguments('authorized(address)', [index_0
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -467,11 +371,12 @@ export class ERC721ProxyContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'authorized'}) 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('authorized(address)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<boolean
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public getAuthorizedAddresses = {
@@ -481,12 +386,7 @@ export class ERC721ProxyContract extends BaseContract {
): Promise<string[]
> {
const self = this as any as ERC721ProxyContract;
- const functionSignature = 'getAuthorizedAddresses()';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, []);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getAuthorizedAddresses;
- const encodedData = ethersFunction.encode([]);
+ const encodedData = self._strictEncodeArguments('getAuthorizedAddresses()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
@@ -497,11 +397,12 @@ export class ERC721ProxyContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'getAuthorizedAddresses'}) 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('getAuthorizedAddresses()');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<string[]
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public transferOwnership = {
@@ -510,13 +411,7 @@ export class ERC721ProxyContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ERC721ProxyContract;
- const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
- [newOwner
- ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner
- ]);
- const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
+ const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -538,11 +433,7 @@ export class ERC721ProxyContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as ERC721ProxyContract;
- const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
- [newOwner
- ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
+ const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -559,11 +450,7 @@ export class ERC721ProxyContract extends BaseContract {
newOwner: string,
): string {
const self = this as any as ERC721ProxyContract;
- const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
- [newOwner
- ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
+ const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
]);
return abiEncodedTransactionData;
},
@@ -574,15 +461,7 @@ export class ERC721ProxyContract extends BaseContract {
): Promise<void
> {
const self = this as any as ERC721ProxyContract;
- const functionSignature = 'transferOwnership(address)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [newOwner
- ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferOwnership;
- const encodedData = ethersFunction.encode([newOwner
+ const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -594,11 +473,12 @@ export class ERC721ProxyContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'transferOwnership'}) 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('transferOwnership(address)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<void
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public static async deployFrom0xArtifactAsync(
@@ -644,7 +524,7 @@ export class ERC721ProxyContract extends BaseContract {
}
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
super('ERC721Proxy', 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-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
diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts b/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts
index 11b5e7024..146fa7c2a 100644
--- a/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts
+++ b/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts
@@ -78,15 +78,7 @@ export class ExchangeContract extends BaseContract {
): Promise<BigNumber
> {
const self = this as any as ExchangeContract;
- const functionSignature = 'filled(bytes32)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [index_0
- ] = BaseContract._formatABIDataItemList(inputAbi, [index_0
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.filled;
- const encodedData = ethersFunction.encode([index_0
+ const encodedData = self._strictEncodeArguments('filled(bytes32)', [index_0
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -98,11 +90,12 @@ export class ExchangeContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'filled'}) 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('filled(bytes32)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<BigNumber
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public batchFillOrders = {
@@ -113,19 +106,7 @@ export class ExchangeContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('batchFillOrders(tuple[],uint256[],bytes[])').inputs;
- [orders,
- takerAssetFillAmounts,
- signatures
- ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
- takerAssetFillAmounts,
- signatures
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
- takerAssetFillAmounts,
- signatures
- ]);
- const encodedData = self._lookupEthersInterface('batchFillOrders(tuple[],uint256[],bytes[])').functions.batchFillOrders.encode([orders,
+ const encodedData = self._strictEncodeArguments('batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders,
takerAssetFillAmounts,
signatures
]);
@@ -153,15 +134,7 @@ export class ExchangeContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('batchFillOrders(tuple[],uint256[],bytes[])').inputs;
- [orders,
- takerAssetFillAmounts,
- signatures
- ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
- takerAssetFillAmounts,
- signatures
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('batchFillOrders(tuple[],uint256[],bytes[])').functions.batchFillOrders.encode([orders,
+ const encodedData = self._strictEncodeArguments('batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders,
takerAssetFillAmounts,
signatures
]);
@@ -182,15 +155,7 @@ export class ExchangeContract extends BaseContract {
signatures: string[],
): string {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('batchFillOrders(tuple[],uint256[],bytes[])').inputs;
- [orders,
- takerAssetFillAmounts,
- signatures
- ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
- takerAssetFillAmounts,
- signatures
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('batchFillOrders(tuple[],uint256[],bytes[])').functions.batchFillOrders.encode([orders,
+ const abiEncodedTransactionData = self._strictEncodeArguments('batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders,
takerAssetFillAmounts,
signatures
]);
@@ -205,21 +170,7 @@ export class ExchangeContract extends BaseContract {
): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}
> {
const self = this as any as ExchangeContract;
- const functionSignature = 'batchFillOrders(tuple[],uint256[],bytes[])';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [orders,
- takerAssetFillAmounts,
- signatures
- ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
- takerAssetFillAmounts,
- signatures
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
- takerAssetFillAmounts,
- signatures
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.batchFillOrders;
- const encodedData = ethersFunction.encode([orders,
+ const encodedData = self._strictEncodeArguments('batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders,
takerAssetFillAmounts,
signatures
]);
@@ -233,11 +184,12 @@ export class ExchangeContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'batchFillOrders'}) 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('batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public cancelled = {
@@ -248,15 +200,7 @@ export class ExchangeContract extends BaseContract {
): Promise<boolean
> {
const self = this as any as ExchangeContract;
- const functionSignature = 'cancelled(bytes32)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [index_0
- ] = BaseContract._formatABIDataItemList(inputAbi, [index_0
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.cancelled;
- const encodedData = ethersFunction.encode([index_0
+ const encodedData = self._strictEncodeArguments('cancelled(bytes32)', [index_0
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -268,11 +212,12 @@ export class ExchangeContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'cancelled'}) 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('cancelled(bytes32)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<boolean
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public preSign = {
@@ -283,19 +228,7 @@ export class ExchangeContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('preSign(bytes32,address,bytes)').inputs;
- [hash,
- signerAddress,
- signature
- ] = BaseContract._formatABIDataItemList(inputAbi, [hash,
- signerAddress,
- signature
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [hash,
- signerAddress,
- signature
- ]);
- const encodedData = self._lookupEthersInterface('preSign(bytes32,address,bytes)').functions.preSign.encode([hash,
+ const encodedData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [hash,
signerAddress,
signature
]);
@@ -323,15 +256,7 @@ export class ExchangeContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('preSign(bytes32,address,bytes)').inputs;
- [hash,
- signerAddress,
- signature
- ] = BaseContract._formatABIDataItemList(inputAbi, [hash,
- signerAddress,
- signature
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('preSign(bytes32,address,bytes)').functions.preSign.encode([hash,
+ const encodedData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [hash,
signerAddress,
signature
]);
@@ -352,15 +277,7 @@ export class ExchangeContract extends BaseContract {
signature: string,
): string {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('preSign(bytes32,address,bytes)').inputs;
- [hash,
- signerAddress,
- signature
- ] = BaseContract._formatABIDataItemList(inputAbi, [hash,
- signerAddress,
- signature
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('preSign(bytes32,address,bytes)').functions.preSign.encode([hash,
+ const abiEncodedTransactionData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [hash,
signerAddress,
signature
]);
@@ -375,21 +292,7 @@ export class ExchangeContract extends BaseContract {
): Promise<void
> {
const self = this as any as ExchangeContract;
- const functionSignature = 'preSign(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.preSign;
- const encodedData = ethersFunction.encode([hash,
+ const encodedData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [hash,
signerAddress,
signature
]);
@@ -403,11 +306,12 @@ export class ExchangeContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'preSign'}) 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('preSign(bytes32,address,bytes)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<void
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public matchOrders = {
@@ -419,22 +323,7 @@ export class ExchangeContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('matchOrders({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},{address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},bytes,bytes)').inputs;
- [leftOrder,
- rightOrder,
- leftSignature,
- rightSignature
- ] = BaseContract._formatABIDataItemList(inputAbi, [leftOrder,
- rightOrder,
- leftSignature,
- rightSignature
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [leftOrder,
- rightOrder,
- leftSignature,
- rightSignature
- ]);
- const encodedData = self._lookupEthersInterface('matchOrders({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},{address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},bytes,bytes)').functions.matchOrders.encode([leftOrder,
+ const encodedData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [leftOrder,
rightOrder,
leftSignature,
rightSignature
@@ -465,17 +354,7 @@ export class ExchangeContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('matchOrders({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},{address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},bytes,bytes)').inputs;
- [leftOrder,
- rightOrder,
- leftSignature,
- rightSignature
- ] = BaseContract._formatABIDataItemList(inputAbi, [leftOrder,
- rightOrder,
- leftSignature,
- rightSignature
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('matchOrders({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},{address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},bytes,bytes)').functions.matchOrders.encode([leftOrder,
+ const encodedData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [leftOrder,
rightOrder,
leftSignature,
rightSignature
@@ -498,17 +377,7 @@ export class ExchangeContract extends BaseContract {
rightSignature: string,
): string {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('matchOrders({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},{address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},bytes,bytes)').inputs;
- [leftOrder,
- rightOrder,
- leftSignature,
- rightSignature
- ] = BaseContract._formatABIDataItemList(inputAbi, [leftOrder,
- rightOrder,
- leftSignature,
- rightSignature
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('matchOrders({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},{address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},bytes,bytes)').functions.matchOrders.encode([leftOrder,
+ const abiEncodedTransactionData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [leftOrder,
rightOrder,
leftSignature,
rightSignature
@@ -525,24 +394,7 @@ export class ExchangeContract extends BaseContract {
): Promise<{left: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};right: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};leftMakerAssetSpreadAmount: BigNumber}
> {
const self = this as any as ExchangeContract;
- const functionSignature = 'matchOrders({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},{address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},bytes,bytes)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [leftOrder,
- rightOrder,
- leftSignature,
- rightSignature
- ] = BaseContract._formatABIDataItemList(inputAbi, [leftOrder,
- rightOrder,
- leftSignature,
- rightSignature
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [leftOrder,
- rightOrder,
- leftSignature,
- rightSignature
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.matchOrders;
- const encodedData = ethersFunction.encode([leftOrder,
+ const encodedData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [leftOrder,
rightOrder,
leftSignature,
rightSignature
@@ -557,11 +409,12 @@ export class ExchangeContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'matchOrders'}) 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('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<{left: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};right: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};leftMakerAssetSpreadAmount: BigNumber}
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public fillOrderNoThrow = {
@@ -572,19 +425,7 @@ export class ExchangeContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('fillOrderNoThrow({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').inputs;
- [order,
- takerAssetFillAmount,
- signature
- ] = BaseContract._formatABIDataItemList(inputAbi, [order,
- takerAssetFillAmount,
- signature
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [order,
- takerAssetFillAmount,
- signature
- ]);
- const encodedData = self._lookupEthersInterface('fillOrderNoThrow({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').functions.fillOrderNoThrow.encode([order,
+ const encodedData = self._strictEncodeArguments('fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order,
takerAssetFillAmount,
signature
]);
@@ -612,15 +453,7 @@ export class ExchangeContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('fillOrderNoThrow({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').inputs;
- [order,
- takerAssetFillAmount,
- signature
- ] = BaseContract._formatABIDataItemList(inputAbi, [order,
- takerAssetFillAmount,
- signature
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('fillOrderNoThrow({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').functions.fillOrderNoThrow.encode([order,
+ const encodedData = self._strictEncodeArguments('fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order,
takerAssetFillAmount,
signature
]);
@@ -641,15 +474,7 @@ export class ExchangeContract extends BaseContract {
signature: string,
): string {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('fillOrderNoThrow({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').inputs;
- [order,
- takerAssetFillAmount,
- signature
- ] = BaseContract._formatABIDataItemList(inputAbi, [order,
- takerAssetFillAmount,
- signature
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('fillOrderNoThrow({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').functions.fillOrderNoThrow.encode([order,
+ const abiEncodedTransactionData = self._strictEncodeArguments('fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order,
takerAssetFillAmount,
signature
]);
@@ -664,21 +489,7 @@ export class ExchangeContract extends BaseContract {
): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}
> {
const self = this as any as ExchangeContract;
- const functionSignature = 'fillOrderNoThrow({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [order,
- takerAssetFillAmount,
- signature
- ] = BaseContract._formatABIDataItemList(inputAbi, [order,
- takerAssetFillAmount,
- signature
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [order,
- takerAssetFillAmount,
- signature
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.fillOrderNoThrow;
- const encodedData = ethersFunction.encode([order,
+ const encodedData = self._strictEncodeArguments('fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order,
takerAssetFillAmount,
signature
]);
@@ -692,11 +503,12 @@ export class ExchangeContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'fillOrderNoThrow'}) 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('fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public assetProxies = {
@@ -707,15 +519,7 @@ export class ExchangeContract extends BaseContract {
): Promise<string
> {
const self = this as any as ExchangeContract;
- const functionSignature = 'assetProxies(bytes4)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [index_0
- ] = BaseContract._formatABIDataItemList(inputAbi, [index_0
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.assetProxies;
- const encodedData = ethersFunction.encode([index_0
+ const encodedData = self._strictEncodeArguments('assetProxies(bytes4)', [index_0
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -727,11 +531,12 @@ export class ExchangeContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'assetProxies'}) 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('assetProxies(bytes4)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<string
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public batchCancelOrders = {
@@ -740,13 +545,7 @@ export class ExchangeContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('batchCancelOrders(tuple[])').inputs;
- [orders
- ] = BaseContract._formatABIDataItemList(inputAbi, [orders
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [orders
- ]);
- const encodedData = self._lookupEthersInterface('batchCancelOrders(tuple[])').functions.batchCancelOrders.encode([orders
+ const encodedData = self._strictEncodeArguments('batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', [orders
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -768,11 +567,7 @@ export class ExchangeContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('batchCancelOrders(tuple[])').inputs;
- [orders
- ] = BaseContract._formatABIDataItemList(inputAbi, [orders
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('batchCancelOrders(tuple[])').functions.batchCancelOrders.encode([orders
+ const encodedData = self._strictEncodeArguments('batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', [orders
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -789,11 +584,7 @@ export class ExchangeContract extends BaseContract {
orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
): string {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('batchCancelOrders(tuple[])').inputs;
- [orders
- ] = BaseContract._formatABIDataItemList(inputAbi, [orders
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('batchCancelOrders(tuple[])').functions.batchCancelOrders.encode([orders
+ const abiEncodedTransactionData = self._strictEncodeArguments('batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', [orders
]);
return abiEncodedTransactionData;
},
@@ -804,15 +595,7 @@ export class ExchangeContract extends BaseContract {
): Promise<void
> {
const self = this as any as ExchangeContract;
- const functionSignature = 'batchCancelOrders(tuple[])';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [orders
- ] = BaseContract._formatABIDataItemList(inputAbi, [orders
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [orders
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.batchCancelOrders;
- const encodedData = ethersFunction.encode([orders
+ const encodedData = self._strictEncodeArguments('batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', [orders
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -824,11 +607,12 @@ export class ExchangeContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'batchCancelOrders'}) 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('batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<void
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public batchFillOrKillOrders = {
@@ -839,19 +623,7 @@ export class ExchangeContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('batchFillOrKillOrders(tuple[],uint256[],bytes[])').inputs;
- [orders,
- takerAssetFillAmounts,
- signatures
- ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
- takerAssetFillAmounts,
- signatures
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
- takerAssetFillAmounts,
- signatures
- ]);
- const encodedData = self._lookupEthersInterface('batchFillOrKillOrders(tuple[],uint256[],bytes[])').functions.batchFillOrKillOrders.encode([orders,
+ const encodedData = self._strictEncodeArguments('batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders,
takerAssetFillAmounts,
signatures
]);
@@ -879,15 +651,7 @@ export class ExchangeContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('batchFillOrKillOrders(tuple[],uint256[],bytes[])').inputs;
- [orders,
- takerAssetFillAmounts,
- signatures
- ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
- takerAssetFillAmounts,
- signatures
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('batchFillOrKillOrders(tuple[],uint256[],bytes[])').functions.batchFillOrKillOrders.encode([orders,
+ const encodedData = self._strictEncodeArguments('batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders,
takerAssetFillAmounts,
signatures
]);
@@ -908,15 +672,7 @@ export class ExchangeContract extends BaseContract {
signatures: string[],
): string {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('batchFillOrKillOrders(tuple[],uint256[],bytes[])').inputs;
- [orders,
- takerAssetFillAmounts,
- signatures
- ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
- takerAssetFillAmounts,
- signatures
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('batchFillOrKillOrders(tuple[],uint256[],bytes[])').functions.batchFillOrKillOrders.encode([orders,
+ const abiEncodedTransactionData = self._strictEncodeArguments('batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders,
takerAssetFillAmounts,
signatures
]);
@@ -931,21 +687,7 @@ export class ExchangeContract extends BaseContract {
): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}
> {
const self = this as any as ExchangeContract;
- const functionSignature = 'batchFillOrKillOrders(tuple[],uint256[],bytes[])';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [orders,
- takerAssetFillAmounts,
- signatures
- ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
- takerAssetFillAmounts,
- signatures
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
- takerAssetFillAmounts,
- signatures
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.batchFillOrKillOrders;
- const encodedData = ethersFunction.encode([orders,
+ const encodedData = self._strictEncodeArguments('batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders,
takerAssetFillAmounts,
signatures
]);
@@ -959,11 +701,12 @@ export class ExchangeContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'batchFillOrKillOrders'}) 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('batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public cancelOrdersUpTo = {
@@ -972,13 +715,7 @@ export class ExchangeContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('cancelOrdersUpTo(uint256)').inputs;
- [targetOrderEpoch
- ] = BaseContract._formatABIDataItemList(inputAbi, [targetOrderEpoch
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [targetOrderEpoch
- ]);
- const encodedData = self._lookupEthersInterface('cancelOrdersUpTo(uint256)').functions.cancelOrdersUpTo.encode([targetOrderEpoch
+ const encodedData = self._strictEncodeArguments('cancelOrdersUpTo(uint256)', [targetOrderEpoch
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -1000,11 +737,7 @@ export class ExchangeContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('cancelOrdersUpTo(uint256)').inputs;
- [targetOrderEpoch
- ] = BaseContract._formatABIDataItemList(inputAbi, [targetOrderEpoch
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('cancelOrdersUpTo(uint256)').functions.cancelOrdersUpTo.encode([targetOrderEpoch
+ const encodedData = self._strictEncodeArguments('cancelOrdersUpTo(uint256)', [targetOrderEpoch
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -1021,11 +754,7 @@ export class ExchangeContract extends BaseContract {
targetOrderEpoch: BigNumber,
): string {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('cancelOrdersUpTo(uint256)').inputs;
- [targetOrderEpoch
- ] = BaseContract._formatABIDataItemList(inputAbi, [targetOrderEpoch
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('cancelOrdersUpTo(uint256)').functions.cancelOrdersUpTo.encode([targetOrderEpoch
+ const abiEncodedTransactionData = self._strictEncodeArguments('cancelOrdersUpTo(uint256)', [targetOrderEpoch
]);
return abiEncodedTransactionData;
},
@@ -1036,15 +765,7 @@ export class ExchangeContract extends BaseContract {
): Promise<void
> {
const self = this as any as ExchangeContract;
- const functionSignature = 'cancelOrdersUpTo(uint256)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [targetOrderEpoch
- ] = BaseContract._formatABIDataItemList(inputAbi, [targetOrderEpoch
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [targetOrderEpoch
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.cancelOrdersUpTo;
- const encodedData = ethersFunction.encode([targetOrderEpoch
+ const encodedData = self._strictEncodeArguments('cancelOrdersUpTo(uint256)', [targetOrderEpoch
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -1056,11 +777,12 @@ export class ExchangeContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'cancelOrdersUpTo'}) 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('cancelOrdersUpTo(uint256)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<void
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public batchFillOrdersNoThrow = {
@@ -1071,19 +793,7 @@ export class ExchangeContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('batchFillOrdersNoThrow(tuple[],uint256[],bytes[])').inputs;
- [orders,
- takerAssetFillAmounts,
- signatures
- ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
- takerAssetFillAmounts,
- signatures
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
- takerAssetFillAmounts,
- signatures
- ]);
- const encodedData = self._lookupEthersInterface('batchFillOrdersNoThrow(tuple[],uint256[],bytes[])').functions.batchFillOrdersNoThrow.encode([orders,
+ const encodedData = self._strictEncodeArguments('batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders,
takerAssetFillAmounts,
signatures
]);
@@ -1111,15 +821,7 @@ export class ExchangeContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('batchFillOrdersNoThrow(tuple[],uint256[],bytes[])').inputs;
- [orders,
- takerAssetFillAmounts,
- signatures
- ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
- takerAssetFillAmounts,
- signatures
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('batchFillOrdersNoThrow(tuple[],uint256[],bytes[])').functions.batchFillOrdersNoThrow.encode([orders,
+ const encodedData = self._strictEncodeArguments('batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders,
takerAssetFillAmounts,
signatures
]);
@@ -1140,15 +842,7 @@ export class ExchangeContract extends BaseContract {
signatures: string[],
): string {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('batchFillOrdersNoThrow(tuple[],uint256[],bytes[])').inputs;
- [orders,
- takerAssetFillAmounts,
- signatures
- ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
- takerAssetFillAmounts,
- signatures
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('batchFillOrdersNoThrow(tuple[],uint256[],bytes[])').functions.batchFillOrdersNoThrow.encode([orders,
+ const abiEncodedTransactionData = self._strictEncodeArguments('batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders,
takerAssetFillAmounts,
signatures
]);
@@ -1163,21 +857,7 @@ export class ExchangeContract extends BaseContract {
): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}
> {
const self = this as any as ExchangeContract;
- const functionSignature = 'batchFillOrdersNoThrow(tuple[],uint256[],bytes[])';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [orders,
- takerAssetFillAmounts,
- signatures
- ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
- takerAssetFillAmounts,
- signatures
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
- takerAssetFillAmounts,
- signatures
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.batchFillOrdersNoThrow;
- const encodedData = ethersFunction.encode([orders,
+ const encodedData = self._strictEncodeArguments('batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [orders,
takerAssetFillAmounts,
signatures
]);
@@ -1191,11 +871,12 @@ export class ExchangeContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'batchFillOrdersNoThrow'}) 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('batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public getAssetProxy = {
@@ -1206,15 +887,7 @@ export class ExchangeContract extends BaseContract {
): Promise<string
> {
const self = this as any as ExchangeContract;
- const functionSignature = 'getAssetProxy(bytes4)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [assetProxyId
- ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxyId
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [assetProxyId
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getAssetProxy;
- const encodedData = ethersFunction.encode([assetProxyId
+ const encodedData = self._strictEncodeArguments('getAssetProxy(bytes4)', [assetProxyId
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -1226,11 +899,12 @@ export class ExchangeContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'getAssetProxy'}) 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('getAssetProxy(bytes4)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<string
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public transactions = {
@@ -1241,15 +915,7 @@ export class ExchangeContract extends BaseContract {
): Promise<boolean
> {
const self = this as any as ExchangeContract;
- const functionSignature = 'transactions(bytes32)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [index_0
- ] = BaseContract._formatABIDataItemList(inputAbi, [index_0
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transactions;
- const encodedData = ethersFunction.encode([index_0
+ const encodedData = self._strictEncodeArguments('transactions(bytes32)', [index_0
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -1261,11 +927,12 @@ export class ExchangeContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'transactions'}) 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('transactions(bytes32)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<boolean
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public fillOrKillOrder = {
@@ -1276,19 +943,7 @@ export class ExchangeContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('fillOrKillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').inputs;
- [order,
- takerAssetFillAmount,
- signature
- ] = BaseContract._formatABIDataItemList(inputAbi, [order,
- takerAssetFillAmount,
- signature
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [order,
- takerAssetFillAmount,
- signature
- ]);
- const encodedData = self._lookupEthersInterface('fillOrKillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').functions.fillOrKillOrder.encode([order,
+ const encodedData = self._strictEncodeArguments('fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order,
takerAssetFillAmount,
signature
]);
@@ -1316,15 +971,7 @@ export class ExchangeContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('fillOrKillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').inputs;
- [order,
- takerAssetFillAmount,
- signature
- ] = BaseContract._formatABIDataItemList(inputAbi, [order,
- takerAssetFillAmount,
- signature
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('fillOrKillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').functions.fillOrKillOrder.encode([order,
+ const encodedData = self._strictEncodeArguments('fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order,
takerAssetFillAmount,
signature
]);
@@ -1345,15 +992,7 @@ export class ExchangeContract extends BaseContract {
signature: string,
): string {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('fillOrKillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').inputs;
- [order,
- takerAssetFillAmount,
- signature
- ] = BaseContract._formatABIDataItemList(inputAbi, [order,
- takerAssetFillAmount,
- signature
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('fillOrKillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').functions.fillOrKillOrder.encode([order,
+ const abiEncodedTransactionData = self._strictEncodeArguments('fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order,
takerAssetFillAmount,
signature
]);
@@ -1368,21 +1007,7 @@ export class ExchangeContract extends BaseContract {
): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}
> {
const self = this as any as ExchangeContract;
- const functionSignature = 'fillOrKillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [order,
- takerAssetFillAmount,
- signature
- ] = BaseContract._formatABIDataItemList(inputAbi, [order,
- takerAssetFillAmount,
- signature
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [order,
- takerAssetFillAmount,
- signature
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.fillOrKillOrder;
- const encodedData = ethersFunction.encode([order,
+ const encodedData = self._strictEncodeArguments('fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order,
takerAssetFillAmount,
signature
]);
@@ -1396,11 +1021,12 @@ export class ExchangeContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'fillOrKillOrder'}) 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('fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public setSignatureValidatorApproval = {
@@ -1410,16 +1036,7 @@ export class ExchangeContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('setSignatureValidatorApproval(address,bool)').inputs;
- [validatorAddress,
- approval
- ] = BaseContract._formatABIDataItemList(inputAbi, [validatorAddress,
- approval
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [validatorAddress,
- approval
- ]);
- const encodedData = self._lookupEthersInterface('setSignatureValidatorApproval(address,bool)').functions.setSignatureValidatorApproval.encode([validatorAddress,
+ const encodedData = self._strictEncodeArguments('setSignatureValidatorApproval(address,bool)', [validatorAddress,
approval
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -1444,13 +1061,7 @@ export class ExchangeContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('setSignatureValidatorApproval(address,bool)').inputs;
- [validatorAddress,
- approval
- ] = BaseContract._formatABIDataItemList(inputAbi, [validatorAddress,
- approval
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('setSignatureValidatorApproval(address,bool)').functions.setSignatureValidatorApproval.encode([validatorAddress,
+ const encodedData = self._strictEncodeArguments('setSignatureValidatorApproval(address,bool)', [validatorAddress,
approval
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -1469,13 +1080,7 @@ export class ExchangeContract extends BaseContract {
approval: boolean,
): string {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('setSignatureValidatorApproval(address,bool)').inputs;
- [validatorAddress,
- approval
- ] = BaseContract._formatABIDataItemList(inputAbi, [validatorAddress,
- approval
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('setSignatureValidatorApproval(address,bool)').functions.setSignatureValidatorApproval.encode([validatorAddress,
+ const abiEncodedTransactionData = self._strictEncodeArguments('setSignatureValidatorApproval(address,bool)', [validatorAddress,
approval
]);
return abiEncodedTransactionData;
@@ -1488,18 +1093,7 @@ export class ExchangeContract extends BaseContract {
): Promise<void
> {
const self = this as any as ExchangeContract;
- const functionSignature = 'setSignatureValidatorApproval(address,bool)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [validatorAddress,
- approval
- ] = BaseContract._formatABIDataItemList(inputAbi, [validatorAddress,
- approval
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [validatorAddress,
- approval
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.setSignatureValidatorApproval;
- const encodedData = ethersFunction.encode([validatorAddress,
+ const encodedData = self._strictEncodeArguments('setSignatureValidatorApproval(address,bool)', [validatorAddress,
approval
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -1512,11 +1106,12 @@ export class ExchangeContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'setSignatureValidatorApproval'}) 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('setSignatureValidatorApproval(address,bool)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<void
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public allowedValidators = {
@@ -1528,18 +1123,7 @@ export class ExchangeContract extends BaseContract {
): Promise<boolean
> {
const self = this as any as ExchangeContract;
- const functionSignature = 'allowedValidators(address,address)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [index_0,
- index_1
- ] = BaseContract._formatABIDataItemList(inputAbi, [index_0,
- index_1
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0,
- index_1
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.allowedValidators;
- const encodedData = ethersFunction.encode([index_0,
+ const encodedData = self._strictEncodeArguments('allowedValidators(address,address)', [index_0,
index_1
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -1552,11 +1136,12 @@ export class ExchangeContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'allowedValidators'}) 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('allowedValidators(address,address)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<boolean
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public marketSellOrders = {
@@ -1567,19 +1152,7 @@ export class ExchangeContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('marketSellOrders(tuple[],uint256,bytes[])').inputs;
- [orders,
- takerAssetFillAmount,
- signatures
- ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
- takerAssetFillAmount,
- signatures
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
- takerAssetFillAmount,
- signatures
- ]);
- const encodedData = self._lookupEthersInterface('marketSellOrders(tuple[],uint256,bytes[])').functions.marketSellOrders.encode([orders,
+ const encodedData = self._strictEncodeArguments('marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders,
takerAssetFillAmount,
signatures
]);
@@ -1607,15 +1180,7 @@ export class ExchangeContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('marketSellOrders(tuple[],uint256,bytes[])').inputs;
- [orders,
- takerAssetFillAmount,
- signatures
- ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
- takerAssetFillAmount,
- signatures
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('marketSellOrders(tuple[],uint256,bytes[])').functions.marketSellOrders.encode([orders,
+ const encodedData = self._strictEncodeArguments('marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders,
takerAssetFillAmount,
signatures
]);
@@ -1636,15 +1201,7 @@ export class ExchangeContract extends BaseContract {
signatures: string[],
): string {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('marketSellOrders(tuple[],uint256,bytes[])').inputs;
- [orders,
- takerAssetFillAmount,
- signatures
- ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
- takerAssetFillAmount,
- signatures
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('marketSellOrders(tuple[],uint256,bytes[])').functions.marketSellOrders.encode([orders,
+ const abiEncodedTransactionData = self._strictEncodeArguments('marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders,
takerAssetFillAmount,
signatures
]);
@@ -1659,21 +1216,7 @@ export class ExchangeContract extends BaseContract {
): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}
> {
const self = this as any as ExchangeContract;
- const functionSignature = 'marketSellOrders(tuple[],uint256,bytes[])';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [orders,
- takerAssetFillAmount,
- signatures
- ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
- takerAssetFillAmount,
- signatures
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
- takerAssetFillAmount,
- signatures
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.marketSellOrders;
- const encodedData = ethersFunction.encode([orders,
+ const encodedData = self._strictEncodeArguments('marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders,
takerAssetFillAmount,
signatures
]);
@@ -1687,11 +1230,12 @@ export class ExchangeContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'marketSellOrders'}) 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('marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public getOrdersInfo = {
@@ -1702,15 +1246,7 @@ export class ExchangeContract extends BaseContract {
): Promise<Array<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}>
> {
const self = this as any as ExchangeContract;
- const functionSignature = 'getOrdersInfo(tuple[])';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [orders
- ] = BaseContract._formatABIDataItemList(inputAbi, [orders
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [orders
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getOrdersInfo;
- const encodedData = ethersFunction.encode([orders
+ const encodedData = self._strictEncodeArguments('getOrdersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', [orders
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -1722,11 +1258,12 @@ export class ExchangeContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'getOrdersInfo'}) 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('getOrdersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<Array<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}>
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public preSigned = {
@@ -1738,18 +1275,7 @@ export class ExchangeContract extends BaseContract {
): Promise<boolean
> {
const self = this as any as ExchangeContract;
- const functionSignature = 'preSigned(bytes32,address)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [index_0,
- index_1
- ] = BaseContract._formatABIDataItemList(inputAbi, [index_0,
- index_1
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0,
- index_1
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.preSigned;
- const encodedData = ethersFunction.encode([index_0,
+ const encodedData = self._strictEncodeArguments('preSigned(bytes32,address)', [index_0,
index_1
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -1762,11 +1288,12 @@ export class ExchangeContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'preSigned'}) 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('preSigned(bytes32,address)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<boolean
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public owner = {
@@ -1776,12 +1303,7 @@ export class ExchangeContract extends BaseContract {
): Promise<string
> {
const self = this as any as ExchangeContract;
- const functionSignature = 'owner()';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, []);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.owner;
- const encodedData = ethersFunction.encode([]);
+ const encodedData = self._strictEncodeArguments('owner()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
@@ -1792,11 +1314,12 @@ export class ExchangeContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'owner'}) 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('owner()');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<string
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public isValidSignature = {
@@ -1809,21 +1332,7 @@ export class ExchangeContract extends BaseContract {
): Promise<boolean
> {
const self = this as any as ExchangeContract;
- 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
]);
@@ -1837,11 +1346,12 @@ export class ExchangeContract 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 marketBuyOrdersNoThrow = {
@@ -1852,19 +1362,7 @@ export class ExchangeContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('marketBuyOrdersNoThrow(tuple[],uint256,bytes[])').inputs;
- [orders,
- makerAssetFillAmount,
- signatures
- ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
- makerAssetFillAmount,
- signatures
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
- makerAssetFillAmount,
- signatures
- ]);
- const encodedData = self._lookupEthersInterface('marketBuyOrdersNoThrow(tuple[],uint256,bytes[])').functions.marketBuyOrdersNoThrow.encode([orders,
+ const encodedData = self._strictEncodeArguments('marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders,
makerAssetFillAmount,
signatures
]);
@@ -1892,15 +1390,7 @@ export class ExchangeContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('marketBuyOrdersNoThrow(tuple[],uint256,bytes[])').inputs;
- [orders,
- makerAssetFillAmount,
- signatures
- ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
- makerAssetFillAmount,
- signatures
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('marketBuyOrdersNoThrow(tuple[],uint256,bytes[])').functions.marketBuyOrdersNoThrow.encode([orders,
+ const encodedData = self._strictEncodeArguments('marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders,
makerAssetFillAmount,
signatures
]);
@@ -1921,15 +1411,7 @@ export class ExchangeContract extends BaseContract {
signatures: string[],
): string {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('marketBuyOrdersNoThrow(tuple[],uint256,bytes[])').inputs;
- [orders,
- makerAssetFillAmount,
- signatures
- ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
- makerAssetFillAmount,
- signatures
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('marketBuyOrdersNoThrow(tuple[],uint256,bytes[])').functions.marketBuyOrdersNoThrow.encode([orders,
+ const abiEncodedTransactionData = self._strictEncodeArguments('marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders,
makerAssetFillAmount,
signatures
]);
@@ -1944,21 +1426,7 @@ export class ExchangeContract extends BaseContract {
): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}
> {
const self = this as any as ExchangeContract;
- const functionSignature = 'marketBuyOrdersNoThrow(tuple[],uint256,bytes[])';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [orders,
- makerAssetFillAmount,
- signatures
- ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
- makerAssetFillAmount,
- signatures
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
- makerAssetFillAmount,
- signatures
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.marketBuyOrdersNoThrow;
- const encodedData = ethersFunction.encode([orders,
+ const encodedData = self._strictEncodeArguments('marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders,
makerAssetFillAmount,
signatures
]);
@@ -1972,11 +1440,12 @@ export class ExchangeContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'marketBuyOrdersNoThrow'}) 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('marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public fillOrder = {
@@ -1987,19 +1456,7 @@ export class ExchangeContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').inputs;
- [order,
- takerAssetFillAmount,
- signature
- ] = BaseContract._formatABIDataItemList(inputAbi, [order,
- takerAssetFillAmount,
- signature
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [order,
- takerAssetFillAmount,
- signature
- ]);
- const encodedData = self._lookupEthersInterface('fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').functions.fillOrder.encode([order,
+ const encodedData = self._strictEncodeArguments('fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order,
takerAssetFillAmount,
signature
]);
@@ -2027,15 +1484,7 @@ export class ExchangeContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').inputs;
- [order,
- takerAssetFillAmount,
- signature
- ] = BaseContract._formatABIDataItemList(inputAbi, [order,
- takerAssetFillAmount,
- signature
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').functions.fillOrder.encode([order,
+ const encodedData = self._strictEncodeArguments('fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order,
takerAssetFillAmount,
signature
]);
@@ -2056,15 +1505,7 @@ export class ExchangeContract extends BaseContract {
signature: string,
): string {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').inputs;
- [order,
- takerAssetFillAmount,
- signature
- ] = BaseContract._formatABIDataItemList(inputAbi, [order,
- takerAssetFillAmount,
- signature
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').functions.fillOrder.encode([order,
+ const abiEncodedTransactionData = self._strictEncodeArguments('fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order,
takerAssetFillAmount,
signature
]);
@@ -2079,21 +1520,7 @@ export class ExchangeContract extends BaseContract {
): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}
> {
const self = this as any as ExchangeContract;
- const functionSignature = 'fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [order,
- takerAssetFillAmount,
- signature
- ] = BaseContract._formatABIDataItemList(inputAbi, [order,
- takerAssetFillAmount,
- signature
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [order,
- takerAssetFillAmount,
- signature
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.fillOrder;
- const encodedData = ethersFunction.encode([order,
+ const encodedData = self._strictEncodeArguments('fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [order,
takerAssetFillAmount,
signature
]);
@@ -2107,11 +1534,12 @@ export class ExchangeContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'fillOrder'}) 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('fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public executeTransaction = {
@@ -2123,22 +1551,7 @@ export class ExchangeContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('executeTransaction(uint256,address,bytes,bytes)').inputs;
- [salt,
- signerAddress,
- data,
- signature
- ] = BaseContract._formatABIDataItemList(inputAbi, [salt,
- signerAddress,
- data,
- signature
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [salt,
- signerAddress,
- data,
- signature
- ]);
- const encodedData = self._lookupEthersInterface('executeTransaction(uint256,address,bytes,bytes)').functions.executeTransaction.encode([salt,
+ const encodedData = self._strictEncodeArguments('executeTransaction(uint256,address,bytes,bytes)', [salt,
signerAddress,
data,
signature
@@ -2169,17 +1582,7 @@ export class ExchangeContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('executeTransaction(uint256,address,bytes,bytes)').inputs;
- [salt,
- signerAddress,
- data,
- signature
- ] = BaseContract._formatABIDataItemList(inputAbi, [salt,
- signerAddress,
- data,
- signature
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('executeTransaction(uint256,address,bytes,bytes)').functions.executeTransaction.encode([salt,
+ const encodedData = self._strictEncodeArguments('executeTransaction(uint256,address,bytes,bytes)', [salt,
signerAddress,
data,
signature
@@ -2202,17 +1605,7 @@ export class ExchangeContract extends BaseContract {
signature: string,
): string {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('executeTransaction(uint256,address,bytes,bytes)').inputs;
- [salt,
- signerAddress,
- data,
- signature
- ] = BaseContract._formatABIDataItemList(inputAbi, [salt,
- signerAddress,
- data,
- signature
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('executeTransaction(uint256,address,bytes,bytes)').functions.executeTransaction.encode([salt,
+ const abiEncodedTransactionData = self._strictEncodeArguments('executeTransaction(uint256,address,bytes,bytes)', [salt,
signerAddress,
data,
signature
@@ -2229,24 +1622,7 @@ export class ExchangeContract extends BaseContract {
): Promise<void
> {
const self = this as any as ExchangeContract;
- const functionSignature = 'executeTransaction(uint256,address,bytes,bytes)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [salt,
- signerAddress,
- data,
- signature
- ] = BaseContract._formatABIDataItemList(inputAbi, [salt,
- signerAddress,
- data,
- signature
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [salt,
- signerAddress,
- data,
- signature
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.executeTransaction;
- const encodedData = ethersFunction.encode([salt,
+ const encodedData = self._strictEncodeArguments('executeTransaction(uint256,address,bytes,bytes)', [salt,
signerAddress,
data,
signature
@@ -2261,11 +1637,12 @@ export class ExchangeContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'executeTransaction'}) 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('executeTransaction(uint256,address,bytes,bytes)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<void
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public registerAssetProxy = {
@@ -2274,13 +1651,7 @@ export class ExchangeContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('registerAssetProxy(address)').inputs;
- [assetProxy
- ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxy
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [assetProxy
- ]);
- const encodedData = self._lookupEthersInterface('registerAssetProxy(address)').functions.registerAssetProxy.encode([assetProxy
+ const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -2302,11 +1673,7 @@ export class ExchangeContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('registerAssetProxy(address)').inputs;
- [assetProxy
- ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxy
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('registerAssetProxy(address)').functions.registerAssetProxy.encode([assetProxy
+ const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -2323,11 +1690,7 @@ export class ExchangeContract extends BaseContract {
assetProxy: string,
): string {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('registerAssetProxy(address)').inputs;
- [assetProxy
- ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxy
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('registerAssetProxy(address)').functions.registerAssetProxy.encode([assetProxy
+ const abiEncodedTransactionData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy
]);
return abiEncodedTransactionData;
},
@@ -2338,15 +1701,7 @@ export class ExchangeContract extends BaseContract {
): Promise<void
> {
const self = this as any as ExchangeContract;
- const functionSignature = 'registerAssetProxy(address)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [assetProxy
- ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxy
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [assetProxy
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.registerAssetProxy;
- const encodedData = ethersFunction.encode([assetProxy
+ const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -2358,11 +1713,12 @@ export class ExchangeContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'registerAssetProxy'}) 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('registerAssetProxy(address)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<void
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public getOrderInfo = {
@@ -2373,15 +1729,7 @@ export class ExchangeContract extends BaseContract {
): Promise<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}
> {
const self = this as any as ExchangeContract;
- const functionSignature = 'getOrderInfo({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [order
- ] = BaseContract._formatABIDataItemList(inputAbi, [order
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [order
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getOrderInfo;
- const encodedData = ethersFunction.encode([order
+ const encodedData = self._strictEncodeArguments('getOrderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -2393,11 +1741,12 @@ export class ExchangeContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'getOrderInfo'}) 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('getOrderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public cancelOrder = {
@@ -2406,13 +1755,7 @@ export class ExchangeContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('cancelOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').inputs;
- [order
- ] = BaseContract._formatABIDataItemList(inputAbi, [order
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [order
- ]);
- const encodedData = self._lookupEthersInterface('cancelOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').functions.cancelOrder.encode([order
+ const encodedData = self._strictEncodeArguments('cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -2434,11 +1777,7 @@ export class ExchangeContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('cancelOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').inputs;
- [order
- ] = BaseContract._formatABIDataItemList(inputAbi, [order
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('cancelOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').functions.cancelOrder.encode([order
+ const encodedData = self._strictEncodeArguments('cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -2455,11 +1794,7 @@ export class ExchangeContract extends BaseContract {
order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
): string {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('cancelOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').inputs;
- [order
- ] = BaseContract._formatABIDataItemList(inputAbi, [order
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('cancelOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').functions.cancelOrder.encode([order
+ const abiEncodedTransactionData = self._strictEncodeArguments('cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order
]);
return abiEncodedTransactionData;
},
@@ -2470,15 +1805,7 @@ export class ExchangeContract extends BaseContract {
): Promise<void
> {
const self = this as any as ExchangeContract;
- const functionSignature = 'cancelOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [order
- ] = BaseContract._formatABIDataItemList(inputAbi, [order
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [order
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.cancelOrder;
- const encodedData = ethersFunction.encode([order
+ const encodedData = self._strictEncodeArguments('cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -2490,11 +1817,12 @@ export class ExchangeContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'cancelOrder'}) 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('cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<void
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public orderEpoch = {
@@ -2506,18 +1834,7 @@ export class ExchangeContract extends BaseContract {
): Promise<BigNumber
> {
const self = this as any as ExchangeContract;
- const functionSignature = 'orderEpoch(address,address)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [index_0,
- index_1
- ] = BaseContract._formatABIDataItemList(inputAbi, [index_0,
- index_1
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0,
- index_1
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.orderEpoch;
- const encodedData = ethersFunction.encode([index_0,
+ const encodedData = self._strictEncodeArguments('orderEpoch(address,address)', [index_0,
index_1
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -2530,11 +1847,12 @@ export class ExchangeContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'orderEpoch'}) 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('orderEpoch(address,address)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<BigNumber
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public ZRX_ASSET_DATA = {
@@ -2544,12 +1862,7 @@ export class ExchangeContract extends BaseContract {
): Promise<string
> {
const self = this as any as ExchangeContract;
- const functionSignature = 'ZRX_ASSET_DATA()';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, []);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.ZRX_ASSET_DATA;
- const encodedData = ethersFunction.encode([]);
+ const encodedData = self._strictEncodeArguments('ZRX_ASSET_DATA()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
@@ -2560,11 +1873,12 @@ export class ExchangeContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'ZRX_ASSET_DATA'}) 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('ZRX_ASSET_DATA()');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<string
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public marketSellOrdersNoThrow = {
@@ -2575,19 +1889,7 @@ export class ExchangeContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('marketSellOrdersNoThrow(tuple[],uint256,bytes[])').inputs;
- [orders,
- takerAssetFillAmount,
- signatures
- ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
- takerAssetFillAmount,
- signatures
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
- takerAssetFillAmount,
- signatures
- ]);
- const encodedData = self._lookupEthersInterface('marketSellOrdersNoThrow(tuple[],uint256,bytes[])').functions.marketSellOrdersNoThrow.encode([orders,
+ const encodedData = self._strictEncodeArguments('marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders,
takerAssetFillAmount,
signatures
]);
@@ -2615,15 +1917,7 @@ export class ExchangeContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('marketSellOrdersNoThrow(tuple[],uint256,bytes[])').inputs;
- [orders,
- takerAssetFillAmount,
- signatures
- ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
- takerAssetFillAmount,
- signatures
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('marketSellOrdersNoThrow(tuple[],uint256,bytes[])').functions.marketSellOrdersNoThrow.encode([orders,
+ const encodedData = self._strictEncodeArguments('marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders,
takerAssetFillAmount,
signatures
]);
@@ -2644,15 +1938,7 @@ export class ExchangeContract extends BaseContract {
signatures: string[],
): string {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('marketSellOrdersNoThrow(tuple[],uint256,bytes[])').inputs;
- [orders,
- takerAssetFillAmount,
- signatures
- ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
- takerAssetFillAmount,
- signatures
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('marketSellOrdersNoThrow(tuple[],uint256,bytes[])').functions.marketSellOrdersNoThrow.encode([orders,
+ const abiEncodedTransactionData = self._strictEncodeArguments('marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders,
takerAssetFillAmount,
signatures
]);
@@ -2667,21 +1953,7 @@ export class ExchangeContract extends BaseContract {
): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}
> {
const self = this as any as ExchangeContract;
- const functionSignature = 'marketSellOrdersNoThrow(tuple[],uint256,bytes[])';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [orders,
- takerAssetFillAmount,
- signatures
- ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
- takerAssetFillAmount,
- signatures
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
- takerAssetFillAmount,
- signatures
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.marketSellOrdersNoThrow;
- const encodedData = ethersFunction.encode([orders,
+ const encodedData = self._strictEncodeArguments('marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders,
takerAssetFillAmount,
signatures
]);
@@ -2695,11 +1967,12 @@ export class ExchangeContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'marketSellOrdersNoThrow'}) 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('marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public EIP712_DOMAIN_HASH = {
@@ -2709,12 +1982,7 @@ export class ExchangeContract extends BaseContract {
): Promise<string
> {
const self = this as any as ExchangeContract;
- const functionSignature = 'EIP712_DOMAIN_HASH()';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, []);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.EIP712_DOMAIN_HASH;
- const encodedData = ethersFunction.encode([]);
+ const encodedData = self._strictEncodeArguments('EIP712_DOMAIN_HASH()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
@@ -2725,11 +1993,12 @@ export class ExchangeContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'EIP712_DOMAIN_HASH'}) 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('EIP712_DOMAIN_HASH()');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<string
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public marketBuyOrders = {
@@ -2740,19 +2009,7 @@ export class ExchangeContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('marketBuyOrders(tuple[],uint256,bytes[])').inputs;
- [orders,
- makerAssetFillAmount,
- signatures
- ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
- makerAssetFillAmount,
- signatures
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
- makerAssetFillAmount,
- signatures
- ]);
- const encodedData = self._lookupEthersInterface('marketBuyOrders(tuple[],uint256,bytes[])').functions.marketBuyOrders.encode([orders,
+ const encodedData = self._strictEncodeArguments('marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders,
makerAssetFillAmount,
signatures
]);
@@ -2780,15 +2037,7 @@ export class ExchangeContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('marketBuyOrders(tuple[],uint256,bytes[])').inputs;
- [orders,
- makerAssetFillAmount,
- signatures
- ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
- makerAssetFillAmount,
- signatures
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('marketBuyOrders(tuple[],uint256,bytes[])').functions.marketBuyOrders.encode([orders,
+ const encodedData = self._strictEncodeArguments('marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders,
makerAssetFillAmount,
signatures
]);
@@ -2809,15 +2058,7 @@ export class ExchangeContract extends BaseContract {
signatures: string[],
): string {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('marketBuyOrders(tuple[],uint256,bytes[])').inputs;
- [orders,
- makerAssetFillAmount,
- signatures
- ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
- makerAssetFillAmount,
- signatures
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('marketBuyOrders(tuple[],uint256,bytes[])').functions.marketBuyOrders.encode([orders,
+ const abiEncodedTransactionData = self._strictEncodeArguments('marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders,
makerAssetFillAmount,
signatures
]);
@@ -2832,21 +2073,7 @@ export class ExchangeContract extends BaseContract {
): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}
> {
const self = this as any as ExchangeContract;
- const functionSignature = 'marketBuyOrders(tuple[],uint256,bytes[])';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [orders,
- makerAssetFillAmount,
- signatures
- ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
- makerAssetFillAmount,
- signatures
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
- makerAssetFillAmount,
- signatures
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.marketBuyOrders;
- const encodedData = ethersFunction.encode([orders,
+ const encodedData = self._strictEncodeArguments('marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [orders,
makerAssetFillAmount,
signatures
]);
@@ -2860,11 +2087,12 @@ export class ExchangeContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'marketBuyOrders'}) 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('marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public currentContextAddress = {
@@ -2874,12 +2102,7 @@ export class ExchangeContract extends BaseContract {
): Promise<string
> {
const self = this as any as ExchangeContract;
- const functionSignature = 'currentContextAddress()';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, []);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.currentContextAddress;
- const encodedData = ethersFunction.encode([]);
+ const encodedData = self._strictEncodeArguments('currentContextAddress()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
@@ -2890,11 +2113,12 @@ export class ExchangeContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'currentContextAddress'}) 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('currentContextAddress()');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<string
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public transferOwnership = {
@@ -2903,13 +2127,7 @@ export class ExchangeContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
- [newOwner
- ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner
- ]);
- const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
+ const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -2931,11 +2149,7 @@ export class ExchangeContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
- [newOwner
- ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
+ const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -2952,11 +2166,7 @@ export class ExchangeContract extends BaseContract {
newOwner: string,
): string {
const self = this as any as ExchangeContract;
- const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
- [newOwner
- ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
+ const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
]);
return abiEncodedTransactionData;
},
@@ -2967,15 +2177,7 @@ export class ExchangeContract extends BaseContract {
): Promise<void
> {
const self = this as any as ExchangeContract;
- const functionSignature = 'transferOwnership(address)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [newOwner
- ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferOwnership;
- const encodedData = ethersFunction.encode([newOwner
+ const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -2987,11 +2189,12 @@ export class ExchangeContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'transferOwnership'}) 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('transferOwnership(address)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<void
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public VERSION = {
@@ -3001,12 +2204,7 @@ export class ExchangeContract extends BaseContract {
): Promise<string
> {
const self = this as any as ExchangeContract;
- const functionSignature = 'VERSION()';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, []);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.VERSION;
- const encodedData = ethersFunction.encode([]);
+ const encodedData = self._strictEncodeArguments('VERSION()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
@@ -3017,11 +2215,12 @@ export class ExchangeContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'VERSION'}) 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('VERSION()');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<string
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public static async deployFrom0xArtifactAsync(
@@ -3074,7 +2273,7 @@ export class ExchangeContract extends BaseContract {
}
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
super('Exchange', 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-wrappers/src/generated-wrappers/forwarder.ts b/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts
index 8a88431b3..530320792 100644
--- a/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts
+++ b/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts
@@ -27,31 +27,7 @@ export class ForwarderContract extends BaseContract {
txData: Partial<TxDataPayable> = {},
): Promise<string> {
const self = this as any as ForwarderContract;
- const inputAbi = self._lookupAbi('marketBuyOrdersWithEth(tuple[],uint256,bytes[],tuple[],bytes[],uint256,address)').inputs;
- [orders,
- makerAssetFillAmount,
- signatures,
- feeOrders,
- feeSignatures,
- feePercentage,
- feeRecipient
- ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
- makerAssetFillAmount,
- signatures,
- feeOrders,
- feeSignatures,
- feePercentage,
- feeRecipient
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
- makerAssetFillAmount,
- signatures,
- feeOrders,
- feeSignatures,
- feePercentage,
- feeRecipient
- ]);
- const encodedData = self._lookupEthersInterface('marketBuyOrdersWithEth(tuple[],uint256,bytes[],tuple[],bytes[],uint256,address)').functions.marketBuyOrdersWithEth.encode([orders,
+ const encodedData = self._strictEncodeArguments('marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders,
makerAssetFillAmount,
signatures,
feeOrders,
@@ -91,23 +67,7 @@ export class ForwarderContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as ForwarderContract;
- const inputAbi = self._lookupAbi('marketBuyOrdersWithEth(tuple[],uint256,bytes[],tuple[],bytes[],uint256,address)').inputs;
- [orders,
- makerAssetFillAmount,
- signatures,
- feeOrders,
- feeSignatures,
- feePercentage,
- feeRecipient
- ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
- makerAssetFillAmount,
- signatures,
- feeOrders,
- feeSignatures,
- feePercentage,
- feeRecipient
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('marketBuyOrdersWithEth(tuple[],uint256,bytes[],tuple[],bytes[],uint256,address)').functions.marketBuyOrdersWithEth.encode([orders,
+ const encodedData = self._strictEncodeArguments('marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders,
makerAssetFillAmount,
signatures,
feeOrders,
@@ -136,23 +96,7 @@ export class ForwarderContract extends BaseContract {
feeRecipient: string,
): string {
const self = this as any as ForwarderContract;
- const inputAbi = self._lookupAbi('marketBuyOrdersWithEth(tuple[],uint256,bytes[],tuple[],bytes[],uint256,address)').inputs;
- [orders,
- makerAssetFillAmount,
- signatures,
- feeOrders,
- feeSignatures,
- feePercentage,
- feeRecipient
- ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
- makerAssetFillAmount,
- signatures,
- feeOrders,
- feeSignatures,
- feePercentage,
- feeRecipient
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('marketBuyOrdersWithEth(tuple[],uint256,bytes[],tuple[],bytes[],uint256,address)').functions.marketBuyOrdersWithEth.encode([orders,
+ const abiEncodedTransactionData = self._strictEncodeArguments('marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders,
makerAssetFillAmount,
signatures,
feeOrders,
@@ -175,33 +119,7 @@ export class ForwarderContract extends BaseContract {
): Promise<[{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}, {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}]
> {
const self = this as any as ForwarderContract;
- const functionSignature = 'marketBuyOrdersWithEth(tuple[],uint256,bytes[],tuple[],bytes[],uint256,address)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [orders,
- makerAssetFillAmount,
- signatures,
- feeOrders,
- feeSignatures,
- feePercentage,
- feeRecipient
- ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
- makerAssetFillAmount,
- signatures,
- feeOrders,
- feeSignatures,
- feePercentage,
- feeRecipient
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
- makerAssetFillAmount,
- signatures,
- feeOrders,
- feeSignatures,
- feePercentage,
- feeRecipient
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.marketBuyOrdersWithEth;
- const encodedData = ethersFunction.encode([orders,
+ const encodedData = self._strictEncodeArguments('marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders,
makerAssetFillAmount,
signatures,
feeOrders,
@@ -219,11 +137,12 @@ export class ForwarderContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'marketBuyOrdersWithEth'}) 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('marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<[{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}, {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}]
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public withdrawAsset = {
@@ -233,16 +152,7 @@ export class ForwarderContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ForwarderContract;
- const inputAbi = self._lookupAbi('withdrawAsset(bytes,uint256)').inputs;
- [assetData,
- amount
- ] = BaseContract._formatABIDataItemList(inputAbi, [assetData,
- amount
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [assetData,
- amount
- ]);
- const encodedData = self._lookupEthersInterface('withdrawAsset(bytes,uint256)').functions.withdrawAsset.encode([assetData,
+ const encodedData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [assetData,
amount
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -267,13 +177,7 @@ export class ForwarderContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as ForwarderContract;
- const inputAbi = self._lookupAbi('withdrawAsset(bytes,uint256)').inputs;
- [assetData,
- amount
- ] = BaseContract._formatABIDataItemList(inputAbi, [assetData,
- amount
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('withdrawAsset(bytes,uint256)').functions.withdrawAsset.encode([assetData,
+ const encodedData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [assetData,
amount
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -292,13 +196,7 @@ export class ForwarderContract extends BaseContract {
amount: BigNumber,
): string {
const self = this as any as ForwarderContract;
- const inputAbi = self._lookupAbi('withdrawAsset(bytes,uint256)').inputs;
- [assetData,
- amount
- ] = BaseContract._formatABIDataItemList(inputAbi, [assetData,
- amount
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('withdrawAsset(bytes,uint256)').functions.withdrawAsset.encode([assetData,
+ const abiEncodedTransactionData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [assetData,
amount
]);
return abiEncodedTransactionData;
@@ -311,18 +209,7 @@ export class ForwarderContract extends BaseContract {
): Promise<void
> {
const self = this as any as ForwarderContract;
- const functionSignature = 'withdrawAsset(bytes,uint256)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [assetData,
- amount
- ] = BaseContract._formatABIDataItemList(inputAbi, [assetData,
- amount
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [assetData,
- amount
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.withdrawAsset;
- const encodedData = ethersFunction.encode([assetData,
+ const encodedData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [assetData,
amount
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -335,11 +222,12 @@ export class ForwarderContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'withdrawAsset'}) 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('withdrawAsset(bytes,uint256)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<void
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public owner = {
@@ -349,12 +237,7 @@ export class ForwarderContract extends BaseContract {
): Promise<string
> {
const self = this as any as ForwarderContract;
- const functionSignature = 'owner()';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, []);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.owner;
- const encodedData = ethersFunction.encode([]);
+ const encodedData = self._strictEncodeArguments('owner()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
@@ -365,11 +248,12 @@ export class ForwarderContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'owner'}) 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('owner()');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<string
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public marketSellOrdersWithEth = {
@@ -383,28 +267,7 @@ export class ForwarderContract extends BaseContract {
txData: Partial<TxDataPayable> = {},
): Promise<string> {
const self = this as any as ForwarderContract;
- const inputAbi = self._lookupAbi('marketSellOrdersWithEth(tuple[],bytes[],tuple[],bytes[],uint256,address)').inputs;
- [orders,
- signatures,
- feeOrders,
- feeSignatures,
- feePercentage,
- feeRecipient
- ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
- signatures,
- feeOrders,
- feeSignatures,
- feePercentage,
- feeRecipient
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
- signatures,
- feeOrders,
- feeSignatures,
- feePercentage,
- feeRecipient
- ]);
- const encodedData = self._lookupEthersInterface('marketSellOrdersWithEth(tuple[],bytes[],tuple[],bytes[],uint256,address)').functions.marketSellOrdersWithEth.encode([orders,
+ const encodedData = self._strictEncodeArguments('marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders,
signatures,
feeOrders,
feeSignatures,
@@ -441,21 +304,7 @@ export class ForwarderContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as ForwarderContract;
- const inputAbi = self._lookupAbi('marketSellOrdersWithEth(tuple[],bytes[],tuple[],bytes[],uint256,address)').inputs;
- [orders,
- signatures,
- feeOrders,
- feeSignatures,
- feePercentage,
- feeRecipient
- ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
- signatures,
- feeOrders,
- feeSignatures,
- feePercentage,
- feeRecipient
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('marketSellOrdersWithEth(tuple[],bytes[],tuple[],bytes[],uint256,address)').functions.marketSellOrdersWithEth.encode([orders,
+ const encodedData = self._strictEncodeArguments('marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders,
signatures,
feeOrders,
feeSignatures,
@@ -482,21 +331,7 @@ export class ForwarderContract extends BaseContract {
feeRecipient: string,
): string {
const self = this as any as ForwarderContract;
- const inputAbi = self._lookupAbi('marketSellOrdersWithEth(tuple[],bytes[],tuple[],bytes[],uint256,address)').inputs;
- [orders,
- signatures,
- feeOrders,
- feeSignatures,
- feePercentage,
- feeRecipient
- ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
- signatures,
- feeOrders,
- feeSignatures,
- feePercentage,
- feeRecipient
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('marketSellOrdersWithEth(tuple[],bytes[],tuple[],bytes[],uint256,address)').functions.marketSellOrdersWithEth.encode([orders,
+ const abiEncodedTransactionData = self._strictEncodeArguments('marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders,
signatures,
feeOrders,
feeSignatures,
@@ -517,30 +352,7 @@ export class ForwarderContract extends BaseContract {
): Promise<[{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}, {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}]
> {
const self = this as any as ForwarderContract;
- const functionSignature = 'marketSellOrdersWithEth(tuple[],bytes[],tuple[],bytes[],uint256,address)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [orders,
- signatures,
- feeOrders,
- feeSignatures,
- feePercentage,
- feeRecipient
- ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
- signatures,
- feeOrders,
- feeSignatures,
- feePercentage,
- feeRecipient
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
- signatures,
- feeOrders,
- feeSignatures,
- feePercentage,
- feeRecipient
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.marketSellOrdersWithEth;
- const encodedData = ethersFunction.encode([orders,
+ const encodedData = self._strictEncodeArguments('marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders,
signatures,
feeOrders,
feeSignatures,
@@ -557,11 +369,12 @@ export class ForwarderContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'marketSellOrdersWithEth'}) 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('marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<[{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}, {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}]
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public transferOwnership = {
@@ -570,13 +383,7 @@ export class ForwarderContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as ForwarderContract;
- const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
- [newOwner
- ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner
- ]);
- const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
+ const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -598,11 +405,7 @@ export class ForwarderContract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as ForwarderContract;
- const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
- [newOwner
- ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
+ const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -619,11 +422,7 @@ export class ForwarderContract extends BaseContract {
newOwner: string,
): string {
const self = this as any as ForwarderContract;
- const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
- [newOwner
- ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
+ const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
]);
return abiEncodedTransactionData;
},
@@ -634,15 +433,7 @@ export class ForwarderContract extends BaseContract {
): Promise<void
> {
const self = this as any as ForwarderContract;
- const functionSignature = 'transferOwnership(address)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [newOwner
- ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferOwnership;
- const encodedData = ethersFunction.encode([newOwner
+ const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -654,11 +445,12 @@ export class ForwarderContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'transferOwnership'}) 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('transferOwnership(address)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<void
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public static async deployFrom0xArtifactAsync(
@@ -725,7 +517,7 @@ _wethAssetData
}
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
super('Forwarder', 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-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
diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts b/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts
index 5fa6f1577..2185c7999 100644
--- a/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts
+++ b/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts
@@ -24,18 +24,7 @@ export class IWalletContract extends BaseContract {
): Promise<boolean
> {
const self = this as any as IWalletContract;
- const functionSignature = 'isValidSignature(bytes32,bytes)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [hash,
- signature
- ] = BaseContract._formatABIDataItemList(inputAbi, [hash,
- signature
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [hash,
- signature
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isValidSignature;
- const encodedData = ethersFunction.encode([hash,
+ const encodedData = self._strictEncodeArguments('isValidSignature(bytes32,bytes)', [hash,
signature
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -48,11 +37,12 @@ export class IWalletContract 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,bytes)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<boolean
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public static async deployFrom0xArtifactAsync(
@@ -98,7 +88,7 @@ export class IWalletContract extends BaseContract {
}
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
super('IWallet', 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-wrappers/src/generated-wrappers/order_validator.ts b/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts
index ce47b76fc..366b207ad 100644
--- a/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts
+++ b/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts
@@ -24,18 +24,7 @@ export class OrderValidatorContract extends BaseContract {
): Promise<[{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}, {makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}]
> {
const self = this as any as OrderValidatorContract;
- const functionSignature = 'getOrderAndTraderInfo({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},address)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [order,
- takerAddress
- ] = BaseContract._formatABIDataItemList(inputAbi, [order,
- takerAddress
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [order,
- takerAddress
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getOrderAndTraderInfo;
- const encodedData = ethersFunction.encode([order,
+ const encodedData = self._strictEncodeArguments('getOrderAndTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', [order,
takerAddress
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -48,11 +37,12 @@ export class OrderValidatorContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'getOrderAndTraderInfo'}) 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('getOrderAndTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<[{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}, {makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}]
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public getBalanceAndAllowance = {
@@ -64,18 +54,7 @@ export class OrderValidatorContract extends BaseContract {
): Promise<[BigNumber, BigNumber]
> {
const self = this as any as OrderValidatorContract;
- const functionSignature = 'getBalanceAndAllowance(address,bytes)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [target,
- assetData
- ] = BaseContract._formatABIDataItemList(inputAbi, [target,
- assetData
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [target,
- assetData
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getBalanceAndAllowance;
- const encodedData = ethersFunction.encode([target,
+ const encodedData = self._strictEncodeArguments('getBalanceAndAllowance(address,bytes)', [target,
assetData
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -88,11 +67,12 @@ export class OrderValidatorContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'getBalanceAndAllowance'}) 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('getBalanceAndAllowance(address,bytes)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<[BigNumber, BigNumber]
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public getOrdersAndTradersInfo = {
@@ -104,18 +84,7 @@ export class OrderValidatorContract extends BaseContract {
): Promise<[Array<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}>, Array<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}>]
> {
const self = this as any as OrderValidatorContract;
- const functionSignature = 'getOrdersAndTradersInfo(tuple[],address[])';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [orders,
- takerAddresses
- ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
- takerAddresses
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
- takerAddresses
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getOrdersAndTradersInfo;
- const encodedData = ethersFunction.encode([orders,
+ const encodedData = self._strictEncodeArguments('getOrdersAndTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', [orders,
takerAddresses
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -128,11 +97,12 @@ export class OrderValidatorContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'getOrdersAndTradersInfo'}) 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('getOrdersAndTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<[Array<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}>, Array<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}>]
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public getTradersInfo = {
@@ -144,18 +114,7 @@ export class OrderValidatorContract extends BaseContract {
): Promise<Array<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}>
> {
const self = this as any as OrderValidatorContract;
- const functionSignature = 'getTradersInfo(tuple[],address[])';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [orders,
- takerAddresses
- ] = BaseContract._formatABIDataItemList(inputAbi, [orders,
- takerAddresses
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [orders,
- takerAddresses
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getTradersInfo;
- const encodedData = ethersFunction.encode([orders,
+ const encodedData = self._strictEncodeArguments('getTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', [orders,
takerAddresses
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -168,11 +127,12 @@ export class OrderValidatorContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'getTradersInfo'}) 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('getTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<Array<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}>
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public getERC721TokenOwner = {
@@ -184,18 +144,7 @@ export class OrderValidatorContract extends BaseContract {
): Promise<string
> {
const self = this as any as OrderValidatorContract;
- const functionSignature = 'getERC721TokenOwner(address,uint256)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [token,
- tokenId
- ] = BaseContract._formatABIDataItemList(inputAbi, [token,
- tokenId
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [token,
- tokenId
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getERC721TokenOwner;
- const encodedData = ethersFunction.encode([token,
+ const encodedData = self._strictEncodeArguments('getERC721TokenOwner(address,uint256)', [token,
tokenId
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -208,11 +157,12 @@ export class OrderValidatorContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'getERC721TokenOwner'}) 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('getERC721TokenOwner(address,uint256)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<string
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public getBalancesAndAllowances = {
@@ -224,18 +174,7 @@ export class OrderValidatorContract extends BaseContract {
): Promise<[BigNumber[], BigNumber[]]
> {
const self = this as any as OrderValidatorContract;
- const functionSignature = 'getBalancesAndAllowances(address,bytes[])';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [target,
- assetData
- ] = BaseContract._formatABIDataItemList(inputAbi, [target,
- assetData
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [target,
- assetData
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getBalancesAndAllowances;
- const encodedData = ethersFunction.encode([target,
+ const encodedData = self._strictEncodeArguments('getBalancesAndAllowances(address,bytes[])', [target,
assetData
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -248,11 +187,12 @@ export class OrderValidatorContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'getBalancesAndAllowances'}) 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('getBalancesAndAllowances(address,bytes[])');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<[BigNumber[], BigNumber[]]
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public getTraderInfo = {
@@ -264,18 +204,7 @@ export class OrderValidatorContract extends BaseContract {
): Promise<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}
> {
const self = this as any as OrderValidatorContract;
- const functionSignature = 'getTraderInfo({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},address)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [order,
- takerAddress
- ] = BaseContract._formatABIDataItemList(inputAbi, [order,
- takerAddress
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [order,
- takerAddress
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getTraderInfo;
- const encodedData = ethersFunction.encode([order,
+ const encodedData = self._strictEncodeArguments('getTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', [order,
takerAddress
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -288,11 +217,12 @@ export class OrderValidatorContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'getTraderInfo'}) 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('getTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public static async deployFrom0xArtifactAsync(
@@ -352,7 +282,7 @@ _zrxAssetData
}
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
super('OrderValidator', 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-wrappers/src/generated-wrappers/weth9.ts b/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts
index 12ec55ae9..5af169e03 100644
--- a/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts
+++ b/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts
@@ -57,12 +57,7 @@ export class WETH9Contract extends BaseContract {
): Promise<string
> {
const self = this as any as WETH9Contract;
- 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 encodedData = self._strictEncodeArguments('name()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
@@ -73,11 +68,12 @@ export class WETH9Contract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- 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));
- return resultArray[0];
+ const abiEncoder = self._lookupAbiEncoder('name()');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<string
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public approve = {
@@ -87,16 +83,7 @@ export class WETH9Contract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as WETH9Contract;
- const inputAbi = self._lookupAbi('approve(address,uint256)').inputs;
- [guy,
- wad
- ] = BaseContract._formatABIDataItemList(inputAbi, [guy,
- wad
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [guy,
- wad
- ]);
- const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([guy,
+ const encodedData = self._strictEncodeArguments('approve(address,uint256)', [guy,
wad
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -121,13 +108,7 @@ export class WETH9Contract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as WETH9Contract;
- const inputAbi = self._lookupAbi('approve(address,uint256)').inputs;
- [guy,
- wad
- ] = BaseContract._formatABIDataItemList(inputAbi, [guy,
- wad
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([guy,
+ const encodedData = self._strictEncodeArguments('approve(address,uint256)', [guy,
wad
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -146,13 +127,7 @@ export class WETH9Contract extends BaseContract {
wad: BigNumber,
): string {
const self = this as any as WETH9Contract;
- const inputAbi = self._lookupAbi('approve(address,uint256)').inputs;
- [guy,
- wad
- ] = BaseContract._formatABIDataItemList(inputAbi, [guy,
- wad
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([guy,
+ const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [guy,
wad
]);
return abiEncodedTransactionData;
@@ -165,18 +140,7 @@ export class WETH9Contract extends BaseContract {
): Promise<boolean
> {
const self = this as any as WETH9Contract;
- const functionSignature = 'approve(address,uint256)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [guy,
- wad
- ] = BaseContract._formatABIDataItemList(inputAbi, [guy,
- wad
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [guy,
- wad
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.approve;
- const encodedData = ethersFunction.encode([guy,
+ const encodedData = self._strictEncodeArguments('approve(address,uint256)', [guy,
wad
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -189,11 +153,12 @@ export class WETH9Contract 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[0];
+ const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<boolean
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public totalSupply = {
@@ -203,12 +168,7 @@ export class WETH9Contract extends BaseContract {
): Promise<BigNumber
> {
const self = this as any as WETH9Contract;
- 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 encodedData = self._strictEncodeArguments('totalSupply()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
@@ -219,11 +179,12 @@ export class WETH9Contract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- 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));
- return resultArray[0];
+ const abiEncoder = self._lookupAbiEncoder('totalSupply()');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<BigNumber
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public transferFrom = {
@@ -234,19 +195,7 @@ export class WETH9Contract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as WETH9Contract;
- const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs;
- [src,
- dst,
- wad
- ] = BaseContract._formatABIDataItemList(inputAbi, [src,
- dst,
- wad
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [src,
- dst,
- wad
- ]);
- const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([src,
+ const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [src,
dst,
wad
]);
@@ -274,15 +223,7 @@ export class WETH9Contract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as WETH9Contract;
- const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs;
- [src,
- dst,
- wad
- ] = BaseContract._formatABIDataItemList(inputAbi, [src,
- dst,
- wad
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([src,
+ const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [src,
dst,
wad
]);
@@ -303,15 +244,7 @@ export class WETH9Contract extends BaseContract {
wad: BigNumber,
): string {
const self = this as any as WETH9Contract;
- const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs;
- [src,
- dst,
- wad
- ] = BaseContract._formatABIDataItemList(inputAbi, [src,
- dst,
- wad
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([src,
+ const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [src,
dst,
wad
]);
@@ -326,21 +259,7 @@ export class WETH9Contract extends BaseContract {
): Promise<boolean
> {
const self = this as any as WETH9Contract;
- const functionSignature = 'transferFrom(address,address,uint256)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [src,
- dst,
- wad
- ] = BaseContract._formatABIDataItemList(inputAbi, [src,
- dst,
- wad
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [src,
- dst,
- wad
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferFrom;
- const encodedData = ethersFunction.encode([src,
+ const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [src,
dst,
wad
]);
@@ -354,11 +273,12 @@ export class WETH9Contract 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[0];
+ const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<boolean
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public withdraw = {
@@ -367,13 +287,7 @@ export class WETH9Contract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as WETH9Contract;
- const inputAbi = self._lookupAbi('withdraw(uint256)').inputs;
- [wad
- ] = BaseContract._formatABIDataItemList(inputAbi, [wad
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [wad
- ]);
- const encodedData = self._lookupEthersInterface('withdraw(uint256)').functions.withdraw.encode([wad
+ const encodedData = self._strictEncodeArguments('withdraw(uint256)', [wad
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -395,11 +309,7 @@ export class WETH9Contract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as WETH9Contract;
- const inputAbi = self._lookupAbi('withdraw(uint256)').inputs;
- [wad
- ] = BaseContract._formatABIDataItemList(inputAbi, [wad
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('withdraw(uint256)').functions.withdraw.encode([wad
+ const encodedData = self._strictEncodeArguments('withdraw(uint256)', [wad
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -416,11 +326,7 @@ export class WETH9Contract extends BaseContract {
wad: BigNumber,
): string {
const self = this as any as WETH9Contract;
- const inputAbi = self._lookupAbi('withdraw(uint256)').inputs;
- [wad
- ] = BaseContract._formatABIDataItemList(inputAbi, [wad
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('withdraw(uint256)').functions.withdraw.encode([wad
+ const abiEncodedTransactionData = self._strictEncodeArguments('withdraw(uint256)', [wad
]);
return abiEncodedTransactionData;
},
@@ -431,15 +337,7 @@ export class WETH9Contract extends BaseContract {
): Promise<void
> {
const self = this as any as WETH9Contract;
- const functionSignature = 'withdraw(uint256)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [wad
- ] = BaseContract._formatABIDataItemList(inputAbi, [wad
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [wad
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.withdraw;
- const encodedData = ethersFunction.encode([wad
+ const encodedData = self._strictEncodeArguments('withdraw(uint256)', [wad
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -451,11 +349,12 @@ export class WETH9Contract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'withdraw'}) 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('withdraw(uint256)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<void
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public decimals = {
@@ -465,12 +364,7 @@ export class WETH9Contract extends BaseContract {
): Promise<number
> {
const self = this as any as WETH9Contract;
- 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 encodedData = self._strictEncodeArguments('decimals()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
@@ -481,11 +375,12 @@ export class WETH9Contract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- 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));
- return resultArray[0];
+ const abiEncoder = self._lookupAbiEncoder('decimals()');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<number
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public balanceOf = {
@@ -496,15 +391,7 @@ export class WETH9Contract extends BaseContract {
): Promise<BigNumber
> {
const self = this as any as WETH9Contract;
- const functionSignature = 'balanceOf(address)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [index_0
- ] = BaseContract._formatABIDataItemList(inputAbi, [index_0
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.balanceOf;
- const encodedData = ethersFunction.encode([index_0
+ const encodedData = self._strictEncodeArguments('balanceOf(address)', [index_0
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
@@ -516,11 +403,12 @@ export class WETH9Contract 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 symbol = {
@@ -530,12 +418,7 @@ export class WETH9Contract extends BaseContract {
): Promise<string
> {
const self = this as any as WETH9Contract;
- 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 encodedData = self._strictEncodeArguments('symbol()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
@@ -546,11 +429,12 @@ export class WETH9Contract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- 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));
- return resultArray[0];
+ const abiEncoder = self._lookupAbiEncoder('symbol()');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<string
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public transfer = {
@@ -560,16 +444,7 @@ export class WETH9Contract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as WETH9Contract;
- const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs;
- [dst,
- wad
- ] = BaseContract._formatABIDataItemList(inputAbi, [dst,
- wad
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [dst,
- wad
- ]);
- const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([dst,
+ const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [dst,
wad
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -594,13 +469,7 @@ export class WETH9Contract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as WETH9Contract;
- const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs;
- [dst,
- wad
- ] = BaseContract._formatABIDataItemList(inputAbi, [dst,
- wad
- ], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([dst,
+ const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [dst,
wad
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -619,13 +488,7 @@ export class WETH9Contract extends BaseContract {
wad: BigNumber,
): string {
const self = this as any as WETH9Contract;
- const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs;
- [dst,
- wad
- ] = BaseContract._formatABIDataItemList(inputAbi, [dst,
- wad
- ], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([dst,
+ const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [dst,
wad
]);
return abiEncodedTransactionData;
@@ -638,18 +501,7 @@ export class WETH9Contract extends BaseContract {
): Promise<boolean
> {
const self = this as any as WETH9Contract;
- const functionSignature = 'transfer(address,uint256)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [dst,
- wad
- ] = BaseContract._formatABIDataItemList(inputAbi, [dst,
- wad
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [dst,
- wad
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transfer;
- const encodedData = ethersFunction.encode([dst,
+ const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [dst,
wad
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -662,11 +514,12 @@ export class WETH9Contract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- 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));
- return resultArray[0];
+ const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<boolean
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public deposit = {
@@ -674,10 +527,7 @@ export class WETH9Contract extends BaseContract {
txData: Partial<TxDataPayable> = {},
): Promise<string> {
const self = this as any as WETH9Contract;
- const inputAbi = self._lookupAbi('deposit()').inputs;
- [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, []);
- const encodedData = self._lookupEthersInterface('deposit()').functions.deposit.encode([]);
+ const encodedData = self._strictEncodeArguments('deposit()', []);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
@@ -696,9 +546,7 @@ export class WETH9Contract extends BaseContract {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as WETH9Contract;
- const inputAbi = self._lookupAbi('deposit()').inputs;
- [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString);
- const encodedData = self._lookupEthersInterface('deposit()').functions.deposit.encode([]);
+ const encodedData = self._strictEncodeArguments('deposit()', []);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
@@ -713,9 +561,7 @@ export class WETH9Contract extends BaseContract {
getABIEncodedTransactionData(
): string {
const self = this as any as WETH9Contract;
- const inputAbi = self._lookupAbi('deposit()').inputs;
- [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString);
- const abiEncodedTransactionData = self._lookupEthersInterface('deposit()').functions.deposit.encode([]);
+ const abiEncodedTransactionData = self._strictEncodeArguments('deposit()', []);
return abiEncodedTransactionData;
},
async callAsync(
@@ -724,12 +570,7 @@ export class WETH9Contract extends BaseContract {
): Promise<void
> {
const self = this as any as WETH9Contract;
- const functionSignature = 'deposit()';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, []);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.deposit;
- const encodedData = ethersFunction.encode([]);
+ const encodedData = self._strictEncodeArguments('deposit()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
@@ -740,11 +581,12 @@ export class WETH9Contract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- const outputAbi = (_.find(self.abi, {name: 'deposit'}) 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('deposit()');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<void
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public allowance = {
@@ -756,18 +598,7 @@ export class WETH9Contract extends BaseContract {
): Promise<BigNumber
> {
const self = this as any as WETH9Contract;
- const functionSignature = 'allowance(address,address)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [index_0,
- index_1
- ] = BaseContract._formatABIDataItemList(inputAbi, [index_0,
- index_1
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0,
- index_1
- ]);
- const ethersFunction = self._lookupEthersInterface(functionSignature).functions.allowance;
- const encodedData = ethersFunction.encode([index_0,
+ const encodedData = self._strictEncodeArguments('allowance(address,address)', [index_0,
index_1
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -780,11 +611,12 @@ export class WETH9Contract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- 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));
- return resultArray[0];
+ const abiEncoder = self._lookupAbiEncoder('allowance(address,address)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<BigNumber
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public static async deployFrom0xArtifactAsync(
@@ -830,7 +662,7 @@ export class WETH9Contract extends BaseContract {
}
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
super('WETH9', 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-wrappers/src/generated-wrappers/zrx_token.ts b/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts
index 877ffd12d..4f5d7f4c5 100644
--- a/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts
+++ b/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts
@@ -43,12 +43,7 @@ export class ZRXTokenContract extends BaseContract {
): Promise<string
> {
const self = this as any as ZRXTokenContract;
- 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 encodedData = self._strictEncodeArguments('name()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
@@ -59,11 +54,12 @@ export class ZRXTokenContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- 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));
- return resultArray[0];
+ const abiEncoder = self._lookupAbiEncoder('name()');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<string
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public approve = {
@@ -73,16 +69,7 @@ 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,
- _value
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [_spender,
- _value
- ]);
- const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender,
+ const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender,
_value
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -107,13 +94,7 @@ 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 encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender,
_value
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -132,13 +113,7 @@ 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 abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_spender,
_value
]);
return abiEncodedTransactionData;
@@ -151,18 +126,7 @@ export class ZRXTokenContract extends BaseContract {
): Promise<boolean
> {
const self = this as any as ZRXTokenContract;
- const functionSignature = 'approve(address,uint256)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [_spender,
- _value
- ] = 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 encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender,
_value
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -175,11 +139,12 @@ export class ZRXTokenContract 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[0];
+ const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<boolean
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public totalSupply = {
@@ -189,12 +154,7 @@ export class ZRXTokenContract extends BaseContract {
): Promise<BigNumber
> {
const self = this as any as ZRXTokenContract;
- 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 encodedData = self._strictEncodeArguments('totalSupply()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
@@ -205,11 +165,12 @@ export class ZRXTokenContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- 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));
- return resultArray[0];
+ const abiEncoder = self._lookupAbiEncoder('totalSupply()');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<BigNumber
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public transferFrom = {
@@ -220,19 +181,7 @@ 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,
- _to,
- _value
- ], BaseContract._bigNumberToString.bind(self));
- BaseContract.strictArgumentEncodingCheck(inputAbi, [_from,
- _to,
- _value
- ]);
- const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from,
+ const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from,
_to,
_value
]);
@@ -260,15 +209,7 @@ 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 encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from,
_to,
_value
]);
@@ -289,15 +230,7 @@ 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 abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from,
_to,
_value
]);
@@ -312,21 +245,7 @@ export class ZRXTokenContract extends BaseContract {
): Promise<boolean
> {
const self = this as any as ZRXTokenContract;
- const functionSignature = 'transferFrom(address,address,uint256)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [_from,
- _to,
- _value
- ] = BaseContract._formatABIDataItemList(inputAbi, [_from,
- _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 encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from,
_to,
_value
]);
@@ -340,11 +259,12 @@ export class ZRXTokenContract 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[0];
+ const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<boolean
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public decimals = {
@@ -354,12 +274,7 @@ export class ZRXTokenContract extends BaseContract {
): Promise<number
> {
const self = this as any as ZRXTokenContract;
- 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 encodedData = self._strictEncodeArguments('decimals()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
@@ -370,11 +285,12 @@ export class ZRXTokenContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- 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));
- return resultArray[0];
+ const abiEncoder = self._lookupAbiEncoder('decimals()');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<number
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public balanceOf = {
@@ -385,15 +301,7 @@ export class ZRXTokenContract extends BaseContract {
): Promise<BigNumber
> {
const self = this as any as ZRXTokenContract;
- 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(
{
@@ -405,11 +313,12 @@ export class ZRXTokenContract 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 symbol = {
@@ -419,12 +328,7 @@ export class ZRXTokenContract extends BaseContract {
): Promise<string
> {
const self = this as any as ZRXTokenContract;
- 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 encodedData = self._strictEncodeArguments('symbol()', []);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
@@ -435,11 +339,12 @@ export class ZRXTokenContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- 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));
- return resultArray[0];
+ const abiEncoder = self._lookupAbiEncoder('symbol()');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<string
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public transfer = {
@@ -449,16 +354,7 @@ 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,
- _value
- ]);
- const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to,
+ const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to,
_value
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -483,13 +379,7 @@ 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 encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to,
_value
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -508,13 +398,7 @@ 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 abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [_to,
_value
]);
return abiEncodedTransactionData;
@@ -527,18 +411,7 @@ export class ZRXTokenContract extends BaseContract {
): Promise<boolean
> {
const self = this as any as ZRXTokenContract;
- const functionSignature = 'transfer(address,uint256)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [_to,
- _value
- ] = 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 encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to,
_value
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -551,11 +424,12 @@ export class ZRXTokenContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- 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));
- return resultArray[0];
+ const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<boolean
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public allowance = {
@@ -567,18 +441,7 @@ export class ZRXTokenContract extends BaseContract {
): Promise<BigNumber
> {
const self = this as any as ZRXTokenContract;
- const functionSignature = 'allowance(address,address)';
- const inputAbi = self._lookupAbi(functionSignature).inputs;
- [_owner,
- _spender
- ] = 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 encodedData = self._strictEncodeArguments('allowance(address,address)', [_owner,
_spender
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
@@ -591,11 +454,12 @@ export class ZRXTokenContract extends BaseContract {
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = ethersFunction.decode(rawCallResult);
- 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));
- return resultArray[0];
+ const abiEncoder = self._lookupAbiEncoder('allowance(address,address)');
+ // tslint:disable boolean-naming
+ const result = abiEncoder.strictDecodeReturnValue<BigNumber
+ >(rawCallResult);
+ // tslint:enable boolean-naming
+ return result;
},
};
public static async deployFrom0xArtifactAsync(
@@ -641,7 +505,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
diff --git a/packages/abi-gen/src/index.ts b/packages/abi-gen/src/index.ts
index 5bad920ca..6e0ca2c87 100644
--- a/packages/abi-gen/src/index.ts
+++ b/packages/abi-gen/src/index.ts
@@ -1,6 +1,6 @@
#!/usr/bin/env node
-import { abiUtils, logUtils } from '@0x/utils';
+import { AbiEncoder, abiUtils, logUtils } from '@0x/utils';
import chalk from 'chalk';
import { AbiDefinition, ConstructorAbi, EventAbi, MethodAbi } from 'ethereum-types';
import { sync as globSync } from 'glob';
@@ -133,7 +133,7 @@ for (const abiFileName of abiFileNames) {
singleReturnValue: methodAbi.outputs.length === 1,
hasReturnValue: methodAbi.outputs.length !== 0,
tsName: sanitizedMethodAbis[methodAbiIndex].name,
- functionSignature: abiUtils.getFunctionSignature(methodAbi),
+ functionSignature: new AbiEncoder.Method(methodAbi).getSignature(),
};
return methodData;
});
diff --git a/packages/base-contract/src/index.ts b/packages/base-contract/src/index.ts
index fbb8478b7..c2b7b943b 100644
--- a/packages/base-contract/src/index.ts
+++ b/packages/base-contract/src/index.ts
@@ -1,4 +1,4 @@
-import { abiUtils, BigNumber } from '@0x/utils';
+import { AbiEncoder, abiUtils } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import {
AbiDefinition,
@@ -16,8 +16,8 @@ import * as _ from 'lodash';
import { formatABIDataItem } from './utils';
-export interface EthersInterfaceByFunctionSignature {
- [key: string]: ethers.utils.Interface;
+export interface AbiEncoderByFunctionSignature {
+ [key: string]: AbiEncoder.Method;
}
const REVERT_ERROR_SELECTOR = '08c379a0';
@@ -26,7 +26,7 @@ const REVERT_ERROR_SELECTOR_BYTES_LENGTH = 4;
const REVERT_ERROR_SELECTOR_END = REVERT_ERROR_SELECTOR_OFFSET + REVERT_ERROR_SELECTOR_BYTES_LENGTH * 2;
export class BaseContract {
- protected _ethersInterfacesByFunctionSignature: EthersInterfaceByFunctionSignature;
+ protected _abiEncoderByFunctionSignature: AbiEncoderByFunctionSignature;
protected _web3Wrapper: Web3Wrapper;
public abi: ContractAbi;
public address: string;
@@ -65,9 +65,6 @@ export class BaseContract {
return defaultConstructorAbi;
}
}
- protected static _bnToBigNumber(_type: string, value: any): any {
- return _.isObject(value) && value._hex ? new BigNumber(value.toString()) : value;
- }
protected static async _applyDefaultsToTxDataAsync<T extends Partial<TxData | TxDataPayable>>(
txData: T,
txDefaults: Partial<TxData>,
@@ -89,10 +86,15 @@ export class BaseContract {
}
protected static _throwIfRevertWithReasonCallResult(rawCallResult: string): void {
if (rawCallResult.slice(REVERT_ERROR_SELECTOR_OFFSET, REVERT_ERROR_SELECTOR_END) === REVERT_ERROR_SELECTOR) {
- const revertReason = ethers.utils.defaultAbiCoder.decode(
- ['string'],
+ const revertReasonArray = AbiEncoder.create('(string)').decodeAsArray(
ethers.utils.hexDataSlice(rawCallResult, REVERT_ERROR_SELECTOR_BYTES_LENGTH),
);
+ if (revertReasonArray.length !== 1) {
+ throw new Error(
+ `Cannot safely decode revert reason: Expected an array with one element, got ${revertReasonArray}`,
+ );
+ }
+ const revertReason = revertReasonArray[0];
throw new Error(revertReason);
}
}
@@ -100,11 +102,11 @@ export class BaseContract {
// the given inputAbi. An argument may not be considered safely encodeable
// if it overflows the corresponding Solidity type, there is a bug in the
// encoder, or the encoder performs unsafe type coercion.
- public static strictArgumentEncodingCheck(inputAbi: DataItem[], args: any[]): void {
- const coder = new ethers.utils.AbiCoder();
+ public static strictArgumentEncodingCheck(inputAbi: DataItem[], args: any[]): string {
+ const abiEncoder = AbiEncoder.create(inputAbi);
const params = abiUtils.parseEthersParams(inputAbi);
- const rawEncoded = coder.encode(inputAbi, args);
- const rawDecoded = coder.decode(inputAbi, rawEncoded);
+ const rawEncoded = abiEncoder.encode(args);
+ const rawDecoded = abiEncoder.decodeAsArray(rawEncoded);
for (let i = 0; i < rawDecoded.length; i++) {
const original = args[i];
const decoded = rawDecoded[i];
@@ -116,13 +118,14 @@ export class BaseContract {
);
}
}
+ return rawEncoded;
}
- protected _lookupEthersInterface(functionSignature: string): ethers.utils.Interface {
- const ethersInterface = this._ethersInterfacesByFunctionSignature[functionSignature];
- if (_.isUndefined(ethersInterface)) {
+ protected _lookupAbiEncoder(functionSignature: string): AbiEncoder.Method {
+ const abiEncoder = this._abiEncoderByFunctionSignature[functionSignature];
+ if (_.isUndefined(abiEncoder)) {
throw new Error(`Failed to lookup method with function signature '${functionSignature}'`);
}
- return ethersInterface;
+ return abiEncoder;
}
protected _lookupAbi(functionSignature: string): MethodAbi {
const methodAbi = _.find(this.abi, (abiDefinition: AbiDefinition) => {
@@ -130,7 +133,7 @@ export class BaseContract {
return false;
}
// tslint:disable-next-line:no-unnecessary-type-assertion
- const abiFunctionSignature = abiUtils.getFunctionSignature(abiDefinition as MethodAbi);
+ const abiFunctionSignature = new AbiEncoder.Method(abiDefinition as MethodAbi).getSignature();
if (abiFunctionSignature === functionSignature) {
return true;
}
@@ -138,6 +141,15 @@ export class BaseContract {
}) as MethodAbi;
return methodAbi;
}
+ protected _strictEncodeArguments(functionSignature: string, functionArguments: any): string {
+ const abiEncoder = this._lookupAbiEncoder(functionSignature);
+ const inputAbi = abiEncoder.getDataItem().components;
+ if (inputAbi === undefined) {
+ throw new Error(`Undefined Method Input ABI`);
+ }
+ const abiEncodedArguments = abiEncoder.encode(functionArguments);
+ return abiEncodedArguments;
+ }
constructor(
contractName: string,
abi: ContractAbi,
@@ -152,10 +164,11 @@ export class BaseContract {
const methodAbis = this.abi.filter(
(abiDefinition: AbiDefinition) => abiDefinition.type === AbiType.Function,
) as MethodAbi[];
- this._ethersInterfacesByFunctionSignature = {};
+ this._abiEncoderByFunctionSignature = {};
_.each(methodAbis, methodAbi => {
- const functionSignature = abiUtils.getFunctionSignature(methodAbi);
- this._ethersInterfacesByFunctionSignature[functionSignature] = new ethers.utils.Interface([methodAbi]);
+ const abiEncoder = new AbiEncoder.Method(methodAbi);
+ const functionSignature = abiEncoder.getSignature();
+ this._abiEncoderByFunctionSignature[functionSignature] = abiEncoder;
});
}
}
diff --git a/packages/utils/src/abi_encoder/abstract_data_types/data_type.ts b/packages/utils/src/abi_encoder/abstract_data_types/data_type.ts
index 13cc87e2a..f23324721 100644
--- a/packages/utils/src/abi_encoder/abstract_data_types/data_type.ts
+++ b/packages/utils/src/abi_encoder/abstract_data_types/data_type.ts
@@ -51,8 +51,26 @@ export abstract class DataType {
return value;
}
+ public decodeAsArray(returndata: string, rules?: DecodingRules): any[] {
+ const value = this.decode(returndata, rules);
+ const valuesAsArray = _.isObject(value) ? _.values(value) : [value];
+ return valuesAsArray;
+ }
+
+ public getSignature(isDetailed?: boolean): string {
+ if (_.isEmpty(this._dataItem.name) || !isDetailed) {
+ return this.getSignatureType();
+ }
+ const name = this.getDataItem().name;
+ const lastIndexOfScopeDelimiter = name.lastIndexOf('.');
+ const isScopedName = !_.isUndefined(lastIndexOfScopeDelimiter) && lastIndexOfScopeDelimiter > 0;
+ const shortName = isScopedName ? name.substr((lastIndexOfScopeDelimiter as number) + 1) : name;
+ const detailedSignature = `${shortName} ${this.getSignatureType()}`;
+ return detailedSignature;
+ }
+
public abstract generateCalldataBlock(value: any, parentBlock?: CalldataBlock): CalldataBlock;
public abstract generateValue(calldata: RawCalldata, rules: DecodingRules): any;
- public abstract getSignature(): string;
+ public abstract getSignatureType(): string;
public abstract isStatic(): boolean;
}
diff --git a/packages/utils/src/abi_encoder/abstract_data_types/types/set.ts b/packages/utils/src/abi_encoder/abstract_data_types/types/set.ts
index 00059a4b6..2c6c4b0f6 100644
--- a/packages/utils/src/abi_encoder/abstract_data_types/types/set.ts
+++ b/packages/utils/src/abi_encoder/abstract_data_types/types/set.ts
@@ -1,3 +1,4 @@
+import { ObjectMap } from '@0x/types';
import { DataItem } from 'ethereum-types';
import * as ethUtil from 'ethereumjs-util';
import * as _ from 'lodash';
@@ -134,31 +135,26 @@ export abstract class AbstractSetDataType extends DataType {
const block = new SetCalldataBlock(this.getDataItem().name, this.getSignature(), parentName);
// Create blocks for members of set.
const memberCalldataBlocks: CalldataBlock[] = [];
- const childMap = _.cloneDeep(this._memberIndexByName);
- _.forOwn(obj, (value: any, key: string) => {
- if (!(key in childMap)) {
+ _.forEach(this._memberIndexByName, (memberIndex: number, memberName: string) => {
+ if (!(memberName in obj)) {
throw new Error(
- `Could not assign tuple to object: unrecognized key '${key}' in object ${this.getDataItem().name}`,
+ `Could not assign tuple to object: missing key '${memberName}' in object ${JSON.stringify(obj)}`,
);
}
- const memberBlock = this._members[this._memberIndexByName[key]].generateCalldataBlock(value, block);
+ const memberValue: any = (obj as ObjectMap<any>)[memberName];
+ const memberBlock = this._members[memberIndex].generateCalldataBlock(memberValue, block);
memberCalldataBlocks.push(memberBlock);
- delete childMap[key];
});
- // Sanity check that all members have been included.
- if (Object.keys(childMap).length !== 0) {
- throw new Error(`Could not assign tuple to object: missing keys ${Object.keys(childMap)}`);
- }
// Associate member blocks with Set block.
block.setMembers(memberCalldataBlocks);
return block;
}
- protected _computeSignatureOfMembers(): string {
+ protected _computeSignatureOfMembers(isDetailed?: boolean): string {
// Compute signature of members
let signature = `(`;
_.each(this._members, (member: DataType, i: number) => {
- signature += member.getSignature();
+ signature += member.getSignature(isDetailed);
if (i < this._members.length - 1) {
signature += ',';
}
@@ -179,17 +175,27 @@ export abstract class AbstractSetDataType extends DataType {
// Create one member for each component of `dataItem`
const members: DataType[] = [];
const memberIndexByName: MemberIndexByName = {};
+ const memberNames: string[] = [];
_.each(dataItem.components, (memberItem: DataItem) => {
+ // If a component with `name` already exists then
+ // rename to `name_nameIdx` to avoid naming conflicts.
+ let memberName = memberItem.name;
+ let nameIdx = 0;
+ while (_.includes(memberNames, memberName) || _.isEmpty(memberName)) {
+ nameIdx++;
+ memberName = `${memberItem.name}_${nameIdx}`;
+ }
+ memberNames.push(memberName);
const childDataItem: DataItem = {
type: memberItem.type,
- name: `${dataItem.name}.${memberItem.name}`,
+ name: `${dataItem.name}.${memberName}`,
};
const components = memberItem.components;
if (!_.isUndefined(components)) {
childDataItem.components = components;
}
const child = this.getFactory().create(childDataItem, this);
- memberIndexByName[memberItem.name] = members.length;
+ memberIndexByName[memberName] = members.length;
members.push(child);
});
return [members, memberIndexByName];
diff --git a/packages/utils/src/abi_encoder/evm_data_type_factory.ts b/packages/utils/src/abi_encoder/evm_data_type_factory.ts
index 4cc124e0a..268649148 100644
--- a/packages/utils/src/abi_encoder/evm_data_type_factory.ts
+++ b/packages/utils/src/abi_encoder/evm_data_type_factory.ts
@@ -2,6 +2,8 @@
import { DataItem, MethodAbi } from 'ethereum-types';
import * as _ from 'lodash';
+import { generateDataItemsFromSignature } from './utils/signature_parser';
+
import { DataType } from './abstract_data_types/data_type';
import { DataTypeFactory } from './abstract_data_types/interfaces';
import { AddressDataType } from './evm_data_types/address';
@@ -129,4 +131,35 @@ export class EvmDataTypeFactory implements DataTypeFactory {
private constructor() {}
}
+
+/**
+ * Convenience function for creating a DataType from different inputs.
+ * @param input A single or set of DataItem or a DataType signature.
+ * A signature in the form of '<type>' is interpreted as a `DataItem`
+ * For example, 'string' is interpreted as {type: 'string'}
+ * A signature in the form '(<type1>, <type2>, ..., <typen>)' is interpreted as `DataItem[]`
+ * For eaxmple, '(string, uint256)' is interpreted as [{type: 'string'}, {type: 'uint256'}]
+ * @return DataType corresponding to input.
+ */
+export function create(input: DataItem | DataItem[] | string): DataType {
+ // Handle different types of input
+ const isSignature = typeof input === 'string';
+ const isTupleSignature = isSignature && (input as string).startsWith('(');
+ const shouldParseAsTuple = isTupleSignature || _.isArray(input);
+ // Create input `dataItem`
+ let dataItem: DataItem;
+ if (shouldParseAsTuple) {
+ const dataItems = isSignature ? generateDataItemsFromSignature(input as string) : (input as DataItem[]);
+ dataItem = {
+ name: '',
+ type: 'tuple',
+ components: dataItems,
+ };
+ } else {
+ dataItem = isSignature ? generateDataItemsFromSignature(input as string)[0] : (input as DataItem);
+ }
+ // Create data type
+ const dataType = EvmDataTypeFactory.getInstance().create(dataItem);
+ return dataType;
+}
/* tslint:enable no-construct */
diff --git a/packages/utils/src/abi_encoder/evm_data_types/address.ts b/packages/utils/src/abi_encoder/evm_data_types/address.ts
index 2e3a206c6..2278830eb 100644
--- a/packages/utils/src/abi_encoder/evm_data_types/address.ts
+++ b/packages/utils/src/abi_encoder/evm_data_types/address.ts
@@ -39,10 +39,11 @@ export class AddressDataType extends AbstractBlobDataType {
const valueBufPadded = calldata.popWord();
const valueBuf = valueBufPadded.slice(AddressDataType._DECODED_ADDRESS_OFFSET_IN_BYTES);
const value = ethUtil.bufferToHex(valueBuf);
- return value;
+ const valueLowercase = _.toLower(value);
+ return valueLowercase;
}
- public getSignature(): string {
+ public getSignatureType(): string {
return SolidityTypes.Address;
}
/* tslint:enable prefer-function-over-method */
diff --git a/packages/utils/src/abi_encoder/evm_data_types/array.ts b/packages/utils/src/abi_encoder/evm_data_types/array.ts
index 7595cb667..d9607f47e 100644
--- a/packages/utils/src/abi_encoder/evm_data_types/array.ts
+++ b/packages/utils/src/abi_encoder/evm_data_types/array.ts
@@ -7,7 +7,6 @@ import { constants } from '../utils/constants';
export class ArrayDataType extends AbstractSetDataType {
private static readonly _MATCHER = RegExp('^(.+)\\[([0-9]*)\\]$');
- private readonly _arraySignature: string;
private readonly _elementType: string;
public static matchType(type: string): boolean {
@@ -35,25 +34,36 @@ export class ArrayDataType extends AbstractSetDataType {
super(dataItem, dataTypeFactory, isArray, arrayLength, arrayElementType);
// Set array properties
this._elementType = arrayElementType;
- this._arraySignature = this._computeSignature();
}
- public getSignature(): string {
- return this._arraySignature;
+ public getSignatureType(): string {
+ return this._computeSignature(false);
}
- private _computeSignature(): string {
+ public getSignature(isDetailed?: boolean): string {
+ if (_.isEmpty(this.getDataItem().name) || !isDetailed) {
+ return this.getSignatureType();
+ }
+ const name = this.getDataItem().name;
+ const lastIndexOfScopeDelimiter = name.lastIndexOf('.');
+ const isScopedName = !_.isUndefined(lastIndexOfScopeDelimiter) && lastIndexOfScopeDelimiter > 0;
+ const shortName = isScopedName ? name.substr((lastIndexOfScopeDelimiter as number) + 1) : name;
+ const detailedSignature = `${shortName} ${this._computeSignature(isDetailed)}`;
+ return detailedSignature;
+ }
+
+ private _computeSignature(isDetailed?: boolean): string {
// Compute signature for a single array element
const elementDataItem: DataItem = {
type: this._elementType,
- name: 'N/A',
+ name: '',
};
const elementComponents = this.getDataItem().components;
if (!_.isUndefined(elementComponents)) {
elementDataItem.components = elementComponents;
}
const elementDataType = this.getFactory().create(elementDataItem);
- const elementSignature = elementDataType.getSignature();
+ const elementSignature = elementDataType.getSignature(isDetailed);
// Construct signature for array of type `element`
if (_.isUndefined(this._arrayLength)) {
return `${elementSignature}[]`;
diff --git a/packages/utils/src/abi_encoder/evm_data_types/bool.ts b/packages/utils/src/abi_encoder/evm_data_types/bool.ts
index d713d5a94..7f91f34e6 100644
--- a/packages/utils/src/abi_encoder/evm_data_types/bool.ts
+++ b/packages/utils/src/abi_encoder/evm_data_types/bool.ts
@@ -46,7 +46,7 @@ export class BoolDataType extends AbstractBlobDataType {
return value;
}
- public getSignature(): string {
+ public getSignatureType(): string {
return SolidityTypes.Bool;
}
/* tslint:enable prefer-function-over-method */
diff --git a/packages/utils/src/abi_encoder/evm_data_types/dynamic_bytes.ts b/packages/utils/src/abi_encoder/evm_data_types/dynamic_bytes.ts
index 5277efd6c..fa38b63c0 100644
--- a/packages/utils/src/abi_encoder/evm_data_types/dynamic_bytes.ts
+++ b/packages/utils/src/abi_encoder/evm_data_types/dynamic_bytes.ts
@@ -65,7 +65,7 @@ export class DynamicBytesDataType extends AbstractBlobDataType {
return value;
}
- public getSignature(): string {
+ public getSignatureType(): string {
return SolidityTypes.Bytes;
}
/* tslint:enable prefer-function-over-method */
diff --git a/packages/utils/src/abi_encoder/evm_data_types/int.ts b/packages/utils/src/abi_encoder/evm_data_types/int.ts
index f1dcf5ea1..8d98e195b 100644
--- a/packages/utils/src/abi_encoder/evm_data_types/int.ts
+++ b/packages/utils/src/abi_encoder/evm_data_types/int.ts
@@ -47,13 +47,17 @@ export class IntDataType extends AbstractBlobDataType {
return encodedValue;
}
- public decodeValue(calldata: RawCalldata): BigNumber {
+ public decodeValue(calldata: RawCalldata): BigNumber | number {
const valueBuf = calldata.popWord();
const value = EncoderMath.safeDecodeNumericValue(valueBuf, this._minValue, this._maxValue);
+ const numberOfBytesInUint8 = 8;
+ if (this._width === numberOfBytesInUint8) {
+ return value.toNumber();
+ }
return value;
}
- public getSignature(): string {
+ public getSignatureType(): string {
return `${SolidityTypes.Int}${this._width}`;
}
}
diff --git a/packages/utils/src/abi_encoder/evm_data_types/method.ts b/packages/utils/src/abi_encoder/evm_data_types/method.ts
index b1cd1377f..c852a0fdf 100644
--- a/packages/utils/src/abi_encoder/evm_data_types/method.ts
+++ b/packages/utils/src/abi_encoder/evm_data_types/method.ts
@@ -44,7 +44,20 @@ export class MethodDataType extends AbstractSetDataType {
return returnValues;
}
- public getSignature(): string {
+ public strictDecodeReturnValue<T>(returndata: string, rules?: DecodingRules): T {
+ const returnValues = this._returnDataType.decode(returndata, rules);
+ const returnValuesAsArray: any = _.isObject(returnValues) ? _.values(returnValues) : [returnValues];
+ switch (returnValuesAsArray.length) {
+ case 0:
+ return undefined as any;
+ case 1:
+ return returnValuesAsArray[0];
+ default:
+ return returnValuesAsArray;
+ }
+ }
+
+ public getSignatureType(): string {
return this._methodSignature;
}
diff --git a/packages/utils/src/abi_encoder/evm_data_types/pointer.ts b/packages/utils/src/abi_encoder/evm_data_types/pointer.ts
index 389e75927..250db7c64 100644
--- a/packages/utils/src/abi_encoder/evm_data_types/pointer.ts
+++ b/packages/utils/src/abi_encoder/evm_data_types/pointer.ts
@@ -11,7 +11,11 @@ export class PointerDataType extends AbstractPointerDataType {
super(dataItem, dataTypeFactory, destDataType, parentDataType);
}
- public getSignature(): string {
- return this._destination.getSignature();
+ public getSignatureType(): string {
+ return this._destination.getSignature(false);
+ }
+
+ public getSignature(isDetailed?: boolean): string {
+ return this._destination.getSignature(isDetailed);
}
}
diff --git a/packages/utils/src/abi_encoder/evm_data_types/static_bytes.ts b/packages/utils/src/abi_encoder/evm_data_types/static_bytes.ts
index 2e371c505..cbf1957d7 100644
--- a/packages/utils/src/abi_encoder/evm_data_types/static_bytes.ts
+++ b/packages/utils/src/abi_encoder/evm_data_types/static_bytes.ts
@@ -36,7 +36,7 @@ export class StaticBytesDataType extends AbstractBlobDataType {
this._width = StaticBytesDataType._decodeWidthFromType(dataItem.type);
}
- public getSignature(): string {
+ public getSignatureType(): string {
// Note that `byte` reduces to `bytes1`
return `${SolidityTypes.Bytes}${this._width}`;
}
diff --git a/packages/utils/src/abi_encoder/evm_data_types/string.ts b/packages/utils/src/abi_encoder/evm_data_types/string.ts
index 91a72ad3f..97ac46442 100644
--- a/packages/utils/src/abi_encoder/evm_data_types/string.ts
+++ b/packages/utils/src/abi_encoder/evm_data_types/string.ts
@@ -52,7 +52,7 @@ export class StringDataType extends AbstractBlobDataType {
return value;
}
- public getSignature(): string {
+ public getSignatureType(): string {
return SolidityTypes.String;
}
/* tslint:enable prefer-function-over-method */
diff --git a/packages/utils/src/abi_encoder/evm_data_types/tuple.ts b/packages/utils/src/abi_encoder/evm_data_types/tuple.ts
index 31593c882..5000c85e8 100644
--- a/packages/utils/src/abi_encoder/evm_data_types/tuple.ts
+++ b/packages/utils/src/abi_encoder/evm_data_types/tuple.ts
@@ -1,11 +1,10 @@
import { DataItem, SolidityTypes } from 'ethereum-types';
+import * as _ from 'lodash';
import { DataTypeFactory } from '../abstract_data_types/interfaces';
import { AbstractSetDataType } from '../abstract_data_types/types/set';
export class TupleDataType extends AbstractSetDataType {
- private readonly _signature: string;
-
public static matchType(type: string): boolean {
return type === SolidityTypes.Tuple;
}
@@ -15,10 +14,21 @@ export class TupleDataType extends AbstractSetDataType {
if (!TupleDataType.matchType(dataItem.type)) {
throw new Error(`Tried to instantiate Tuple with bad input: ${dataItem}`);
}
- this._signature = this._computeSignatureOfMembers();
}
- public getSignature(): string {
- return this._signature;
+ public getSignatureType(): string {
+ return this._computeSignatureOfMembers(false);
+ }
+
+ public getSignature(isDetailed?: boolean): string {
+ if (_.isEmpty(this.getDataItem().name) || !isDetailed) {
+ return this.getSignatureType();
+ }
+ const name = this.getDataItem().name;
+ const lastIndexOfScopeDelimiter = name.lastIndexOf('.');
+ const isScopedName = !_.isUndefined(lastIndexOfScopeDelimiter) && lastIndexOfScopeDelimiter > 0;
+ const shortName = isScopedName ? name.substr((lastIndexOfScopeDelimiter as number) + 1) : name;
+ const detailedSignature = `${shortName} ${this._computeSignatureOfMembers(isDetailed)}`;
+ return detailedSignature;
}
}
diff --git a/packages/utils/src/abi_encoder/evm_data_types/uint.ts b/packages/utils/src/abi_encoder/evm_data_types/uint.ts
index 5180f0cf3..8e382e8dc 100644
--- a/packages/utils/src/abi_encoder/evm_data_types/uint.ts
+++ b/packages/utils/src/abi_encoder/evm_data_types/uint.ts
@@ -46,13 +46,17 @@ export class UIntDataType extends AbstractBlobDataType {
return encodedValue;
}
- public decodeValue(calldata: RawCalldata): BigNumber {
+ public decodeValue(calldata: RawCalldata): BigNumber | number {
const valueBuf = calldata.popWord();
const value = EncoderMath.safeDecodeNumericValue(valueBuf, UIntDataType._MIN_VALUE, this._maxValue);
+ const numberOfBytesInUint8 = 8;
+ if (this._width === numberOfBytesInUint8) {
+ return value.toNumber();
+ }
return value;
}
- public getSignature(): string {
+ public getSignatureType(): string {
return `${SolidityTypes.Uint}${this._width}`;
}
}
diff --git a/packages/utils/src/abi_encoder/index.ts b/packages/utils/src/abi_encoder/index.ts
index baf844ac6..cfacfe075 100644
--- a/packages/utils/src/abi_encoder/index.ts
+++ b/packages/utils/src/abi_encoder/index.ts
@@ -11,4 +11,6 @@ export {
String,
Tuple,
UInt,
+ create,
} from './evm_data_type_factory';
+export { DataType } from './abstract_data_types/data_type';
diff --git a/packages/utils/src/abi_encoder/utils/constants.ts b/packages/utils/src/abi_encoder/utils/constants.ts
index 36de2dd4f..fc586f295 100644
--- a/packages/utils/src/abi_encoder/utils/constants.ts
+++ b/packages/utils/src/abi_encoder/utils/constants.ts
@@ -11,7 +11,7 @@ export const constants = {
HEX_SELECTOR_BYTE_OFFSET_IN_CALLDATA: 0,
// Disable no-object-literal-type-assertion so we can enforce cast
/* tslint:disable no-object-literal-type-assertion */
- DEFAULT_DECODING_RULES: { shouldConvertStructsToObjects: false } as DecodingRules,
+ DEFAULT_DECODING_RULES: { shouldConvertStructsToObjects: true } as DecodingRules,
DEFAULT_ENCODING_RULES: { shouldOptimize: true, shouldAnnotate: false } as EncodingRules,
/* tslint:enable no-object-literal-type-assertion */
};
diff --git a/packages/utils/src/abi_encoder/utils/signature_parser.ts b/packages/utils/src/abi_encoder/utils/signature_parser.ts
new file mode 100644
index 000000000..315784cea
--- /dev/null
+++ b/packages/utils/src/abi_encoder/utils/signature_parser.ts
@@ -0,0 +1,101 @@
+import { DataItem } from 'ethereum-types';
+import * as _ from 'lodash';
+
+/**
+ * Returns an array of DataItem's corresponding to the input signature.
+ * A signature can be in two forms: '<DataItem.type>' or '(<DataItem1.type>, <DataItem2.type>, ...)
+ * An example of the first form would be 'address' or 'uint256'
+ * An example of the second form would be '(address, uint256)'
+ * Signatures can also include a name field, for example: 'foo address' or '(foo address, bar uint256)'
+ * @param signature of input DataItems
+ * @return DataItems derived from input signature
+ */
+export function generateDataItemsFromSignature(signature: string): DataItem[] {
+ let trimmedSignature = signature;
+ if (signature.startsWith('(')) {
+ if (!signature.endsWith(')')) {
+ throw new Error(`Failed to generate data item. Must end with ')'`);
+ }
+ trimmedSignature = signature.substr(1, signature.length - 2);
+ }
+ trimmedSignature += ',';
+ let isCurrTokenArray = false;
+ let currTokenArrayModifier = '';
+ let isParsingArrayModifier = false;
+ let currToken = '';
+ let parenCount = 0;
+ let currTokenName = '';
+ const dataItems: DataItem[] = [];
+ for (const char of trimmedSignature) {
+ // Tokenize the type string while keeping track of parentheses.
+ switch (char) {
+ case '(':
+ parenCount += 1;
+ currToken += char;
+ break;
+ case ')':
+ parenCount -= 1;
+ currToken += char;
+ break;
+ case '[':
+ if (parenCount === 0) {
+ isParsingArrayModifier = true;
+ isCurrTokenArray = true;
+ currTokenArrayModifier += '[';
+ } else {
+ currToken += char;
+ }
+ break;
+ case ']':
+ if (parenCount === 0) {
+ isParsingArrayModifier = false;
+ currTokenArrayModifier += ']';
+ } else {
+ currToken += char;
+ }
+ break;
+ case ' ':
+ if (parenCount === 0) {
+ currTokenName = currToken;
+ currToken = '';
+ } else {
+ currToken += char;
+ }
+ break;
+ case ',':
+ if (parenCount === 0) {
+ // Generate new DataItem from token
+ const components = currToken.startsWith('(') ? generateDataItemsFromSignature(currToken) : [];
+ const isTuple = !_.isEmpty(components);
+ const dataItem: DataItem = { name: currTokenName, type: '' };
+ if (isTuple) {
+ dataItem.type = 'tuple';
+ dataItem.components = components;
+ } else {
+ dataItem.type = currToken;
+ }
+ if (isCurrTokenArray) {
+ dataItem.type += currTokenArrayModifier;
+ }
+ dataItems.push(dataItem);
+ // reset token state
+ currTokenName = '';
+ currToken = '';
+ isCurrTokenArray = false;
+ currTokenArrayModifier = '';
+ break;
+ } else {
+ currToken += char;
+ break;
+ }
+ default:
+ if (isParsingArrayModifier) {
+ currTokenArrayModifier += char;
+ } else {
+ currToken += char;
+ }
+ break;
+ }
+ }
+ return dataItems;
+}
diff --git a/packages/utils/test/abi_encoder/evm_data_types_test.ts b/packages/utils/test/abi_encoder/evm_data_types_test.ts
index 55d582d10..54d536a7e 100644
--- a/packages/utils/test/abi_encoder/evm_data_types_test.ts
+++ b/packages/utils/test/abi_encoder/evm_data_types_test.ts
@@ -26,6 +26,10 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
// Decode Encoded Args and validate result
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
+ // Validate signature
+ const dataTypeFromSignature = AbiEncoder.create(dataType.getSignature(true));
+ const argsEncodedFromSignature = dataTypeFromSignature.encode(args);
+ expect(argsEncodedFromSignature).to.be.deep.equal(expectedEncodedArgs);
});
it('Dynamic size; Static elements', async () => {
// Create DataType object
@@ -41,6 +45,10 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
// Decode Encoded Args and validate result
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
+ // Validate signature
+ const dataTypeFromSignature = AbiEncoder.create(dataType.getSignature(true));
+ const argsEncodedFromSignature = dataTypeFromSignature.encode(args);
+ expect(argsEncodedFromSignature).to.be.deep.equal(expectedEncodedArgs);
});
it('Fixed size; Dynamic elements', async () => {
// Create DataType object
@@ -56,6 +64,10 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
// Decode Encoded Args and validate result
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
+ // Validate signature
+ const dataTypeFromSignature = AbiEncoder.create(dataType.getSignature(true));
+ const argsEncodedFromSignature = dataTypeFromSignature.encode(args);
+ expect(argsEncodedFromSignature).to.be.deep.equal(expectedEncodedArgs);
});
it('Dynamic size; Dynamic elements', async () => {
// Create DataType object
@@ -71,6 +83,10 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
// Decode Encoded Args and validate result
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
+ // Validate signature
+ const dataTypeFromSignature = AbiEncoder.create(dataType.getSignature(true));
+ const argsEncodedFromSignature = dataTypeFromSignature.encode(args);
+ expect(argsEncodedFromSignature).to.be.deep.equal(expectedEncodedArgs);
});
it('Dynamic Size; Multidimensional; Dynamic Elements', async () => {
// Create DataType object
@@ -89,6 +105,10 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
// Decode Encoded Args and validate result
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
+ // Validate signature
+ const dataTypeFromSignature = AbiEncoder.create(dataType.getSignature(true));
+ const argsEncodedFromSignature = dataTypeFromSignature.encode(args);
+ expect(argsEncodedFromSignature).to.be.deep.equal(expectedEncodedArgs);
});
it('Dynamic Size; Multidimensional; Static Elements', async () => {
// Create DataType object
@@ -107,6 +127,10 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
// Decode Encoded Args and validate result
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
+ // Validate signature
+ const dataTypeFromSignature = AbiEncoder.create(dataType.getSignature(true));
+ const argsEncodedFromSignature = dataTypeFromSignature.encode(args);
+ expect(argsEncodedFromSignature).to.be.deep.equal(expectedEncodedArgs);
});
it('Static Size; Multidimensional; Static Elements', async () => {
// Create DataType object
@@ -124,6 +148,10 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
// Decode Encoded Args and validate result
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
+ // Validate signature
+ const dataTypeFromSignature = AbiEncoder.create(dataType.getSignature(true));
+ const argsEncodedFromSignature = dataTypeFromSignature.encode(args);
+ expect(argsEncodedFromSignature).to.be.deep.equal(expectedEncodedArgs);
});
it('Static Size; Multidimensional; Dynamic Elements', async () => {
// Create DataType object
@@ -141,6 +169,10 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
// Decode Encoded Args and validate result
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
+ // Validate signature
+ const dataTypeFromSignature = AbiEncoder.create(dataType.getSignature(true));
+ const argsEncodedFromSignature = dataTypeFromSignature.encode(args);
+ expect(argsEncodedFromSignature).to.be.deep.equal(expectedEncodedArgs);
});
it('Static size; Too Few Elements', async () => {
// Create DataType object
@@ -197,6 +229,10 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodingRules: AbiEncoder.DecodingRules = { shouldConvertStructsToObjects: true };
const decodedArgs = dataType.decode(encodedArgs, decodingRules);
expect(decodedArgs).to.be.deep.equal(args);
+ // Validate signature
+ const dataTypeFromSignature = AbiEncoder.create(dataType.getSignature(true));
+ const argsEncodedFromSignature = dataTypeFromSignature.encode(args, encodingRules);
+ expect(argsEncodedFromSignature).to.be.deep.equal(expectedEncodedArgs);
});
it('Dynamic elements only', async () => {
// Create DataType object
@@ -217,6 +253,10 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodingRules: AbiEncoder.DecodingRules = { shouldConvertStructsToObjects: true };
const decodedArgs = dataType.decode(encodedArgs, decodingRules);
expect(decodedArgs).to.be.deep.equal(args);
+ // Validate signature
+ const dataTypeFromSignature = AbiEncoder.create(dataType.getSignature(true));
+ const argsEncodedFromSignature = dataTypeFromSignature.encode(args);
+ expect(argsEncodedFromSignature).to.be.deep.equal(expectedEncodedArgs);
});
it('Nested Static Array', async () => {
// Create DataType object
@@ -237,6 +277,10 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodingRules: AbiEncoder.DecodingRules = { shouldConvertStructsToObjects: true };
const decodedArgs = dataType.decode(encodedArgs, decodingRules);
expect(decodedArgs).to.be.deep.equal(args);
+ // Validate signature
+ const dataTypeFromSignature = AbiEncoder.create(dataType.getSignature(true));
+ const argsEncodedFromSignature = dataTypeFromSignature.encode(args);
+ expect(argsEncodedFromSignature).to.be.deep.equal(expectedEncodedArgs);
});
it('Nested Dynamic Array', async () => {
// Create DataType object
@@ -257,6 +301,10 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodingRules: AbiEncoder.DecodingRules = { shouldConvertStructsToObjects: true };
const decodedArgs = dataType.decode(encodedArgs, decodingRules);
expect(decodedArgs).to.be.deep.equal(args);
+ // Validate signature
+ const dataTypeFromSignature = AbiEncoder.create(dataType.getSignature(true));
+ const argsEncodedFromSignature = dataTypeFromSignature.encode(args);
+ expect(argsEncodedFromSignature).to.be.deep.equal(expectedEncodedArgs);
});
it('Nested Static Multidimensional Array', async () => {
// Create DataType object
@@ -279,6 +327,10 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodingRules: AbiEncoder.DecodingRules = { shouldConvertStructsToObjects: true };
const decodedArgs = dataType.decode(encodedArgs, decodingRules);
expect(decodedArgs).to.be.deep.equal(args);
+ // Validate signature
+ const dataTypeFromSignature = AbiEncoder.create(dataType.getSignature(true));
+ const argsEncodedFromSignature = dataTypeFromSignature.encode(args);
+ expect(argsEncodedFromSignature).to.be.deep.equal(expectedEncodedArgs);
});
it('Nested Dynamic Multidimensional Array', async () => {
// Create DataType object
@@ -301,6 +353,10 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodingRules: AbiEncoder.DecodingRules = { shouldConvertStructsToObjects: true };
const decodedArgs = dataType.decode(encodedArgs, decodingRules);
expect(decodedArgs).to.be.deep.equal(args);
+ // Validate signature
+ const dataTypeFromSignature = AbiEncoder.create(dataType.getSignature(true));
+ const argsEncodedFromSignature = dataTypeFromSignature.encode(args);
+ expect(argsEncodedFromSignature).to.be.deep.equal(expectedEncodedArgs);
});
it('Static and dynamic elements mixed', async () => {
// Create DataType object
@@ -331,6 +387,10 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodingRules: AbiEncoder.DecodingRules = { shouldConvertStructsToObjects: true };
const decodedArgs = dataType.decode(encodedArgs, decodingRules);
expect(decodedArgs).to.be.deep.equal(args);
+ // Validate signature
+ const dataTypeFromSignature = AbiEncoder.create(dataType.getSignature(true));
+ const argsEncodedFromSignature = dataTypeFromSignature.encode(args);
+ expect(argsEncodedFromSignature).to.be.deep.equal(expectedEncodedArgs);
});
it('Missing Key', async () => {
// Create DataType object
@@ -345,22 +405,7 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
// Encode Args and validate result
expect(() => {
dataType.encode(args, encodingRules);
- }).to.throw('Could not assign tuple to object: missing keys field_2');
- });
- it('Bad Key', async () => {
- // Create DataType object
- const testDataItem = {
- name: 'Tuple',
- type: 'tuple',
- components: [{ name: 'field_1', type: 'int32' }, { name: 'field_2', type: 'bool' }],
- };
- const dataType = new AbiEncoder.Tuple(testDataItem);
- // Construct args to be encoded
- const args = { unknown_field: new BigNumber(-5) };
- // Encode Args and validate result
- expect(() => {
- dataType.encode(args, encodingRules);
- }).to.throw("Could not assign tuple to object: unrecognized key 'unknown_field' in object Tuple");
+ }).to.throw('Could not assign tuple to object: missing key \'field_2\' in object {"field_1":"-5"}');
});
});
@@ -378,6 +423,10 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
// Decode Encoded Args and validate result
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
+ // Validate signature
+ const dataTypeFromSignature = AbiEncoder.create(dataType.getSignature(true));
+ const argsEncodedFromSignature = dataTypeFromSignature.encode(args);
+ expect(argsEncodedFromSignature).to.be.deep.equal(expectedEncodedArgs);
});
it('Invalid Address - input is not valid hex', async () => {
// Create DataType object
@@ -417,6 +466,10 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
// Decode Encoded Args and validate result
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
+ // Validate signature
+ const dataTypeFromSignature = AbiEncoder.create(dataType.getSignature(true));
+ const argsEncodedFromSignature = dataTypeFromSignature.encode(args);
+ expect(argsEncodedFromSignature).to.be.deep.equal(expectedEncodedArgs);
});
it('False', async () => {
// Create DataType object
@@ -431,6 +484,10 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
// Decode Encoded Args and validate result
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
+ // Validate signature
+ const dataTypeFromSignature = AbiEncoder.create(dataType.getSignature(true));
+ const argsEncodedFromSignature = dataTypeFromSignature.encode(args);
+ expect(argsEncodedFromSignature).to.be.deep.equal(expectedEncodedArgs);
});
});
@@ -455,6 +512,10 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
// Decode Encoded Args and validate result
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
+ // Validate signature
+ const dataTypeFromSignature = AbiEncoder.create(dataType.getSignature(true));
+ const argsEncodedFromSignature = dataTypeFromSignature.encode(args);
+ expect(argsEncodedFromSignature).to.be.deep.equal(expectedEncodedArgs);
});
it('Int256 - Negative Base Case', async () => {
// Create DataType object
@@ -469,6 +530,10 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
// Decode Encoded Args and validate result
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
+ // Validate signature
+ const dataTypeFromSignature = AbiEncoder.create(dataType.getSignature(true));
+ const argsEncodedFromSignature = dataTypeFromSignature.encode(args);
+ expect(argsEncodedFromSignature).to.be.deep.equal(expectedEncodedArgs);
});
it('Int256 - Positive Value', async () => {
// Create DataType object
@@ -483,6 +548,10 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
// Decode Encoded Args and validate result
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
+ // Validate signature
+ const dataTypeFromSignature = AbiEncoder.create(dataType.getSignature(true));
+ const argsEncodedFromSignature = dataTypeFromSignature.encode(args);
+ expect(argsEncodedFromSignature).to.be.deep.equal(expectedEncodedArgs);
});
it('Int256 - Negative Value', async () => {
// Create DataType object
@@ -497,6 +566,10 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
// Decode Encoded Args and validate result
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
+ // Validate signature
+ const dataTypeFromSignature = AbiEncoder.create(dataType.getSignature(true));
+ const argsEncodedFromSignature = dataTypeFromSignature.encode(args);
+ expect(argsEncodedFromSignature).to.be.deep.equal(expectedEncodedArgs);
});
it('Int256 - Value too large', async () => {
// Create DataType object
@@ -533,6 +606,10 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
// Decode Encoded Args and validate result
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
+ // Validate signature
+ const dataTypeFromSignature = AbiEncoder.create(dataType.getSignature(true));
+ const argsEncodedFromSignature = dataTypeFromSignature.encode(args);
+ expect(argsEncodedFromSignature).to.be.deep.equal(expectedEncodedArgs);
});
it('Int32 - Negative Base Case', async () => {
// Create DataType object
@@ -547,6 +624,10 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
// Decode Encoded Args and validate result
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
+ // Validate signature
+ const dataTypeFromSignature = AbiEncoder.create(dataType.getSignature(true));
+ const argsEncodedFromSignature = dataTypeFromSignature.encode(args);
+ expect(argsEncodedFromSignature).to.be.deep.equal(expectedEncodedArgs);
});
it('Int32 - Positive Value', async () => {
// Create DataType object
@@ -561,6 +642,10 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
// Decode Encoded Args and validate result
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
+ // Validate signature
+ const dataTypeFromSignature = AbiEncoder.create(dataType.getSignature(true));
+ const argsEncodedFromSignature = dataTypeFromSignature.encode(args);
+ expect(argsEncodedFromSignature).to.be.deep.equal(expectedEncodedArgs);
});
it('Int32 - Negative Value', async () => {
// Create DataType object
@@ -575,6 +660,10 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
// Decode Encoded Args and validate result
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
+ // Validate signature
+ const dataTypeFromSignature = AbiEncoder.create(dataType.getSignature(true));
+ const argsEncodedFromSignature = dataTypeFromSignature.encode(args);
+ expect(argsEncodedFromSignature).to.be.deep.equal(expectedEncodedArgs);
});
it('Int32 - Value too large', async () => {
// Create DataType object
@@ -621,6 +710,10 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
// Decode Encoded Args and validate result
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
+ // Validate signature
+ const dataTypeFromSignature = AbiEncoder.create(dataType.getSignature(true));
+ const argsEncodedFromSignature = dataTypeFromSignature.encode(args);
+ expect(argsEncodedFromSignature).to.be.deep.equal(expectedEncodedArgs);
});
it('UInt256 - Positive Value', async () => {
// Create DataType object
@@ -635,6 +728,10 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
// Decode Encoded Args and validate result
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
+ // Validate signature
+ const dataTypeFromSignature = AbiEncoder.create(dataType.getSignature(true));
+ const argsEncodedFromSignature = dataTypeFromSignature.encode(args);
+ expect(argsEncodedFromSignature).to.be.deep.equal(expectedEncodedArgs);
});
it('UInt256 - Zero Value', async () => {
// Create DataType object
@@ -649,6 +746,10 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
// Decode Encoded Args and validate result
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
+ // Validate signature
+ const dataTypeFromSignature = AbiEncoder.create(dataType.getSignature(true));
+ const argsEncodedFromSignature = dataTypeFromSignature.encode(args);
+ expect(argsEncodedFromSignature).to.be.deep.equal(expectedEncodedArgs);
});
it('UInt256 - Value too large', async () => {
// Create DataType object
@@ -685,6 +786,10 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
// Decode Encoded Args and validate result
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
+ // Validate signature
+ const dataTypeFromSignature = AbiEncoder.create(dataType.getSignature(true));
+ const argsEncodedFromSignature = dataTypeFromSignature.encode(args);
+ expect(argsEncodedFromSignature).to.be.deep.equal(expectedEncodedArgs);
});
it('UInt32 - Positive Value', async () => {
// Create DataType object
@@ -699,6 +804,10 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
// Decode Encoded Args and validate result
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
+ // Validate signature
+ const dataTypeFromSignature = AbiEncoder.create(dataType.getSignature(true));
+ const argsEncodedFromSignature = dataTypeFromSignature.encode(args);
+ expect(argsEncodedFromSignature).to.be.deep.equal(expectedEncodedArgs);
});
it('UInt32 - Zero Value', async () => {
// Create DataType object
@@ -713,6 +822,10 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
// Decode Encoded Args and validate result
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
+ // Validate signature
+ const dataTypeFromSignature = AbiEncoder.create(dataType.getSignature(true));
+ const argsEncodedFromSignature = dataTypeFromSignature.encode(args);
+ expect(argsEncodedFromSignature).to.be.deep.equal(expectedEncodedArgs);
});
it('UInt32 - Value too large', async () => {
// Create DataType object
@@ -752,6 +865,10 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
// Decode Encoded Args and validate result
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
+ // Validate signature
+ const dataTypeFromSignature = AbiEncoder.create(dataType.getSignature(true));
+ const argsEncodedFromSignature = dataTypeFromSignature.encode(args);
+ expect(argsEncodedFromSignature).to.be.deep.equal(expectedEncodedArgs);
});
it('Single Byte (bytes1)', async () => {
// Create DataType object
@@ -766,6 +883,10 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
// Decode Encoded Args and validate result
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
+ // Validate signature
+ const dataTypeFromSignature = AbiEncoder.create(dataType.getSignature(true));
+ const argsEncodedFromSignature = dataTypeFromSignature.encode(args);
+ expect(argsEncodedFromSignature).to.be.deep.equal(expectedEncodedArgs);
});
it('4 Bytes (bytes4)', async () => {
// Create DataType object
@@ -780,6 +901,10 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
// Decode Encoded Args and validate result
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
+ // Validate signature
+ const dataTypeFromSignature = AbiEncoder.create(dataType.getSignature(true));
+ const argsEncodedFromSignature = dataTypeFromSignature.encode(args);
+ expect(argsEncodedFromSignature).to.be.deep.equal(expectedEncodedArgs);
});
it('4 Bytes (bytes4); Encoder must pad input', async () => {
// Create DataType object
@@ -796,6 +921,10 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodedArgs = dataType.decode(encodedArgs);
const paddedArgs = '0x1a180000';
expect(decodedArgs).to.be.deep.equal(paddedArgs);
+ // Validate signature
+ const dataTypeFromSignature = AbiEncoder.create(dataType.getSignature(true));
+ const argsEncodedFromSignature = dataTypeFromSignature.encode(args);
+ expect(argsEncodedFromSignature).to.be.deep.equal(expectedEncodedArgs);
});
it('32 Bytes (bytes32)', async () => {
// Create DataType object
@@ -810,6 +939,10 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
// Decode Encoded Args and validate result
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
+ // Validate signature
+ const dataTypeFromSignature = AbiEncoder.create(dataType.getSignature(true));
+ const argsEncodedFromSignature = dataTypeFromSignature.encode(args);
+ expect(argsEncodedFromSignature).to.be.deep.equal(expectedEncodedArgs);
});
it('32 Bytes (bytes32); Encoder must pad input', async () => {
// Create DataType object
@@ -826,6 +959,10 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
const decodedArgs = dataType.decode(encodedArgs);
const paddedArgs = '0x1a18bf6100000000000000000000000000000000000000000000000000000000';
expect(decodedArgs).to.be.deep.equal(paddedArgs);
+ // Validate signature
+ const dataTypeFromSignature = AbiEncoder.create(dataType.getSignature(true));
+ const argsEncodedFromSignature = dataTypeFromSignature.encode(args);
+ expect(argsEncodedFromSignature).to.be.deep.equal(expectedEncodedArgs);
});
it('Should throw when pass in too many bytes (bytes4)', async () => {
// Create DataType object
@@ -893,6 +1030,10 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
// Decode Encoded Args and validate result
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
+ // Validate signature
+ const dataTypeFromSignature = AbiEncoder.create(dataType.getSignature(true));
+ const argsEncodedFromSignature = dataTypeFromSignature.encode(args);
+ expect(argsEncodedFromSignature).to.be.deep.equal(expectedEncodedArgs);
});
it('Spans multiple EVM words', async () => {
// Create DataType object
@@ -910,6 +1051,10 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
// Decode Encoded Args and validate result
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
+ // Validate signature
+ const dataTypeFromSignature = AbiEncoder.create(dataType.getSignature(true));
+ const argsEncodedFromSignature = dataTypeFromSignature.encode(args);
+ expect(argsEncodedFromSignature).to.be.deep.equal(expectedEncodedArgs);
});
it('Input as Buffer', async () => {
// Create DataType object
@@ -927,6 +1072,10 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
// Decode Encoded Args and validate result
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
+ // Validate signature
+ const dataTypeFromSignature = AbiEncoder.create(dataType.getSignature(true));
+ const argsEncodedFromSignature = dataTypeFromSignature.encode(args);
+ expect(argsEncodedFromSignature).to.be.deep.equal(expectedEncodedArgs);
});
it('Should throw when pass in bad hex (no 0x prefix)', async () => {
// Create DataType object
@@ -968,6 +1117,10 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
// Decode Encoded Args and validate result
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
+ // Validate signature
+ const dataTypeFromSignature = AbiEncoder.create(dataType.getSignature(true));
+ const argsEncodedFromSignature = dataTypeFromSignature.encode(args);
+ expect(argsEncodedFromSignature).to.be.deep.equal(expectedEncodedArgs);
});
it('Spans multiple EVM words', async () => {
// Create DataType object
@@ -985,6 +1138,10 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
// Decode Encoded Args and validate result
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
+ // Validate signature
+ const dataTypeFromSignature = AbiEncoder.create(dataType.getSignature(true));
+ const argsEncodedFromSignature = dataTypeFromSignature.encode(args);
+ expect(argsEncodedFromSignature).to.be.deep.equal(expectedEncodedArgs);
});
it('String that begins with 0x prefix', async () => {
// Create DataType object
@@ -1002,6 +1159,10 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
// Decode Encoded Args and validate result
const decodedArgs = dataType.decode(encodedArgs);
expect(decodedArgs).to.be.deep.equal(args);
+ // Validate signature
+ const dataTypeFromSignature = AbiEncoder.create(dataType.getSignature(true));
+ const argsEncodedFromSignature = dataTypeFromSignature.encode(args);
+ expect(argsEncodedFromSignature).to.be.deep.equal(expectedEncodedArgs);
});
});
});
diff --git a/packages/utils/test/abi_encoder/methods_test.ts b/packages/utils/test/abi_encoder/methods_test.ts
index a0525967e..d8045fece 100644
--- a/packages/utils/test/abi_encoder/methods_test.ts
+++ b/packages/utils/test/abi_encoder/methods_test.ts
@@ -21,7 +21,8 @@ describe('ABI Encoder: Method Encoding / Decoding', () => {
'0x09f2b0c30000000000000000000000000000000000000000000000000000000000000001ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff560000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000000000015600000000000000000000000000000000000000000000000000000000000000';
expect(calldata).to.be.equal(expectedCalldata);
// Validate decoding
- const decodedValue = method.decode(calldata);
+ const decodingRules = { shouldConvertStructsToObjects: false };
+ const decodedValue = method.decode(calldata, decodingRules);
expect(decodedValue).to.be.deep.equal(args);
});
it('Array of Static Tuples (Array has defined length)', async () => {
@@ -40,7 +41,8 @@ describe('ABI Encoder: Method Encoding / Decoding', () => {
'0x9eb20969000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000b000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000f0000000000000000000000000000000000000000000000000000000000000010';
expect(calldata).to.be.equal(expectedCalldata);
// Validate decoding
- const decodedValue = method.decode(calldata);
+ const decodingRules = { shouldConvertStructsToObjects: false };
+ const decodedValue = method.decode(calldata, decodingRules);
expect(decodedValue).to.be.deep.equal(args);
});
it('Array of Static Tuples (Array has dynamic length)', async () => {
@@ -59,7 +61,8 @@ describe('ABI Encoder: Method Encoding / Decoding', () => {
'0x63275d6e00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000b000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000f0000000000000000000000000000000000000000000000000000000000000010';
expect(calldata).to.be.equal(expectedCalldata);
// Validate decoding
- const decodedValue = method.decode(calldata);
+ const decodingRules = { shouldConvertStructsToObjects: false };
+ const decodedValue = method.decode(calldata, decodingRules);
expect(decodedValue).to.be.deep.equal(args);
});
it('Array of Dynamic Tuples (Array has defined length)', async () => {
@@ -78,7 +81,8 @@ describe('ABI Encoder: Method Encoding / Decoding', () => {
'0xdeedb00f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000280000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000003800000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000048000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000132000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000013400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001360000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000138000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000023130000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000023132000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000023134000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000023136000000000000000000000000000000000000000000000000000000000000';
expect(calldata).to.be.equal(expectedCalldata);
// Validate decoding
- const decodedValue = method.decode(calldata);
+ const decodingRules = { shouldConvertStructsToObjects: false };
+ const decodedValue = method.decode(calldata, decodingRules);
expect(decodedValue).to.be.deep.equal(args);
});
it('Array of Dynamic Tuples (Array has dynamic length)', async () => {
@@ -97,7 +101,8 @@ describe('ABI Encoder: Method Encoding / Decoding', () => {
'0x60c847fb000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000280000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000003800000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000048000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000132000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000013400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001360000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000138000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000023130000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000023132000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000023134000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000023136000000000000000000000000000000000000000000000000000000000000';
expect(calldata).to.be.equal(expectedCalldata);
// Validate decoding
- const decodedValue = method.decode(calldata);
+ const decodingRules = { shouldConvertStructsToObjects: false };
+ const decodedValue = method.decode(calldata, decodingRules);
expect(decodedValue).to.be.deep.equal(args);
});
it('Multidimensional Arrays / Static Members', async () => {
@@ -108,19 +113,16 @@ describe('ABI Encoder: Method Encoding / Decoding', () => {
const args = [];
const argsLength = 8;
for (let i = 0; i < argsLength; ++i) {
- args.push([
- [[new BigNumber(++value), new BigNumber(++value)], [new BigNumber(++value), new BigNumber(++value)]],
- [[new BigNumber(++value), new BigNumber(++value)], [new BigNumber(++value), new BigNumber(++value)]],
- ]);
+ args.push([[[++value, ++value], [++value, ++value]], [[++value, ++value], [++value, ++value]]]);
}
const calldata = method.encode(args, encodingRules);
// Validate calldata
const expectedCalldata =
'0xc2f47d6f00000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000480000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000009600000000000000000000000000000000000000000000000000000000000000b000000000000000000000000000000000000000000000000000000000000000d400000000000000000000000000000000000000000000000000000000000000e600000000000000000000000000000000000000000000000000000000000000039000000000000000000000000000000000000000000000000000000000000003a000000000000000000000000000000000000000000000000000000000000003b000000000000000000000000000000000000000000000000000000000000003c000000000000000000000000000000000000000000000000000000000000003d000000000000000000000000000000000000000000000000000000000000003e000000000000000000000000000000000000000000000000000000000000003f00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000b000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000d000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000f0000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000110000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000130000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001500000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001700000000000000000000000000000000000000000000000000000000000000180000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000019000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000001b000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001d000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000000001f000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000210000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000230000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000025000000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000027000000000000000000000000000000000000000000000000000000000000002800000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000029000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000002b000000000000000000000000000000000000000000000000000000000000002c000000000000000000000000000000000000000000000000000000000000002d000000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000002f0000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000003100000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000033000000000000000000000000000000000000000000000000000000000000003400000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000035000000000000000000000000000000000000000000000000000000000000003600000000000000000000000000000000000000000000000000000000000000370000000000000000000000000000000000000000000000000000000000000038';
expect(calldata).to.be.equal(expectedCalldata);
- expect(calldata).to.be.equal(expectedCalldata);
// Validate decoding
- const decodedValue = method.decode(calldata);
+ const decodingRules = { shouldConvertStructsToObjects: false };
+ const decodedValue = method.decode(calldata, decodingRules);
expect(decodedValue).to.be.deep.equal(args);
});
it('Multidimensional Arrays / Dynamic Members', async () => {
@@ -148,7 +150,8 @@ describe('ABI Encoder: Method Encoding / Decoding', () => {
'0x81534ebd0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000052000000000000000000000000000000000000000000000000000000000000009a00000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000260000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000131000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001320000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000013300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000134000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000001350000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000013600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000137000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001380000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000260000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000139000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002313000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000023131000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000231320000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000002313300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000023134000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000231350000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002313600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000231370000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002313800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000023139000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000232300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000023231000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000232320000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000002323300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000023234000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000232350000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002323600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000232370000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002323800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000002323900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000023330000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000002333100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000023332000000000000000000000000000000000000000000000000000000000000';
expect(calldata).to.be.equal(expectedCalldata);
// Validate decoding
- const decodedValue = method.decode(calldata);
+ const decodingRules = { shouldConvertStructsToObjects: false };
+ const decodedValue = method.decode(calldata, decodingRules);
expect(decodedValue).to.be.deep.equal(args);
});
it('Fixed Length Array / Dynamic Members', async () => {
@@ -161,7 +164,8 @@ describe('ABI Encoder: Method Encoding / Decoding', () => {
'0x243a6e6e0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000005427261766500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034e657700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005576f726c64000000000000000000000000000000000000000000000000000000';
expect(calldata).to.be.equal(expectedCalldata);
// Validate decoding
- const decodedValue = method.decode(calldata);
+ const decodingRules = { shouldConvertStructsToObjects: false };
+ const decodedValue = method.decode(calldata, decodingRules);
expect(decodedValue).to.be.deep.equal(args);
});
it('Fixed Length Array / Dynamic Members', async () => {
@@ -174,7 +178,8 @@ describe('ABI Encoder: Method Encoding / Decoding', () => {
'0x243a6e6e0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000005427261766500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034e657700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005576f726c64000000000000000000000000000000000000000000000000000000';
expect(calldata).to.be.equal(expectedCalldata);
// Validate decoding
- const decodedValue = method.decode(calldata);
+ const decodingRules = { shouldConvertStructsToObjects: false };
+ const decodedValue = method.decode(calldata, decodingRules);
expect(decodedValue).to.be.deep.equal(args);
});
it('Unfixed Length Array / Dynamic Members ABI', async () => {
@@ -187,33 +192,40 @@ describe('ABI Encoder: Method Encoding / Decoding', () => {
'0x13e751a900000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000005427261766500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034e657700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005576f726c64000000000000000000000000000000000000000000000000000000';
expect(calldata).to.be.equal(expectedCalldata);
// Validate decoding
- const decodedValue = method.decode(calldata);
+ const decodingRules = { shouldConvertStructsToObjects: false };
+ const decodedValue = method.decode(calldata, decodingRules);
expect(decodedValue).to.be.deep.equal(args);
});
it('Unfixed Length Array / Static Members ABI', async () => {
// Generate calldata
const method = new AbiEncoder.Method(AbiSamples.dynamicArrayStaticMembersAbi);
- const args = [[new BigNumber(127), new BigNumber(14), new BigNumber(54)]];
+ // tslint:disable custom-no-magic-numbers
+ const args = [[127, 14, 54]];
+ // tslint:enable custom-no-magic-numbers
const calldata = method.encode(args, encodingRules);
// Validate calldata
const expectedCalldata =
'0x4fc8a83300000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000036';
expect(calldata).to.be.equal(expectedCalldata);
// Validate decoding
- const decodedValue = method.decode(calldata);
+ const decodingRules = { shouldConvertStructsToObjects: false };
+ const decodedValue = method.decode(calldata, decodingRules);
expect(decodedValue).to.be.deep.equal(args);
});
it('Fixed Length Array / Static Members ABI', async () => {
// Generate calldata
const method = new AbiEncoder.Method(AbiSamples.staticArrayAbi);
- const args = [[new BigNumber(127), new BigNumber(14), new BigNumber(54)]];
+ // tslint:disable custom-no-magic-numbers
+ const args = [[127, 14, 54]];
+ // tslint:enable custom-no-magic-numbers
const calldata = method.encode(args, encodingRules);
// Validate calldata
const expectedCalldata =
'0xf68ade72000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000036';
expect(calldata).to.be.equal(expectedCalldata);
// Validate decoding
- const decodedValue = method.decode(calldata);
+ const decodingRules = { shouldConvertStructsToObjects: false };
+ const decodedValue = method.decode(calldata, decodingRules);
expect(decodedValue).to.be.deep.equal(args);
});
it('Array ABI', async () => {
@@ -226,7 +238,8 @@ describe('ABI Encoder: Method Encoding / Decoding', () => {
'0x13e751a900000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000046669766500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000373697800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005736576656e000000000000000000000000000000000000000000000000000000';
expect(calldata).to.be.equal(expectedCalldata);
// Validate decoding
- const decodedValue = method.decode(calldata);
+ const decodingRules = { shouldConvertStructsToObjects: false };
+ const decodedValue = method.decode(calldata, decodingRules);
expect(decodedValue).to.be.deep.equal(args);
});
it('Static Tuple', async () => {
@@ -240,7 +253,8 @@ describe('ABI Encoder: Method Encoding / Decoding', () => {
'0xa9125e150000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000f0000000000000000000000000000000000000000000000000000000000000000';
expect(calldata).to.be.equal(expectedCalldata);
// Validate decoding
- const decodedValue = method.decode(calldata);
+ const decodingRules = { shouldConvertStructsToObjects: false };
+ const decodedValue = method.decode(calldata, decodingRules);
expect(decodedValue).to.be.deep.equal(args);
});
it('Dynamic Tuple (Array input)', async () => {
@@ -254,7 +268,8 @@ describe('ABI Encoder: Method Encoding / Decoding', () => {
'0x5b998f3500000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000046669766500000000000000000000000000000000000000000000000000000000';
expect(calldata).to.be.equal(expectedCalldata);
// Validate decoding
- const decodedValue = method.decode(calldata);
+ const decodingRules = { shouldConvertStructsToObjects: false };
+ const decodedValue = method.decode(calldata, decodingRules);
expect(decodedValue).to.be.deep.equal(args);
});
it('Dynamic Tuple (Object input)', async () => {
@@ -268,7 +283,8 @@ describe('ABI Encoder: Method Encoding / Decoding', () => {
'0x5b998f3500000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000046669766500000000000000000000000000000000000000000000000000000000';
expect(calldata).to.be.equal(expectedCalldata);
// Validate decoding
- const decodedValue = method.decode(calldata);
+ const decodingRules = { shouldConvertStructsToObjects: false };
+ const decodedValue = method.decode(calldata, decodingRules);
expect(decodedValue).to.be.deep.equal(args);
});
it('Large, Flat ABI', async () => {
@@ -291,13 +307,16 @@ describe('ABI Encoder: Method Encoding / Decoding', () => {
'0x312d4d42000000000000000000000000000000000000000000000000000000000f4d9feefffffffffffffffffffffffffffffffffffffffffffffffffffffffff0b26012000000000000000000000000000000000000000000000000000000000006a0444300000000000000000000000000000000000000000000000000000000000000000102030405060708091112131415161718192021222324252627282930313200000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000180000000000000000000000000e41d2489571d322189246dafa5ebde1f4699f4980000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000003800010203040506070809111213141516171819202122232425262728293031320809111213141516171819202122232425262728293031320000000000000000000000000000000000000000000000000000000000000000000000000000002c4c6974746c65207065746572207069706572207069706564206120706970696e672070657070657220706f740000000000000000000000000000000000000000';
expect(calldata).to.be.equal(expectedCalldata);
// Validate decoding
- const decodedValue = method.decode(calldata);
+ const decodingRules = { shouldConvertStructsToObjects: false };
+ const decodedValue = method.decode(calldata, decodingRules);
expect(decodedValue).to.be.deep.equal(args);
});
it('Large, Nested ABI', async () => {
// Construct Calldata
const method = new AbiEncoder.Method(AbiSamples.largeNestedAbi);
- const someStaticArray = [new BigNumber(127), new BigNumber(14), new BigNumber(54)];
+ // tslint:disable custom-no-magic-numbers
+ const someStaticArray = [127, 14, 54];
+ // tslint:enable custom-no-magic-numbers
const someStaticArrayWithDynamicMembers = [
'the little piping piper piped a piping pipper papper',
'the kid knows how to write poems, what can I say -- I guess theres a lot I could say to try to fill this line with a lot of text.',
diff --git a/packages/utils/test/abi_encoder/optimizer_test.ts b/packages/utils/test/abi_encoder/optimizer_test.ts
index ee0654ec3..c2881f14c 100644
--- a/packages/utils/test/abi_encoder/optimizer_test.ts
+++ b/packages/utils/test/abi_encoder/optimizer_test.ts
@@ -23,7 +23,7 @@ describe('ABI Encoder: Optimized Method Encoding/Decoding', () => {
'0x7221063300000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000096';
expect(optimizedCalldata).to.be.equal(expectedOptimizedCalldata);
// Validate decoding
- const decodedArgs = method.decode(optimizedCalldata);
+ const decodedArgs = method.decode(optimizedCalldata, { shouldConvertStructsToObjects: false });
expect(decodedArgs).to.be.deep.equal(args);
});
it('Duplicate Dynamic Arrays with Dynamic Elements', async () => {
@@ -38,7 +38,7 @@ describe('ABI Encoder: Optimized Method Encoding/Decoding', () => {
'0xbb4f12e300000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000548656c6c6f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005576f726c64000000000000000000000000000000000000000000000000000000';
expect(optimizedCalldata).to.be.equal(expectedOptimizedCalldata);
// Validate decoding
- const decodedArgs = method.decode(optimizedCalldata);
+ const decodedArgs = method.decode(optimizedCalldata, { shouldConvertStructsToObjects: false });
expect(decodedArgs).to.be.deep.equal(args);
});
it('Duplicate Static Arrays with Static Elements (should not optimize)', async () => {
@@ -55,7 +55,7 @@ describe('ABI Encoder: Optimized Method Encoding/Decoding', () => {
const unoptimizedCalldata = method.encode(args);
expect(optimizedCalldata).to.be.equal(unoptimizedCalldata);
// Validate decoding
- const decodedArgs = method.decode(optimizedCalldata);
+ const decodedArgs = method.decode(optimizedCalldata, { shouldConvertStructsToObjects: false });
expect(decodedArgs).to.be.deep.equal(args);
});
it('Duplicate Static Arrays with Dynamic Elements', async () => {
@@ -70,7 +70,7 @@ describe('ABI Encoder: Optimized Method Encoding/Decoding', () => {
'0x9fe31f8e0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000548656c6c6f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005576f726c64000000000000000000000000000000000000000000000000000000';
expect(optimizedCalldata).to.be.equal(expectedOptimizedCalldata);
// Validate decoding
- const decodedArgs = method.decode(optimizedCalldata);
+ const decodedArgs = method.decode(optimizedCalldata, { shouldConvertStructsToObjects: false });
expect(decodedArgs).to.be.deep.equal(args);
});
it('Duplicate Array Elements (should optimize)', async () => {
@@ -84,7 +84,7 @@ describe('ABI Encoder: Optimized Method Encoding/Decoding', () => {
'0x13e751a900000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000548656c6c6f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005576f726c64000000000000000000000000000000000000000000000000000000';
expect(optimizedCalldata).to.be.equal(expectedOptimizedCalldata);
// Validate decoding
- const decodedArgs = method.decode(optimizedCalldata);
+ const decodedArgs = method.decode(optimizedCalldata, { shouldConvertStructsToObjects: false });
expect(decodedArgs).to.be.deep.equal(args);
});
it('Duplicate Tuple Fields', async () => {
@@ -98,7 +98,7 @@ describe('ABI Encoder: Optimized Method Encoding/Decoding', () => {
'0x16780a5e000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000548656c6c6f000000000000000000000000000000000000000000000000000000';
expect(optimizedCalldata).to.be.equal(expectedOptimizedCalldata);
// Validate decoding
- const decodedArgs = method.decode(optimizedCalldata);
+ const decodedArgs = method.decode(optimizedCalldata, { shouldConvertStructsToObjects: false });
expect(decodedArgs).to.be.deep.equal(args);
});
it('Duplicate Strings', async () => {
@@ -115,7 +115,7 @@ describe('ABI Encoder: Optimized Method Encoding/Decoding', () => {
'0x07370bfa00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000548656c6c6f000000000000000000000000000000000000000000000000000000';
expect(optimizedCalldata).to.be.equal(expectedOptimizedCalldata);
// Validate decoding
- const decodedArgs = method.decode(optimizedCalldata);
+ const decodedArgs = method.decode(optimizedCalldata, { shouldConvertStructsToObjects: false });
expect(decodedArgs).to.be.deep.equal(args);
});
it('Duplicate Bytes', async () => {
@@ -133,7 +133,7 @@ describe('ABI Encoder: Optimized Method Encoding/Decoding', () => {
'0x6045e42900000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000002801020304050607080910111213141516171819202122232425262728293031323334353637383940000000000000000000000000000000000000000000000000';
expect(optimizedCalldata).to.be.equal(expectedOptimizedCalldata);
// Validate decoding
- const decodedArgs = method.decode(optimizedCalldata);
+ const decodedArgs = method.decode(optimizedCalldata, { shouldConvertStructsToObjects: false });
expect(decodedArgs).to.be.deep.equal(args);
});
it('Duplicate Tuples', async () => {
@@ -148,7 +148,7 @@ describe('ABI Encoder: Optimized Method Encoding/Decoding', () => {
'0x564f826d000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000006792a000000000000000000000000000000000000000000000000000000000000000d48656c6c6f2c20576f726c642100000000000000000000000000000000000000';
expect(optimizedCalldata).to.be.equal(expectedOptimizedCalldata);
// Validate decoding
- const decodedArgs = method.decode(optimizedCalldata);
+ const decodedArgs = method.decode(optimizedCalldata, { shouldConvertStructsToObjects: false });
expect(decodedArgs).to.be.deep.equal(args);
});
it('Duplicate Fields Across Two Tuples', async () => {
@@ -164,7 +164,7 @@ describe('ABI Encoder: Optimized Method Encoding/Decoding', () => {
'0x564f826d000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000d48656c6c6f2c20576f726c642100000000000000000000000000000000000000';
expect(optimizedCalldata).to.be.equal(expectedOptimizedCalldata);
// Validate decoding
- const decodedArgs = method.decode(optimizedCalldata);
+ const decodedArgs = method.decode(optimizedCalldata, { shouldConvertStructsToObjects: false });
expect(decodedArgs).to.be.deep.equal(args);
});
it('Duplicate Arrays, Nested in Separate Tuples', async () => {
@@ -180,7 +180,7 @@ describe('ABI Encoder: Optimized Method Encoding/Decoding', () => {
'0x18970a9e000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000009600000000000000000000000000000000000000000000000000000000000000c80000000000000000000000000000000000000000000000000000000000000035657874726120617267756d656e7420746f2070726576656e742065786163746c79206d61746368696e6720746865207475706c65730000000000000000000000';
expect(optimizedCalldata).to.be.equal(expectedOptimizedCalldata);
// Validate decoding
- const decodedArgs = method.decode(optimizedCalldata);
+ const decodedArgs = method.decode(optimizedCalldata, { shouldConvertStructsToObjects: false });
expect(decodedArgs).to.be.deep.equal(args);
});
it('Duplicate Tuples, Nested in Separate Tuples', async () => {
@@ -196,7 +196,7 @@ describe('ABI Encoder: Optimized Method Encoding/Decoding', () => {
'0x0b4d2e6a000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000d48656c6c6f2c20576f726c6421000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000035657874726120617267756d656e7420746f2070726576656e742065786163746c79206d61746368696e6720746865207475706c65730000000000000000000000';
expect(optimizedCalldata).to.be.equal(expectedOptimizedCalldata);
// Validate decoding
- const decodedArgs = method.decode(optimizedCalldata);
+ const decodedArgs = method.decode(optimizedCalldata, { shouldConvertStructsToObjects: false });
expect(decodedArgs).to.be.deep.equal(args);
});
it('Duplicate Two-Dimensional Arrays', async () => {
@@ -211,7 +211,7 @@ describe('ABI Encoder: Optimized Method Encoding/Decoding', () => {
'0x0d28c4f9000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000002c0000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000548656c6c6f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005576f726c640000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000003466f6f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003426172000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000035a61610000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000548656c6c6f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005576f726c640000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000003466f6f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003426172000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000035a61610000000000000000000000000000000000000000000000000000000000';
expect(optimizedCalldata).to.be.equal(expectedOptimizedCalldata);
// Validate decoding
- const decodedArgs = method.decode(optimizedCalldata);
+ const decodedArgs = method.decode(optimizedCalldata, { shouldConvertStructsToObjects: false });
expect(decodedArgs).to.be.deep.equal(args);
});
it('Duplicate Array, Nested within Separate Two-Dimensional Arrays', async () => {
@@ -226,14 +226,21 @@ describe('ABI Encoder: Optimized Method Encoding/Decoding', () => {
'0x0d28c4f900000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000003466f6f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000548656c6c6f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005576f726c640000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000034261720000000000000000000000000000000000000000000000000000000000';
expect(optimizedCalldata).to.be.equal(expectedOptimizedCalldata);
// Validate decoding
- const decodedArgs = method.decode(optimizedCalldata);
+ const decodedArgs = method.decode(optimizedCalldata, { shouldConvertStructsToObjects: false });
expect(decodedArgs).to.be.deep.equal(args);
});
it('Array Elements Duplicated as Tuple Fields', async () => {
// Generate calldata
const method = new AbiEncoder.Method(OptimizedAbis.arrayElementsDuplicatedAsTupleFields);
- const array = [new BigNumber(100), new BigNumber(150), new BigNumber(200), new BigNumber(225)];
- const tuple = [[array[0]], [array[1]], [array[2]], [array[3]]];
+ // tslint:disable custom-no-magic-numbers
+ const array = [100, 150, 200, 225];
+ // tslint:enable custom-no-magic-numbers
+ const tuple = [
+ [new BigNumber(array[0])],
+ [new BigNumber(array[1])],
+ [new BigNumber(array[2])],
+ [new BigNumber(array[3])],
+ ];
const args = [array, tuple];
// Validata calldata
const optimizedCalldata = method.encode(args, encodingRules);
@@ -241,7 +248,7 @@ describe('ABI Encoder: Optimized Method Encoding/Decoding', () => {
'0x5b5c78fd0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000009600000000000000000000000000000000000000000000000000000000000000c800000000000000000000000000000000000000000000000000000000000000e1';
expect(optimizedCalldata).to.be.equal(expectedOptimizedCalldata);
// Validate decoding
- const decodedArgs = method.decode(optimizedCalldata);
+ const decodedArgs = method.decode(optimizedCalldata, { shouldConvertStructsToObjects: false });
expect(decodedArgs).to.be.deep.equal(args);
});
it('Array Elements Duplicated as Separate Parameter', async () => {
@@ -256,7 +263,7 @@ describe('ABI Encoder: Optimized Method Encoding/Decoding', () => {
'0xe0e0d34900000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000005576f726c64000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000548656c6c6f000000000000000000000000000000000000000000000000000000';
expect(optimizedCalldata).to.be.equal(expectedOptimizedCalldata);
// Validate decoding
- const decodedArgs = method.decode(optimizedCalldata);
+ const decodedArgs = method.decode(optimizedCalldata, { shouldConvertStructsToObjects: false });
expect(decodedArgs).to.be.deep.equal(args);
});
});
diff --git a/packages/utils/test/abi_encoder/return_values_test.ts b/packages/utils/test/abi_encoder/return_values_test.ts
index 104c7f5db..308d11ee5 100644
--- a/packages/utils/test/abi_encoder/return_values_test.ts
+++ b/packages/utils/test/abi_encoder/return_values_test.ts
@@ -15,7 +15,7 @@ describe('ABI Encoder: Return Value Encoding/Decoding', () => {
// Decode return value
const method = new AbiEncoder.Method(ReturnValueAbis.noReturnValues);
const returnValue = '0x';
- const decodedReturnValue = method.decodeReturnValues(returnValue);
+ const decodedReturnValue = method.decodeReturnValues(returnValue, { shouldConvertStructsToObjects: false });
const expectedDecodedReturnValue: any[] = [];
expect(decodedReturnValue).to.be.deep.equal(expectedDecodedReturnValue);
});
@@ -24,7 +24,9 @@ describe('ABI Encoder: Return Value Encoding/Decoding', () => {
const method = new AbiEncoder.Method(ReturnValueAbis.singleStaticReturnValue);
const returnValue = ['0x01020304'];
const encodedReturnValue = method.encodeReturnValues(returnValue, encodingRules);
- const decodedReturnValue = method.decodeReturnValues(encodedReturnValue);
+ const decodedReturnValue = method.decodeReturnValues(encodedReturnValue, {
+ shouldConvertStructsToObjects: false,
+ });
// Validate decoded return value
expect(decodedReturnValue).to.be.deep.equal(returnValue);
});
@@ -33,7 +35,9 @@ describe('ABI Encoder: Return Value Encoding/Decoding', () => {
const method = new AbiEncoder.Method(ReturnValueAbis.multipleStaticReturnValues);
const returnValue = ['0x01020304', '0x05060708'];
const encodedReturnValue = method.encodeReturnValues(returnValue, encodingRules);
- const decodedReturnValue = method.decodeReturnValues(encodedReturnValue);
+ const decodedReturnValue = method.decodeReturnValues(encodedReturnValue, {
+ shouldConvertStructsToObjects: false,
+ });
// Validate decoded return value
expect(decodedReturnValue).to.be.deep.equal(returnValue);
});
@@ -42,7 +46,9 @@ describe('ABI Encoder: Return Value Encoding/Decoding', () => {
const method = new AbiEncoder.Method(ReturnValueAbis.singleDynamicReturnValue);
const returnValue = ['0x01020304'];
const encodedReturnValue = method.encodeReturnValues(returnValue, encodingRules);
- const decodedReturnValue = method.decodeReturnValues(encodedReturnValue);
+ const decodedReturnValue = method.decodeReturnValues(encodedReturnValue, {
+ shouldConvertStructsToObjects: false,
+ });
// Validate decoded return value
expect(decodedReturnValue).to.be.deep.equal(returnValue);
});
@@ -51,7 +57,9 @@ describe('ABI Encoder: Return Value Encoding/Decoding', () => {
const method = new AbiEncoder.Method(ReturnValueAbis.multipleDynamicReturnValues);
const returnValue = ['0x01020304', '0x05060708'];
const encodedReturnValue = method.encodeReturnValues(returnValue, encodingRules);
- const decodedReturnValue = method.decodeReturnValues(encodedReturnValue);
+ const decodedReturnValue = method.decodeReturnValues(encodedReturnValue, {
+ shouldConvertStructsToObjects: false,
+ });
// Validate decoded return value
expect(decodedReturnValue).to.be.deep.equal(returnValue);
});
@@ -60,7 +68,9 @@ describe('ABI Encoder: Return Value Encoding/Decoding', () => {
const method = new AbiEncoder.Method(ReturnValueAbis.mixedStaticAndDynamicReturnValues);
const returnValue = ['0x01020304', '0x05060708'];
const encodedReturnValue = method.encodeReturnValues(returnValue, encodingRules);
- const decodedReturnValue = method.decodeReturnValues(encodedReturnValue);
+ const decodedReturnValue = method.decodeReturnValues(encodedReturnValue, {
+ shouldConvertStructsToObjects: false,
+ });
// Validate decoded return value
expect(decodedReturnValue).to.be.deep.equal(returnValue);
});
diff --git a/packages/utils/test/abi_encoder/signature_tests.ts b/packages/utils/test/abi_encoder/signature_tests.ts
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/packages/utils/test/abi_encoder/signature_tests.ts