aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
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/CHANGELOG.json9
-rw-r--r--packages/abi-gen-wrappers/package.json2
-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/multi_asset_proxy.ts824
-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-wrappers/src/index.ts1
-rw-r--r--packages/abi-gen/src/index.ts4
-rw-r--r--packages/base-contract/src/index.ts55
-rw-r--r--packages/contract-addresses/CHANGELOG.json9
-rw-r--r--packages/contract-addresses/src/index.ts10
-rw-r--r--packages/contract-artifacts/CHANGELOG.json9
-rw-r--r--packages/contract-artifacts/artifacts/MultiAssetProxy.json263
-rw-r--r--packages/contract-artifacts/src/index.ts4
-rw-r--r--packages/contract-artifacts/tsconfig.json1
-rw-r--r--packages/contract-wrappers/CHANGELOG.json4
-rw-r--r--packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts4
-rw-r--r--packages/contract-wrappers/test/utils/token_utils.ts12
-rw-r--r--packages/migrations/CHANGELOG.json9
-rw-r--r--packages/migrations/src/migration.ts123
-rw-r--r--packages/pipeline/src/scripts/pull_competing_dex_trades.ts13
-rw-r--r--packages/pipeline/src/scripts/pull_copper.ts19
-rw-r--r--packages/pipeline/src/scripts/pull_exchange_events.ts32
-rw-r--r--packages/pipeline/src/scripts/pull_missing_blocks.ts17
-rw-r--r--packages/pipeline/src/scripts/pull_ohlcv_cryptocompare.ts13
-rw-r--r--packages/pipeline/src/scripts/pull_radar_relay_orders.ts11
-rw-r--r--packages/pipeline/src/scripts/pull_trusted_tokens.ts20
-rw-r--r--packages/pipeline/src/scripts/update_relayer_info.ts9
-rw-r--r--packages/react-shared/package.json2
-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
66 files changed, 3207 insertions, 4622 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/CHANGELOG.json b/packages/abi-gen-wrappers/CHANGELOG.json
index 028415b9c..1879d7696 100644
--- a/packages/abi-gen-wrappers/CHANGELOG.json
+++ b/packages/abi-gen-wrappers/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "2.2.0",
+ "changes": [
+ {
+ "note": "Added `MultiAssetProxy`",
+ "pr": 1503
+ }
+ ]
+ },
+ {
"timestamp": 1547225310,
"version": "2.1.1",
"changes": [
diff --git a/packages/abi-gen-wrappers/package.json b/packages/abi-gen-wrappers/package.json
index c97810548..14aa64e9e 100644
--- a/packages/abi-gen-wrappers/package.json
+++ b/packages/abi-gen-wrappers/package.json
@@ -18,7 +18,7 @@
"generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output src/generated-wrappers --backend ethers"
},
"config": {
- "abis": "../contract-artifacts/artifacts/@(AssetProxyOwner|DutchAuction|DummyERC20Token|DummyERC721Token|ERC20Proxy|ERC20Token|ERC721Proxy|ERC721Token|Exchange|Forwarder|IValidator|IWallet|OrderValidator|WETH9|ZRXToken).json"
+ "abis": "../contract-artifacts/artifacts/@(AssetProxyOwner|DutchAuction|DummyERC20Token|DummyERC721Token|ERC20Proxy|ERC20Token|ERC721Proxy|ERC721Token|Exchange|Forwarder|IValidator|IWallet|MultiAssetProxy|OrderValidator|WETH9|ZRXToken).json"
},
"repository": {
"type": "git",
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/multi_asset_proxy.ts b/packages/abi-gen-wrappers/src/generated-wrappers/multi_asset_proxy.ts
new file mode 100644
index 000000000..b43a345ae
--- /dev/null
+++ b/packages/abi-gen-wrappers/src/generated-wrappers/multi_asset_proxy.ts
@@ -0,0 +1,824 @@
+// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
+// tslint:disable:no-unused-variable
+// tslint:disable:no-unbound-method
+import { BaseContract } from '@0x/base-contract';
+import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
+import { BigNumber, classUtils, logUtils } from '@0x/utils';
+import { SimpleContractArtifact } from '@0x/types';
+import { Web3Wrapper } from '@0x/web3-wrapper';
+import * as ethers from 'ethers';
+import * as _ from 'lodash';
+// tslint:enable:no-unused-variable
+
+export type MultiAssetProxyEventArgs =
+ | MultiAssetProxyAuthorizedAddressAddedEventArgs
+ | MultiAssetProxyAuthorizedAddressRemovedEventArgs
+ | MultiAssetProxyAssetProxyRegisteredEventArgs;
+
+export enum MultiAssetProxyEvents {
+ AuthorizedAddressAdded = 'AuthorizedAddressAdded',
+ AuthorizedAddressRemoved = 'AuthorizedAddressRemoved',
+ AssetProxyRegistered = 'AssetProxyRegistered',
+}
+
+export interface MultiAssetProxyAuthorizedAddressAddedEventArgs extends DecodedLogArgs {
+ target: string;
+ caller: string;
+}
+
+export interface MultiAssetProxyAuthorizedAddressRemovedEventArgs extends DecodedLogArgs {
+ target: string;
+ caller: string;
+}
+
+export interface MultiAssetProxyAssetProxyRegisteredEventArgs extends DecodedLogArgs {
+ id: string;
+ assetProxy: string;
+}
+
+
+/* istanbul ignore next */
+// tslint:disable:no-parameter-reassignment
+// tslint:disable-next-line:class-name
+export class MultiAssetProxyContract extends BaseContract {
+ public assetProxies = {
+ async callAsync(
+ index_0: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as MultiAssetProxyContract;
+ 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 callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ 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];
+ },
+ };
+ public addAuthorizedAddress = {
+ async sendTransactionAsync(
+ target: string,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as MultiAssetProxyContract;
+ 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 txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.addAuthorizedAddress.estimateGasAsync.bind(
+ self,
+ target
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ target: string,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as MultiAssetProxyContract;
+ 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 txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ target: string,
+ ): string {
+ const self = this as any as MultiAssetProxyContract;
+ const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs;
+ [target
+ ] = BaseContract._formatABIDataItemList(inputAbi, [target
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('addAuthorizedAddress(address)').functions.addAuthorizedAddress.encode([target
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ target: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as MultiAssetProxyContract;
+ 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 callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ 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;
+ },
+ };
+ public authorities = {
+ async callAsync(
+ index_0: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as MultiAssetProxyContract;
+ 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 callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ 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];
+ },
+ };
+ public getAssetProxy = {
+ async callAsync(
+ assetProxyId: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as MultiAssetProxyContract;
+ 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 callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ 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];
+ },
+ };
+ public removeAuthorizedAddress = {
+ async sendTransactionAsync(
+ target: string,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as MultiAssetProxyContract;
+ 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 txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.removeAuthorizedAddress.estimateGasAsync.bind(
+ self,
+ target
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ target: string,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as MultiAssetProxyContract;
+ 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 txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ target: string,
+ ): string {
+ const self = this as any as MultiAssetProxyContract;
+ const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs;
+ [target
+ ] = BaseContract._formatABIDataItemList(inputAbi, [target
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('removeAuthorizedAddress(address)').functions.removeAuthorizedAddress.encode([target
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ target: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as MultiAssetProxyContract;
+ 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 callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ 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;
+ },
+ };
+ public owner = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as MultiAssetProxyContract;
+ 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 callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ 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];
+ },
+ };
+ public removeAuthorizedAddressAtIndex = {
+ async sendTransactionAsync(
+ target: string,
+ index: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as MultiAssetProxyContract;
+ 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,
+ index
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind(
+ self,
+ target,
+ index
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ target: string,
+ index: BigNumber,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as MultiAssetProxyContract;
+ 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,
+ index
+ ]);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ target: string,
+ index: BigNumber,
+ ): string {
+ const self = this as any as MultiAssetProxyContract;
+ 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,
+ index
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ target: string,
+ index: BigNumber,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as MultiAssetProxyContract;
+ 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,
+ index
+ ]);
+ const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ 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;
+ },
+ };
+ public getProxyId = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string
+ > {
+ const self = this as any as MultiAssetProxyContract;
+ 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 callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ 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];
+ },
+ };
+ public authorized = {
+ async callAsync(
+ index_0: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as any as MultiAssetProxyContract;
+ 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 callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ 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];
+ },
+ };
+ public registerAssetProxy = {
+ async sendTransactionAsync(
+ assetProxy: string,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as MultiAssetProxyContract;
+ 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 txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.registerAssetProxy.estimateGasAsync.bind(
+ self,
+ assetProxy
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ assetProxy: string,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as MultiAssetProxyContract;
+ 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 txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ assetProxy: string,
+ ): string {
+ const self = this as any as MultiAssetProxyContract;
+ const inputAbi = self._lookupAbi('registerAssetProxy(address)').inputs;
+ [assetProxy
+ ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxy
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('registerAssetProxy(address)').functions.registerAssetProxy.encode([assetProxy
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ assetProxy: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as MultiAssetProxyContract;
+ 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 callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ 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;
+ },
+ };
+ public getAuthorizedAddresses = {
+ async callAsync(
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<string[]
+ > {
+ const self = this as any as MultiAssetProxyContract;
+ 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 callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ 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];
+ },
+ };
+ public transferOwnership = {
+ async sendTransactionAsync(
+ newOwner: string,
+ txData: Partial<TxData> = {},
+ ): Promise<string> {
+ const self = this as any as MultiAssetProxyContract;
+ 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 txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ self.transferOwnership.estimateGasAsync.bind(
+ self,
+ newOwner
+ ),
+ );
+ const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ return txHash;
+ },
+ async estimateGasAsync(
+ newOwner: string,
+ txData: Partial<TxData> = {},
+ ): Promise<number> {
+ const self = this as any as MultiAssetProxyContract;
+ 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 txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...txData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ newOwner: string,
+ ): string {
+ const self = this as any as MultiAssetProxyContract;
+ const inputAbi = self._lookupAbi('transferOwnership(address)').inputs;
+ [newOwner
+ ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner
+ ], BaseContract._bigNumberToString);
+ const abiEncodedTransactionData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner
+ ]);
+ return abiEncodedTransactionData;
+ },
+ async callAsync(
+ newOwner: string,
+ callData: Partial<CallData> = {},
+ defaultBlock?: BlockParam,
+ ): Promise<void
+ > {
+ const self = this as any as MultiAssetProxyContract;
+ 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 callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {
+ to: self.address,
+ ...callData,
+ data: encodedData,
+ },
+ self._web3Wrapper.getContractDefaults(),
+ );
+ 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;
+ },
+ };
+ public static async deployFrom0xArtifactAsync(
+ artifact: ContractArtifact | SimpleContractArtifact,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ ): Promise<MultiAssetProxyContract> {
+ if (_.isUndefined(artifact.compilerOutput)) {
+ throw new Error('Compiler output not found in the artifact file');
+ }
+ const bytecode = artifact.compilerOutput.evm.bytecode.object;
+ const abi = artifact.compilerOutput.abi;
+ return MultiAssetProxyContract.deployAsync(bytecode, abi, provider, txDefaults, );
+ }
+ public static async deployAsync(
+ bytecode: string,
+ abi: ContractAbi,
+ provider: Provider,
+ txDefaults: Partial<TxData>,
+ ): Promise<MultiAssetProxyContract> {
+ const constructorAbi = BaseContract._lookupConstructorAbi(abi);
+ [] = BaseContract._formatABIDataItemList(
+ constructorAbi.inputs,
+ [],
+ BaseContract._bigNumberToString,
+ );
+ const iface = new ethers.utils.Interface(abi);
+ const deployInfo = iface.deployFunction;
+ const txData = deployInfo.encode(bytecode, []);
+ const web3Wrapper = new Web3Wrapper(provider);
+ const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
+ {data: txData},
+ txDefaults,
+ web3Wrapper.estimateGasAsync.bind(web3Wrapper),
+ );
+ const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults);
+ logUtils.log(`transactionHash: ${txHash}`);
+ const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
+ logUtils.log(`MultiAssetProxy successfully deployed at ${txReceipt.contractAddress}`);
+ const contractInstance = new MultiAssetProxyContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
+ contractInstance.constructorArgs = [];
+ return contractInstance;
+ }
+ constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
+ super('MultiAssetProxy', abi, address, provider, txDefaults);
+ classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', '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-wrappers/src/index.ts b/packages/abi-gen-wrappers/src/index.ts
index b5a7d0cfe..1a81c0187 100644
--- a/packages/abi-gen-wrappers/src/index.ts
+++ b/packages/abi-gen-wrappers/src/index.ts
@@ -10,6 +10,7 @@ export * from './generated-wrappers/exchange';
export * from './generated-wrappers/forwarder';
export * from './generated-wrappers/i_validator';
export * from './generated-wrappers/i_wallet';
+export * from './generated-wrappers/multi_asset_proxy';
export * from './generated-wrappers/order_validator';
export * from './generated-wrappers/weth9';
export * from './generated-wrappers/zrx_token';
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/contract-addresses/CHANGELOG.json b/packages/contract-addresses/CHANGELOG.json
index 36684d443..014495351 100644
--- a/packages/contract-addresses/CHANGELOG.json
+++ b/packages/contract-addresses/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "2.2.0",
+ "changes": [
+ {
+ "note": "Added migration for `MultiAssetProxy` contract",
+ "pr": 1503
+ }
+ ]
+ },
+ {
"version": "2.1.0",
"changes": [
{
diff --git a/packages/contract-addresses/src/index.ts b/packages/contract-addresses/src/index.ts
index d181a1bec..4f580e825 100644
--- a/packages/contract-addresses/src/index.ts
+++ b/packages/contract-addresses/src/index.ts
@@ -70,15 +70,15 @@ const networkToAddresses: { [networkId: number]: ContractAddresses } = {
},
// NetworkId 50 represents our Ganache snapshot generated from migrations.
50: {
- exchange: '0x48bacb9266a570d521063ef5dd96e61686dbe788',
erc20Proxy: '0x1dc4c1cefef38a777b15aa20260a54e584b16c48',
erc721Proxy: '0x1d7022f5b17d2f8b695918fb48fa1089c9f85401',
zrxToken: '0x871dd7c2b4b25e1aa18728e9d5f2af4c4e431f5c',
etherToken: '0x0b1ba0af832d7c05fd64161e0db78e85978e8082',
- assetProxyOwner: '0x34d402f14d58e001d8efbe6585051bf9706aa064',
- forwarder: '0xb69e673309512a9d726f87304c6984054f87a93b',
- orderValidator: '0xe86bb98fcf9bff3512c74589b78fb168200cc546',
- dutchAuction: '0xdc688d29394a3f1e6f1e5100862776691afaf3d2',
+ exchange: '0x48bacb9266a570d521063ef5dd96e61686dbe788',
+ assetProxyOwner: '0x04b5dadd2c0d6a261bfafbc964e0cac48585def3',
+ forwarder: '0x6000eca38b8b5bba64986182fe2a69c57f6b5414',
+ orderValidator: '0x32eecaf51dfea9618e9bc94e9fbfddb1bbdcba15',
+ dutchAuction: '0x7e3f4e1deb8d3a05d9d2da87d9521268d0ec3239',
},
};
diff --git a/packages/contract-artifacts/CHANGELOG.json b/packages/contract-artifacts/CHANGELOG.json
index 237014d09..fcd99fc3b 100644
--- a/packages/contract-artifacts/CHANGELOG.json
+++ b/packages/contract-artifacts/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "1.3.0",
+ "changes": [
+ {
+ "note": "Added artifact for `MultiAssetProxy` contract",
+ "pr": 1503
+ }
+ ]
+ },
+ {
"version": "1.2.0",
"changes": [
{
diff --git a/packages/contract-artifacts/artifacts/MultiAssetProxy.json b/packages/contract-artifacts/artifacts/MultiAssetProxy.json
new file mode 100644
index 000000000..f143cd817
--- /dev/null
+++ b/packages/contract-artifacts/artifacts/MultiAssetProxy.json
@@ -0,0 +1,263 @@
+{
+ "schemaVersion": "2.0.0",
+ "contractName": "MultiAssetProxy",
+ "compilerOutput": {
+ "abi": [
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "bytes4"
+ }
+ ],
+ "name": "assetProxies",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "target",
+ "type": "address"
+ }
+ ],
+ "name": "addAuthorizedAddress",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "name": "authorities",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "assetProxyId",
+ "type": "bytes4"
+ }
+ ],
+ "name": "getAssetProxy",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "target",
+ "type": "address"
+ }
+ ],
+ "name": "removeAuthorizedAddress",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "owner",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "target",
+ "type": "address"
+ },
+ {
+ "name": "index",
+ "type": "uint256"
+ }
+ ],
+ "name": "removeAuthorizedAddressAtIndex",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "getProxyId",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bytes4"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "pure",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "name": "authorized",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "assetProxy",
+ "type": "address"
+ }
+ ],
+ "name": "registerAssetProxy",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "getAuthorizedAddresses",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address[]"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "newOwner",
+ "type": "address"
+ }
+ ],
+ "name": "transferOwnership",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "fallback"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "target",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "caller",
+ "type": "address"
+ }
+ ],
+ "name": "AuthorizedAddressAdded",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "target",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "caller",
+ "type": "address"
+ }
+ ],
+ "name": "AuthorizedAddressRemoved",
+ "type": "event"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "name": "id",
+ "type": "bytes4"
+ },
+ {
+ "indexed": false,
+ "name": "assetProxy",
+ "type": "address"
+ }
+ ],
+ "name": "AssetProxyRegistered",
+ "type": "event"
+ }
+ ],
+ "evm": {
+ "bytecode": {
+ "linkReferences": {},
+ "object": "0x608060405260008054600160a060020a03191633179055611527806100256000396000f3006080604052600436106100b95763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416633fd3c997811461048457806342f1181e146104e7578063494503d414610517578063607041081461052f57806370712939146105695780638da5cb5b146105975780639ad26744146105ac578063ae25532e146105dd578063b918161114610627578063c585bb9314610669578063d39de6e914610697578063f2fde38b146106fc575b3480156100c557600080fd5b507fffffffff00000000000000000000000000000000000000000000000000000000600035167fa85e59e40000000000000000000000000000000000000000000000000000000081141561047f573360005260026020526040600020541515610199577f08c379a0000000000000000000000000000000000000000000000000000000006000527c20000000000000000000000000000000000000000000000000000000006020527c1553454e4445525f4e4f545f415554484f52495a454400000000000000604052600060605260646000fd5b600435602881013560488201356048820183016020810335604883018501602081033580830315610235577f08c379a0000000000000000000000000000000000000000000000000000000006000527c20000000000000000000000000000000000000000000000000000000006020527c0f4c454e4754485f4d49534d4154434800000000000000000000000000604052600060605260646000fd5b60646000803760806004526064356020840260008060005b8381101561047c5780890135858102818782041487151715156102db577f08c379a0000000000000000000000000000000000000000000000000000000006000527c20000000000000000000000000000000000000000000000000000000006020527c1055494e543235365f4f564552464c4f57000000000000000000000000604052600060605260646000fd5b8060645282890135606881018d018f01602081038035600481101561038a577f08c379a0000000000000000000000000000000000000000000000000000000006000527c20000000000000000000000000000000000000000000000000000000006020527c1e4c454e4754485f475245415445525f5448414e5f335f5245515549526040527f454400000000000000000000000000000000000000000000000000000000000060605260646000fd5b7fffffffff00000000000000000000000000000000000000000000000000000000833516898103156103cb5780995089608452600160a45260406084205498505b881515610443577f08c379a0000000000000000000000000000000000000000000000000000000006000527c20000000000000000000000000000000000000000000000000000000006020527c1a41535345545f50524f58595f444f45535f4e4f545f45584953540000604052600060605260646000fd5b60208201836084376000808360a4016000808d5af1801515610469573d6000803e3d6000fd5b505050505050505060208101905061024d565b50005b600080fd5b34801561049057600080fd5b506104be7fffffffff000000000000000000000000000000000000000000000000000000006004351661072a565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b3480156104f357600080fd5b5061051573ffffffffffffffffffffffffffffffffffffffff60043516610752565b005b34801561052357600080fd5b506104be60043561093e565b34801561053b57600080fd5b506104be7fffffffff0000000000000000000000000000000000000000000000000000000060043516610973565b34801561057557600080fd5b5061051573ffffffffffffffffffffffffffffffffffffffff600435166109bd565b3480156105a357600080fd5b506104be610cb6565b3480156105b857600080fd5b5061051573ffffffffffffffffffffffffffffffffffffffff60043516602435610cd2565b3480156105e957600080fd5b506105f2611087565b604080517fffffffff000000000000000000000000000000000000000000000000000000009092168252519081900360200190f35b34801561063357600080fd5b5061065573ffffffffffffffffffffffffffffffffffffffff600435166110bd565b604080519115158252519081900360200190f35b34801561067557600080fd5b5061051573ffffffffffffffffffffffffffffffffffffffff600435166110d2565b3480156106a357600080fd5b506106ac61135f565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156106e85781810151838201526020016106d0565b505050509050019250505060405180910390f35b34801561070857600080fd5b5061051573ffffffffffffffffffffffffffffffffffffffff600435166113ce565b60016020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b60005473ffffffffffffffffffffffffffffffffffffffff1633146107d857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff811660009081526002602052604090205460ff161561086d57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f5441524745545f414c52454144595f415554484f52495a454400000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff811660008181526002602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811790915560038054918201815583527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180547fffffffffffffffffffffffff00000000000000000000000000000000000000001684179055513392917f3147867c59d17e8fa9d522465651d44aae0a9e38f902f3475b97e58072f0ed4c91a350565b600380548290811061094c57fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b7fffffffff000000000000000000000000000000000000000000000000000000001660009081526001602052604090205473ffffffffffffffffffffffffffffffffffffffff1690565b6000805473ffffffffffffffffffffffffffffffffffffffff163314610a4457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff821660009081526002602052604090205460ff161515610ada57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f5441524745545f4e4f545f415554484f52495a45440000000000000000000000604482015290519081900360640190fd5b5073ffffffffffffffffffffffffffffffffffffffff8116600090815260026020526040812080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690555b600354811015610c6f578173ffffffffffffffffffffffffffffffffffffffff16600382815481101515610b5757fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff161415610c6757600380547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8101908110610baf57fe5b6000918252602090912001546003805473ffffffffffffffffffffffffffffffffffffffff9092169183908110610be257fe5b600091825260209091200180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055600380547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190610c6190826114b4565b50610c6f565b600101610b27565b604051339073ffffffffffffffffffffffffffffffffffffffff8416907f1f32c1b084e2de0713b8fb16bd46bb9df710a3dbeae2f3ca93af46e016dcc6b090600090a35050565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b60005473ffffffffffffffffffffffffffffffffffffffff163314610d5857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff821660009081526002602052604090205460ff161515610dee57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f5441524745545f4e4f545f415554484f52495a45440000000000000000000000604482015290519081900360640190fd5b6003548110610e5e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f494e4445585f4f55545f4f465f424f554e445300000000000000000000000000604482015290519081900360640190fd5b8173ffffffffffffffffffffffffffffffffffffffff16600382815481101515610e8457fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff1614610f1257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f415554484f52495a45445f414444524553535f4d49534d415443480000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8216600090815260026020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055600380547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8101908110610f8d57fe5b6000918252602090912001546003805473ffffffffffffffffffffffffffffffffffffffff9092169183908110610fc057fe5b600091825260209091200180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055600380547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019061103f90826114b4565b50604051339073ffffffffffffffffffffffffffffffffffffffff8416907f1f32c1b084e2de0713b8fb16bd46bb9df710a3dbeae2f3ca93af46e016dcc6b090600090a35050565b604080517f4d756c746941737365742875696e743235365b5d2c62797465735b5d290000008152905190819003601d0190205b90565b60026020526000908152604090205460ff1681565b600080548190819073ffffffffffffffffffffffffffffffffffffffff16331461115d57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b8392508273ffffffffffffffffffffffffffffffffffffffff1663ae25532e6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1580156111c457600080fd5b505af11580156111d8573d6000803e3d6000fd5b505050506040513d60208110156111ee57600080fd5b50517fffffffff00000000000000000000000000000000000000000000000000000000811660009081526001602052604090205490925073ffffffffffffffffffffffffffffffffffffffff16905080156112aa57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f41535345545f50524f58595f414c52454144595f455849535453000000000000604482015290519081900360640190fd5b7fffffffff00000000000000000000000000000000000000000000000000000000821660008181526001602090815260409182902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff88811691909117909155825193845287169083015280517fd2c6b762299c609bdb96520b58a49bfb80186934d4f71a86a367571a15c031949281900390910190a150505050565b606060038054806020026020016040519081016040528092919081815260200182805480156113c457602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311611399575b5050505050905090565b60005473ffffffffffffffffffffffffffffffffffffffff16331461145457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8116156114b157600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83161790555b50565b8154818355818111156114d8576000838152602090206114d89181019083016114dd565b505050565b6110ba91905b808211156114f757600081556001016114e3565b50905600a165627a7a72305820edc27b59aaf514c0deebc8a00d0f17f092fc6e8b8544bcccb6f7e8f4a81c781d0029"
+ }
+ }
+ },
+ "networks": {}
+}
diff --git a/packages/contract-artifacts/src/index.ts b/packages/contract-artifacts/src/index.ts
index bd5f8fee3..1cbda9518 100644
--- a/packages/contract-artifacts/src/index.ts
+++ b/packages/contract-artifacts/src/index.ts
@@ -1,7 +1,7 @@
import * as AssetProxyOwner from '../artifacts/AssetProxyOwner.json';
-import * as DutchAuction from '../artifacts/DutchAuction.json';
import * as DummyERC20Token from '../artifacts/DummyERC20Token.json';
import * as DummyERC721Token from '../artifacts/DummyERC721Token.json';
+import * as DutchAuction from '../artifacts/DutchAuction.json';
import * as ERC20Proxy from '../artifacts/ERC20Proxy.json';
import * as ERC20Token from '../artifacts/ERC20Token.json';
import * as ERC721Proxy from '../artifacts/ERC721Proxy.json';
@@ -10,6 +10,7 @@ import * as Exchange from '../artifacts/Exchange.json';
import * as Forwarder from '../artifacts/Forwarder.json';
import * as IValidator from '../artifacts/IValidator.json';
import * as IWallet from '../artifacts/IWallet.json';
+import * as MultiAssetProxy from '../artifacts/MultiAssetProxy.json';
import * as OrderValidator from '../artifacts/OrderValidator.json';
import * as WETH9 from '../artifacts/WETH9.json';
import * as ZRXToken from '../artifacts/ZRXToken.json';
@@ -27,6 +28,7 @@ export {
Forwarder,
IValidator,
IWallet,
+ MultiAssetProxy,
OrderValidator,
WETH9,
ZRXToken,
diff --git a/packages/contract-artifacts/tsconfig.json b/packages/contract-artifacts/tsconfig.json
index 59169fceb..1aef41bb8 100644
--- a/packages/contract-artifacts/tsconfig.json
+++ b/packages/contract-artifacts/tsconfig.json
@@ -19,6 +19,7 @@
"./artifacts/Forwarder.json",
"./artifacts/IValidator.json",
"./artifacts/IWallet.json",
+ "./artifacts/MultiAssetProxy.json",
"./artifacts/OrderValidator.json",
"./artifacts/WETH9.json",
"./artifacts/ZRXToken.json"
diff --git a/packages/contract-wrappers/CHANGELOG.json b/packages/contract-wrappers/CHANGELOG.json
index 9a225726a..c6af3adee 100644
--- a/packages/contract-wrappers/CHANGELOG.json
+++ b/packages/contract-wrappers/CHANGELOG.json
@@ -5,6 +5,10 @@
{
"note": "Renamed OrderStatus enum members to PascalCase to conform with tslint enum-naming rule",
"pr": 1474
+ },
+ {
+ "note": "Remove Exchange `matchOrdersAsync` optimization",
+ "pr": 1514
}
]
},
diff --git a/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts b/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts
index c9556971a..49193f816 100644
--- a/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts
+++ b/packages/contract-wrappers/src/contract_wrappers/exchange_wrapper.ts
@@ -743,10 +743,6 @@ export class ExchangeWrapper extends ContractWrapper {
rightSignedOrder.takerAssetData !== leftSignedOrder.makerAssetData
) {
throw new Error(ExchangeWrapperError.AssetDataMismatch);
- } else {
- // Smart contracts assigns the asset data from the left order to the right one so we can save gas on reducing the size of call data
- rightSignedOrder.makerAssetData = '0x';
- rightSignedOrder.takerAssetData = '0x';
}
const exchangeInstance = await this._getExchangeContractAsync();
if (orderTransactionOpts.shouldValidate) {
diff --git a/packages/contract-wrappers/test/utils/token_utils.ts b/packages/contract-wrappers/test/utils/token_utils.ts
index f8a88637f..e390d2775 100644
--- a/packages/contract-wrappers/test/utils/token_utils.ts
+++ b/packages/contract-wrappers/test/utils/token_utils.ts
@@ -9,14 +9,14 @@ import { provider, txDefaults, web3Wrapper } from './web3_wrapper';
// Before we were fetching them from the TokenRegistry but now we can't as it's deprecated and removed.
// TODO(albrow): Import these from the migrations package instead of hard-coding them.
const DUMMY_ERC_20_ADRESSES = [
- '0x6dfff22588be9b3ef8cf0ad6dc9b84796f9fb45f',
- '0xcfc18cec799fbd1793b5c43e773c98d4d61cc2db',
- '0xf22469f31527adc53284441bae1665a7b9214dba',
- '0x10add991de718a69dec2117cb6aa28098836511b',
- '0x8d61158a366019ac78db4149d75fff9dda51160d',
+ '0x34d402f14d58e001d8efbe6585051bf9706aa064',
+ '0x25b8fe1de9daf8ba351890744ff28cf7dfa8f5e3',
+ '0xcdb594a32b1cc3479d8746279712c39d18a07fc0',
+ '0x1e2f9e10d02a6b8f8f69fcbf515e75039d2ea30d',
+ '0xbe0037eaf2d64fe5529bca93c18c9702d3930376',
];
-const DUMMY_ERC_721_ADRESSES = ['0x131855dda0aaff096f6854854c55a4debf61077a'];
+const DUMMY_ERC_721_ADRESSES = ['0x07f96aa816c1f244cbc6ef114bb2b023ba54a2eb'];
export const tokenUtils = {
getDummyERC20TokenAddresses(): string[] {
diff --git a/packages/migrations/CHANGELOG.json b/packages/migrations/CHANGELOG.json
index 13aca373b..6a7df758b 100644
--- a/packages/migrations/CHANGELOG.json
+++ b/packages/migrations/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "2.4.0",
+ "changes": [
+ {
+ "note": "Added migrations for `MultiAssetProxy` contract",
+ "pr": 1503
+ }
+ ]
+ },
+ {
"timestamp": 1547225310,
"version": "2.3.1",
"changes": [
diff --git a/packages/migrations/src/migration.ts b/packages/migrations/src/migration.ts
index 99d1719f1..e0f245017 100644
--- a/packages/migrations/src/migration.ts
+++ b/packages/migrations/src/migration.ts
@@ -18,6 +18,8 @@ import { erc20TokenInfo, erc721TokenInfo } from './utils/token_info';
*/
export async function runMigrationsAsync(provider: Provider, txDefaults: Partial<TxData>): Promise<ContractAddresses> {
const web3Wrapper = new Web3Wrapper(provider);
+ const accounts: string[] = await web3Wrapper.getAvailableAddressesAsync();
+ const owner = accounts[0];
// Proxies
const erc20Proxy = await wrappers.ERC20ProxyContract.deployFrom0xArtifactAsync(
@@ -50,22 +52,35 @@ export async function runMigrationsAsync(provider: Provider, txDefaults: Partial
zrxAssetData,
);
- // Multisigs
- const accounts: string[] = await web3Wrapper.getAvailableAddressesAsync();
- const owners = [accounts[0], accounts[1]];
- const confirmationsRequired = new BigNumber(2);
- const secondsRequired = new BigNumber(0);
- const owner = accounts[0];
+ // Dummy ERC20 tokens
+ for (const token of erc20TokenInfo) {
+ const totalSupply = new BigNumber(1000000000000000000000000000);
+ // tslint:disable-next-line:no-unused-variable
+ const dummyErc20Token = await wrappers.DummyERC20TokenContract.deployFrom0xArtifactAsync(
+ artifacts.DummyERC20Token,
+ provider,
+ txDefaults,
+ token.name,
+ token.symbol,
+ token.decimals,
+ totalSupply,
+ );
+ }
- // AssetProxyOwner
- const assetProxyOwner = await wrappers.AssetProxyOwnerContract.deployFrom0xArtifactAsync(
- artifacts.AssetProxyOwner,
+ // ERC721
+ // tslint:disable-next-line:no-unused-variable
+ const cryptoKittieToken = await wrappers.DummyERC721TokenContract.deployFrom0xArtifactAsync(
+ artifacts.DummyERC721Token,
+ provider,
+ txDefaults,
+ erc721TokenInfo[0].name,
+ erc721TokenInfo[0].symbol,
+ );
+
+ const multiAssetProxy = await wrappers.MultiAssetProxyContract.deployFrom0xArtifactAsync(
+ artifacts.MultiAssetProxy,
provider,
txDefaults,
- owners,
- [erc20Proxy.address, erc721Proxy.address],
- confirmationsRequired,
- secondsRequired,
);
await web3Wrapper.awaitTransactionSuccessAsync(
@@ -74,20 +89,33 @@ export async function runMigrationsAsync(provider: Provider, txDefaults: Partial
}),
);
await web3Wrapper.awaitTransactionSuccessAsync(
- await erc20Proxy.transferOwnership.sendTransactionAsync(assetProxyOwner.address, {
+ await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, {
from: owner,
}),
);
await web3Wrapper.awaitTransactionSuccessAsync(
- await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, {
+ await multiAssetProxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, {
from: owner,
}),
);
+
+ // MultiAssetProxy
await web3Wrapper.awaitTransactionSuccessAsync(
- await erc721Proxy.transferOwnership.sendTransactionAsync(assetProxyOwner.address, {
+ await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(multiAssetProxy.address, {
from: owner,
}),
);
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(multiAssetProxy.address, {
+ from: owner,
+ }),
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await multiAssetProxy.registerAssetProxy.sendTransactionAsync(erc20Proxy.address),
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await multiAssetProxy.registerAssetProxy.sendTransactionAsync(erc721Proxy.address),
+ );
// Register the Asset Proxies to the Exchange
await web3Wrapper.awaitTransactionSuccessAsync(
@@ -96,30 +124,8 @@ export async function runMigrationsAsync(provider: Provider, txDefaults: Partial
await web3Wrapper.awaitTransactionSuccessAsync(
await exchange.registerAssetProxy.sendTransactionAsync(erc721Proxy.address),
);
-
- // Dummy ERC20 tokens
- for (const token of erc20TokenInfo) {
- const totalSupply = new BigNumber(1000000000000000000000000000);
- // tslint:disable-next-line:no-unused-variable
- const dummyErc20Token = await wrappers.DummyERC20TokenContract.deployFrom0xArtifactAsync(
- artifacts.DummyERC20Token,
- provider,
- txDefaults,
- token.name,
- token.symbol,
- token.decimals,
- totalSupply,
- );
- }
-
- // ERC721
- // tslint:disable-next-line:no-unused-variable
- const cryptoKittieToken = await wrappers.DummyERC721TokenContract.deployFrom0xArtifactAsync(
- artifacts.DummyERC721Token,
- provider,
- txDefaults,
- erc721TokenInfo[0].name,
- erc721TokenInfo[0].symbol,
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await exchange.registerAssetProxy.sendTransactionAsync(multiAssetProxy.address),
);
// Forwarder
@@ -149,6 +155,39 @@ export async function runMigrationsAsync(provider: Provider, txDefaults: Partial
exchange.address,
);
+ // Multisigs
+ const owners = [accounts[0], accounts[1]];
+ const confirmationsRequired = new BigNumber(2);
+ const secondsRequired = new BigNumber(0);
+
+ // AssetProxyOwner
+ const assetProxyOwner = await wrappers.AssetProxyOwnerContract.deployFrom0xArtifactAsync(
+ artifacts.AssetProxyOwner,
+ provider,
+ txDefaults,
+ owners,
+ [erc20Proxy.address, erc721Proxy.address, multiAssetProxy.address],
+ confirmationsRequired,
+ secondsRequired,
+ );
+
+ // Transfer Ownership to the Asset Proxy Owner
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc20Proxy.transferOwnership.sendTransactionAsync(assetProxyOwner.address, {
+ from: owner,
+ }),
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await erc721Proxy.transferOwnership.sendTransactionAsync(assetProxyOwner.address, {
+ from: owner,
+ }),
+ );
+ await web3Wrapper.awaitTransactionSuccessAsync(
+ await multiAssetProxy.transferOwnership.sendTransactionAsync(assetProxyOwner.address, {
+ from: owner,
+ }),
+ );
+
// Fund the Forwarder with ZRX
const zrxDecimals = await zrxToken.decimals.callAsync();
const zrxForwarderAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(5000), zrxDecimals);
@@ -156,7 +195,7 @@ export async function runMigrationsAsync(provider: Provider, txDefaults: Partial
await zrxToken.transfer.sendTransactionAsync(forwarder.address, zrxForwarderAmount, txDefaults),
);
- return {
+ const contractAddresses = {
erc20Proxy: erc20Proxy.address,
erc721Proxy: erc721Proxy.address,
zrxToken: zrxToken.address,
@@ -167,6 +206,8 @@ export async function runMigrationsAsync(provider: Provider, txDefaults: Partial
orderValidator: orderValidator.address,
dutchAuction: dutchAuction.address,
};
+
+ return contractAddresses;
}
let _cachedContractAddresses: ContractAddresses;
diff --git a/packages/pipeline/src/scripts/pull_competing_dex_trades.ts b/packages/pipeline/src/scripts/pull_competing_dex_trades.ts
index 1478d5615..14644bb2e 100644
--- a/packages/pipeline/src/scripts/pull_competing_dex_trades.ts
+++ b/packages/pipeline/src/scripts/pull_competing_dex_trades.ts
@@ -1,7 +1,8 @@
-// tslint:disable:no-console
import 'reflect-metadata';
import { Connection, ConnectionOptions, createConnection, Repository } from 'typeorm';
+import { logUtils } from '@0x/utils';
+
import { BloxySource } from '../data_sources/bloxy';
import { DexTrade } from '../entities';
import * as ormConfig from '../ormconfig';
@@ -27,14 +28,14 @@ async function getAndSaveTradesAsync(): Promise<void> {
const bloxySource = new BloxySource(apiKey);
const tradesRepository = connection.getRepository(DexTrade);
const lastSeenTimestamp = await getLastSeenTimestampAsync(tradesRepository);
- console.log(`Last seen timestamp: ${lastSeenTimestamp === 0 ? 'none' : lastSeenTimestamp}`);
- console.log('Getting latest dex trades...');
+ logUtils.log(`Last seen timestamp: ${lastSeenTimestamp === 0 ? 'none' : lastSeenTimestamp}`);
+ logUtils.log('Getting latest dex trades...');
const rawTrades = await bloxySource.getDexTradesAsync(lastSeenTimestamp);
- console.log(`Parsing ${rawTrades.length} trades...`);
+ logUtils.log(`Parsing ${rawTrades.length} trades...`);
const trades = parseBloxyTrades(rawTrades);
- console.log(`Saving ${trades.length} trades...`);
+ logUtils.log(`Saving ${trades.length} trades...`);
await tradesRepository.save(trades, { chunk: Math.ceil(trades.length / BATCH_SAVE_SIZE) });
- console.log('Done saving trades.');
+ logUtils.log('Done saving trades.');
}
async function getLastSeenTimestampAsync(tradesRepository: Repository<DexTrade>): Promise<number> {
diff --git a/packages/pipeline/src/scripts/pull_copper.ts b/packages/pipeline/src/scripts/pull_copper.ts
index 69814f209..5e4a6a643 100644
--- a/packages/pipeline/src/scripts/pull_copper.ts
+++ b/packages/pipeline/src/scripts/pull_copper.ts
@@ -1,7 +1,8 @@
-// tslint:disable:no-console
import * as R from 'ramda';
import { Connection, ConnectionOptions, createConnection, Repository } from 'typeorm';
+import { logUtils } from '@0x/utils';
+
import { CopperEndpoint, CopperSearchParams, CopperSource } from '../data_sources/copper';
import { CopperActivity, CopperActivityType, CopperCustomField, CopperLead, CopperOpportunity } from '../entities';
import * as ormConfig from '../ormconfig';
@@ -43,14 +44,14 @@ let connection: Connection;
async function fetchAndSaveLeadsAsync(source: CopperSource): Promise<void> {
const repository = connection.getRepository(CopperLead);
const startTime = await getMaxAsync(connection, 'date_modified', 'raw.copper_leads');
- console.log(`Fetching Copper leads starting from ${startTime}...`);
+ logUtils.log(`Fetching Copper leads starting from ${startTime}...`);
await fetchAndSaveAsync(CopperEndpoint.Leads, source, startTime, {}, parseLeads, repository);
}
async function fetchAndSaveOpportunitiesAsync(source: CopperSource): Promise<void> {
const repository = connection.getRepository(CopperOpportunity);
const startTime = await getMaxAsync(connection, 'date_modified', 'raw.copper_opportunities');
- console.log(`Fetching Copper opportunities starting from ${startTime}...`);
+ logUtils.log(`Fetching Copper opportunities starting from ${startTime}...`);
await fetchAndSaveAsync(
CopperEndpoint.Opportunities,
source,
@@ -67,7 +68,7 @@ async function fetchAndSaveActivitiesAsync(source: CopperSource): Promise<void>
const searchParams = {
minimum_activity_date: Math.floor(startTime / ONE_SECOND),
};
- console.log(`Fetching Copper activities starting from ${startTime}...`);
+ logUtils.log(`Fetching Copper activities starting from ${startTime}...`);
await fetchAndSaveAsync(CopperEndpoint.Activities, source, startTime, searchParams, parseActivities, repository);
}
@@ -97,7 +98,7 @@ async function fetchAndSaveAsync<T extends CopperSearchResponse, E>(
const numPages = await source.fetchNumberOfPagesAsync(endpoint);
try {
for (let i = numPages; i > 0; i--) {
- console.log(`Fetching page ${i}/${numPages} of ${endpoint}...`);
+ logUtils.log(`Fetching page ${i}/${numPages} of ${endpoint}...`);
const raw = await source.fetchSearchResultsAsync<T>(endpoint, {
...searchParams,
page_number: i,
@@ -108,21 +109,21 @@ async function fetchAndSaveAsync<T extends CopperSearchResponse, E>(
saved += newRecords.length;
}
} catch (err) {
- console.log(`Error fetching ${endpoint}, stopping: ${err.stack}`);
+ logUtils.log(`Error fetching ${endpoint}, stopping: ${err.stack}`);
} finally {
- console.log(`Saved ${saved} items from ${endpoint}, done.`);
+ logUtils.log(`Saved ${saved} items from ${endpoint}, done.`);
}
}
async function fetchAndSaveActivityTypesAsync(source: CopperSource): Promise<void> {
- console.log(`Fetching Copper activity types...`);
+ logUtils.log(`Fetching Copper activity types...`);
const activityTypes = await source.fetchActivityTypesAsync();
const repository = connection.getRepository(CopperActivityType);
await repository.save(parseActivityTypes(activityTypes));
}
async function fetchAndSaveCustomFieldsAsync(source: CopperSource): Promise<void> {
- console.log(`Fetching Copper custom fields...`);
+ logUtils.log(`Fetching Copper custom fields...`);
const customFields = await source.fetchCustomFieldsAsync();
const repository = connection.getRepository(CopperCustomField);
await repository.save(parseCustomFields(customFields));
diff --git a/packages/pipeline/src/scripts/pull_exchange_events.ts b/packages/pipeline/src/scripts/pull_exchange_events.ts
index e98fc6629..f8ce4038d 100644
--- a/packages/pipeline/src/scripts/pull_exchange_events.ts
+++ b/packages/pipeline/src/scripts/pull_exchange_events.ts
@@ -1,6 +1,6 @@
-// tslint:disable:no-console
import { web3Factory } from '@0x/dev-utils';
import { Web3ProviderEngine } from '@0x/subproviders';
+import { logUtils } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import R = require('ramda');
import 'reflect-metadata';
@@ -32,38 +32,38 @@ let connection: Connection;
})().catch(handleError);
async function getFillEventsAsync(eventsSource: ExchangeEventsSource, endBlock: number): Promise<void> {
- console.log('Checking existing fill events...');
+ logUtils.log('Checking existing fill events...');
const repository = connection.getRepository(ExchangeFillEvent);
const startBlock = await getStartBlockAsync(repository);
- console.log(`Getting fill events starting at ${startBlock}...`);
+ logUtils.log(`Getting fill events starting at ${startBlock}...`);
const eventLogs = await eventsSource.getFillEventsAsync(startBlock, endBlock);
- console.log('Parsing fill events...');
+ logUtils.log('Parsing fill events...');
const events = parseExchangeFillEvents(eventLogs);
- console.log(`Retrieved and parsed ${events.length} total fill events.`);
+ logUtils.log(`Retrieved and parsed ${events.length} total fill events.`);
await saveEventsAsync(startBlock === EXCHANGE_START_BLOCK, repository, events);
}
async function getCancelEventsAsync(eventsSource: ExchangeEventsSource, endBlock: number): Promise<void> {
- console.log('Checking existing cancel events...');
+ logUtils.log('Checking existing cancel events...');
const repository = connection.getRepository(ExchangeCancelEvent);
const startBlock = await getStartBlockAsync(repository);
- console.log(`Getting cancel events starting at ${startBlock}...`);
+ logUtils.log(`Getting cancel events starting at ${startBlock}...`);
const eventLogs = await eventsSource.getCancelEventsAsync(startBlock, endBlock);
- console.log('Parsing cancel events...');
+ logUtils.log('Parsing cancel events...');
const events = parseExchangeCancelEvents(eventLogs);
- console.log(`Retrieved and parsed ${events.length} total cancel events.`);
+ logUtils.log(`Retrieved and parsed ${events.length} total cancel events.`);
await saveEventsAsync(startBlock === EXCHANGE_START_BLOCK, repository, events);
}
async function getCancelUpToEventsAsync(eventsSource: ExchangeEventsSource, endBlock: number): Promise<void> {
- console.log('Checking existing CancelUpTo events...');
+ logUtils.log('Checking existing CancelUpTo events...');
const repository = connection.getRepository(ExchangeCancelUpToEvent);
const startBlock = await getStartBlockAsync(repository);
- console.log(`Getting CancelUpTo events starting at ${startBlock}...`);
+ logUtils.log(`Getting CancelUpTo events starting at ${startBlock}...`);
const eventLogs = await eventsSource.getCancelUpToEventsAsync(startBlock, endBlock);
- console.log('Parsing CancelUpTo events...');
+ logUtils.log('Parsing CancelUpTo events...');
const events = parseExchangeCancelUpToEvents(eventLogs);
- console.log(`Retrieved and parsed ${events.length} total CancelUpTo events.`);
+ logUtils.log(`Retrieved and parsed ${events.length} total CancelUpTo events.`);
await saveEventsAsync(startBlock === EXCHANGE_START_BLOCK, repository, events);
}
@@ -72,7 +72,7 @@ const tableNameRegex = /^[a-zA-Z_]*$/;
async function getStartBlockAsync<T extends ExchangeEvent>(repository: Repository<T>): Promise<number> {
const fillEventCount = await repository.count();
if (fillEventCount === 0) {
- console.log(`No existing ${repository.metadata.name}s found.`);
+ logUtils.log(`No existing ${repository.metadata.name}s found.`);
return EXCHANGE_START_BLOCK;
}
const tableName = repository.metadata.tableName;
@@ -91,7 +91,7 @@ async function saveEventsAsync<T extends ExchangeEvent>(
repository: Repository<T>,
events: T[],
): Promise<void> {
- console.log(`Saving ${repository.metadata.name}s...`);
+ logUtils.log(`Saving ${repository.metadata.name}s...`);
if (isInitialPull) {
// Split data into numChunks pieces of maximum size BATCH_SAVE_SIZE
// each.
@@ -104,7 +104,7 @@ async function saveEventsAsync<T extends ExchangeEvent>(
await saveIndividuallyWithFallbackAsync(repository, events);
}
const totalEvents = await repository.count();
- console.log(`Done saving events. There are now ${totalEvents} total ${repository.metadata.name}s.`);
+ logUtils.log(`Done saving events. There are now ${totalEvents} total ${repository.metadata.name}s.`);
}
async function saveIndividuallyWithFallbackAsync<T extends ExchangeEvent>(
diff --git a/packages/pipeline/src/scripts/pull_missing_blocks.ts b/packages/pipeline/src/scripts/pull_missing_blocks.ts
index ced9d99eb..345ea38fe 100644
--- a/packages/pipeline/src/scripts/pull_missing_blocks.ts
+++ b/packages/pipeline/src/scripts/pull_missing_blocks.ts
@@ -1,5 +1,6 @@
-// tslint:disable:no-console
import { web3Factory } from '@0x/dev-utils';
+import { logUtils } from '@0x/utils';
+
import * as Parallel from 'async-parallel';
import R = require('ramda');
import 'reflect-metadata';
@@ -47,7 +48,7 @@ interface MissingBlocksResponse {
async function getAllMissingBlocksAsync(web3Source: Web3Source, tableName: string): Promise<void> {
const blocksRepository = connection.getRepository(Block);
while (true) {
- console.log(`Checking for missing blocks in ${tableName}...`);
+ logUtils.log(`Checking for missing blocks in ${tableName}...`);
const blockNumbers = await getMissingBlockNumbersAsync(tableName);
if (blockNumbers.length === 0) {
// There are no more missing blocks. We're done.
@@ -56,7 +57,7 @@ async function getAllMissingBlocksAsync(web3Source: Web3Source, tableName: strin
await getAndSaveBlocksAsync(web3Source, blocksRepository, blockNumbers);
}
const totalBlocks = await blocksRepository.count();
- console.log(`Done saving blocks for ${tableName}. There are now ${totalBlocks} total blocks.`);
+ logUtils.log(`Done saving blocks for ${tableName}. There are now ${totalBlocks} total blocks.`);
}
async function getMissingBlockNumbersAsync(tableName: string): Promise<number[]> {
@@ -68,7 +69,7 @@ async function getMissingBlockNumbersAsync(tableName: string): Promise<number[]>
)) as MissingBlocksResponse[];
const blockNumberStrings = R.pluck('block_number', response);
const blockNumbers = R.map(parseInt, blockNumberStrings);
- console.log(`Found ${blockNumbers.length} missing blocks.`);
+ logUtils.log(`Found ${blockNumbers.length} missing blocks.`);
return blockNumbers;
}
@@ -77,14 +78,14 @@ async function getAndSaveBlocksAsync(
blocksRepository: Repository<Block>,
blockNumbers: number[],
): Promise<void> {
- console.log(`Getting block data for ${blockNumbers.length} blocks...`);
+ logUtils.log(`Getting block data for ${blockNumbers.length} blocks...`);
Parallel.setConcurrency(MAX_CONCURRENCY);
const rawBlocks = await Parallel.map(blockNumbers, async (blockNumber: number) =>
web3Source.getBlockInfoAsync(blockNumber),
);
- console.log(`Parsing ${rawBlocks.length} blocks...`);
+ logUtils.log(`Parsing ${rawBlocks.length} blocks...`);
const blocks = R.map(parseBlock, rawBlocks);
- console.log(`Saving ${blocks.length} blocks...`);
+ logUtils.log(`Saving ${blocks.length} blocks...`);
await blocksRepository.save(blocks, { chunk: Math.ceil(blocks.length / BATCH_SAVE_SIZE) });
- console.log('Done saving this batch of blocks');
+ logUtils.log('Done saving this batch of blocks');
}
diff --git a/packages/pipeline/src/scripts/pull_ohlcv_cryptocompare.ts b/packages/pipeline/src/scripts/pull_ohlcv_cryptocompare.ts
index d44eb5cc6..caac7b9d4 100644
--- a/packages/pipeline/src/scripts/pull_ohlcv_cryptocompare.ts
+++ b/packages/pipeline/src/scripts/pull_ohlcv_cryptocompare.ts
@@ -1,6 +1,7 @@
-// tslint:disable:no-console
import { Connection, ConnectionOptions, createConnection, Repository } from 'typeorm';
+import { logUtils } from '@0x/utils';
+
import { CryptoCompareOHLCVSource } from '../data_sources/ohlcv_external/crypto_compare';
import { OHLCVExternal } from '../entities';
import * as ormConfig from '../ormconfig';
@@ -24,14 +25,14 @@ let connection: Connection;
const jobTime = new Date().getTime();
const tradingPairs = await fetchOHLCVTradingPairsAsync(connection, SOURCE_NAME, EARLIEST_BACKFILL_TIME);
- console.log(`Starting ${tradingPairs.length} job(s) to scrape Crypto Compare for OHLCV records...`);
+ logUtils.log(`Starting ${tradingPairs.length} job(s) to scrape Crypto Compare for OHLCV records...`);
const fetchAndSavePromises = tradingPairs.map(async pair => {
const pairs = source.generateBackfillIntervals(pair);
return fetchAndSaveAsync(source, repository, jobTime, pairs);
});
await Promise.all(fetchAndSavePromises);
- console.log(`Finished scraping OHLCV records from Crypto Compare, exiting...`);
+ logUtils.log(`Finished scraping OHLCV records from Crypto Compare, exiting...`);
process.exit(0);
})().catch(handleError);
@@ -60,7 +61,7 @@ async function fetchAndSaveAsync(
}
try {
const records = await source.getHourlyOHLCVAsync(pair);
- console.log(`Retrieved ${records.length} records for ${JSON.stringify(pair)}`);
+ logUtils.log(`Retrieved ${records.length} records for ${JSON.stringify(pair)}`);
if (records.length > 0) {
const metadata: OHLCVMetadata = {
exchange: source.defaultExchange,
@@ -75,7 +76,7 @@ async function fetchAndSaveAsync(
}
i++;
} catch (err) {
- console.log(`Error scraping OHLCVRecords, stopping task for ${JSON.stringify(pair)} [${err}]`);
+ logUtils.log(`Error scraping OHLCVRecords, stopping task for ${JSON.stringify(pair)} [${err}]`);
break;
}
}
@@ -90,6 +91,6 @@ async function saveRecordsAsync(repository: Repository<OHLCVExternal>, records:
new Date(records[records.length - 1].endTime),
];
- console.log(`Saving ${records.length} records to ${repository.metadata.name}... ${JSON.stringify(metadata)}`);
+ logUtils.log(`Saving ${records.length} records to ${repository.metadata.name}... ${JSON.stringify(metadata)}`);
await repository.save(records);
}
diff --git a/packages/pipeline/src/scripts/pull_radar_relay_orders.ts b/packages/pipeline/src/scripts/pull_radar_relay_orders.ts
index 03fc764f2..8e8720803 100644
--- a/packages/pipeline/src/scripts/pull_radar_relay_orders.ts
+++ b/packages/pipeline/src/scripts/pull_radar_relay_orders.ts
@@ -1,5 +1,6 @@
-// tslint:disable:no-console
import { HttpClient } from '@0x/connect';
+import { logUtils } from '@0x/utils';
+
import * as R from 'ramda';
import 'reflect-metadata';
import { Connection, ConnectionOptions, createConnection, EntityManager } from 'typeorm';
@@ -21,13 +22,13 @@ let connection: Connection;
})().catch(handleError);
async function getOrderbookAsync(): Promise<void> {
- console.log('Getting all orders...');
+ logUtils.log('Getting all orders...');
const connectClient = new HttpClient(RADAR_RELAY_URL);
const rawOrders = await connectClient.getOrdersAsync({
perPage: ORDERS_PER_PAGE,
});
- console.log(`Got ${rawOrders.records.length} orders.`);
- console.log('Parsing orders...');
+ logUtils.log(`Got ${rawOrders.records.length} orders.`);
+ logUtils.log('Parsing orders...');
// Parse the sra orders, then add source url to each.
const orders = R.pipe(
parseSraOrders,
@@ -35,7 +36,7 @@ async function getOrderbookAsync(): Promise<void> {
)(rawOrders);
// Save all the orders and update the observed time stamps in a single
// transaction.
- console.log('Saving orders and updating timestamps...');
+ logUtils.log('Saving orders and updating timestamps...');
const observedTimestamp = Date.now();
await connection.transaction(
async (manager: EntityManager): Promise<void> => {
diff --git a/packages/pipeline/src/scripts/pull_trusted_tokens.ts b/packages/pipeline/src/scripts/pull_trusted_tokens.ts
index 5906deee6..8afb3e052 100644
--- a/packages/pipeline/src/scripts/pull_trusted_tokens.ts
+++ b/packages/pipeline/src/scripts/pull_trusted_tokens.ts
@@ -1,6 +1,8 @@
import 'reflect-metadata';
import { Connection, ConnectionOptions, createConnection } from 'typeorm';
+import { logUtils } from '@0x/utils';
+
import { MetamaskTrustedTokenMeta, TrustedTokenSource, ZeroExTrustedTokenMeta } from '../data_sources/trusted_tokens';
import { TokenMetadata } from '../entities';
import * as ormConfig from '../ormconfig';
@@ -22,31 +24,25 @@ let connection: Connection;
})().catch(handleError);
async function getMetamaskTrustedTokensAsync(): Promise<void> {
- // tslint:disable-next-line:no-console
- console.log('Getting latest metamask trusted tokens list ...');
+ logUtils.log('Getting latest metamask trusted tokens list ...');
const trustedTokensRepository = connection.getRepository(TokenMetadata);
const trustedTokensSource = new TrustedTokenSource<Map<string, MetamaskTrustedTokenMeta>>(
METAMASK_TRUSTED_TOKENS_URL,
);
const resp = await trustedTokensSource.getTrustedTokenMetaAsync();
const trustedTokens = parseMetamaskTrustedTokens(resp);
- // tslint:disable-next-line:no-console
- console.log('Saving metamask trusted tokens list');
+ logUtils.log('Saving metamask trusted tokens list');
await trustedTokensRepository.save(trustedTokens);
- // tslint:disable-next-line:no-console
- console.log('Done saving metamask trusted tokens.');
+ logUtils.log('Done saving metamask trusted tokens.');
}
async function getZeroExTrustedTokensAsync(): Promise<void> {
- // tslint:disable-next-line:no-console
- console.log('Getting latest 0x trusted tokens list ...');
+ logUtils.log('Getting latest 0x trusted tokens list ...');
const trustedTokensRepository = connection.getRepository(TokenMetadata);
const trustedTokensSource = new TrustedTokenSource<ZeroExTrustedTokenMeta[]>(ZEROEX_TRUSTED_TOKENS_URL);
const resp = await trustedTokensSource.getTrustedTokenMetaAsync();
const trustedTokens = parseZeroExTrustedTokens(resp);
- // tslint:disable-next-line:no-console
- console.log('Saving metamask trusted tokens list');
+ logUtils.log('Saving metamask trusted tokens list');
await trustedTokensRepository.save(trustedTokens);
- // tslint:disable-next-line:no-console
- console.log('Done saving metamask trusted tokens.');
+ logUtils.log('Done saving metamask trusted tokens.');
}
diff --git a/packages/pipeline/src/scripts/update_relayer_info.ts b/packages/pipeline/src/scripts/update_relayer_info.ts
index 41d29b385..910a0157c 100644
--- a/packages/pipeline/src/scripts/update_relayer_info.ts
+++ b/packages/pipeline/src/scripts/update_relayer_info.ts
@@ -1,7 +1,8 @@
-// tslint:disable:no-console
import 'reflect-metadata';
import { Connection, ConnectionOptions, createConnection } from 'typeorm';
+import { logUtils } from '@0x/utils';
+
import { RelayerRegistrySource } from '../data_sources/relayer-registry';
import { Relayer } from '../entities';
import * as ormConfig from '../ormconfig';
@@ -22,12 +23,12 @@ let connection: Connection;
})().catch(handleError);
async function getRelayersAsync(): Promise<void> {
- console.log('Getting latest relayer info...');
+ logUtils.log('Getting latest relayer info...');
const relayerRepository = connection.getRepository(Relayer);
const relayerSource = new RelayerRegistrySource(RELAYER_REGISTRY_URL);
const relayersResp = await relayerSource.getRelayerInfoAsync();
const relayers = parseRelayers(relayersResp);
- console.log('Saving relayer info...');
+ logUtils.log('Saving relayer info...');
await relayerRepository.save(relayers);
- console.log('Done saving relayer info.');
+ logUtils.log('Done saving relayer info.');
}
diff --git a/packages/react-shared/package.json b/packages/react-shared/package.json
index 1d9eb246f..1b253e1e4 100644
--- a/packages/react-shared/package.json
+++ b/packages/react-shared/package.json
@@ -52,7 +52,7 @@
"material-ui": "^0.20.0",
"react": "^16.5.2",
"react-dom": "^16.5.2",
- "react-highlight": "0xproject/react-highlight#2f40a42e0a3f0ad126f9f42d505b97b603fc7162",
+ "react-highlight": "0xproject/react-highlight#699ac4d9529e33520bff4b9bd9c624d21efbba75",
"react-markdown": "^3.2.2",
"react-router-dom": "^4.1.1",
"react-scroll": "0xproject/react-scroll#pr-330-and-replace-state",
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