From cdb938ea2840818b59507e0cccbe5dfdf2868f3b Mon Sep 17 00:00:00 2001 From: Lawrence Forman Date: Sat, 18 May 2019 02:10:36 -0400 Subject: [PATCH] `@0x/base-contract`: Add a method for converting `Error` types to `RevertError`s. `@0x/abi-gen-templates`: Automatically try to convert `Error`s thrown in `callAsync()` to `RevertError`s. `@0x/abi-gen-wrappers`: Update generated wrappers. --- packages/abi-gen-templates/CHANGELOG.json | 4 + .../partials/callAsync.handlebars | 11 +- packages/abi-gen-wrappers/CHANGELOG.json | 4 + .../generated-wrappers/asset_proxy_owner.ts | 297 ++++++++---- .../src/generated-wrappers/coordinator.ts | 197 +++----- .../coordinator_registry.ts | 22 +- .../generated-wrappers/dummy_erc20_token.ts | 154 ++++-- .../generated-wrappers/dummy_erc721_token.ts | 165 +++++-- .../src/generated-wrappers/dutch_auction.ts | 29 +- .../src/generated-wrappers/erc20_proxy.ts | 99 ++-- .../src/generated-wrappers/erc20_token.ts | 66 ++- .../src/generated-wrappers/erc721_proxy.ts | 99 ++-- .../src/generated-wrappers/erc721_token.ts | 99 ++-- .../generated-wrappers/eth_balance_checker.ts | 11 +- .../src/generated-wrappers/exchange.ts | 444 ++++++++++++------ .../src/generated-wrappers/forwarder.ts | 63 ++- .../src/generated-wrappers/i_asset_proxy.ts | 77 ++- .../src/generated-wrappers/i_validator.ts | 11 +- .../src/generated-wrappers/i_wallet.ts | 11 +- .../generated-wrappers/multi_asset_proxy.ts | 132 ++++-- .../src/generated-wrappers/order_validator.ts | 87 ++-- .../src/generated-wrappers/weth9.ts | 121 +++-- .../src/generated-wrappers/zrx_token.ts | 99 ++-- packages/base-contract/CHANGELOG.json | 4 + packages/base-contract/src/index.ts | 25 +- 25 files changed, 1578 insertions(+), 753 deletions(-) diff --git a/packages/abi-gen-templates/CHANGELOG.json b/packages/abi-gen-templates/CHANGELOG.json index b9b463acbe..f57d8b3563 100644 --- a/packages/abi-gen-templates/CHANGELOG.json +++ b/packages/abi-gen-templates/CHANGELOG.json @@ -53,6 +53,10 @@ { "note": "add `awaitTransactionSuccessAsync()` to `tx.handlebars`", "pr": 1797 + }, + { + "note": "Update `callAsync` to automatically transform Errors into RevertErrors, if possible.", + "pr": 1819 } ], "timestamp": 1557507213 diff --git a/packages/abi-gen-templates/partials/callAsync.handlebars b/packages/abi-gen-templates/partials/callAsync.handlebars index adaf7098d9..51d26ad8e6 100644 --- a/packages/abi-gen-templates/partials/callAsync.handlebars +++ b/packages/abi-gen-templates/partials/callAsync.handlebars @@ -25,9 +25,14 @@ async callAsync( self._web3Wrapper.getContractDefaults(), ); callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('{{this.functionSignature}}'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue<{{> return_type outputs=outputs}}>(rawCallResult); diff --git a/packages/abi-gen-wrappers/CHANGELOG.json b/packages/abi-gen-wrappers/CHANGELOG.json index 6f3cab6f7b..01cabd2a33 100644 --- a/packages/abi-gen-wrappers/CHANGELOG.json +++ b/packages/abi-gen-wrappers/CHANGELOG.json @@ -53,6 +53,10 @@ { "note": "Update wrapper functions to expose `awaitTransactionSuccessAsync()` methods", "pr": 1797 + }, + { + "note": "Update wrappers to automatically throw `RevertError` types when possible.", + "pr": 1819 } ], "timestamp": 1557507213 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 dd2689fa7b..e98e8b9aed 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 @@ -137,9 +137,14 @@ export class AssetProxyOwnerContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owners(uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -237,9 +242,14 @@ export class AssetProxyOwnerContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeOwner(address)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -343,9 +353,14 @@ export class AssetProxyOwnerContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('revokeConfirmation(uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -389,9 +404,14 @@ export class AssetProxyOwnerContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('isOwner(address)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -438,9 +458,14 @@ export class AssetProxyOwnerContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('confirmations(uint256,address)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -555,9 +580,14 @@ export class AssetProxyOwnerContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('executeRemoveAuthorizedAddressAtIndex(uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -597,9 +627,14 @@ export class AssetProxyOwnerContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('secondsTimeLocked()'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -642,9 +677,14 @@ export class AssetProxyOwnerContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getTransactionCount(bool,bool)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -777,9 +817,14 @@ export class AssetProxyOwnerContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('registerAssetProxy(address,bool)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -881,9 +926,14 @@ export class AssetProxyOwnerContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('addOwner(address)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -925,9 +975,14 @@ export class AssetProxyOwnerContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('isConfirmed(uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -1032,9 +1087,14 @@ export class AssetProxyOwnerContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('changeTimeLock(uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -1078,9 +1138,14 @@ export class AssetProxyOwnerContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('isAssetProxyRegistered(address)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -1124,9 +1189,14 @@ export class AssetProxyOwnerContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getConfirmationCount(uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -1170,9 +1240,14 @@ export class AssetProxyOwnerContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transactions(uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue<[string, BigNumber, string, boolean]>(rawCallResult); @@ -1209,9 +1284,14 @@ export class AssetProxyOwnerContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getOwners()'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -1263,9 +1343,14 @@ export class AssetProxyOwnerContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getTransactionIds(uint256,uint256,bool,bool)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -1313,9 +1398,14 @@ export class AssetProxyOwnerContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getConfirmations(uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -1352,9 +1442,14 @@ export class AssetProxyOwnerContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transactionCount()'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -1455,9 +1550,14 @@ export class AssetProxyOwnerContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('changeRequirement(uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -1559,9 +1659,14 @@ export class AssetProxyOwnerContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('confirmTransaction(uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -1704,9 +1809,14 @@ export class AssetProxyOwnerContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('submitTransaction(address,uint256,bytes)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -1754,9 +1864,14 @@ export class AssetProxyOwnerContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('confirmationTimes(uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -1793,9 +1908,14 @@ export class AssetProxyOwnerContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('MAX_OWNER_COUNT()'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -1831,9 +1951,14 @@ export class AssetProxyOwnerContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('required()'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -1957,9 +2082,14 @@ export class AssetProxyOwnerContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('replaceOwner(address,address)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -2065,9 +2195,14 @@ export class AssetProxyOwnerContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('executeTransaction(uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts b/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts index c80c8a3986..22e4b1fcb3 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts @@ -57,9 +57,14 @@ export class CoordinatorContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getSignerAddress(bytes32,bytes)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -106,9 +111,14 @@ export class CoordinatorContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getTransactionHash((uint256,address,bytes))'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -159,9 +169,14 @@ export class CoordinatorContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getCoordinatorApprovalHash((address,bytes32,bytes,uint256))'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -182,66 +197,6 @@ export class CoordinatorContract extends BaseContract { return abiEncodedTransactionData; }, }; - public getTransactionHash = { - async callAsync( - transaction: { salt: BigNumber; signerAddress: string; data: string }, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { - const self = (this as any) as CoordinatorContract; - const encodedData = self._strictEncodeArguments('getTransactionHash((uint256,address,bytes))', [ - transaction, - ]); - 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); - const abiEncoder = self._lookupAbiEncoder('getTransactionHash((uint256,address,bytes))'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public getCoordinatorApprovalHash = { - async callAsync( - approval: { - txOrigin: string; - transactionHash: string; - transactionSignature: string; - approvalExpirationTimeSeconds: BigNumber; - }, - callData: Partial = {}, - defaultBlock?: BlockParam, - ): Promise { - const self = (this as any) as CoordinatorContract; - const encodedData = self._strictEncodeArguments( - 'getCoordinatorApprovalHash((address,bytes32,bytes,uint256))', - [approval], - ); - 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); - const abiEncoder = self._lookupAbiEncoder('getCoordinatorApprovalHash((address,bytes32,bytes,uint256))'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; public executeTransaction = { async sendTransactionAsync( transaction: { salt: BigNumber; signerAddress: string; data: string }, @@ -405,9 +360,14 @@ export class CoordinatorContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder( 'executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', ); @@ -464,9 +424,14 @@ export class CoordinatorContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('EIP712_EXCHANGE_DOMAIN_HASH()'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -479,27 +444,6 @@ export class CoordinatorContract extends BaseContract { return abiEncodedTransactionData; }, }; - public EIP712_EXCHANGE_DOMAIN_HASH = { - async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { - const self = (this as any) as CoordinatorContract; - const encodedData = self._strictEncodeArguments('EIP712_EXCHANGE_DOMAIN_HASH()', []); - 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); - const abiEncoder = self._lookupAbiEncoder('EIP712_EXCHANGE_DOMAIN_HASH()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; public assertValidCoordinatorApprovals = { async callAsync( transaction: { salt: BigNumber; signerAddress: string; data: string }, @@ -544,9 +488,14 @@ export class CoordinatorContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder( 'assertValidCoordinatorApprovals((uint256,address,bytes),address,bytes,uint256[],bytes[])', ); @@ -623,9 +572,14 @@ export class CoordinatorContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('decodeOrdersFromFillData(bytes)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue< @@ -677,9 +631,14 @@ export class CoordinatorContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('EIP712_COORDINATOR_DOMAIN_HASH()'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -696,8 +655,7 @@ export class CoordinatorContract extends BaseContract { artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - exchange: string, - chainId: BigNumber, + _exchange: string, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -710,15 +668,14 @@ export class CoordinatorContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - return CoordinatorContract.deployAsync(bytecode, abi, provider, txDefaults, exchange, chainId); + return CoordinatorContract.deployAsync(bytecode, abi, provider, txDefaults, _exchange); } public static async deployAsync( bytecode: string, abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, - exchange: string, - chainId: BigNumber, + _exchange: string, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -728,14 +685,14 @@ export class CoordinatorContract extends BaseContract { ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [exchange, chainId] = BaseContract._formatABIDataItemList( + [_exchange] = BaseContract._formatABIDataItemList( constructorAbi.inputs, - [exchange, chainId], + [_exchange], BaseContract._bigNumberToString, ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [exchange, chainId]); + const txData = deployInfo.encode(bytecode, [_exchange]); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { data: txData }, @@ -746,13 +703,8 @@ export class CoordinatorContract extends BaseContract { logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`Coordinator successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new CoordinatorContract( - abi, - txReceipt.contractAddress as string, - provider, - txDefaults, - ); - contractInstance.constructorArgs = [exchange, chainId]; + const contractInstance = new CoordinatorContract(txReceipt.contractAddress as string, provider, txDefaults); + contractInstance.constructorArgs = [_exchange]; return contractInstance; } @@ -790,7 +742,6 @@ export class CoordinatorContract extends BaseContract { { name: 'transaction', type: 'tuple', - components: [ { name: 'salt', @@ -824,7 +775,6 @@ export class CoordinatorContract extends BaseContract { { name: 'approval', type: 'tuple', - components: [ { name: 'txOrigin', @@ -862,7 +812,6 @@ export class CoordinatorContract extends BaseContract { { name: 'transaction', type: 'tuple', - components: [ { name: 'salt', @@ -921,7 +870,6 @@ export class CoordinatorContract extends BaseContract { { name: 'transaction', type: 'tuple', - components: [ { name: 'salt', @@ -973,7 +921,6 @@ export class CoordinatorContract extends BaseContract { { name: 'orders', type: 'tuple[]', - components: [ { name: 'makerAddress', diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/coordinator_registry.ts b/packages/abi-gen-wrappers/src/generated-wrappers/coordinator_registry.ts index 4502db105a..7361cad4ba 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/coordinator_registry.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/coordinator_registry.ts @@ -126,9 +126,14 @@ export class CoordinatorRegistryContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('setCoordinatorEndpoint(string)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -174,9 +179,14 @@ export class CoordinatorRegistryContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getCoordinatorEndpoint(address)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); 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 58c465ea81..ff8dfa2db2 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 @@ -69,9 +69,14 @@ export class DummyERC20TokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('name()'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -195,9 +200,14 @@ export class DummyERC20TokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -238,9 +248,14 @@ export class DummyERC20TokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('totalSupply()'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -380,9 +395,14 @@ export class DummyERC20TokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -425,9 +445,14 @@ export class DummyERC20TokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('decimals()'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -468,9 +493,14 @@ export class DummyERC20TokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -507,9 +537,14 @@ export class DummyERC20TokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owner()'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -545,9 +580,14 @@ export class DummyERC20TokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('symbol()'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -644,9 +684,14 @@ export class DummyERC20TokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('mint(uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -758,9 +803,14 @@ export class DummyERC20TokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -811,9 +861,14 @@ export class DummyERC20TokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('allowance(address,address)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -942,9 +997,14 @@ export class DummyERC20TokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('setBalance(address,uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -1046,9 +1106,14 @@ export class DummyERC20TokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -1087,9 +1152,14 @@ export class DummyERC20TokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('MAX_MINT_AMOUNT()'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); 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 3852687fc9..c556831557 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 @@ -79,9 +79,14 @@ export class DummyERC721TokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('name()'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -122,9 +127,14 @@ export class DummyERC721TokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getApproved(uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -249,9 +259,14 @@ export class DummyERC721TokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -396,9 +411,14 @@ export class DummyERC721TokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -520,9 +540,14 @@ export class DummyERC721TokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('mint(address,uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -667,9 +692,14 @@ export class DummyERC721TokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -717,9 +747,14 @@ export class DummyERC721TokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('ownerOf(uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -761,9 +796,14 @@ export class DummyERC721TokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -800,9 +840,14 @@ export class DummyERC721TokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owner()'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -838,9 +883,14 @@ export class DummyERC721TokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('symbol()'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -955,9 +1005,14 @@ export class DummyERC721TokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('burn(address,uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -1090,9 +1145,14 @@ export class DummyERC721TokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('setApprovalForAll(address,bool)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -1255,9 +1315,14 @@ export class DummyERC721TokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256,bytes)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -1310,9 +1375,14 @@ export class DummyERC721TokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('isApprovedForAll(address,address)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -1414,9 +1484,14 @@ export class DummyERC721TokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); 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 5073a0d510..cbfc198033 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/dutch_auction.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/dutch_auction.ts @@ -185,9 +185,14 @@ export class DutchAuctionContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder( 'getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', ); @@ -468,9 +473,14 @@ export class DutchAuctionContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); 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)', ); @@ -603,7 +613,6 @@ export class DutchAuctionContract extends BaseContract { { name: 'order', type: 'tuple', - components: [ { name: 'makerAddress', @@ -661,7 +670,6 @@ export class DutchAuctionContract extends BaseContract { { name: 'auctionDetails', type: 'tuple', - components: [ { name: 'beginTimeSeconds', @@ -700,7 +708,6 @@ export class DutchAuctionContract extends BaseContract { { name: 'buyOrder', type: 'tuple', - components: [ { name: 'makerAddress', @@ -755,7 +762,6 @@ export class DutchAuctionContract extends BaseContract { { name: 'sellOrder', type: 'tuple', - components: [ { name: 'makerAddress', @@ -821,12 +827,10 @@ export class DutchAuctionContract extends BaseContract { { name: 'matchedFillResults', type: 'tuple', - components: [ { name: 'left', type: 'tuple', - components: [ { name: 'makerAssetFilledAmount', @@ -849,7 +853,6 @@ export class DutchAuctionContract extends BaseContract { { name: 'right', type: 'tuple', - components: [ { name: 'makerAssetFilledAmount', 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 cf54c78d8b..ad1f902382 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts @@ -130,9 +130,14 @@ export class ERC20ProxyContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -176,9 +181,14 @@ export class ERC20ProxyContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('authorities(uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -276,9 +286,14 @@ export class ERC20ProxyContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -317,9 +332,14 @@ export class ERC20ProxyContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owner()'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -447,9 +467,14 @@ export class ERC20ProxyContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -490,9 +515,14 @@ export class ERC20ProxyContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getProxyId()'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -533,9 +563,14 @@ export class ERC20ProxyContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('authorized(address)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -574,9 +609,14 @@ export class ERC20ProxyContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -673,9 +713,14 @@ export class ERC20ProxyContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); 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 8f0812c7f7..b255e32335 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts @@ -157,9 +157,14 @@ export class ERC20TokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -200,9 +205,14 @@ export class ERC20TokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('totalSupply()'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -342,9 +352,14 @@ export class ERC20TokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -392,9 +407,14 @@ export class ERC20TokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -506,9 +526,14 @@ export class ERC20TokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -559,9 +584,14 @@ export class ERC20TokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('allowance(address,address)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); 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 c8664c3b1a..a12a7dc967 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts @@ -130,9 +130,14 @@ export class ERC721ProxyContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -176,9 +181,14 @@ export class ERC721ProxyContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('authorities(uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -276,9 +286,14 @@ export class ERC721ProxyContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -317,9 +332,14 @@ export class ERC721ProxyContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owner()'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -447,9 +467,14 @@ export class ERC721ProxyContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -490,9 +515,14 @@ export class ERC721ProxyContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getProxyId()'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -533,9 +563,14 @@ export class ERC721ProxyContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('authorized(address)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -574,9 +609,14 @@ export class ERC721ProxyContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -673,9 +713,14 @@ export class ERC721ProxyContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); 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 3a271860d5..65001e08e5 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts @@ -84,9 +84,14 @@ export class ERC721TokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getApproved(uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -211,9 +216,14 @@ export class ERC721TokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -358,9 +368,14 @@ export class ERC721TokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -507,9 +522,14 @@ export class ERC721TokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -557,9 +577,14 @@ export class ERC721TokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('ownerOf(uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -601,9 +626,14 @@ export class ERC721TokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -732,9 +762,14 @@ export class ERC721TokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('setApprovalForAll(address,bool)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -897,9 +932,14 @@ export class ERC721TokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256,bytes)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -952,9 +992,14 @@ export class ERC721TokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('isApprovedForAll(address,address)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/eth_balance_checker.ts b/packages/abi-gen-wrappers/src/generated-wrappers/eth_balance_checker.ts index 786f61b3a5..edb8dae235 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/eth_balance_checker.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/eth_balance_checker.ts @@ -55,9 +55,14 @@ export class EthBalanceCheckerContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getEthBalances(address[])'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts b/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts index 3a211e037b..dcadb69559 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts @@ -110,9 +110,14 @@ export class ExchangeContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('filled(bytes32)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -307,9 +312,14 @@ export class ExchangeContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder( 'batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', ); @@ -380,9 +390,14 @@ export class ExchangeContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('cancelled(bytes32)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -523,9 +538,14 @@ export class ExchangeContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('preSign(bytes32,address,bytes)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -788,9 +808,14 @@ export class ExchangeContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); 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)', ); @@ -1032,9 +1057,14 @@ export class ExchangeContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder( 'fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', ); @@ -1100,9 +1130,14 @@ export class ExchangeContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('assetProxies(bytes4)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -1271,9 +1306,14 @@ export class ExchangeContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder( 'batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', ); @@ -1488,9 +1528,14 @@ export class ExchangeContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder( 'batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', ); @@ -1621,9 +1666,14 @@ export class ExchangeContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('cancelOrdersUpTo(uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -1820,9 +1870,14 @@ export class ExchangeContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder( 'batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', ); @@ -1893,9 +1948,14 @@ export class ExchangeContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getAssetProxy(bytes4)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -1937,9 +1997,14 @@ export class ExchangeContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transactions(bytes32)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -2130,9 +2195,14 @@ export class ExchangeContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder( 'fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', ); @@ -2293,9 +2363,14 @@ export class ExchangeContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('setSignatureValidatorApproval(address,bool)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -2346,9 +2421,14 @@ export class ExchangeContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('allowedValidators(address,address)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -2547,9 +2627,14 @@ export class ExchangeContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder( 'marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', ); @@ -2636,9 +2721,14 @@ export class ExchangeContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder( 'getOrdersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', ); @@ -2707,9 +2797,14 @@ export class ExchangeContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('preSigned(bytes32,address)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -2750,9 +2845,14 @@ export class ExchangeContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owner()'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -2801,9 +2901,14 @@ export class ExchangeContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('isValidSignature(bytes32,address,bytes)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -3004,9 +3109,14 @@ export class ExchangeContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder( 'marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', ); @@ -3221,9 +3331,14 @@ export class ExchangeContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder( 'fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', ); @@ -3404,9 +3519,14 @@ export class ExchangeContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('executeTransaction(uint256,address,bytes,bytes)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -3514,9 +3634,14 @@ export class ExchangeContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('registerAssetProxy(address)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -3575,9 +3700,14 @@ export class ExchangeContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder( 'getOrderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', ); @@ -3763,9 +3893,14 @@ export class ExchangeContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder( 'cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', ); @@ -3829,9 +3964,14 @@ export class ExchangeContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('orderEpoch(address,address)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -3872,9 +4012,14 @@ export class ExchangeContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('ZRX_ASSET_DATA()'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -4068,9 +4213,14 @@ export class ExchangeContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder( 'marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', ); @@ -4136,9 +4286,14 @@ export class ExchangeContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('EIP712_DOMAIN_HASH()'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -4332,9 +4487,14 @@ export class ExchangeContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder( 'marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', ); @@ -4400,9 +4560,14 @@ export class ExchangeContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('currentContextAddress()'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -4499,9 +4664,14 @@ export class ExchangeContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -4540,9 +4710,14 @@ export class ExchangeContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('VERSION()'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -4559,8 +4734,7 @@ export class ExchangeContract extends BaseContract { artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, txDefaults: Partial, - zrxAssetData: string, - chainId: BigNumber, + _zrxAssetData: string, ): Promise { assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ schemas.addressSchema, @@ -4573,17 +4747,14 @@ export class ExchangeContract extends BaseContract { const provider = providerUtils.standardizeOrThrow(supportedProvider); const bytecode = artifact.compilerOutput.evm.bytecode.object; const abi = artifact.compilerOutput.abi; - return ExchangeContract.deployAsync(bytecode, abi, provider, txDefaults, zrxAssetData, -chainId -); + return ExchangeContract.deployAsync(bytecode, abi, provider, txDefaults, _zrxAssetData); } public static async deployAsync( bytecode: string, abi: ContractAbi, supportedProvider: SupportedProvider, txDefaults: Partial, - zrxAssetData: string, - chainId: BigNumber, + _zrxAssetData: string, ): Promise { assert.isHexString('bytecode', bytecode); assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [ @@ -4593,20 +4764,14 @@ chainId ]); const provider = providerUtils.standardizeOrThrow(supportedProvider); const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [zrxAssetData, -chainId -] = BaseContract._formatABIDataItemList( + [_zrxAssetData] = BaseContract._formatABIDataItemList( constructorAbi.inputs, - [zrxAssetData, -chainId -], + [_zrxAssetData], BaseContract._bigNumberToString, ); const iface = new ethers.utils.Interface(abi); const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [zrxAssetData, -chainId -]); + const txData = deployInfo.encode(bytecode, [_zrxAssetData]); const web3Wrapper = new Web3Wrapper(provider); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( { data: txData }, @@ -4617,10 +4782,8 @@ chainId logUtils.log(`transactionHash: ${txHash}`); const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); logUtils.log(`Exchange successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new ExchangeContract(abi, txReceipt.contractAddress as string, provider, txDefaults); - contractInstance.constructorArgs = [zrxAssetData, -chainId -]; + const contractInstance = new ExchangeContract(txReceipt.contractAddress as string, provider, txDefaults); + contractInstance.constructorArgs = [_zrxAssetData]; return contractInstance; } @@ -4654,7 +4817,6 @@ chainId { name: 'orders', type: 'tuple[]', - components: [ { name: 'makerAddress', @@ -4720,7 +4882,6 @@ chainId { name: 'totalFillResults', type: 'tuple', - components: [ { name: 'makerAssetFilledAmount', @@ -4792,7 +4953,6 @@ chainId { name: 'leftOrder', type: 'tuple', - components: [ { name: 'makerAddress', @@ -4847,7 +5007,6 @@ chainId { name: 'rightOrder', type: 'tuple', - components: [ { name: 'makerAddress', @@ -4913,12 +5072,10 @@ chainId { name: 'matchedFillResults', type: 'tuple', - components: [ { name: 'left', type: 'tuple', - components: [ { name: 'makerAssetFilledAmount', @@ -4941,7 +5098,6 @@ chainId { name: 'right', type: 'tuple', - components: [ { name: 'makerAssetFilledAmount', @@ -4978,7 +5134,6 @@ chainId { name: 'order', type: 'tuple', - components: [ { name: 'makerAddress', @@ -5044,7 +5199,6 @@ chainId { name: 'fillResults', type: 'tuple', - components: [ { name: 'makerAssetFilledAmount', @@ -5094,7 +5248,6 @@ chainId { name: 'orders', type: 'tuple[]', - components: [ { name: 'makerAddress', @@ -5159,7 +5312,6 @@ chainId { name: 'orders', type: 'tuple[]', - components: [ { name: 'makerAddress', @@ -5225,7 +5377,6 @@ chainId { name: 'totalFillResults', type: 'tuple', - components: [ { name: 'makerAssetFilledAmount', @@ -5270,7 +5421,6 @@ chainId { name: 'orders', type: 'tuple[]', - components: [ { name: 'makerAddress', @@ -5336,7 +5486,6 @@ chainId { name: 'totalFillResults', type: 'tuple', - components: [ { name: 'makerAssetFilledAmount', @@ -5405,7 +5554,6 @@ chainId { name: 'order', type: 'tuple', - components: [ { name: 'makerAddress', @@ -5471,7 +5619,6 @@ chainId { name: 'fillResults', type: 'tuple', - components: [ { name: 'makerAssetFilledAmount', @@ -5543,7 +5690,6 @@ chainId { name: 'orders', type: 'tuple[]', - components: [ { name: 'makerAddress', @@ -5609,7 +5755,6 @@ chainId { name: 'totalFillResults', type: 'tuple', - components: [ { name: 'makerAssetFilledAmount', @@ -5640,7 +5785,6 @@ chainId { name: 'orders', type: 'tuple[]', - components: [ { name: 'makerAddress', @@ -5698,7 +5842,6 @@ chainId { name: '', type: 'tuple[]', - components: [ { name: 'orderStatus', @@ -5789,7 +5932,6 @@ chainId { name: 'orders', type: 'tuple[]', - components: [ { name: 'makerAddress', @@ -5855,7 +5997,6 @@ chainId { name: 'totalFillResults', type: 'tuple', - components: [ { name: 'makerAssetFilledAmount', @@ -5886,7 +6027,6 @@ chainId { name: 'order', type: 'tuple', - components: [ { name: 'makerAddress', @@ -5952,7 +6092,6 @@ chainId { name: 'fillResults', type: 'tuple', - components: [ { name: 'makerAssetFilledAmount', @@ -6023,7 +6162,6 @@ chainId { name: 'order', type: 'tuple', - components: [ { name: 'makerAddress', @@ -6081,7 +6219,6 @@ chainId { name: 'orderInfo', type: 'tuple', - components: [ { name: 'orderStatus', @@ -6108,7 +6245,6 @@ chainId { name: 'order', type: 'tuple', - components: [ { name: 'makerAddress', @@ -6210,7 +6346,6 @@ chainId { name: 'orders', type: 'tuple[]', - components: [ { name: 'makerAddress', @@ -6276,7 +6411,6 @@ chainId { name: 'totalFillResults', type: 'tuple', - components: [ { name: 'makerAssetFilledAmount', @@ -6321,7 +6455,6 @@ chainId { name: 'orders', type: 'tuple[]', - components: [ { name: 'makerAddress', @@ -6387,7 +6520,6 @@ chainId { name: 'totalFillResults', type: 'tuple', - components: [ { name: 'makerAssetFilledAmount', diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts b/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts index d744d34ba7..fe626d06ee 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts @@ -339,9 +339,14 @@ export class ForwarderContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); 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)', ); @@ -525,9 +530,14 @@ export class ForwarderContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('withdrawAsset(bytes,uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -568,9 +578,14 @@ export class ForwarderContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owner()'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -861,9 +876,14 @@ export class ForwarderContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); 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)', ); @@ -1019,9 +1039,14 @@ export class ForwarderContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -1117,7 +1142,6 @@ export class ForwarderContract extends BaseContract { { name: 'orders', type: 'tuple[]', - components: [ { name: 'makerAddress', @@ -1180,7 +1204,6 @@ export class ForwarderContract extends BaseContract { { name: 'feeOrders', type: 'tuple[]', - components: [ { name: 'makerAddress', @@ -1250,7 +1273,6 @@ export class ForwarderContract extends BaseContract { { name: 'orderFillResults', type: 'tuple', - components: [ { name: 'makerAssetFilledAmount', @@ -1273,7 +1295,6 @@ export class ForwarderContract extends BaseContract { { name: 'feeOrderFillResults', type: 'tuple', - components: [ { name: 'makerAssetFilledAmount', @@ -1336,7 +1357,6 @@ export class ForwarderContract extends BaseContract { { name: 'orders', type: 'tuple[]', - components: [ { name: 'makerAddress', @@ -1395,7 +1415,6 @@ export class ForwarderContract extends BaseContract { { name: 'feeOrders', type: 'tuple[]', - components: [ { name: 'makerAddress', @@ -1465,7 +1484,6 @@ export class ForwarderContract extends BaseContract { { name: 'orderFillResults', type: 'tuple', - components: [ { name: 'makerAssetFilledAmount', @@ -1488,7 +1506,6 @@ export class ForwarderContract extends BaseContract { { name: 'feeOrderFillResults', type: 'tuple', - components: [ { name: 'makerAssetFilledAmount', diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/i_asset_proxy.ts b/packages/abi-gen-wrappers/src/generated-wrappers/i_asset_proxy.ts index 08753c6a21..d5ec38a6fb 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/i_asset_proxy.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/i_asset_proxy.ts @@ -111,9 +111,14 @@ export class IAssetProxyContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -213,9 +218,14 @@ export class IAssetProxyContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -346,9 +356,14 @@ export class IAssetProxyContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -505,9 +520,14 @@ export class IAssetProxyContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferFrom(bytes,address,address,uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -550,9 +570,14 @@ export class IAssetProxyContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getProxyId()'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -588,9 +613,14 @@ export class IAssetProxyContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -687,9 +717,14 @@ export class IAssetProxyContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); 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 5f32cf4fea..3f73f313ae 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts @@ -63,9 +63,14 @@ export class IValidatorContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('isValidSignature(bytes32,address,bytes)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); 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 3f653ea9c3..f54cfe1e56 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts @@ -57,9 +57,14 @@ export class IWalletContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('isValidSignature(bytes32,bytes)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); 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 index 119b1d76fb..2d454dc9da 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/multi_asset_proxy.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/multi_asset_proxy.ts @@ -77,9 +77,14 @@ export class MultiAssetProxyContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('assetProxies(bytes4)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -177,9 +182,14 @@ export class MultiAssetProxyContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -223,9 +233,14 @@ export class MultiAssetProxyContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('authorities(uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -267,9 +282,14 @@ export class MultiAssetProxyContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getAssetProxy(bytes4)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -367,9 +387,14 @@ export class MultiAssetProxyContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -408,9 +433,14 @@ export class MultiAssetProxyContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('owner()'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -538,9 +568,14 @@ export class MultiAssetProxyContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -581,9 +616,14 @@ export class MultiAssetProxyContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getProxyId()'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -624,9 +664,14 @@ export class MultiAssetProxyContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('authorized(address)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -730,9 +775,14 @@ export class MultiAssetProxyContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('registerAssetProxy(address)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -771,9 +821,14 @@ export class MultiAssetProxyContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -870,9 +925,14 @@ export class MultiAssetProxyContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); 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 76b38de9f3..d39582be81 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts @@ -86,9 +86,14 @@ export class OrderValidatorContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder( 'getOrderAndTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', ); @@ -170,9 +175,14 @@ export class OrderValidatorContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getBalanceAndAllowance(address,bytes)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue<[BigNumber, BigNumber]>(rawCallResult); @@ -250,9 +260,14 @@ export class OrderValidatorContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder( 'getOrdersAndTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', ); @@ -359,9 +374,14 @@ export class OrderValidatorContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder( 'getTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', ); @@ -441,9 +461,14 @@ export class OrderValidatorContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getERC721TokenOwner(address,uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -494,9 +519,14 @@ export class OrderValidatorContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('getBalancesAndAllowances(address,bytes[])'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue<[BigNumber[], BigNumber[]]>(rawCallResult); @@ -568,9 +598,14 @@ export class OrderValidatorContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder( 'getTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', ); @@ -684,7 +719,6 @@ export class OrderValidatorContract extends BaseContract { { name: 'order', type: 'tuple', - components: [ { name: 'makerAddress', @@ -746,7 +780,6 @@ export class OrderValidatorContract extends BaseContract { { name: 'orderInfo', type: 'tuple', - components: [ { name: 'orderStatus', @@ -765,7 +798,6 @@ export class OrderValidatorContract extends BaseContract { { name: 'traderInfo', type: 'tuple', - components: [ { name: 'makerBalance', @@ -839,7 +871,6 @@ export class OrderValidatorContract extends BaseContract { { name: 'orders', type: 'tuple[]', - components: [ { name: 'makerAddress', @@ -901,7 +932,6 @@ export class OrderValidatorContract extends BaseContract { { name: 'ordersInfo', type: 'tuple[]', - components: [ { name: 'orderStatus', @@ -920,7 +950,6 @@ export class OrderValidatorContract extends BaseContract { { name: 'tradersInfo', type: 'tuple[]', - components: [ { name: 'makerBalance', @@ -967,7 +996,6 @@ export class OrderValidatorContract extends BaseContract { { name: 'orders', type: 'tuple[]', - components: [ { name: 'makerAddress', @@ -1029,7 +1057,6 @@ export class OrderValidatorContract extends BaseContract { { name: '', type: 'tuple[]', - components: [ { name: 'makerBalance', @@ -1126,7 +1153,6 @@ export class OrderValidatorContract extends BaseContract { { name: 'order', type: 'tuple', - components: [ { name: 'makerAddress', @@ -1188,7 +1214,6 @@ export class OrderValidatorContract extends BaseContract { { name: 'traderInfo', type: 'tuple', - components: [ { name: 'makerBalance', diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts b/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts index 49ac1028aa..58d6d37c1e 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts @@ -85,9 +85,14 @@ export class WETH9Contract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('name()'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -194,9 +199,14 @@ export class WETH9Contract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -237,9 +247,14 @@ export class WETH9Contract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('totalSupply()'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -379,9 +394,14 @@ export class WETH9Contract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -485,9 +505,14 @@ export class WETH9Contract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('withdraw(uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -524,9 +549,14 @@ export class WETH9Contract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('decimals()'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -567,9 +597,14 @@ export class WETH9Contract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -608,9 +643,14 @@ export class WETH9Contract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('symbol()'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -717,9 +757,14 @@ export class WETH9Contract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -816,9 +861,14 @@ export class WETH9Contract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('deposit()'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -864,9 +914,14 @@ export class WETH9Contract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('allowance(address,address)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); 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 1072cdba29..8336c49894 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts @@ -69,9 +69,14 @@ export class ZRXTokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('name()'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -195,9 +200,14 @@ export class ZRXTokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -238,9 +248,14 @@ export class ZRXTokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('totalSupply()'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -380,9 +395,14 @@ export class ZRXTokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -425,9 +445,14 @@ export class ZRXTokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('decimals()'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -468,9 +493,14 @@ export class ZRXTokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -507,9 +537,14 @@ export class ZRXTokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('symbol()'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -620,9 +655,14 @@ export class ZRXTokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); @@ -673,9 +713,14 @@ export class ZRXTokenContract extends BaseContract { callDataWithDefaults.from = callDataWithDefaults.from ? callDataWithDefaults.from.toLowerCase() : callDataWithDefaults.from; - - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); + let rawCallResult; + try { + rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); + } catch (err) { + BaseContract._throwIfThrownErrorIsRevertError(err); + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder('allowance(address,address)'); // tslint:disable boolean-naming const result = abiEncoder.strictDecodeReturnValue(rawCallResult); diff --git a/packages/base-contract/CHANGELOG.json b/packages/base-contract/CHANGELOG.json index d5b3e6954c..ef4bb57a5d 100644 --- a/packages/base-contract/CHANGELOG.json +++ b/packages/base-contract/CHANGELOG.json @@ -9,6 +9,10 @@ { "note": "Remove dependency on ethers.js", "pr": 1761 + }, + { + "note": "Add more RevertError decoding functions", + "pr": 1819 } ] }, diff --git a/packages/base-contract/src/index.ts b/packages/base-contract/src/index.ts index 82301ee3d6..832347d637 100644 --- a/packages/base-contract/src/index.ts +++ b/packages/base-contract/src/index.ts @@ -1,6 +1,14 @@ import { assert } from '@0x/assert'; import { schemas } from '@0x/json-schemas'; -import { AbiEncoder, abiUtils, BigNumber, providerUtils, RevertError } from '@0x/utils'; +import { + AbiEncoder, + abiUtils, + BigNumber, + decodeBytesAsRevertError, + decodeThrownErrorAsRevertError, + providerUtils, + RevertError, +} from '@0x/utils'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { AbiDefinition, @@ -104,17 +112,28 @@ export class BaseContract { } return txDataWithDefaults; } - protected static _throwIfRevertWithReasonCallResult(rawCallResult: string): void { + protected static _throwIfCallResultIsRevertError(rawCallResult: string): void { // Try to decode the call result as a revert error. let revert: RevertError; try { - revert = RevertError.decode(rawCallResult); + revert = decodeBytesAsRevertError(rawCallResult); } catch (err) { // Can't decode it as a revert error, so assume it didn't revert. return; } throw revert; } + protected static _throwIfThrownErrorIsRevertError(error: Error): void { + // Try to decode a thrown error. + let revertError: RevertError; + try { + revertError = decodeThrownErrorAsRevertError(error); + } catch (err) { + // Can't decode it. + return; + } + throw revertError; + } // Throws if the given arguments cannot be safely/correctly encoded based on // the given inputAbi. An argument may not be considered safely encodeable // if it overflows the corresponding Solidity type, there is a bug in the